2using System.Threading.Tasks;
40 this.filterRegistry = FilterRegistry;
58 return this.RouteChatAsync(Intent, CancellationToken);
60 return this.RouteProfileAsync(Intent, CancellationToken);
62 return this.RouteIdentityAsync(Intent, CancellationToken);
64 return this.RouteContractAsync(Intent, CancellationToken);
66 return this.RouteTokenAsync(CancellationToken);
68 return this.RouteBalanceAsync(CancellationToken);
70 return this.RoutePetitionAsync(Intent, CancellationToken);
72 return this.RoutePresenceAsync(Intent, CancellationToken);
74 return this.RouteSettingsAsync(CancellationToken);
86 private async Task<NotificationRouteResult> RouteChatAsync(
NotificationIntent Intent, CancellationToken CancellationToken)
88 if (
string.IsNullOrEmpty(Intent.
EntityId))
93 string? LegalId = Info?.
LegalId;
100 private Task<NotificationRouteResult> RouteProfileAsync(NotificationIntent Intent, CancellationToken CancellationToken)
103 return this.RoutePresenceAsync(Intent, CancellationToken);
106 private async Task<NotificationRouteResult> RoutePresenceAsync(NotificationIntent Intent, CancellationToken CancellationToken)
112 private async Task<NotificationRouteResult> RouteIdentityAsync(NotificationIntent Intent, CancellationToken CancellationToken)
114 if (
string.IsNullOrEmpty(Intent.EntityId))
120 if (Intent.Extras.TryGetValue(
"state", out
string? stateString) && Enum.TryParse(stateString, out
IdentityState parsed))
135 if (reference is not
null && !isApproved)
143 ViewIdentityNavigationArgs viewArgs =
new(identity);
154 private async Task<NotificationRouteResult> RouteContractAsync(NotificationIntent Intent, CancellationToken CancellationToken)
156 if (
string.IsNullOrEmpty(Intent.EntityId))
165 ViewContractNavigationArgs args =
new(contract,
false);
177 private async Task<NotificationRouteResult> RouteTokenAsync(CancellationToken CancellationToken)
183 private async Task<NotificationRouteResult> RouteBalanceAsync(CancellationToken CancellationToken)
187 TargetTabKey =
"wallet"
194 private async Task<NotificationRouteResult> RoutePetitionAsync(NotificationIntent Intent, CancellationToken CancellationToken)
198 if (Intent.Extras.TryGetValue(
"requestedIdentityId", out
string? RequestedIdentityId))
201 if (!
string.IsNullOrEmpty(Intent.EntityId))
208 if (!Succeeded || RequestedIdentity is
null)
211 string Message =
"Petition has expired or is no longer available.";
217 RequestorIdentity = RequestedIdentity;
220 string? PetitionId = Intent.Extras.TryGetValue(
"petitionId", out
string? pid) ? pid :
null;
221 PetitionIdentityNavigationArgs Args =
new(RequestorIdentity, Intent.EntityId, RequestedIdentityId, PetitionId, Intent.Body);
226 if (Intent.Extras.TryGetValue(
"signatoryId", out
string? SignatoryIdentityId) &&
227 Intent.Extras.TryGetValue(
"contentToSign", out
string? ContentToSignBase64) &&
228 !
string.IsNullOrEmpty(SignatoryIdentityId) &&
229 !
string.IsNullOrEmpty(ContentToSignBase64))
232 string? RequestorFullJid = Intent.EntityId;
233 if (Intent.Extras.TryGetValue(
"requestorIdentityId", out
string? RequestorIdentityId) &&
234 !
string.IsNullOrEmpty(RequestorIdentityId))
237 if (Succeeded && LegalId is not
null)
238 RequestorIdentity = LegalId;
241 if (RequestorIdentity is
null && !
string.IsNullOrEmpty(RequestorFullJid))
247 if (RequestorIdentity is
null ||
string.IsNullOrEmpty(RequestorFullJid))
250 string Message =
"Petition has expired or is no longer available.";
255 byte[] ContentToSign;
258 ContentToSign = Convert.FromBase64String(ContentToSignBase64);
260 catch (FormatException ex)
264 string Message =
"Petition has expired or is no longer available.";
269 string Purpose = Intent.Extras.TryGetValue(
"purpose", out
string? PurposeValue)
270 ? PurposeValue ?? string.Empty
272 string PetitionId = Intent.Extras.TryGetValue(
"petitionId", out
string? Pid)
273 ? Pid ?? string.Empty
277 ContentToSign, PetitionId, Purpose);
282 if (Intent.Extras.TryGetValue(
"contractId", out
string? contractId))
294 string? PetitionId = Intent.Extras.TryGetValue(
"petitionId", out
string? Pid) ? Pid :
null;
310 private async Task<NotificationRouteResult> RouteSettingsAsync(CancellationToken CancellationToken)
A strongly-typed resource class, for looking up localized strings, etc.
static string ErrorTitle
Looks up a localized string similar to An error has occurred.
Contains a local reference to a KYC process.
IdentityState? CreatedIdentityState
Last known state of the created identity (if any), for quick status tagging offline.
string? CreatedIdentityId
The legal ID of the created identity (if any).
Represents a filter decision for notification handling.
bool IgnoreRoute
Gets a value indicating whether routing should be suppressed.
Platform-neutral intent describing how to route a notification.
string? EntityId
Gets or sets an entity identifier associated with the action.
NotificationAction Action
Gets or sets the intended action.
Default router for notification intents. Wiring to navigation can be extended here.
Task< NotificationRouteResult > RouteAsync(NotificationIntent Intent, bool FromUserInteraction, CancellationToken CancellationToken)
Routes a notification intent. Routing result.
NotificationIntentRouter(INotificationFilterRegistry FilterRegistry)
Initializes a new instance of the NotificationIntentRouter class.
Base class that references services in the app.
static ILogService LogService
Log service.
static INetworkService NetworkService
Network service.
static IUiService UiService
Service serializing and managing UI-related tasks.
static INavigationService NavigationService
The navigation service for navigating between pages.
static IReportingStringLocalizer Localizer
Localization service
static IXmppService XmppService
The XMPP service for XMPP communication.
Holds navigation parameters specific to views displaying a list of contacts.
A page that displays a list of the current user's contacts.
A page that displays a list of the current user's contacts.
A page that displays a list of the current user's contracts.
A page that displays a specific contract.
A page to display when the user wants to view an identity.
Navigation arguments for the KYC process page. Carries the KycReference to edit/continue.
Navigation arguments for the MainPage, allowing callers to target a specific tab.
Main page for App settings.
Holds navigation parameters specific to views displaying a contract petition request.
A page to display when the user is asked to petition a contract.
A page to display when the user is asked to petition an identity.
Holds navigation parameters specific to views displaying a petition of a signature.
A page to display when the user is asked to petition a signature.
A page that allows the user to view its tokens.
Contains the definition of a contract
Static interface for database persistence. In order to work, a database provider has to be assigned t...
This filter selects objects that have a named field equal to a given value.
Manages runtime notification filters (ignore rules).
Routes notification intents to navigation targets.
NotificationRouteResult
Possible outcomes when routing a notification intent.
NotificationAction
Actions that can be routed from notifications.
IdentityState
Lists recognized legal identity states.