Example #1
0
        public void Passport()
        {
            if (IsWorking)
            {
                return;
            }

            var passportConfig     = StateService.GetPassportConfig();
            var passportConfigHash = passportConfig != null ? passportConfig.Hash : new TLInt(0);

            MTProtoService.GetPassportDataAsync(
                (result1, result2) => BeginOnUIThread(() =>
            {
                IsWorking = false;
                if (result1.HasPassword)
                {
                    StateService.Password     = result1;
                    StateService.SecureValues = result2;
                    NavigationService.UriFor <Passport.EnterPasswordViewModel>().Navigate();
                    return;
                }

                if (!result1.HasPassword)
                {
                    if (!TLString.IsNullOrEmpty(result1.EmailUnconfirmedPattern))
                    {
                        StateService.Password     = result1;
                        StateService.SecureValues = result2;
                        NavigationService.UriFor <PasswordViewModel>().Navigate();
                    }
                    else
                    {
                        StateService.Password     = result1;
                        StateService.SecureValues = result2;
                        NavigationService.UriFor <PasswordIntroViewModel>().Navigate();
                    }
                    return;
                }
            }),
                error => BeginOnUIThread(() =>
            {
                IsWorking = false;
                Execute.ShowDebugMessage("passport.container error " + error);
            }));
        }