Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
LoadingPage.xaml.cs
1using System.Threading.Tasks;
2using CommunityToolkit.Mvvm.ComponentModel;
3using NeuroAccessMaui.Services; // for ServiceRef and ServiceHelper
10using NeuroAccessMaui.UI.Pages.Main; // for MainPage
12
14{
15 public partial class LoadingPage : BaseContentPage
16 {
17 private readonly ITagProfile tagProfile;
18 private readonly INavigationService navigationService;
19 private readonly IThemeService themeService;
20 private readonly INotificationServiceV2 notificationService;
21
23 {
24 this.InitializeComponent();
25 this.BindingContext = this;
26 this.tagProfile = TagProfile;
27 this.navigationService = NavigationService;
28 this.themeService = ThemeService;
29 this.notificationService = NotificationService;
30 }
31
32 public override Task OnDisposeAsync() => Task.CompletedTask;
33
34 public override Task OnInitializeAsync() => Task.CompletedTask;
35
36 public override async Task OnAppearingAsync()
37 {
38 App? AppInstance = App.Current;
39 if (AppInstance is not null)
40 await AppInstance.InitCompleted;
41
42 await ServiceRef.XmppService.WaitForConnectedState(TimeSpan.FromSeconds(3));
43
44 string? PendingIntentUri = await ServiceRef.IntentService.TryGetAndDequeueOnboardingUrl();
45
46 await ServiceRef.IntentService.ProcessQueuedIntentsAsync();
47
48 bool IsOnboarded = this.tagProfile.IsComplete();
49
50 if (!IsOnboarded)
51 {
53
54 if (PendingIntentUri is not null)
55 Args = new OnboardingNavigationArgs(OnboardingScenario.FullSetup, PendingIntentUri);
56 else
57 Args = new OnboardingNavigationArgs(OnboardingScenario.FullSetup);
58
59 await this.navigationService.SetRootAsync(nameof(OnboardingPage), Args);
60 }
61 else
62 {
63 ThemeApplyOutcome ThemeOutcome = await this.themeService.ApplyProviderThemeAsync(ThemeFetchPolicy.BlockingFirstRun, CancellationToken.None);
64 // Edge case: a reachable but unavailable branding endpoint times out and stays transient.
65 // This loop intentionally blocks first-run until branding resolves; revisit if we add a
66 // "continue without branding" path.
67 while (ThemeOutcome == ThemeApplyOutcome.FailedTransient)
68 {
73 ThemeOutcome = await this.themeService.ApplyProviderThemeAsync(ThemeFetchPolicy.BlockingFirstRun, CancellationToken.None);
74 }
75 await this.navigationService.SetRootAsync(nameof(MainPage));
76 try
77 {
78 await this.notificationService.ProcessPendingAsync(CancellationToken.None);
79 }
80 catch (Exception Ex)
81 {
82 ServiceRef.LogService.LogException(Ex);
83 }
84 }
85 }
86
87 public override Task OnDisappearingAsync() => Task.CompletedTask;
88 }
89}
Represents an instance of the Neuro-Access app.
Definition: App.xaml.cs:125
static new? App Current
Gets the current application instance.
Definition: App.xaml.cs:169
A strongly-typed resource class, for looking up localized strings, etc.
static string NetworkSeemsToBeMissing
Looks up a localized string similar to Network seems to be missing. Please check your configuration a...
static string Ok
Looks up a localized string similar to OK.
static string ErrorTitle
Looks up a localized string similar to An error has occurred.
Base class that references services in the app.
Definition: ServiceRef.cs:43
static ILogService LogService
Log service.
Definition: ServiceRef.cs:214
static IUiService UiService
Service serializing and managing UI-related tasks.
Definition: ServiceRef.cs:130
static IReportingStringLocalizer Localizer
Localization service
Definition: ServiceRef.cs:370
static IXmppService XmppService
The XMPP service for XMPP communication.
Definition: ServiceRef.cs:190
The TAG Profile is the heart of the digital identity for a specific user/device. Use this instance to...
Definition: TagProfile.cs:28
Manages application theming. Applies bundled (local) light/dark themes and, when a provider domain is...
Definition: ThemeService.cs:24
Navigation service managing a custom stack of BaseContentPage instances. Modal navigation is deprecat...
A base class for all pages, intended for custom navigation with explicit life-cycle events.
Navigation arguments for onboarding flow. Scenario determines dynamic starting step.
override Task OnDisappearingAsync()
Called when the page is about to be hidden. Triggers save state, disappearing logic,...
override Task OnInitializeAsync()
Override to register event handlers, process navigation args, etc. Called ONCE per page lifetime.
override Task OnDisposeAsync()
Override to unregister event handlers, cleanup, etc. Called when page is permanently removed.
override async Task OnAppearingAsync()
Called when the page is about to be shown. Triggers restore state, appearing logic,...
Interface for the redesigned notification service.
The TAG Profile is the heart of the digital identity for a specific user/device. Use this instance to...
Definition: ITagProfile.cs:18
Service for loading, applying, and retrieving themes and branding in the application....
Service for navigating between pages using route-based navigation.
Task< bool > DisplayAlert(string Title, string Message, string? Accept=null, string? Cancel=null)
Displays an alert/message box to the user.
ThemeApplyOutcome
Represents the outcome of a provider theme application attempt.
ThemeFetchPolicy
Defines how provider branding should be fetched and applied.
OnboardingScenario
Distinct onboarding scenarios.