wrap adding fields and hints to dictionary, avoiding to add a duplicate key. Should close #2262 (but I can't reproduce)
This commit is contained in:
@@ -838,7 +838,7 @@ namespace Kp2aAutofillParser
|
||||
continue;
|
||||
if (viewHints.Select(AutofillHintsHelper.ToCanonicalHint).Intersect(_autofillHintsForLogin).Any())
|
||||
{
|
||||
FieldsMappedToHints.Add(viewNode, viewHints.Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet().ToArray());
|
||||
AddFieldToHintMap(viewNode, viewHints.Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet().ToArray());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -873,9 +873,9 @@ namespace Kp2aAutofillParser
|
||||
if (passwordFields.Concat(usernameFields).Any(f => f.IsFocused))
|
||||
{
|
||||
foreach (var uf in usernameFields)
|
||||
FieldsMappedToHints.Add(uf, new string[] { AutofillHintsHelper.AutofillHintUsername });
|
||||
AddFieldToHintMap(uf, new string[] { AutofillHintsHelper.AutofillHintUsername });
|
||||
foreach (var pf in passwordFields.Except(usernameFields))
|
||||
FieldsMappedToHints.Add(pf, new string[] { AutofillHintsHelper.AutofillHintPassword });
|
||||
AddFieldToHintMap(pf, new string[] { AutofillHintsHelper.AutofillHintPassword });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -895,6 +895,18 @@ namespace Kp2aAutofillParser
|
||||
return result;
|
||||
}
|
||||
|
||||
private void AddFieldToHintMap(FieldT field, string[] hints)
|
||||
{
|
||||
if (FieldsMappedToHints.ContainsKey(field))
|
||||
{
|
||||
FieldsMappedToHints[field] = FieldsMappedToHints[field].Concat(hints).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
FieldsMappedToHints[field] = hints;
|
||||
}
|
||||
}
|
||||
|
||||
public bool LogAutofillView { get; set; }
|
||||
|
||||
private bool IsEditText(FieldT f)
|
||||
|
Reference in New Issue
Block a user