From 9e6bd2ee9c6abf2037810dface717e1f8b0800d5 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 4 Nov 2021 10:10:36 +0000 Subject: [PATCH] checking if the event is an image message to avoid attepting to render non image based attachments --- .../app/features/notifications/NotifiableEventResolver.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotifiableEventResolver.kt b/vector/src/main/java/im/vector/app/features/notifications/NotifiableEventResolver.kt index 23f9fc307bb..fa669244971 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotifiableEventResolver.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotifiableEventResolver.kt @@ -30,6 +30,7 @@ import org.matrix.android.sdk.api.session.crypto.MXCryptoError import org.matrix.android.sdk.api.session.events.model.Event import org.matrix.android.sdk.api.session.events.model.EventType import org.matrix.android.sdk.api.session.events.model.isEdition +import org.matrix.android.sdk.api.session.events.model.isImageMessage import org.matrix.android.sdk.api.session.events.model.toModel import org.matrix.android.sdk.api.session.room.model.Membership import org.matrix.android.sdk.api.session.room.model.RoomMemberContent @@ -202,7 +203,7 @@ class NotifiableEventResolver @Inject constructor( private suspend fun TimelineEvent.fetchImageIfPresent(session: Session): Uri? { return when { root.isEncrypted() && root.mxDecryptionResult == null -> null - root.getClearType() == EventType.MESSAGE -> downloadAndExportImage(session) + root.isImageMessage() -> downloadAndExportImage(session) else -> null } }