on demand password node scans for autofill

This commit is contained in:
Kyle Spearrin 2017-05-25 23:16:48 -04:00
parent 0e28b1ffe1
commit 6215a7d65e
2 changed files with 32 additions and 1 deletions

View file

@ -82,6 +82,36 @@ namespace Bit.Android
break;
}
var uri = GetUri(root);
if(uri != null && !uri.Contains(BitwardenWebsite))
{
var needToFill = NeedToAutofill(AutofillActivity.LastCredentials, uri);
if(needToFill)
{
var passwordNodes = GetWindowNodes(root, e, n => n.Password, false);
needToFill = passwordNodes.Any();
if(needToFill)
{
var allEditTexts = GetWindowNodes(root, e, n => EditText(n), false);
var usernameEditText = allEditTexts.TakeWhile(n => !n.Password).LastOrDefault();
FillCredentials(usernameEditText, passwordNodes);
allEditTexts.Dispose();
usernameEditText.Dispose();
passwordNodes.Dispose();
}
}
if(!needToFill)
{
NotifyToAutofill(uri, notificationManager);
cancelNotification = false;
}
}
AutofillActivity.LastCredentials = null;
/*
var passwordNodes = GetWindowNodes(root, e, n => n.Password, false);
if(passwordNodes.Count > 0)
{
@ -108,6 +138,8 @@ namespace Bit.Android
}
passwordNodes.Dispose();
*/
if(cancelNotification)
{

View file

@ -12,7 +12,6 @@ namespace Bit.Android.Services
private readonly GoogleAnalytics _instance;
private readonly IAuthService _authService;
private readonly Tracker _tracker;
private bool _setUserId = true;
public GoogleAnalyticsService(
Context appContext,