From 5f6a3f4cb5908cc38c06220b23e3444a6d79af51 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 16 May 2019 08:41:57 -0400 Subject: [PATCH] lock page fixes --- src/App/Pages/Accounts/LockPage.xaml.cs | 12 ++++++++++-- src/App/Pages/Accounts/LockPageViewModel.cs | 1 + src/App/Resources/AppResources.Designer.cs | 9 +++++++++ src/App/Resources/AppResources.resx | 3 +++ src/Core/Services/CryptoService.cs | 6 +++--- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/App/Pages/Accounts/LockPage.xaml.cs b/src/App/Pages/Accounts/LockPage.xaml.cs index bacab30d8..bf605b36c 100644 --- a/src/App/Pages/Accounts/LockPage.xaml.cs +++ b/src/App/Pages/Accounts/LockPage.xaml.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using Xamarin.Forms; namespace Bit.App.Pages @@ -33,11 +34,18 @@ namespace Bit.App.Pages } } - private async void Unlock_Clicked(object sender, EventArgs e) + private void Unlock_Clicked(object sender, EventArgs e) { if(DoOnce()) { - await _vm.SubmitAsync(); + var tasks = Task.Run(async () => + { + await Task.Delay(50); + Device.BeginInvokeOnMainThread(async () => + { + await _vm.SubmitAsync(); + }); + }); } } diff --git a/src/App/Pages/Accounts/LockPageViewModel.cs b/src/App/Pages/Accounts/LockPageViewModel.cs index b9d60ee25..c760b66bf 100644 --- a/src/App/Pages/Accounts/LockPageViewModel.cs +++ b/src/App/Pages/Accounts/LockPageViewModel.cs @@ -169,6 +169,7 @@ namespace Bit.App.Pages private async Task SetKeyAndContinueAsync(SymmetricCryptoKey key) { await _cryptoService.SetKeyAsync(key); + DoContinue(); } private void DoContinue() diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index 1c77242c8..81cc7812e 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -3498,6 +3498,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Unlock. + /// + public static string Unlock { + get { + return ResourceManager.GetString("Unlock", resourceCulture); + } + } + /// /// Looks up a localized string similar to Unlock with {0}. /// diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 488441cfb..7f8c4b0a8 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -1487,4 +1487,7 @@ PIN + + Unlock + \ No newline at end of file diff --git a/src/Core/Services/CryptoService.cs b/src/Core/Services/CryptoService.cs index 29576c3e1..6b889a84f 100644 --- a/src/Core/Services/CryptoService.cs +++ b/src/Core/Services/CryptoService.cs @@ -99,7 +99,7 @@ namespace Bit.Core.Services { _key = new SymmetricCryptoKey(Convert.FromBase64String(key)); } - return key == null ? null : _key; + return _key; } public async Task GetKeyHashAsync() @@ -108,12 +108,12 @@ namespace Bit.Core.Services { return _keyHash; } - var keyHash = await _secureStorageService.GetAsync(Keys_KeyHash); + var keyHash = await _storageService.GetAsync(Keys_KeyHash); if(keyHash != null) { _keyHash = keyHash; } - return keyHash == null ? null : _keyHash; + return _keyHash; } public Task GetEncKeyAsync()