mirror of
https://github.com/bitwarden/mobile
synced 2025-12-20 10:13:42 +00:00
[SG-813] Not You? crashes app after vault logout timeout (#2184)
* Merge branch 'master' into feature/SG-174-login-with-device * [SG-813] Fix merge * [SG-813] rename HomePage parameter name * [SG-813] Added NavParams for home page on account switching. * [SG-813] Remove account showing when adding new account. * [SG-813] Add account switch pop up if email already exists * [SG-813] Add default account avatar to HomePage * [SG-813] Code format * [SG-813] Remove unused import * [SG-813] Renamed checkNavigateLogin to shouldCheckRememberEmail * [SG-813] Move prompt account switch to account manager service * [SG-813] Remove Account button appears if email is the same as the ActiveUser * [SG-813] Fix code duplicate * [SG-813] Fix for android RemoveAccount button * [SG-813] Code format
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Controls;
|
||||
using Bit.App.Resources;
|
||||
using Bit.App.Utilities;
|
||||
@@ -24,13 +25,17 @@ namespace Bit.App.Pages
|
||||
private bool _canLogin;
|
||||
private IPlatformUtilsService _platformUtilsService;
|
||||
private ILogger _logger;
|
||||
private IEnvironmentService _environmentService;
|
||||
private IAccountsManager _accountManager;
|
||||
|
||||
public HomeViewModel()
|
||||
{
|
||||
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
|
||||
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
|
||||
_stateService = ServiceContainer.Resolve<IStateService>();
|
||||
_messagingService = ServiceContainer.Resolve<IMessagingService>();
|
||||
_platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>();
|
||||
_logger = ServiceContainer.Resolve<ILogger>("logger");
|
||||
_logger = ServiceContainer.Resolve<ILogger>();
|
||||
_environmentService = ServiceContainer.Resolve<IEnvironmentService>();
|
||||
_accountManager = ServiceContainer.Resolve<IAccountsManager>();
|
||||
|
||||
PageTitle = AppResources.Bitwarden;
|
||||
|
||||
@@ -68,7 +73,7 @@ namespace Bit.App.Pages
|
||||
|
||||
public bool CanContinue => !string.IsNullOrEmpty(Email);
|
||||
|
||||
public bool CheckHasRememberedEmail { get; set; }
|
||||
public bool ShouldCheckRememberEmail { get; set; }
|
||||
|
||||
public FormattedString CreateAccountText
|
||||
{
|
||||
@@ -107,11 +112,11 @@ namespace Bit.App.Pages
|
||||
|
||||
public void CheckNavigateLoginStep()
|
||||
{
|
||||
if (CheckHasRememberedEmail && RememberEmail)
|
||||
if (ShouldCheckRememberEmail && RememberEmail)
|
||||
{
|
||||
StartLoginAction();
|
||||
}
|
||||
CheckHasRememberedEmail = false;
|
||||
ShouldCheckRememberEmail = false;
|
||||
}
|
||||
|
||||
public async Task ContinueToLoginStepAsync()
|
||||
@@ -132,6 +137,16 @@ namespace Bit.App.Pages
|
||||
return;
|
||||
}
|
||||
await _stateService.SetRememberedEmailAsync(RememberEmail ? Email : null);
|
||||
var userId = await _stateService.GetUserIdAsync(Email);
|
||||
if (!string.IsNullOrWhiteSpace(userId))
|
||||
{
|
||||
var userEnvUrls = await _stateService.GetEnvironmentUrlsAsync(userId);
|
||||
if (userEnvUrls?.Base == _environmentService.BaseUrl)
|
||||
{
|
||||
await _accountManager.PromptToSwitchToExistingAccountAsync(userId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
StartLoginAction();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user