mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-07 09:20:04 +01:00
pass nodes as reference
This commit is contained in:
parent
17ed1cdc00
commit
079fb34120
@ -78,7 +78,7 @@ namespace Bit.Android
|
|||||||
}
|
}
|
||||||
|
|
||||||
var passwordNodes = GetWindowNodes(root, e, n => n.Password);
|
var passwordNodes = GetWindowNodes(root, e, n => n.Password);
|
||||||
if(passwordNodes.Any())
|
if(passwordNodes.Count > 0)
|
||||||
{
|
{
|
||||||
var uri = GetUri(root);
|
var uri = GetUri(root);
|
||||||
if(uri != null && !uri.Contains(BitwardenWebsite))
|
if(uri != null && !uri.Contains(BitwardenWebsite))
|
||||||
@ -238,24 +238,28 @@ namespace Bit.Android
|
|||||||
editTextNode.PerformAction(global::Android.Views.Accessibility.Action.SetText, bundle);
|
editTextNode.PerformAction(global::Android.Views.Accessibility.Action.SetText, bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<AccessibilityNodeInfo> GetWindowNodes(AccessibilityNodeInfo n,
|
private List<AccessibilityNodeInfo> GetWindowNodes(AccessibilityNodeInfo n,
|
||||||
AccessibilityEvent e, Func<AccessibilityNodeInfo, bool> condition)
|
AccessibilityEvent e, Func<AccessibilityNodeInfo, bool> condition, List<AccessibilityNodeInfo> nodes = null)
|
||||||
{
|
{
|
||||||
|
if(nodes == null)
|
||||||
|
{
|
||||||
|
nodes = new List<AccessibilityNodeInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
if(n != null)
|
if(n != null)
|
||||||
{
|
{
|
||||||
if(n.WindowId == e.WindowId && !(n.ViewIdResourceName?.StartsWith(SystemUiPackage) ?? false) && condition(n))
|
if(n.WindowId == e.WindowId && !(n.ViewIdResourceName?.StartsWith(SystemUiPackage) ?? false) && condition(n))
|
||||||
{
|
{
|
||||||
yield return n;
|
nodes.Add(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < n.ChildCount; i++)
|
for(int i = 0; i < n.ChildCount; i++)
|
||||||
{
|
{
|
||||||
foreach(var node in GetWindowNodes(n.GetChild(i), e, condition))
|
nodes.AddRange(GetWindowNodes(n.GetChild(i), e, condition, nodes));
|
||||||
{
|
|
||||||
yield return node;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Browser
|
public class Browser
|
||||||
|
Loading…
Reference in New Issue
Block a user