Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,13 @@ internal class AppUriHandler(
}
}
} catch (_: Throwable) {
showToast(getString(R.string.open_link_something_wrong))
startActivity(intent)
val fallbackIntent = intent.setPackage(null)
if (fallbackIntent.resolveActivity(packageManager) != null) {
showToast(getString(R.string.open_link_something_wrong))
startActivity(fallbackIntent)
} else {
showToast(getString(R.string.open_link_no_app_found))
}
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/java/me/ash/reader/ui/ext/ContextExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,13 @@ fun Context.openURL(

}
} catch (_: Throwable) {
showToast(getString(R.string.open_link_something_wrong))
startActivity(intent)
val fallbackIntent = intent.setPackage(null)
if (fallbackIntent.resolveActivity(packageManager) != null) {
showToast(getString(R.string.open_link_something_wrong))
startActivity(fallbackIntent)
} else {
showToast(getString(R.string.open_link_no_app_found))
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
<string name="always_ask">Always ask</string>
<string name="open_link_specific_browser">Browser</string>
<string name="open_link_something_wrong">\"Open link\" setting ignored because something went wrong</string>
<string name="open_link_no_app_found">No app found to open this link</string>
<string name="open_link_ask_dialog_title">Open with…</string>
<string name="include_additional_info">Include additional info</string>
<string name="exclude">Exclude</string>
Expand Down
Loading