23 internal class NeuroWalletOrchestratorService :
LoadableService, INeuroWalletOrchestratorService
25 public NeuroWalletOrchestratorService()
29 public override Task Load(
bool isResuming, CancellationToken CancellationToken)
31 if (this.
BeginLoad(isResuming, CancellationToken))
33 ServiceRef.XmppService.EDalerBalanceUpdated += this.Wallet_BalanceUpdated;
34 ServiceRef.XmppService.NeuroFeatureAdded += this.Wallet_TokenAdded;
35 ServiceRef.XmppService.NeuroFeatureRemoved += this.Wallet_TokenRemoved;
36 ServiceRef.XmppService.NeuroFeatureStateUpdated += Wallet_StateUpdated;
37 ServiceRef.XmppService.NeuroFeatureVariablesUpdated += this.Wallet_VariablesUpdated;
42 return Task.CompletedTask;
45 public override Task Unload()
49 ServiceRef.XmppService.EDalerBalanceUpdated -= this.Wallet_BalanceUpdated;
50 ServiceRef.XmppService.NeuroFeatureAdded -= this.Wallet_TokenAdded;
51 ServiceRef.XmppService.NeuroFeatureRemoved -= this.Wallet_TokenRemoved;
52 ServiceRef.XmppService.NeuroFeatureStateUpdated -= Wallet_StateUpdated;
53 ServiceRef.XmppService.NeuroFeatureVariablesUpdated -= this.Wallet_VariablesUpdated;
58 return Task.CompletedTask;
61 #region Event Handlers
66 ServiceRef.TagProfile.HasWallet =
true;
77 EntityId = e.Balance.Currency
83 private async Task Wallet_TokenAdded(
object? Sender,
TokenEventArgs e)
88 private async Task Wallet_TokenRemoved(
object? Sender,
TokenEventArgs e)
99 EntityId = e.Token.TokenId
105 private static async Task Wallet_StateUpdated(
object? Sender,
NewStateEventArgs e)
136 public async Task OpenEDalerWallet()
158 public async Task OpenEDalerUri(
string Uri)
167 if (Parsed.Expires.AddDays(1) < DateTime.UtcNow)
176 MainThread.BeginInvokeOnMainThread(async () =>
187 MainThread.BeginInvokeOnMainThread(async () =>
194 MainThread.BeginInvokeOnMainThread(async () =>
211 public async Task OpenNeuroFeatureUri(
string Uri)
213 int i = Uri.IndexOf(
':');
217 string TokenId = Uri[(i + 1)..];
Contains information about a balance.
decimal Amount
Amount at given point in time.
Wallet balance event arguments.
Contains information about a pending payment.
eDaler URI representing the destruction of eDaler by an operator.
eDaler URI representing the issuance of eDaler by an operator.
eDaler URI representing the payment of eDaler from a sender to a receiver.
Abstract base class for eDaler URIs
Incomplete eDaler URI for simplifying payments to a predefined recipient.
const int AccountEventBatchSize
Number of account events to load in a single batch.
const string EDaler
eDaler channel
const string Tokens
Tokens channel
A set of never changing property constants and helpful values.
A strongly-typed resource class, for looking up localized strings, etc.
static string State
Looks up a localized string similar to State.
static string NotificationTokenRemovedBody
Looks up a localized string similar to Your wallet was updated..
static string NotificationTokenRemovedTitle
Looks up a localized string similar to Token removed.
static string NotificationBalanceUpdatedTitle
Looks up a localized string similar to Balance updated.
static string ExpiredEDalerUri
Looks up a localized string similar to This eDaler code has expired..
static string InvalidEDalerUri
Looks up a localized string similar to Invalid eDaler URI: {0}.
static string NotificationBalanceUpdatedBody
Looks up a localized string similar to Your balance was updated..
static string UnrecognizedEDalerURI
Looks up a localized string similar to Unrecognized eDaler URI..
static string ErrorTitle
Looks up a localized string similar to An error has occurred.
bool BeginLoad(bool IsResuming, CancellationToken CancellationToken)
Sets the IsLoading flag if the service isn't already loading.
void EndLoad(bool isLoaded)
Sets the IsLoading and IsLoaded flags and fires an event representing the current load state of the s...
bool BeginUnload()
Sets the IsLoading flag if the service isn't already unloading.
void EndUnload()
Sets the IsLoading and IsLoaded flags and fires an event representing the current load state of the s...
Platform-neutral intent describing how to route a notification.
Base class that references services in the app.
static IServiceProvider Provider
The service provider for the app. This is set before the app is started, and will be used to resolve ...
static ILogService LogService
Log service.
static IUiService UiService
Service serializing and managing UI-related tasks.
static INavigationService NavigationService
The navigation service for navigating between pages.
static INotificationService NotificationService
Service for managing notifications for the user.
static ITagProfile TagProfile
TAG Profile service.
static IReportingStringLocalizer Localizer
Localization service
static IXmppService XmppService
The XMPP service for XMPP communication.
Holds navigation parameters specific to eDaler URIs.
A page that allows the user to receive newly issued eDaler.
A page that allows the user to view the contents of its eDaler wallet, pending payments and recent ac...
Encapsulates a Token object.
Holds navigation parameters specific to the eDaler wallet.
A page that allows the user to realize payments.
A page that allows the user to accept an offline payment.
Holds navigation parameters specific to a token.
A page that allows the user to view information about a token.
Event arguments events when the current state of a state-machine has changed.
Event arguments for token events.
Event arguments events when the variables of a state-machine has changed.
bool TryGetNotificationEvents(NotificationEventType Type, CaseInsensitiveString Category, [NotNullWhen(true)] out NotificationEvent[]? Events)
Tries to get available notification events.
Interface for the redesigned notification service.
Task GoToAsync(string Route)
Navigates to the specified route and pushes the page onto the navigation stack.
Task DisplayException(Exception Exception, string? Title=null)
Displays an alert/message box to the user.
Task< bool > DisplayAlert(string Title, string Message, string? Accept=null, string? Cancel=null)
Displays an alert/message box to the user.
abstract class NotificationEvent()
Abstract base class of notification events.
NotificationAction
Actions that can be routed from notifications.
NotificationEventType
Button on which event is to be displayed.
NotificationSource
Describes the source producing a notification.
BackMethod
Navigation Back Method
Action
The Action field indicates the action performed by the Reporting-MTA as a result of its attempt to de...