Skip to content

Commit

Permalink
fix(fdc3) - Refactored DesktopAgent queries to find the appropriate i…
Browse files Browse the repository at this point in the history
…ntents via raiseIntent, findIntent, findIntentsByContext call. Removed unnecessary codes, tests, code cleanup
  • Loading branch information
lilla28 committed Apr 22, 2024
1 parent 7fec763 commit ae29277
Show file tree
Hide file tree
Showing 12 changed files with 1,847 additions and 1,950 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace MorganStanley.ComposeUI.Fdc3.DesktopAgent.Contracts;
internal sealed class FindIntentRequest
{
/// <summary>
/// Unique identifier from the application which sent the RaiseIntentRequest type of message.
/// eg.: the instanceId of the application which can be queried from the window.object.composeui.fdc3.config, if it's a webapplication.
/// Unique identifier from the application which sent the FindIntentRequest type of message.
/// eg.: the instanceId of the application which can be queried from the window.object.composeui.fdc3.config, if it's a WebApplication.
/// </summary>
public string Fdc3InstanceId { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal sealed class FindIntentsByContextRequest
{
/// <summary>
/// Unique identifier from the application which sent the FindIntentsByContextRequest type of message.
/// eg.: the instanceId of the application which can be queried from the window.object.composeui.fdc3.config, if it's a webapplication.
/// eg.: the instanceId of the application which can be queried from the window.object.composeui.fdc3.config, if it's a WebApplication.
/// </summary>
public string Fdc3InstanceId { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal sealed class RaiseIntentRequest

/// <summary>
/// Unique identifier from the application which sent the RaiseIntentRequest type of message.
/// eg.: the instanceId of the application which can be queried from the window.object.composeui.fdc3.config, if it's a webapplication.
/// eg.: the instanceId of the application which can be queried from the window.object.composeui.fdc3.config, if it's a WebApplication.
/// </summary>
public string Fdc3InstanceId { get; set; }

Expand All @@ -52,9 +52,4 @@ internal sealed class RaiseIntentRequest
/// Information about the app that should resolve the raised intent.
/// </summary>
public AppIdentifier? TargetAppIdentifier { get; set; }

/// <summary>
/// Contains error text if an error happened during executing the raiseIntent method.
/// </summary>
public string? Error { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,4 @@ public static class Fdc3DesktopAgentErrors
/// Indicates that getting the IntentResult from the backend, has no appropriate attribute.
/// </summary>
public const string ResponseHasNoAttribute = $"{nameof(ResponseHasNoAttribute)}";

/// <summary>
/// Indicates that <seealso cref="MorganStanley.ComposeUI.ModuleLoader.IModuleLoader"/> could not start a module via raiseIntent, etc.
/// </summary>
public const string StartModuleFailure = $"{nameof(StartModuleFailure)}";

/// <summary>
/// Indicates that querying raised intent invocations does not contain an element for the intent.
/// </summary>
public const string MissingIntent = $"{nameof(MissingIntent)}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@ public static Fdc3DesktopAgentException MissingAppFromRaisedIntentInvocations(st
new(Fdc3DesktopAgentErrors.MissingId, $"Missing Fdc3InstanceId: {instanceId}, when module has added its intent listener and FDC3 is enabled by the application.");

public static Fdc3DesktopAgentException MultipleIntentRegisteredToAnAppInstance(string intent) =>
new(Fdc3DesktopAgentErrors.MultipleIntent, $"Multiplpe intent were registered to the running instance. Intent: {intent}.");
new(Fdc3DesktopAgentErrors.MultipleIntent, $"Multiple intents were registered to the running instance. Intent: {intent}.");

public static Fdc3DesktopAgentException TargetInstanceUnavailable() =>
new(ResolveError.TargetAppUnavailable, $"Target app is unavailable when intent was raised.");

public static Fdc3DesktopAgentException StartModuleFailure(Exception exception) =>
new(Fdc3DesktopAgentErrors.StartModuleFailure, $"Could not start module when intent was raised.", exception);

public static Fdc3DesktopAgentException MissingIntentForMessage(string messageId, string intent) =>
new(Fdc3DesktopAgentErrors.MissingIntent, $"Could not found raised intent invocations for message: {messageId} with intent: {intent}");
}
Loading

0 comments on commit ae29277

Please sign in to comment.