1using System.ComponentModel;
2using System.Runtime.CompilerServices;
3using CommunityToolkit.Mvvm.ComponentModel;
4using CommunityToolkit.Mvvm.Input;
25 await base.OnInitialize();
27 ServiceRef.XmppService.ConnectionStateChanged += this.XmppService_ConnectionStateChanged;
28 ServiceRef.XmppService.LegalIdentityChanged += this.XmppContracts_LegalIdentityChanged;
34 ServiceRef.XmppService.ConnectionStateChanged -= this.XmppService_ConnectionStateChanged;
35 ServiceRef.XmppService.LegalIdentityChanged -= this.XmppContracts_LegalIdentityChanged;
37 await base.OnDispose();
43 await base.DoAssignProperties();
45 if (this.CreateIdentityCommand.CanExecute(
null))
46 await this.CreateIdentityCommand.ExecuteAsync(
null);
48 await this.CheckAndHandleIdentityApplicationAsync();
51 private Task XmppService_ConnectionStateChanged(
object _,
XmppState NewState)
55 MainThread.BeginInvokeOnMainThread(async () =>
61 return Task.CompletedTask;
64 private async Task XmppContracts_LegalIdentityChanged(
object _, LegalIdentityEventArgs e)
66 MainThread.BeginInvokeOnMainThread(async () =>
69 this.CreateIdentityCommand.NotifyCanExecuteChanged();
74 protected override void OnPropertyChanged(PropertyChangedEventArgs e)
76 base.OnPropertyChanged(e);
78 switch (e.PropertyName)
80 case nameof(this.IsBusy):
81 this.CreateIdentityCommand.NotifyCanExecuteChanged();
103 return ServiceRef.TagProfile.LegalIdentity is not
null &&
104 (ServiceRef.TagProfile.LegalIdentity.State == IdentityState.Approved ||
105 ServiceRef.TagProfile.LegalIdentity.State ==
IdentityState.Created);
120 private async Task CreateIdentity()
130 if (Succeeded && AddedIdentity is not
null)
141 private static async Task ValidateIdentity()
143 await Task.CompletedTask;
147 private async Task CheckAndHandleIdentityApplicationAsync()
167 private static RegisterIdentityModel CreateRegisterModel()
169 RegisterIdentityModel IdentityModel =
new();
177 IdentityModel.PhoneNr = s;
185 IdentityModel.EMail = s;
193 IdentityModel.CountryCode = s;
196 return IdentityModel;
Absolute paths to important pages.
const string RegistrationPage
Path to registration page.
XMPP Protocol Properties.
const string Country
Country
const string Phone
Phone number
const string EMail
e-Mail address
A set of never changing property constants and helpful values.
Represent an attachment to a LegalIdentity.
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 ITagProfile TagProfile
TAG Profile service.
static IXmppService XmppService
The XMPP service for XMPP communication.
The data model for registering an identity.
override async Task OnDispose()
bool CanCreateIdentity
If we can create an identity.
static bool IsLegalIdentityCreated
If Legal ID has been created.
override async Task OnInitialize()
static bool IsAccountCreated
If App has an XMPP account defined.
override async Task DoAssignProperties()
static bool IsXmppConnected
If App is connected to the XMPP network.
IdentityState State
Current state of identity
RegistrationStep Step
This profile's current registration step.
Task SetLegalIdentity(LegalIdentity? Identity, bool RemoveOldAttachments)
Sets the legal identity of the profile.
string? Account
The account name for this profile
string? EMail
Verified e-mail address.
Task ClearLegalIdentity()
Revert the Set LegalIdentity
string? SelectedCountry
Selected country. Some countries have the same phone code, so we want to save the selected country
string? PhoneNumber
Verified phone number.
LegalIdentity? LegalIdentity
The legal identity of the current user/profile.
RegistrationStep
The different steps of a TAG Profile registration journey.
IdentityState
Lists recognized legal identity states.
XmppState
State of XMPP connection.