Skip to content

Commit 1b0dd18

Browse files
committed
Enable links in internal browser on self-hosted sites
1 parent 6951689 commit 1b0dd18

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

WordPress/src/main/java/org/wordpress/android/ui/ActivityLauncher.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ public static void viewCurrentSite(Context context, SiteModel site, boolean open
467467
WPWebViewActivity.openUrlByUsingGlobalWPCOMCredentials(context, siteUrl);
468468
} else if (!TextUtils.isEmpty(site.getUsername()) && !TextUtils.isEmpty(site.getPassword())) {
469469
// Show self-hosted sites as authenticated since we should have the username & password
470-
WPWebViewActivity.openUrlByUsingBlogCredentials(context, site, null, siteUrl, new String[]{siteUrl});
470+
WPWebViewActivity.openUrlByUsingBlogCredentials(context, site, null, siteUrl, new String[]{}, false);
471471
} else {
472472
// Show non-wp.com sites without a password unauthenticated. These would be Jetpack sites that are
473473
// connected through REST API.
@@ -585,7 +585,8 @@ public static void browsePostOrPage(Context context, SiteModel site, PostModel p
585585
// from the passed URL, and internally redirects to it. EX:Published posts on a site with Plain
586586
// permalink structure settings.
587587
// Ref: https://github.com/wordpress-mobile/WordPress-Android/issues/4873
588-
WPWebViewActivity.openUrlByUsingBlogCredentials(context, site, post, url, new String[]{post.getLink()});
588+
WPWebViewActivity
589+
.openUrlByUsingBlogCredentials(context, site, post, url, new String[]{post.getLink()}, true);
589590
}
590591
}
591592

WordPress/src/main/java/org/wordpress/android/ui/WPWebViewActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public static void openJetpackBlogPostPreview(Context context, String url, Strin
196196

197197
// Note: The webview has links disabled (excepted for urls in the whitelist: listOfAllowedURLs)
198198
public static void openUrlByUsingBlogCredentials(Context context, SiteModel site, PostModel post, String url,
199-
String[] listOfAllowedURLs) {
199+
String[] listOfAllowedURLs, boolean disableLinks) {
200200
if (context == null) {
201201
AppLog.e(AppLog.T.UTILS, "Context is null");
202202
return;
@@ -220,7 +220,7 @@ public static void openUrlByUsingBlogCredentials(Context context, SiteModel site
220220
intent.putExtra(WPWebViewActivity.URL_TO_LOAD, url);
221221
intent.putExtra(WPWebViewActivity.AUTHENTICATION_URL, authURL);
222222
intent.putExtra(WPWebViewActivity.LOCAL_BLOG_ID, site.getId());
223-
intent.putExtra(WPWebViewActivity.DISABLE_LINKS_ON_PAGE, true);
223+
intent.putExtra(WPWebViewActivity.DISABLE_LINKS_ON_PAGE, disableLinks);
224224
intent.putExtra(ALLOWED_URLS, listOfAllowedURLs);
225225
if (post != null) {
226226
intent.putExtra(WPWebViewActivity.SHAREABLE_URL, post.getLink());

0 commit comments

Comments
 (0)