Skip to content

Commit

Permalink
let webview handle same page links
Browse files Browse the repository at this point in the history
  • Loading branch information
itkach committed Feb 3, 2022
1 parent dda32f2 commit a2abd60
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/itkach/aard2/ArticleWebView.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,19 @@ public boolean shouldOverrideUrlLoading(WebView view,
return true;
}

String fragment = uri.getFragment();
if (fragment != null ) {
Uri current = Uri.parse(view.getUrl());
Log.d(TAG, "shouldOverrideUrlLoading URL with fragment: " + url);
if (scheme.equals(current.getScheme()) &&
host.equals(current.getHost()) &&
uri.getPort() == current.getPort() &&
uri.getPath().equals(current.getPath())) {
Log.d(TAG, "NOT overriding loading of same page link " + url);
return false;
}
}

if (scheme.equals("http") && host.equals(LOCALHOST) && uri.getQueryParameter("blob") == null) {
Intent intent = new Intent(getContext(), ArticleCollectionActivity.class);
intent.setData(uri);
Expand Down

0 comments on commit a2abd60

Please sign in to comment.