Support for multiple browser UriViewIds when extracting a uri (#713)

* Support for multiple browser UriViewIds when extracting a uri

* Simplified
This commit is contained in:
Matt Portune 2020-01-29 12:59:17 -05:00 committed by GitHub
parent 4b9cff2271
commit 179514ddf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,7 +40,7 @@ namespace Bit.Droid.Accessibility
new Browser("org.iron.srware", "url_bar"), new Browser("org.iron.srware", "url_bar"),
new Browser("com.sec.android.app.sbrowser", "location_bar_edit_text"), new Browser("com.sec.android.app.sbrowser", "location_bar_edit_text"),
new Browser("com.sec.android.app.sbrowser.beta", "location_bar_edit_text"), new Browser("com.sec.android.app.sbrowser.beta", "location_bar_edit_text"),
new Browser("com.yandex.browser", "bro_omnibar_address_title_text", new Browser("com.yandex.browser", "bro_omnibar_address_title_text,bro_omnibox_collapsed_title",
(s) => s.Split(new char[]{' ', ' '}).FirstOrDefault()), // 0 = Regular Space, 1 = No-break space (00A0) (s) => s.Split(new char[]{' ', ' '}).FirstOrDefault()), // 0 = Regular Space, 1 = No-break space (00A0)
new Browser("org.mozilla.firefox", "url_bar_title"), new Browser("org.mozilla.firefox", "url_bar_title"),
new Browser("org.mozilla.firefox_beta", "url_bar_title"), new Browser("org.mozilla.firefox_beta", "url_bar_title"),
@ -115,8 +115,17 @@ namespace Bit.Droid.Accessibility
if(SupportedBrowsers.ContainsKey(root.PackageName)) if(SupportedBrowsers.ContainsKey(root.PackageName))
{ {
var browser = SupportedBrowsers[root.PackageName]; var browser = SupportedBrowsers[root.PackageName];
var addressNode = root.FindAccessibilityNodeInfosByViewId( AccessibilityNodeInfo addressNode = null;
$"{root.PackageName}:id/{browser.UriViewId}").FirstOrDefault(); foreach(var uriViewId in browser.UriViewId.Split(","))
{
addressNode = root.FindAccessibilityNodeInfosByViewId(
$"{root.PackageName}:id/{uriViewId}").FirstOrDefault();
if(addressNode != null)
{
break;
}
}
if(addressNode != null) if(addressNode != null)
{ {
uri = ExtractUri(uri, addressNode, browser); uri = ExtractUri(uri, addressNode, browser);