Prevent view action from crashing the app, fixes #233

This commit is contained in:
Philipp Heckel 2022-05-03 19:38:52 -04:00
parent 821a1ac222
commit fc11a5079f
2 changed files with 9 additions and 4 deletions

View file

@ -433,11 +433,15 @@ class DetailAdapter(private val activity: Activity, private val lifecycleScope:
}
private fun runViewAction(context: Context, action: Action) {
val url = action.url ?: return
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply {
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
try {
val url = action.url ?: return
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply {
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
context.startActivity(intent)
} catch (e: Exception) {
Log.w(TAG, "Unable to start activity from URL ${action.url}", e)
}
context.startActivity(intent)
}
private fun runOtherUserAction(context: Context, notification: Notification, action: Action) {

View file

@ -7,6 +7,7 @@ Bugs:
* Restoring topics or settings from backup doesn't work (#223, thanks to @shadow00 for reporting)
* Fix app icon on old Android versions (#120, thanks to @shadow00 for reporting)
* Fix races in UnifiedPush registration (#230, thanks to @Jakob for reporting)
* Prevent view action from crashing the app (#233)
**Thanks for testing:**