Exemplo n.º 1
0
        public override async Task InitializeAsync(object navigationData)
        {
            await Connections.InitializeAsync(null);

            await Credentials.InitializeAsync(null);

            await Account.InitializeAsync(null);

            await CreateInvitation.InitializeAsync(null);

            await ProofRequests.InitializeAsync(null);

            await base.InitializeAsync(navigationData);

            await poolConfigurator.ConfigurePoolsAsync();
        }
        private async Task AcceptCredentialOffer(CredentialRecord credentialRecord)
        {
            if (credentialRecord.State != CredentialState.Offered)
            {
                await DialogService.AlertAsync(string.Format("res-CredentialStateShouldBe", CredentialState.Offered));

                await NavigationService.PopModalAsync();

                return;
            }

            await _poolConfigurator.ConfigurePoolsAsync();

            var context = await _agentContextProvider.GetContextAsync();

            var(msg, rec) = await _credentialService.CreateRequestAsync(context, credentialRecord.Id);

            var connectionRecord = await _connectionService.GetAsync(context, credentialRecord.ConnectionId);

            if (connectionRecord == null)
            {
                //await _messageService.SendAsync(context.Wallet, msg, conectionRecord.TheirVk ?? rec.GetTag("InvitationKey") ?? throw new InvalidOperationException("Cannot locate recipient Key"), conectionRecord.Endpoint.Uri,
                //    conectionRecord.Endpoint?.Verkey == null ? null : conectionRecord.Endpoint.Verkey, conectionRecord.MyVk);
                await DialogService.AlertAsync("Connection-less credentials not supported.");

                return;
            }
            else
            {
                await _messageService.SendAsync(context.Wallet, msg, connectionRecord);
            }

            _eventAggregator.Publish(new ApplicationEvent()
            {
                Type = ApplicationEventType.CredentialUpdated
            });

            await NavigationService.PopModalAsync();
        }