diff --git a/src/Android/MainApplication.cs b/src/Android/MainApplication.cs index d8ba361d2..61f3d8113 100644 --- a/src/Android/MainApplication.cs +++ b/src/Android/MainApplication.cs @@ -148,10 +148,10 @@ namespace Bit.Droid private async Task BootstrapAsync() { - var disableFavicon = await ServiceContainer.Resolve("storageService").GetAsync( - Constants.DisableFaviconKey); - await ServiceContainer.Resolve("stateService").SaveAsync(Constants.DisableFaviconKey, - disableFavicon); + var disableFavicon = await ServiceContainer.Resolve("storageService") + .GetAsync(Constants.DisableFaviconKey); + await ServiceContainer.Resolve("stateService").SaveAsync( + Constants.DisableFaviconKey, disableFavicon); await ServiceContainer.Resolve("environmentService").SetUrlsFromStorageAsync(); } } diff --git a/src/App/App.xaml.cs b/src/App/App.xaml.cs index 0f60049e7..cc7eb2c0d 100644 --- a/src/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -227,7 +227,8 @@ namespace Bit.App _folderService.ClearAsync(userId), _collectionService.ClearAsync(userId), _passwordGenerationService.ClearAsync(), - _lockService.ClearAsync()); + _lockService.ClearAsync(), + _stateService.PurgeAsync()); _lockService.PinLocked = false; _lockService.FingerprintLocked = true; _searchService.ClearIndex(); diff --git a/src/App/Pages/Accounts/LockPageViewModel.cs b/src/App/Pages/Accounts/LockPageViewModel.cs index fabc21895..b11375ac5 100644 --- a/src/App/Pages/Accounts/LockPageViewModel.cs +++ b/src/App/Pages/Accounts/LockPageViewModel.cs @@ -23,6 +23,7 @@ namespace Bit.App.Pages private readonly IMessagingService _messagingService; private readonly IStorageService _secureStorageService; private readonly IEnvironmentService _environmentService; + private readonly IStateService _stateService; private bool _hasKey; private string _email; @@ -46,6 +47,7 @@ namespace Bit.App.Pages _messagingService = ServiceContainer.Resolve("messagingService"); _secureStorageService = ServiceContainer.Resolve("secureStorageService"); _environmentService = ServiceContainer.Resolve("environmentService"); + _stateService = ServiceContainer.Resolve("stateService"); PageTitle = AppResources.VerifyMasterPassword; TogglePasswordCommand = new Command(TogglePassword); @@ -174,7 +176,7 @@ namespace Bit.App.Pages if(!failed) { Pin = string.Empty; - DoContinue(); + await DoContinueAsync(); } } else @@ -270,7 +272,7 @@ namespace Bit.App.Pages _lockService.FingerprintLocked = !success; if(success) { - DoContinue(); + await DoContinueAsync(); } } @@ -280,11 +282,13 @@ namespace Bit.App.Pages { await _cryptoService.SetKeyAsync(key); } - DoContinue(); + await DoContinueAsync(); } - private void DoContinue() + private async Task DoContinueAsync() { + var disableFavicon = await _storageService.GetAsync(Constants.DisableFaviconKey); + await _stateService.SaveAsync(Constants.DisableFaviconKey, disableFavicon.GetValueOrDefault()); _messagingService.Send("unlocked"); UnlockedAction?.Invoke(); } diff --git a/src/App/Pages/Accounts/LoginPageViewModel.cs b/src/App/Pages/Accounts/LoginPageViewModel.cs index e4aeed361..25e7954db 100644 --- a/src/App/Pages/Accounts/LoginPageViewModel.cs +++ b/src/App/Pages/Accounts/LoginPageViewModel.cs @@ -1,5 +1,6 @@ using Bit.App.Abstractions; using Bit.App.Resources; +using Bit.Core; using Bit.Core.Abstractions; using Bit.Core.Exceptions; using Bit.Core.Utilities; @@ -18,6 +19,7 @@ namespace Bit.App.Pages private readonly ISyncService _syncService; private readonly IStorageService _storageService; private readonly IPlatformUtilsService _platformUtilsService; + private readonly IStateService _stateService; private bool _showPassword; private string _email; @@ -30,6 +32,7 @@ namespace Bit.App.Pages _syncService = ServiceContainer.Resolve("syncService"); _storageService = ServiceContainer.Resolve("storageService"); _platformUtilsService = ServiceContainer.Resolve("platformUtilsService"); + _stateService = ServiceContainer.Resolve("stateService"); PageTitle = AppResources.Bitwarden; TogglePasswordCommand = new Command(TogglePassword); @@ -123,6 +126,8 @@ namespace Bit.App.Pages } else { + var disableFavicon = await _storageService.GetAsync(Constants.DisableFaviconKey); + await _stateService.SaveAsync(Constants.DisableFaviconKey, disableFavicon.GetValueOrDefault()); var task = Task.Run(async () => await _syncService.FullSyncAsync(true)); Application.Current.MainPage = new TabsPage(); } diff --git a/src/App/Pages/Accounts/TwoFactorPageViewModel.cs b/src/App/Pages/Accounts/TwoFactorPageViewModel.cs index 6f03b3bfc..142919a7c 100644 --- a/src/App/Pages/Accounts/TwoFactorPageViewModel.cs +++ b/src/App/Pages/Accounts/TwoFactorPageViewModel.cs @@ -1,5 +1,6 @@ using Bit.App.Abstractions; using Bit.App.Resources; +using Bit.Core; using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; @@ -23,6 +24,7 @@ namespace Bit.App.Pages private readonly IEnvironmentService _environmentService; private readonly IMessagingService _messagingService; private readonly IBroadcasterService _broadcasterService; + private readonly IStateService _stateService; private bool _u2fSupported = false; private TwoFactorProviderType? _selectedProviderType; @@ -40,6 +42,7 @@ namespace Bit.App.Pages _environmentService = ServiceContainer.Resolve("environmentService"); _messagingService = ServiceContainer.Resolve("messagingService"); _broadcasterService = ServiceContainer.Resolve("broadcasterService"); + _stateService = ServiceContainer.Resolve("stateService"); PageTitle = AppResources.TwoStepLogin; SubmitCommand = new Command(async () => await SubmitAsync()); @@ -200,6 +203,8 @@ namespace Bit.App.Pages var task = Task.Run(() => _syncService.FullSyncAsync(true)); _messagingService.Send("listenYubiKeyOTP", false); _broadcasterService.Unsubscribe(nameof(TwoFactorPage)); + var disableFavicon = await _storageService.GetAsync(Constants.DisableFaviconKey); + await _stateService.SaveAsync(Constants.DisableFaviconKey, disableFavicon.GetValueOrDefault()); Application.Current.MainPage = new TabsPage(); } catch(ApiException e)