public static void LogOutCommon(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService, IUpdatesService updateService, ICacheService cacheService, IStateService stateService, IPushService pushService, INavigationService navigationService) { eventAggregator.Publish(Commands.LogOutCommand); SettingsHelper.SetValue(Constants.IsAuthorizedKey, false); SettingsHelper.RemoveValue(Constants.CurrentUserKey); mtProtoService.ClearQueue(); updateService.ClearState(); cacheService.ClearAsync(); stateService.ResetPasscode(); stateService.GetAllStickersAsync(result => { var allStickers29 = result as TLAllStickers29; if (allStickers29 != null) { allStickers29.RecentlyUsed = new TLVector <TLRecentlyUsedSticker>(); } stateService.SaveAllStickersAsync(allStickers29); }); SearchViewModel.DeleteRecentAsync(); if (navigationService.CurrentSource == navigationService.UriFor <StartupViewModel>().BuildUri() || navigationService.CurrentSource == navigationService.UriFor <SignInViewModel>().BuildUri() || navigationService.CurrentSource == navigationService.UriFor <ConfirmViewModel>().BuildUri() || navigationService.CurrentSource == navigationService.UriFor <SignUpViewModel>().BuildUri()) { return; } stateService.ClearNavigationStack = true; Telegram.Logs.Log.Write("StartupViewModel SettingsViewModel.LogOutCommon"); navigationService.UriFor <StartupViewModel>().Navigate(); }
public static void LogOutCommon(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService, IUpdatesService updateService, ICacheService cacheService, IStateService stateService, IPushService pushService, INavigationService navigationService) { eventAggregator.Publish(Commands.LogOutCommand); SettingsHelper.SetValue(Constants.IsAuthorizedKey, false); SettingsHelper.RemoveValue(Constants.CurrentUserKey); mtProtoService.ClearQueue(); updateService.ClearState(); cacheService.ClearAsync(); stateService.ResetPasscode(); stateService.ClearAllStickersAsync(); stateService.ClearFeaturedStickersAsync(); stateService.ClearArchivedStickersAsync(); EmojiControl emojiControl; if (EmojiControl.TryGetInstance(out emojiControl)) { emojiControl.ClearStickersOnLogOut(); } cacheService.ClearConfigImportAsync(); SearchViewModel.DeleteRecentAsync(); Bootstrapper.UpdateMainTile(); DialogDetailsViewModel.DeleteInlineBots(); FileUtils.Delete(new object(), Constants.InlineBotsNotificationFileName); FileUtils.Delete(new object(), Constants.WebPagePreviewsFileName); var liveLocationService = IoC.Get <ILiveLocationService>(); liveLocationService.Clear(); if (navigationService.CurrentSource == navigationService.UriFor <StartupViewModel>().BuildUri() || navigationService.CurrentSource == navigationService.UriFor <SignInViewModel>().BuildUri() || navigationService.CurrentSource == navigationService.UriFor <ConfirmViewModel>().BuildUri() || navigationService.CurrentSource == navigationService.UriFor <SignUpViewModel>().BuildUri()) { return; } stateService.ClearNavigationStack = true; Telegram.Logs.Log.Write("StartupViewModel SettingsViewModel.LogOutCommon"); navigationService.UriFor <StartupViewModel>().Navigate(); }