mirror of
https://github.com/bitwarden/mobile.git
synced 2024-09-04 00:20:34 +02: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);
|
||||
if(passwordNodes.Any())
|
||||
if(passwordNodes.Count > 0)
|
||||
{
|
||||
var uri = GetUri(root);
|
||||
if(uri != null && !uri.Contains(BitwardenWebsite))
|
||||
|
@ -238,24 +238,28 @@ namespace Bit.Android
|
|||
editTextNode.PerformAction(global::Android.Views.Accessibility.Action.SetText, bundle);
|
||||
}
|
||||
|
||||
private IEnumerable<AccessibilityNodeInfo> GetWindowNodes(AccessibilityNodeInfo n,
|
||||
AccessibilityEvent e, Func<AccessibilityNodeInfo, bool> condition)
|
||||
private List<AccessibilityNodeInfo> GetWindowNodes(AccessibilityNodeInfo n,
|
||||
AccessibilityEvent e, Func<AccessibilityNodeInfo, bool> condition, List<AccessibilityNodeInfo> nodes = null)
|
||||
{
|
||||
if(nodes == null)
|
||||
{
|
||||
nodes = new List<AccessibilityNodeInfo>();
|
||||
}
|
||||
|
||||
if(n != null)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
foreach(var node in GetWindowNodes(n.GetChild(i), e, condition))
|
||||
{
|
||||
yield return node;
|
||||
}
|
||||
nodes.AddRange(GetWindowNodes(n.GetChild(i), e, condition, nodes));
|
||||
}
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
public class Browser
|
||||
|
|
Loading…
Reference in New Issue
Block a user