Exemplo 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
            {
            }
        }
Exemplo n.º 2
0
        private async void LogoutExecute()
        {
            var confirm = await TLMessageDialog.ShowAsync(Strings.Android.AreYouSureLogout, Strings.Android.AppName, Strings.Android.OK, Strings.Android.Cancel);

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

            await _pushService.UnregisterAsync();

            var response = await ProtoService.LogOutAsync();

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

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

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