From 69f02eef8284c23692a7b8669348ddd9a0e873b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bispo?= Date: Fri, 4 Nov 2022 16:54:16 +0000 Subject: [PATCH] [SG-800] Selecting notification for inactive account on iOS while app is open does not display the request (#2166) * [SG-800] Remove await from ActionSheet If the user never answers the pop up, the lock is never released. * [SG-800] Add try catch --- src/App/App.xaml.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/App/App.xaml.cs b/src/App/App.xaml.cs index 5239a278c..979828212 100644 --- a/src/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -221,13 +221,20 @@ namespace Bit.App } var notificationUserEmail = await _stateService.GetEmailAsync(notification.UserId); - await Device.InvokeOnMainThreadAsync(async () => + Device.BeginInvokeOnMainThread(async () => { - var result = await _deviceActionService.DisplayAlertAsync(AppResources.LogInRequested, string.Format(AppResources.LoginAttemptFromXDoYouWantToSwitchToThisAccount, notificationUserEmail), AppResources.Cancel, AppResources.Ok); - if (result == AppResources.Ok) + try { - await _stateService.SetActiveUserAsync(notification.UserId); - _messagingService.Send(AccountsManagerMessageCommands.SWITCHED_ACCOUNT); + var result = await _deviceActionService.DisplayAlertAsync(AppResources.LogInRequested, string.Format(AppResources.LoginAttemptFromXDoYouWantToSwitchToThisAccount, notificationUserEmail), AppResources.Cancel, AppResources.Ok); + if (result == AppResources.Ok) + { + await _stateService.SetActiveUserAsync(notification.UserId); + _messagingService.Send(AccountsManagerMessageCommands.SWITCHED_ACCOUNT); + } + } + catch (Exception ex) + { + LoggerHelper.LogEvenIfCantBeResolved(ex); } }); return true;