Exemple #1
0
 public async void CheckActivation()
 {
     await WithProgress(activityIndicator, async() => {
         var created = await StellarHelper.CheckAccountCreated(App.Locator.Profile.KeyPair);
         if (created)
         {
             var trusted = await StellarHelper.CheckTokenTrusted();
             if (trusted)
             {
                 App.Locator.Profile.Activated = true;
                 Application.Current.MainPage  = new MainPage();
             }
             else
             {
                 var added = await StellarHelper.AddTrustToken(App.Locator.Profile.KeyPair);
                 if (added)
                 {
                     App.Locator.Profile.Activated = true;
                     Application.Current.MainPage  = new MainPage();
                 }
                 else
                 {
                     ShowMessage("Error adding trust token");
                 }
             }
         }
         else
         {
             ShowMessage("Stellar account isn't created yet");
         }
     });
 }
Exemple #2
0
        public async void CheckActivation()
        {
            var created = await StellarHelper.CheckAccountCreated(App.Locator.Profile.KeyPair);

            if (created)
            {
                var trusted = await StellarHelper.CheckTokenTrusted();

                if (trusted)
                {
                    App.Locator.Profile.Activated = true;

                    var navigationPage = new NavigationPage(new MainPage());

                    Application.Current.MainPage = navigationPage;

                    App.ShowLoading(false);
                }
                else
                {
                    var added = await StellarHelper.AddTrustToken(App.Locator.Profile.KeyPair);

                    if (added)
                    {
                        App.Locator.Profile.Activated = true;

                        var navigationPage = new NavigationPage(new MainPage());

                        Application.Current.MainPage = navigationPage;

                        App.ShowLoading(false);
                    }
                    else
                    {
                        App.ShowLoading(false);

                        ShowErrorMessage(AppResources.ErrorAddTrustToken);
                    }
                }
            }
            else
            {
                App.ShowLoading(false);

                ShowErrorMessage(AppResources.StellarAccountNotCreated);
            }
        }
        public async void CheckActivation()
        {
            Unfocus();

            var created = await StellarHelper.CheckAccountCreated(App.Locator.Profile.KeyPair);

            if (created)
            {
                var trusted = await StellarHelper.CheckTokenTrusted();

                if (trusted)
                {
                    App.Locator.Profile.Activated = true;

                    //var userInfo = await App.Locator.IdentityServiceClient.UserInfos();
                    //if (userInfo != null)
                    //{
                    //    App.Locator.Profile.SetCredentials(App.Locator.Profile.UserName,
                    //                                       userInfo.UserDetails.FullName, userInfo.UserDetails.PhoneNumber, userInfo.UserDetails.Address,
                    //                                       App.Locator.Profile.KeyPair.SecretSeed, App.Locator.Profile.Mnemonic);

                    //}

                    var page = new WaitingAccountCreationPage(true, true);

                    await Navigation.PushAsync(page, true);

                    App.ShowLoading(false);
                }
                else
                {
                    var page = new SMSVereficationPage();

                    await Navigation.PushAsync(page, true);

                    App.ShowLoading(false);
                }
            }
            else
            {
                var page = new SMSVereficationPage();

                await Navigation.PushAsync(page, true);

                App.ShowLoading(false);
            }
        }
        private async void OnVerify(object sender, EventArgs e)
        {
            if (!ValidationHelper.ValidateTextField(entryCode.Text))
            {
                entryCode.Focus();
            }
            else
            {
                Unfocus();

                if (!App.Locator.FriendlyService.IsFundWorking)
                {
                    ShowErrorMessage(AppResources.RegistrationFundNotWorking);
                    return;
                }

                var page = new WaitingAccountCreationPage();
                await Navigation.PushAsync(page, false);

                await Task.Delay(1000);

                try
                {
                    var result = await App.Locator.IdentityServiceClient.VerifyCode(entryCode.Text);

                    if (result != null)
                    {
                        var trusted = await StellarHelper.CheckTokenTrusted();

                        if (trusted)
                        {
                            page.OpenMainPage();
                        }
                        else
                        {
                            var added = await StellarHelper.AddTrustToken(App.Locator.Profile.KeyPair);

                            if (added)
                            {
                                page.OpenMainPage();
                            }
                            else
                            {
                                page.GoBack();

                                ShowErrorMessage(AppResources.ErrorAddTrustToken);
                            }
                        }
                    }
                    else
                    {
                        page.GoBack();
                    }
                }
                catch (Exception ex)
                {
                    page.GoBack();

                    ShowErrorMessage(ex.Message);
                }
            }
        }