mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 18:38:27 +03:00
set package and website independently
This commit is contained in:
parent
8847991bba
commit
4dd6df5bbe
1 changed files with 19 additions and 14 deletions
|
@ -17,6 +17,11 @@ namespace Bit.Android.Autofill
|
||||||
"com.amazon.cloud9","org.mozilla.klar", "com.duckduckgo.mobile.android"
|
"com.amazon.cloud9","org.mozilla.klar", "com.duckduckgo.mobile.android"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static HashSet<string> ExcludedPackageIds = new HashSet<string>
|
||||||
|
{
|
||||||
|
"android"
|
||||||
|
};
|
||||||
|
|
||||||
private readonly AssistStructure _structure;
|
private readonly AssistStructure _structure;
|
||||||
private string _uri;
|
private string _uri;
|
||||||
private string _packageName;
|
private string _packageName;
|
||||||
|
@ -96,28 +101,15 @@ namespace Bit.Android.Autofill
|
||||||
|
|
||||||
private void ParseNode(ViewNode node)
|
private void ParseNode(ViewNode node)
|
||||||
{
|
{
|
||||||
|
SetPackageAndDomain(node);
|
||||||
var hints = node.GetAutofillHints();
|
var hints = node.GetAutofillHints();
|
||||||
var isEditText = node.ClassName == "android.widget.EditText" || node?.HtmlInfo?.Tag == "input";
|
var isEditText = node.ClassName == "android.widget.EditText" || node?.HtmlInfo?.Tag == "input";
|
||||||
if(isEditText || (hints?.Length ?? 0) > 0)
|
if(isEditText || (hints?.Length ?? 0) > 0)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(PackageName))
|
|
||||||
{
|
|
||||||
PackageName = node.IdPackage;
|
|
||||||
}
|
|
||||||
if(string.IsNullOrWhiteSpace(WebDomain))
|
|
||||||
{
|
|
||||||
WebDomain = node.WebDomain;
|
|
||||||
}
|
|
||||||
|
|
||||||
FieldCollection.Add(new Field(node));
|
FieldCollection.Add(new Field(node));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(WebDomain))
|
|
||||||
{
|
|
||||||
WebDomain = node.WebDomain;
|
|
||||||
}
|
|
||||||
|
|
||||||
FieldCollection.IgnoreAutofillIds.Add(node.AutofillId);
|
FieldCollection.IgnoreAutofillIds.Add(node.AutofillId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,5 +118,18 @@ namespace Bit.Android.Autofill
|
||||||
ParseNode(node.GetChildAt(i));
|
ParseNode(node.GetChildAt(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetPackageAndDomain(ViewNode node)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(PackageName) && !string.IsNullOrWhiteSpace(node.IdPackage) &&
|
||||||
|
!ExcludedPackageIds.Contains(node.IdPackage))
|
||||||
|
{
|
||||||
|
PackageName = node.IdPackage;
|
||||||
|
}
|
||||||
|
if(string.IsNullOrWhiteSpace(WebDomain) && !string.IsNullOrWhiteSpace(node.WebDomain))
|
||||||
|
{
|
||||||
|
WebDomain = node.WebDomain;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue