jenkins-bot has submitted this change and it was merged.

Change subject: Fix long-pressing of links inside the WebView.
......................................................................


Fix long-pressing of links inside the WebView.

I've noticed that long-pressing links was no longer working. This is
because we've recently made a change that updates the base URL of the
WebView dynamically, but then our long-press handler was expecting link
URIs to have an authority that exactly matches "wikipedia.org", which
would fail for language-specific domains, e.g. "en.wikipedia.org".

This patch fixes the URI checking logic, and thus fixes the long-press
handler.

Change-Id: I48b0add7bcaf21ad4e4db705d5823502205c2eb5
---
M app/src/main/java/org/wikipedia/util/UriUtil.java
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  BearND: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/app/src/main/java/org/wikipedia/util/UriUtil.java 
b/app/src/main/java/org/wikipedia/util/UriUtil.java
index 0c4e38d..4157026 100644
--- a/app/src/main/java/org/wikipedia/util/UriUtil.java
+++ b/app/src/main/java/org/wikipedia/util/UriUtil.java
@@ -69,8 +69,10 @@
                 : url);
     }
 
-    public static boolean isValidPageLink(Uri uri) {
-        return ("wikipedia.org".equals(uri.getAuthority()) && 
!TextUtils.isEmpty(uri.getPath())
+    public static boolean isValidPageLink(@NonNull Uri uri) {
+        return (!TextUtils.isEmpty(uri.getAuthority())
+                && uri.getAuthority().endsWith("wikipedia.org")
+                && !TextUtils.isEmpty(uri.getPath())
                 && uri.getPath().startsWith("/wiki"));
     }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/304233
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I48b0add7bcaf21ad4e4db705d5823502205c2eb5
Gerrit-PatchSet: 2
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: BearND <bsitzm...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org>
Gerrit-Reviewer: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to