From d5c610b81964eadf0f6c960285e3e4c56d0e6164 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 6 Jun 2019 20:34:59 -0400 Subject: [PATCH] set generator page from tile if locked --- src/Android/MainActivity.cs | 8 ++++++++ src/App/App.xaml.cs | 6 ++++-- src/App/Pages/Accounts/LockPage.xaml.cs | 2 +- src/App/Pages/TabsPage.cs | 4 ++++ src/App/Pages/Vault/AddEditPage.xaml | 1 - src/App/Pages/Vault/CiphersPage.xaml.cs | 2 +- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Android/MainActivity.cs b/src/Android/MainActivity.cs index 3bc912f18..69def55ce 100644 --- a/src/Android/MainActivity.cs +++ b/src/Android/MainActivity.cs @@ -146,10 +146,18 @@ namespace Bit.Droid if(intent.GetBooleanExtra("generatorTile", false)) { _messagingService.Send("popAllAndGoToTabGenerator"); + if(_appOptions != null) + { + _appOptions.GeneratorTile = true; + } } if(intent.GetBooleanExtra("myVaultTile", false)) { _messagingService.Send("popAllAndGoToTabMyVault"); + if(_appOptions != null) + { + _appOptions.MyVaultTile = true; + } } else { diff --git a/src/App/App.xaml.cs b/src/App/App.xaml.cs index 43aab025f..285be41ea 100644 --- a/src/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -90,7 +90,7 @@ namespace Bit.App else if(message.Command == "locked") { await _stateService.PurgeAsync(); - var lockPage = new LockPage(null, !(message.Data as bool?).GetValueOrDefault()); + var lockPage = new LockPage(_appOptions, !(message.Data as bool?).GetValueOrDefault()); Device.BeginInvokeOnMainThread(() => Current.MainPage = new NavigationPage(lockPage)); } else if(message.Command == "lockVault") @@ -135,10 +135,12 @@ namespace Bit.App } if(message.Command == "popAllAndGoToTabMyVault") { + _appOptions.MyVaultTile = false; tabsPage.ResetToVaultPage(); } else { + _appOptions.GeneratorTile = false; tabsPage.ResetToGeneratorPage(); } } @@ -170,8 +172,8 @@ namespace Bit.App { await _storageService.SaveAsync(Constants.LastActiveKey, DateTime.UtcNow); } - await HandleLockingAsync(); SetTabsPageFromAutofill(); + await HandleLockingAsync(); } protected async override void OnResume() diff --git a/src/App/Pages/Accounts/LockPage.xaml.cs b/src/App/Pages/Accounts/LockPage.xaml.cs index f8a7c2aa5..b6d90e2e6 100644 --- a/src/App/Pages/Accounts/LockPage.xaml.cs +++ b/src/App/Pages/Accounts/LockPage.xaml.cs @@ -36,7 +36,7 @@ namespace Bit.App.Pages return; } } - Application.Current.MainPage = new TabsPage(); + Application.Current.MainPage = new TabsPage(_appOptions); }; MasterPasswordEntry = _masterPassword; PinEntry = _pin; diff --git a/src/App/Pages/TabsPage.cs b/src/App/Pages/TabsPage.cs index d0f07c999..96577539b 100644 --- a/src/App/Pages/TabsPage.cs +++ b/src/App/Pages/TabsPage.cs @@ -54,6 +54,10 @@ namespace Bit.App.Pages appOptions.GeneratorTile = false; ResetToGeneratorPage(); } + else if(appOptions?.MyVaultTile ?? false) + { + appOptions.MyVaultTile = false; + } } public void ResetToVaultPage() diff --git a/src/App/Pages/Vault/AddEditPage.xaml b/src/App/Pages/Vault/AddEditPage.xaml index 527fca1ac..a0c9977d5 100644 --- a/src/App/Pages/Vault/AddEditPage.xaml +++ b/src/App/Pages/Vault/AddEditPage.xaml @@ -483,7 +483,6 @@ diff --git a/src/App/Pages/Vault/CiphersPage.xaml.cs b/src/App/Pages/Vault/CiphersPage.xaml.cs index e742ddd34..14f0eb61e 100644 --- a/src/App/Pages/Vault/CiphersPage.xaml.cs +++ b/src/App/Pages/Vault/CiphersPage.xaml.cs @@ -63,7 +63,7 @@ namespace Bit.App.Pages { return; } - _vm.Search(e.NewTextValue, 1000); + _vm.Search(e.NewTextValue, 300); } private void SearchBar_SearchButtonPressed(object sender, EventArgs e)