[SG-691] Login request is not displayed after changing accounts (#2111)

* [SG-691] Added new message to be broadcasted when account is switched to trigger a check for login requests.

* [SG-691] PR fixes
This commit is contained in:
André Bispo 2022-10-03 17:11:38 +01:00 committed by GitHub
parent a890ee6612
commit bc949fe87a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 6 deletions

View file

@ -72,8 +72,9 @@ namespace Bit.Droid
ServiceContainer.Resolve<IStateService>("stateService"), ServiceContainer.Resolve<IStateService>("stateService"),
ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService"), ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService"),
ServiceContainer.Resolve<IAuthService>("authService"), ServiceContainer.Resolve<IAuthService>("authService"),
ServiceContainer.Resolve<ILogger>("logger")); ServiceContainer.Resolve<ILogger>("logger"),
ServiceContainer.Register<IAccountsManager>("accountsManager", accountsManager); ServiceContainer.Resolve<IMessagingService>("messagingService"));
ServiceContainer.Register<IAccountsManager>("accountsManager", accountsManager);
} }
#if !FDROID #if !FDROID
if (Build.VERSION.SdkInt <= BuildVersionCodes.Kitkat) if (Build.VERSION.SdkInt <= BuildVersionCodes.Kitkat)

View file

@ -140,7 +140,7 @@ namespace Bit.App
new NavigationPage(new RemoveMasterPasswordPage())); new NavigationPage(new RemoveMasterPasswordPage()));
}); });
} }
else if (message.Command == "passwordlessLoginRequest" || message.Command == "unlocked") else if (message.Command == "passwordlessLoginRequest" || message.Command == "unlocked" || message.Command == AccountsManagerMessageCommands.ACCOUNT_SWITCH_COMPLETED)
{ {
CheckPasswordlessLoginRequestsAsync().FireAndForget(); CheckPasswordlessLoginRequestsAsync().FireAndForget();
} }

View file

@ -20,7 +20,7 @@ namespace Bit.App.Utilities.AccountManagement
private readonly IPlatformUtilsService _platformUtilsService; private readonly IPlatformUtilsService _platformUtilsService;
private readonly IAuthService _authService; private readonly IAuthService _authService;
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IMessagingService _messagingService;
Func<AppOptions> _getOptionsFunc; Func<AppOptions> _getOptionsFunc;
private IAccountsManagerHost _accountsManagerHost; private IAccountsManagerHost _accountsManagerHost;
@ -30,7 +30,8 @@ namespace Bit.App.Utilities.AccountManagement
IStateService stateService, IStateService stateService,
IPlatformUtilsService platformUtilsService, IPlatformUtilsService platformUtilsService,
IAuthService authService, IAuthService authService,
ILogger logger) ILogger logger,
IMessagingService messagingService)
{ {
_broadcasterService = broadcasterService; _broadcasterService = broadcasterService;
_vaultTimeoutService = vaultTimeoutService; _vaultTimeoutService = vaultTimeoutService;
@ -39,6 +40,7 @@ namespace Bit.App.Utilities.AccountManagement
_platformUtilsService = platformUtilsService; _platformUtilsService = platformUtilsService;
_authService = authService; _authService = authService;
_logger = logger; _logger = logger;
_messagingService = messagingService;
} }
private AppOptions Options => _getOptionsFunc?.Invoke() ?? new AppOptions { IosExtension = true }; private AppOptions Options => _getOptionsFunc?.Invoke() ?? new AppOptions { IosExtension = true };
@ -213,6 +215,7 @@ namespace Bit.App.Utilities.AccountManagement
} }
await Task.Delay(50); await Task.Delay(50);
await _accountsManagerHost.UpdateThemeAsync(); await _accountsManagerHost.UpdateThemeAsync();
_messagingService.Send(AccountsManagerMessageCommands.ACCOUNT_SWITCH_COMPLETED);
}); });
} }
} }

View file

@ -9,5 +9,6 @@
public const string ADD_ACCOUNT = "addAccount"; public const string ADD_ACCOUNT = "addAccount";
public const string ACCOUNT_ADDED = "accountAdded"; public const string ACCOUNT_ADDED = "accountAdded";
public const string SWITCHED_ACCOUNT = "switchedAccount"; public const string SWITCHED_ACCOUNT = "switchedAccount";
public const string ACCOUNT_SWITCH_COMPLETED = "accountSwitchCompleted";
} }
} }

View file

@ -222,7 +222,8 @@ namespace Bit.iOS.Core.Utilities
ServiceContainer.Resolve<IStateService>("stateService"), ServiceContainer.Resolve<IStateService>("stateService"),
ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService"), ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService"),
ServiceContainer.Resolve<IAuthService>("authService"), ServiceContainer.Resolve<IAuthService>("authService"),
ServiceContainer.Resolve<ILogger>("logger")); ServiceContainer.Resolve<ILogger>("logger"),
ServiceContainer.Resolve<IMessagingService>("messagingService"));
ServiceContainer.Register<IAccountsManager>("accountsManager", accountsManager); ServiceContainer.Register<IAccountsManager>("accountsManager", accountsManager);
if (postBootstrapFunc != null) if (postBootstrapFunc != null)