From c2f2a5e52fced842b2ab9ad83f3d62ec23de3921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Old=C5=99ich=20Jedli=C4=8Dka?= Date: Mon, 24 Feb 2020 14:57:36 +0100 Subject: [PATCH] Make callbacks from UI thread. (#739) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code expects to be called form UI thread, but it loks like JavaScript callbacks are not. Switch to UI thread when invoking a callback. Signed-off-by: Oldřich Jedlička --- src/App/Pages/Accounts/TwoFactorPageViewModel.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/App/Pages/Accounts/TwoFactorPageViewModel.cs b/src/App/Pages/Accounts/TwoFactorPageViewModel.cs index e1d7affa1..cd1e4615f 100644 --- a/src/App/Pages/Accounts/TwoFactorPageViewModel.cs +++ b/src/App/Pages/Accounts/TwoFactorPageViewModel.cs @@ -138,10 +138,10 @@ namespace Bit.App.Pages var host = WebUtility.UrlEncode(providerData["Host"] as string); var req = WebUtility.UrlEncode(providerData["Signature"] as string); page.DuoWebView.Uri = $"{_webVaultUrl}/duo-connector.html?host={host}&request={req}"; - page.DuoWebView.RegisterAction(async sig => + page.DuoWebView.RegisterAction(sig => { Token = sig; - await SubmitAsync(); + Device.BeginInvokeOnMainThread(async() => await SubmitAsync()); }); break; case TwoFactorProviderType.Email: @@ -208,7 +208,7 @@ namespace Bit.App.Pages _broadcasterService.Unsubscribe(nameof(TwoFactorPage)); var disableFavicon = await _storageService.GetAsync(Constants.DisableFaviconKey); await _stateService.SaveAsync(Constants.DisableFaviconKey, disableFavicon.GetValueOrDefault()); - Device.BeginInvokeOnMainThread(() => { Application.Current.MainPage = new TabsPage(); }); + Application.Current.MainPage = new TabsPage(); } catch(ApiException e) {