From 2062a284e34e820817ae19f65235287fbaaf4016 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 22 Jul 2019 08:37:06 -0400 Subject: [PATCH] fix lock checks on sleep of app --- src/App/App.xaml.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/App/App.xaml.cs b/src/App/App.xaml.cs index 35ea34849..8dff50671 100644 --- a/src/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -188,8 +188,12 @@ namespace Bit.App System.Diagnostics.Debug.WriteLine("XF App: OnSleep"); if(Device.RuntimePlatform == Device.Android) { - await _storageService.SaveAsync(Constants.LastActiveKey, DateTime.UtcNow); - SetTabsPageFromAutofill(); + var isLocked = await _lockService.IsLockedAsync(); + if(!isLocked) + { + await _storageService.SaveAsync(Constants.LastActiveKey, DateTime.UtcNow); + } + SetTabsPageFromAutofill(isLocked); await SleptAsync(); } } @@ -319,7 +323,7 @@ namespace Bit.App } } - private void SetTabsPageFromAutofill() + private void SetTabsPageFromAutofill(bool isLocked) { if(Device.RuntimePlatform == Device.Android && !string.IsNullOrWhiteSpace(_appOptions.Uri) && !_appOptions.FromAutofillFramework) @@ -328,8 +332,15 @@ namespace Bit.App { Device.BeginInvokeOnMainThread(() => { - Current.MainPage = new TabsPage(); _appOptions.Uri = null; + if(isLocked) + { + Current.MainPage = new NavigationPage(new LockPage()); + } + else + { + Current.MainPage = new TabsPage(); + } }); }); }