1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-09-30 04:17:55 +02:00

Make callbacks from UI thread. (#739)

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 <oldium.pro@gmail.com>
This commit is contained in:
Oldřich Jedlička 2020-02-24 14:57:36 +01:00 committed by GitHub
parent d8e19415e3
commit c2f2a5e52f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,10 +138,10 @@ namespace Bit.App.Pages
var host = WebUtility.UrlEncode(providerData["Host"] as string); var host = WebUtility.UrlEncode(providerData["Host"] as string);
var req = WebUtility.UrlEncode(providerData["Signature"] as string); var req = WebUtility.UrlEncode(providerData["Signature"] as string);
page.DuoWebView.Uri = $"{_webVaultUrl}/duo-connector.html?host={host}&request={req}"; page.DuoWebView.Uri = $"{_webVaultUrl}/duo-connector.html?host={host}&request={req}";
page.DuoWebView.RegisterAction(async sig => page.DuoWebView.RegisterAction(sig =>
{ {
Token = sig; Token = sig;
await SubmitAsync(); Device.BeginInvokeOnMainThread(async() => await SubmitAsync());
}); });
break; break;
case TwoFactorProviderType.Email: case TwoFactorProviderType.Email:
@ -208,7 +208,7 @@ namespace Bit.App.Pages
_broadcasterService.Unsubscribe(nameof(TwoFactorPage)); _broadcasterService.Unsubscribe(nameof(TwoFactorPage));
var disableFavicon = await _storageService.GetAsync<bool?>(Constants.DisableFaviconKey); var disableFavicon = await _storageService.GetAsync<bool?>(Constants.DisableFaviconKey);
await _stateService.SaveAsync(Constants.DisableFaviconKey, disableFavicon.GetValueOrDefault()); await _stateService.SaveAsync(Constants.DisableFaviconKey, disableFavicon.GetValueOrDefault());
Device.BeginInvokeOnMainThread(() => { Application.Current.MainPage = new TabsPage(); }); Application.Current.MainPage = new TabsPage();
} }
catch(ApiException e) catch(ApiException e)
{ {