mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
on demand password node scans for autofill
This commit is contained in:
parent
0e28b1ffe1
commit
6215a7d65e
2 changed files with 32 additions and 1 deletions
|
@ -82,6 +82,36 @@ namespace Bit.Android
|
||||||
break;
|
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);
|
var passwordNodes = GetWindowNodes(root, e, n => n.Password, false);
|
||||||
if(passwordNodes.Count > 0)
|
if(passwordNodes.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -108,6 +138,8 @@ namespace Bit.Android
|
||||||
}
|
}
|
||||||
|
|
||||||
passwordNodes.Dispose();
|
passwordNodes.Dispose();
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
if(cancelNotification)
|
if(cancelNotification)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace Bit.Android.Services
|
||||||
private readonly GoogleAnalytics _instance;
|
private readonly GoogleAnalytics _instance;
|
||||||
private readonly IAuthService _authService;
|
private readonly IAuthService _authService;
|
||||||
private readonly Tracker _tracker;
|
private readonly Tracker _tracker;
|
||||||
private bool _setUserId = true;
|
|
||||||
|
|
||||||
public GoogleAnalyticsService(
|
public GoogleAnalyticsService(
|
||||||
Context appContext,
|
Context appContext,
|
||||||
|
|
Loading…
Reference in a new issue