21 internal class NeuroWalletOrchestratorService :
LoadableService, INeuroWalletOrchestratorService
23 public NeuroWalletOrchestratorService()
27 public override Task Load(
bool isResuming, CancellationToken cancellationToken)
29 if (this.
BeginLoad(isResuming, cancellationToken))
31 ServiceRef.XmppService.EDalerBalanceUpdated += this.Wallet_BalanceUpdated;
32 ServiceRef.XmppService.NeuroFeatureAdded += this.Wallet_TokenAdded;
33 ServiceRef.XmppService.NeuroFeatureRemoved += this.Wallet_TokenRemoved;
34 ServiceRef.XmppService.NeuroFeatureStateUpdated += this.Wallet_StateUpdated;
35 ServiceRef.XmppService.NeuroFeatureVariablesUpdated += this.Wallet_VariablesUpdated;
40 return Task.CompletedTask;
43 public override Task Unload()
47 ServiceRef.XmppService.EDalerBalanceUpdated -= this.Wallet_BalanceUpdated;
48 ServiceRef.XmppService.NeuroFeatureAdded -= this.Wallet_TokenAdded;
49 ServiceRef.XmppService.NeuroFeatureRemoved -= this.Wallet_TokenRemoved;
50 ServiceRef.XmppService.NeuroFeatureStateUpdated -= this.Wallet_StateUpdated;
51 ServiceRef.XmppService.NeuroFeatureVariablesUpdated -= this.Wallet_VariablesUpdated;
56 return Task.CompletedTask;
59 #region Event Handlers
61 private async Task Wallet_BalanceUpdated(
object? Sender, BalanceEventArgs e)
64 ServiceRef.TagProfile.HasWallet =
true;
69 private async Task Wallet_TokenAdded(
object? Sender, TokenEventArgs e)
74 private async Task Wallet_TokenRemoved(
object? Sender, TokenEventArgs e)
85 private async Task Wallet_StateUpdated(
object? Sender, NewStateEventArgs e)
90 private async Task Wallet_VariablesUpdated(
object? Sender, VariablesUpdatedEventArgs e)
100 public async Task OpenEDalerWallet()
122 public async Task OpenEDalerUri(
string Uri)
131 if (Parsed.Expires.AddDays(1) < DateTime.UtcNow)
140 MainThread.BeginInvokeOnMainThread(async () =>
151 MainThread.BeginInvokeOnMainThread(async () =>
158 MainThread.BeginInvokeOnMainThread(async () =>
175 public async Task OpenNeuroFeatureUri(
string Uri)
177 int i = Uri.IndexOf(
':');
181 string TokenId = Uri[(i + 1)..];
Contains information about a balance.
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.
A set of never changing property constants and helpful values.
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...
Contains information about an incoming chat message.
Contains information about a change in a state-machine associated with a token.
Contains information about a change in internal variables of a state-machine associated with a token.
Contains information about a token that has been added.
Contains information about a token that has been removed.
Base class that references services in the app.
static ILogService LogService
Log service.
static IUiService UiService
Service serializing and managing UI-related tasks.
static INotificationService NotificationService
Service for managing notifications for the user.
static ITagProfile TagProfile
TAG Profile service.
static IStringLocalizer 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.
Task DeleteEvents(NotificationEventType Type, CaseInsensitiveString Category)
Deletes events for a given button and category.
bool TryGetNotificationEvents(NotificationEventType Type, CaseInsensitiveString Category, [NotNullWhen(true)] out NotificationEvent[]? Events)
Tries to get available notification events.
Task NewEvent(NotificationEvent Event)
Registers a new event and notifies the user.
Task DisplayException(Exception Exception, string? Title=null)
Displays an alert/message box to the user.
Task GoToAsync(string Route, BackMethod BackMethod=BackMethod.Inherited, string? UniqueId=null)
Navigates the AppShell to the specified route, with page arguments to match.
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.
NotificationEventType
Button on which event is to be displayed.
BackMethod
Navigation Back Method