Skip to content

Commit

Permalink
fix: external links (e.g. pdfs) are not opened by their app
Browse files Browse the repository at this point in the history
  • Loading branch information
axxie committed Jul 12, 2024
1 parent e53ef9c commit b3b0d4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0.1"
versionName "1.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ public boolean shouldOverrideUrlLoading(WebView view, String url)
{
if (url != null && (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("content://com.axxie.fileprovider"))) {
// TODO: propose download for unhandled files (e.g. bash scripts) (images should be opened ok)
view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
view.getContext().startActivity(intent);
return true;
} else {
return false;
Expand Down

0 comments on commit b3b0d4b

Please sign in to comment.