Example #1
0
        private async Task StartVerification()
        {
            _canVerify = false;
            _userDialogs.ShowLoading("Verifying security code.");

            VerifyCommand.ChangeCanExecute();
            var password = AuthenticationService.GeneratePassword();
            var response = await _verificationManager.ResolveVerificationCodeAsync(VerificationCode, PhoneNumber, password);

            _userDialogs.HideLoading();

            if (!response)
            {
                _canVerify = true;
                VerifyCommand.ChangeCanExecute();

                _userDialogs.ShowError("\nThe verification code doesn't match.", 2500);
            }
            else
            {
                App.Settings.SetupFinished = true;
                _appUserManager.InitUser(PhoneNumber);

                await _appUserManager.PersistUser();

                await AuthenticationService.RequestToken(PhoneNumber, password);

                MessagingCenter.Send(this,
                                     MessagingEvents.LifecycleChanged, new
                                     LifecycleEventArgs(Lifecycle.SetupCompleted));

                await _pageService.Navigation.PushAsync(new ProfilePage());
            }
        }