From 8c6d395d8962bf23313ed6b159025becb073ec11 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 2 Feb 2017 23:05:24 -0500 Subject: [PATCH] remove uri extra after captured --- src/Android/MainActivity.cs | 5 +++++ src/App/App.cs | 13 +++++++++---- src/App/Pages/Vault/VaultAutofillListLoginsPage.cs | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Android/MainActivity.cs b/src/Android/MainActivity.cs index b4fac37e4..29f1fe651 100644 --- a/src/Android/MainActivity.cs +++ b/src/Android/MainActivity.cs @@ -29,6 +29,11 @@ namespace Bit.Android protected override void OnCreate(Bundle bundle) { var uri = Intent.GetStringExtra("uri"); + if(Intent.HasExtra("uri")) + { + Intent.RemoveExtra("uri"); + } + if(uri != null && !Resolver.IsSet) { MainApplication.SetIoc(Application); diff --git a/src/App/App.cs b/src/App/App.cs index 0d7cf2a99..79c2f67a9 100644 --- a/src/App/App.cs +++ b/src/App/App.cs @@ -95,7 +95,12 @@ namespace Bit.App MessagingCenter.Subscribe(Current, "SetMainPage", (sender) => { - _setMainPageCancellationTokenSource = SetMainPageFromAutofill(_setMainPageCancellationTokenSource); + _setMainPageCancellationTokenSource = SetMainPageFromAutofill(_setMainPageCancellationTokenSource, 1000); + }); + + MessagingCenter.Subscribe(Current, "SetMainPageNow", (sender) => + { + _setMainPageCancellationTokenSource = SetMainPageFromAutofill(_setMainPageCancellationTokenSource, 0); }); } @@ -114,7 +119,7 @@ namespace Bit.App // Handle when your app sleeps Debug.WriteLine("OnSleep"); - _setMainPageCancellationTokenSource = SetMainPageFromAutofill(_setMainPageCancellationTokenSource); + _setMainPageCancellationTokenSource = SetMainPageFromAutofill(_setMainPageCancellationTokenSource, 1000); if(Device.OS == TargetPlatform.Android && !TopPageIsLock()) { _settings.AddOrUpdateValue(Constants.LastActivityDate, DateTime.UtcNow); @@ -144,7 +149,7 @@ namespace Bit.App } } - private CancellationTokenSource SetMainPageFromAutofill(CancellationTokenSource previousCts) + private CancellationTokenSource SetMainPageFromAutofill(CancellationTokenSource previousCts, int delay) { if(Device.OS != TargetPlatform.Android) { @@ -160,7 +165,7 @@ namespace Bit.App var cts = new CancellationTokenSource(); Task.Run(async () => { - await Task.Delay(1000); + await Task.Delay(delay); if(cts.Token.IsCancellationRequested) { return; diff --git a/src/App/Pages/Vault/VaultAutofillListLoginsPage.cs b/src/App/Pages/Vault/VaultAutofillListLoginsPage.cs index b7238d9ea..295f4f57d 100644 --- a/src/App/Pages/Vault/VaultAutofillListLoginsPage.cs +++ b/src/App/Pages/Vault/VaultAutofillListLoginsPage.cs @@ -264,7 +264,7 @@ namespace Bit.App.Pages private void ClickedItem(object sender, EventArgs e) { - Application.Current.MainPage = new MainPage(); + MessagingCenter.Send(Application.Current, "SetMainPageNow"); } } }