remove uri extra after captured

This commit is contained in:
Kyle Spearrin 2017-02-02 23:05:24 -05:00
parent f66b26a866
commit 8c6d395d89
3 changed files with 15 additions and 5 deletions

View file

@ -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);

View file

@ -95,7 +95,12 @@ namespace Bit.App
MessagingCenter.Subscribe<Application>(Current, "SetMainPage", (sender) =>
{
_setMainPageCancellationTokenSource = SetMainPageFromAutofill(_setMainPageCancellationTokenSource);
_setMainPageCancellationTokenSource = SetMainPageFromAutofill(_setMainPageCancellationTokenSource, 1000);
});
MessagingCenter.Subscribe<Application>(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;

View file

@ -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");
}
}
}