private async void Contracts_PetitionForIdentityReceived(object sender, LegalIdentityPetitionEventArgs e) { LegalIdentity identity; if (e.RequestedIdentityId == this.tagProfile.LegalIdentity?.Id) { identity = this.tagProfile.LegalIdentity; } else { (bool succeeded, LegalIdentity li) = await this.networkService.TryRequest(() => this.neuronService.Contracts.GetLegalIdentity(e.RequestedIdentityId)); if (succeeded && !(li is null)) { identity = li; } else { return; } } if (identity is null) { this.logService.LogWarning($"{GetType().Name}.{nameof(Contracts_PetitionForIdentityReceived)}() - identity is missing or cannot be retrieved, ignore."); return; } if (identity.State == IdentityState.Compromised || identity.State == IdentityState.Rejected) { await this.networkService.TryRequest(() => this.neuronService.Contracts.SendPetitionIdentityResponse(e.RequestedIdentityId, e.PetitionId, e.RequestorFullJid, false)); } else { this.uiDispatcher.BeginInvokeOnMainThread(async() => { if (this.tagProfile.IsCompleteOrWaitingForValidation()) { await this.navigationService.GoToAsync(nameof(PetitionIdentityPage), new PetitionIdentityNavigationArgs(e.RequestorIdentity, e.RequestorFullJid, e.RequestedIdentityId, e.PetitionId, e.Purpose)); } }); } }
private async Task ContractsClient_PetitionForIdentityReceived(object sender, LegalIdentityPetitionEventArgs e) { try { this.OnPetitionForIdentityReceived(e); } catch (Exception ex) { this.logService.LogException(ex); await this.uiDispatcher.DisplayAlert(AppResources.ErrorTitle, ex.Message); } }
private void OnPetitionForIdentityReceived(LegalIdentityPetitionEventArgs e) { PetitionForIdentityReceived?.Invoke(this, e); }