Making sure we do not crash when trying to open a document that hasn't yet been downloaded

pull/1710/head
ThomasSession 1 month ago
parent e95fa6cc03
commit fd45cdf568

@ -193,6 +193,7 @@ class VisibleMessageContentView : ConstraintLayout {
message.slideDeck.documentSlide?.let { slide -> message.slideDeck.documentSlide?.let { slide ->
onContentClick.add { onContentClick.add {
// open the document when tapping it // open the document when tapping it
try {
val intent = Intent(Intent.ACTION_VIEW) val intent = Intent(Intent.ACTION_VIEW)
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
intent.setDataAndType( intent.setDataAndType(
@ -200,7 +201,6 @@ class VisibleMessageContentView : ConstraintLayout {
slide.contentType slide.contentType
) )
try {
context.startActivity(intent) context.startActivity(intent)
} catch (e: ActivityNotFoundException) { } catch (e: ActivityNotFoundException) {
Log.e("VisibleMessageContentView", "Error opening document", e) Log.e("VisibleMessageContentView", "Error opening document", e)

Loading…
Cancel
Save