Skip to content

Commit

Permalink
fix(fdc3) - Remove unnecessary property
Browse files Browse the repository at this point in the history
  • Loading branch information
lilla28 committed Sep 5, 2024
1 parent 9fb6d01 commit 49a2167
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ internal sealed class RaiseIntentRequest
/// </summary>
public string Intent { get; set; }

/// <summary>
/// Indicates that the client selected an instance or an app to start and resolve the raised intent.
/// </summary>
public bool Selected { get; set; }

/// <summary>
/// Context for identifying more the specific app that should handle the raised intent.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,11 +669,6 @@ public async ValueTask<RaiseIntentResult<RaiseIntentResponse>> RaiseIntent(Raise
//else for consistency it will return a single element array containing the intentMetadata which is allowed by the request.
Func<Fdc3App, Dictionary<string, AppIntent>, IEnumerable<KeyValuePair<string, IntentMetadata>>?> selector = (fdc3App, appIntents) =>
{
//If the user selects an application from the AppDirectory instead of the its running instance
if (request.Selected && appIntents.TryGetValue(request.Intent, out var result) && result.Apps.Any())
{
return null;
}

if (fdc3App.Interop?.Intents?.ListensFor == null
|| !fdc3App.Interop.Intents.ListensFor.TryGetValue(request.Intent!, out var intentMetadata))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ public async Task RaiseIntentReturnsNoAppsFound()
MessageId = 2,
Fdc3InstanceId = originFdc3InstanceId,
Intent = "noIntentShouldHandle",
Selected = false,
Context = new Context(ContextTypes.Nothing)
};

Expand Down Expand Up @@ -509,7 +508,6 @@ public async Task RaiseIntentReturnsAppIntentWithOneExistingAppAndPublishesConte
MessageId = 2,
Fdc3InstanceId = originFdc3InstanceId,
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -575,7 +573,6 @@ public async Task StoreIntentResultReturnsSuccessfully()
MessageId = 2,
Fdc3InstanceId = originFdc3InstanceId,
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -708,7 +705,6 @@ public async Task GetIntentResultReturnsSuccessfully()
MessageId = 2,
Fdc3InstanceId = originFdc3InstanceId,
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -819,7 +815,6 @@ public async Task AddIntentListenerSubscribesWithExistingAppPerRaisedIntent()
MessageId = 1,
Fdc3InstanceId = originFdc3InstanceId,
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ public async Task GetIntentResult_returns()
MessageId = int.MaxValue,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context("context2"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -320,7 +319,6 @@ public async Task GetIntentResult_fails()
MessageId = int.MaxValue,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context("context2"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -395,7 +393,6 @@ public async Task StoreIntentResult_returns()
MessageId = int.MaxValue,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context("context2"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -448,7 +445,6 @@ public async Task AddIntentListener_subscribes()
MessageId = 1,
Fdc3InstanceId = originFdc3InstanceId,
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -490,7 +486,6 @@ public async Task AddIntentListener_unsubscribes()
MessageId = 1,
Fdc3InstanceId = originFdc3InstanceId,
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -540,7 +535,6 @@ public async Task RaiseIntent_returns_NoAppsFound()
MessageId = 1,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "noAppShouldReturn",
Selected = false,
Context = new Context("context2")
};

Expand All @@ -557,7 +551,6 @@ public async Task RaiseIntent_calls_ResolverUI()
MessageId = 1,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context(ContextTypes.Nothing)
};

Expand Down Expand Up @@ -595,7 +588,6 @@ public async Task RaiseIntent_returns_one_running_app()
MessageId = 1,
Fdc3InstanceId = originFdc3InstanceId,
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public async Task HandleRaiseIntent_returns_IntentDeliveryFailed_error_as_no_int
MessageId = 1,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context("context2"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4" }
};
Expand Down Expand Up @@ -154,7 +153,6 @@ public async Task HandleRaiseIntent_returns_IntentDeliveryFailed_error_as_no_int
MessageId = 1,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom")
};

