示例#1
0
        public void Handle(UpdateAuthorizationState update)
        {
            if (update.AuthorizationState is AuthorizationStateClosed)
            {
                _lifetimeService.Destroy(this);
            }
            else if (update.AuthorizationState is AuthorizationStateWaitPhoneNumber && !_isActive && _lifetimeService.Items.Count > 1)
            {
                ProtoService.Send(new Destroy());
            }

            //if (update.AuthorizationState is AuthorizationStateReady)
            //{
            //    _lifetimeService.Register(this);
            //}
            //else
            //{
            //    _lifetimeService.Unregister(this);
            //}

            foreach (TLWindowContext window in WindowContext.ActiveWrappers)
            {
                window.Handle(this, update);
            }
        }
示例#2
0
        public void Handle(UpdateAuthorizationState update)
        {
            switch (update.AuthorizationState)
            {
            case AuthorizationStateWaitTdlibParameters waitTdlibParameters:
            case AuthorizationStateWaitEncryptionKey waitEncryptionKey:
                break;

            default:
                _authorizationStateTask.TrySetResult(update.AuthorizationState);
                break;
            }
        }
示例#3
0
        public void Handle(ISessionService session, UpdateAuthorizationState update)
        {
            if (!session.IsActive)
            {
                return;
            }

            Dispatcher.Dispatch(() =>
            {
                var root = NavigationServices.FirstOrDefault(x => x.SessionId == session.Id && x.FrameFacade.FrameId == $"{session.Id}") as TLRootNavigationService;
                if (root != null)
                {
                    root.Handle(update);
                }
            });
        }
示例#4
0
        public void Handle(UpdateAuthorizationState update)
        {
            if (update.AuthorizationState is AuthorizationStateLoggingOut && _continueOnLogOut == null)
            {
                _loggingOut = true;
            }
            else if (update.AuthorizationState is AuthorizationStateClosed)
            {
                if (_loggingOut)
                {
                    _loggingOut = false;
                    _lifetimeService.Destroy(this);
                }
                else if (_continueOnLogOut != null)
                {
                    ProtoService.TryInitialize();
                }
            }
            else if (update.AuthorizationState is AuthorizationStateWaitPhoneNumber && _continueOnLogOut != null)
            {
                ContinueOnLogOut();
            }
            else if ((update.AuthorizationState is AuthorizationStateWaitPhoneNumber || update.AuthorizationState is AuthorizationStateWaitOtherDeviceConfirmation) && !_isActive && _lifetimeService.Items.Count > 1)
            {
                ProtoService.Send(new Destroy());
            }
            else
            {
                _loggingOut = false;
            }

            //if (update.AuthorizationState is AuthorizationStateReady)
            //{
            //    _lifetimeService.Register(this);
            //}
            //else
            //{
            //    _lifetimeService.Unregister(this);
            //}

            foreach (TLWindowContext window in WindowContext.ActiveWrappers)
            {
                window.Handle(this, update);
            }
        }
示例#5
0
        public void Handle(ISessionService session, UpdateAuthorizationState update)
        {
            if (!session.IsActive)
            {
                return;
            }

            Dispatcher.Dispatch(() =>
            {
                var root = NavigationServices.FirstOrDefault(x => x.SessionId == session.Id && x.FrameFacade.FrameId == $"{session.Id}") as IHandle <UpdateAuthorizationState>;
                if (root != null)
                {
                    root.Handle(update);
                }
            });

            //await _window.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            //{
            //    _service = WindowContext.GetForCurrentView().NavigationServices.GetByFrameId($"{session.Id}");
            //    UseActivatedArgs(_args, _service, update.AuthorizationState);
            //});
        }
示例#6
0
        public async void Handle(UpdateAuthorizationState update)
        {
            switch (update.AuthorizationState)
            {
            case AuthorizationStateReady:
                Navigate(typeof(MainPage));
                break;

            case AuthorizationStateWaitPhoneNumber:
            case AuthorizationStateWaitOtherDeviceConfirmation:
                if (_lifetimeService.Items.Count > 1)
                {
                    if (Frame.Content is SignInPage page && page.DataContext is SignInViewModel viewModel)
                    {
                        await viewModel.NavigatedToAsync(null, NavigationMode.Refresh, null);
                    }
                    else
                    {
                        Navigate(typeof(SignInPage));
                    }

                    ClearBackStack();
                    AddToBackStack(typeof(BlankPage));
                }