Skip to content

Commit

Permalink
Fix raiseIntentForContext
Browse files Browse the repository at this point in the history
  • Loading branch information
lilla28 committed Sep 25, 2024
1 parent 232b394 commit b54a42b
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -887,14 +887,23 @@ public async ValueTask<RaiseIntentResult<RaiseIntentResponse>> RaiseIntentForCon
SourceAppInstanceId = new(request.Fdc3InstanceId)
};
}

if (result.ElementAt(0).Apps.Count() == 1)

var appIntent = result.FirstOrDefault(x => x.Intent.Name == raiseIntentSpecification.Intent);
if (appIntent == null)
{
raiseIntentSpecification.TargetAppMetadata = result.ElementAt(0).Apps.ElementAt(0);
return new()
{
Response = RaiseIntentResponse.Failure(ResolveError.IntentDeliveryFailed)
};
}

if (appIntent.Apps.Count() == 1)
{
raiseIntentSpecification.TargetAppMetadata = appIntent.Apps.ElementAt(0);
return await RaiseIntentToApplication(raiseIntentSpecification);
}

var resolverUIResult = await WaitForResolverUIAsync(result.ElementAt(0).Apps);
var resolverUIResult = await WaitForResolverUIAsync(appIntent.Apps);
if (resolverUIResult != null && resolverUIResult.Error == null)
{
raiseIntentSpecification.TargetAppMetadata = (AppMetadata) resolverUIResult.AppMetadata!;
Expand Down

0 comments on commit b54a42b

Please sign in to comment.