added back FromAutofillService functionality

This commit is contained in:
Kyle Spearrin 2017-02-03 23:21:40 -05:00
parent 31b2eeb293
commit 46bb8d2cb5
3 changed files with 19 additions and 3 deletions

View File

@ -52,6 +52,8 @@ namespace Bit.Android
public override void OnAccessibilityEvent(AccessibilityEvent e)
{
Enabled = true;
var eventType = e.EventType;
var packageName = e.PackageName;

View File

@ -98,6 +98,7 @@ namespace Bit.Android
private void ReturnCredentials(VaultListPageModel.Login login)
{
App.App.FromAutofillService = true;
Intent data = new Intent();
if(login == null)
{
@ -154,8 +155,12 @@ namespace Bit.Android
protected override void OnResume()
{
Console.WriteLine("A OnResume");
base.OnResume();
Console.WriteLine("A OnResume");
// workaround for app compat bug
// ref https://bugzilla.xamarin.com/show_bug.cgi?id=36907
Task.Delay(10).Wait();
}
public void RateApp()

View File

@ -33,6 +33,8 @@ namespace Bit.App
private readonly ILocalizeService _localizeService;
private CancellationTokenSource _setMainPageCancellationTokenSource = null;
public static bool FromAutofillService { get; set; } = false;
public App(
string uri,
IAuthService authService,
@ -61,6 +63,7 @@ namespace Bit.App
SetCulture();
SetStyles();
FromAutofillService = !string.IsNullOrWhiteSpace(_uri);
if(authService.IsAuthenticated && _uri != null)
{
MainPage = new ExtendedNavigationPage(new VaultAutofillListLoginsPage(_uri));
@ -111,11 +114,12 @@ namespace Bit.App
Debug.WriteLine("OnStart");
}
protected async override void OnSleep()
protected override void OnSleep()
{
// Handle when your app sleeps
Debug.WriteLine("OnSleep");
_setMainPageCancellationTokenSource = SetMainPageFromAutofill(_setMainPageCancellationTokenSource, 500);
if(Device.OS == TargetPlatform.Android && !TopPageIsLock())
{
_settings.AddOrUpdateValue(Constants.LastActivityDate, DateTime.UtcNow);
@ -153,6 +157,10 @@ namespace Bit.App
}
previousCts?.Cancel();
if(!FromAutofillService || string.IsNullOrWhiteSpace(_uri))
{
return null;
}
var cts = new CancellationTokenSource();
Task.Run(async () =>
@ -169,6 +177,7 @@ namespace Bit.App
});
_uri = null;
FromAutofillService = false;
}, cts.Token);
return cts;