Expand Down Expand Up @@ -194,7 +192,6 @@ public async Task
MessageId = 1,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -253,7 +250,6 @@ public async Task
MessageId = 1,
Fdc3InstanceId = originFdc3InstanceId,
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand All @@ -276,13 +272,18 @@ public async Task
[Fact]
public async Task HandleRaiseIntent_calls_ResolverUI_by_Context_filter()
{
await _fdc3.StartAsync(CancellationToken.None);

//TODO: should add some identifier to the query => "fdc3:" + instance.Manifest.Id
var origin = await _mockModuleLoader.Object.StartModule(new StartRequest("appId4"));
var originFdc3InstanceId = Fdc3InstanceIdRetriever.Get(origin);

var instanceId = Guid.NewGuid().ToString();
var raiseIntentRequest = new RaiseIntentRequest
{
MessageId = 1,
Fdc3InstanceId = instanceId,
Intent = "intentMetadata4",
Selected = false,
Context = new Context("context2")
};

Expand All @@ -299,7 +300,6 @@ public async Task HandleRaiseIntent_calls_ResolverUI_by_Context_filter_if_fdc3_n
MessageId = 1,
Fdc3InstanceId = instanceId,
Intent = "intentMetadata4",
Selected = false,
Context = new Context(ContextTypes.Nothing)
};

Expand All @@ -315,7 +315,6 @@ public async Task HandleRaiseIntent_fails_as_no_apps_found_by_AppIdentifier()
MessageId = 1,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "testIntent",
Selected = false,
Context = new Context("contextType"),
TargetAppIdentifier = new AppIdentifier { AppId = "noAppShouldReturn" }
};
Expand All @@ -333,7 +332,6 @@ public async Task HandleRaiseIntent_fails_as_no_apps_found_by_Context()
MessageId = 1,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context("noAppShouldReturn")
};

Expand All @@ -350,7 +348,6 @@ public async Task HandleRaiseIntent_fails_as_no_apps_found_by_Intent()
MessageId = 1,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "noAppShouldReturn",
Selected = false,
Context = new Context("context2")
};

Expand Down Expand Up @@ -412,7 +409,6 @@ public async Task HandleStoreIntentResult_succeeds_with_channel()
MessageId = int.MaxValue,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context("context2"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -462,7 +458,6 @@ public async Task HandleStoreIntentResult_succeeds_with_context()
MessageId = int.MaxValue,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = true,
Context = new Context("context2"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -513,7 +508,6 @@ public async Task HandleStoreIntentResult_succeeds_with_voidResult()
MessageId = int.MaxValue,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context("context2"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -608,7 +602,6 @@ public async Task HandleGetIntentResult_fails_due_no_intent_found()
MessageId = int.MaxValue,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context("context2"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -671,7 +664,6 @@ public async Task HandleGetIntentResult_succeeds_with_context()
MessageId = int.MaxValue,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context("context2"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -734,7 +726,6 @@ public async Task HandleGetIntentResult_succeeds_with_channel()
MessageId = int.MaxValue,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context("context2"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -798,7 +789,6 @@ public async Task HandleGetIntentResult_succeeds_with_voidResult()
MessageId = int.MaxValue,
Fdc3InstanceId = Guid.NewGuid().ToString(),
Intent = "intentMetadata4",
Selected = false,
Context = new Context("context2"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -887,7 +877,6 @@ public async Task HandleAddIntentListener_subscribes_to_existing_raised_intent()
MessageId = 1,
Fdc3InstanceId = originFdc3InstanceId,
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down Expand Up @@ -936,7 +925,6 @@ public async Task HandleAddIntentListener_subscribes()
MessageId = 1,
Fdc3InstanceId = originFdc3InstanceId,
Intent = "intentMetadataCustom",
Selected = false,
Context = new Context("contextCustom"),
TargetAppIdentifier = new AppIdentifier { AppId = "appId4", InstanceId = targetFdc3InstanceId }
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class MessageRouterIntentsClient implements IntentsClient {
}

const messageId = Math.floor(Math.random() * 10000);
const message = new Fdc3RaiseIntentRequest(messageId, window.composeui.fdc3.config!.instanceId!, intent, false, context, app);
const message = new Fdc3RaiseIntentRequest(messageId, window.composeui.fdc3.config!.instanceId!, intent, context, app);
const responseFromService = await this.messageRouterClient.invoke(ComposeUITopic.raiseIntent(), JSON.stringify(message));
if (!responseFromService) {
throw new Error(ComposeUIErrors.NoAnswerWasProvided);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export class Fdc3RaiseIntentRequest {
public readonly messageId: number,
public readonly fdc3InstanceId: string,
public readonly intent: string,
public readonly selected: boolean,
public readonly context: Context,
public readonly targetAppIdentifier?: AppIdentifier) {
}
Expand Down

0 comments on commit 49a2167

Please sign in to comment.