Ejemplo n.º 1
0
        private async void LogoutExecute()
        {
            var confirm = await TLMessageDialog.ShowAsync("Are you sure you want to logout?", "Unigram", "OK", "Cancel");

            if (confirm != ContentDialogResult.Primary)
            {
                return;
            }

            await _pushService.UnregisterAsync();

            var response = await ProtoService.LogOutAsync();

            if (response.IsSucceeded)
            {
                await _contactsService.UnsyncContactsAsync();

                SettingsHelper.IsAuthorized = false;
                SettingsHelper.UserId       = 0;
                ProtoService.ClearQueue();
                _updatesService.ClearState();
                _stickersService.Cleanup();
                CacheService.ClearAsync();
                CacheService.ClearConfigImportAsync();

                await TLMessageDialog.ShowAsync("The app will be closed. Relaunch it to login again.", "Unigram", "OK");

                App.Current.Exit();
            }
            else
            {
            }
        }