diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/Event.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/Event.kt index 7dd0c6e2..a0a037f0 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/Event.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/Event.kt @@ -302,31 +302,19 @@ data class Event( fun Event.isTextMessage(): Boolean { - if (this.getClearType() == EventType.MESSAGE) { - return getClearContent()?.toModel()?.let { - when (it.type) { - MessageType.MSGTYPE_TEXT, - MessageType.MSGTYPE_EMOTE, - MessageType.MSGTYPE_NOTICE -> { - true - } - else -> false - } - } ?: false + return getClearType() == EventType.MESSAGE + && when (getClearContent()?.toModel()?.type) { + MessageType.MSGTYPE_TEXT, + MessageType.MSGTYPE_EMOTE, + MessageType.MSGTYPE_NOTICE -> true + else -> false } - return false } fun Event.isImageMessage(): Boolean { - if (this.getClearType() == EventType.MESSAGE) { - return getClearContent()?.toModel()?.let { - when (it.type) { - MessageType.MSGTYPE_IMAGE -> { - true - } - else -> false - } - } ?: false + return getClearType() == EventType.MESSAGE + && when (getClearContent()?.toModel()?.type) { + MessageType.MSGTYPE_IMAGE -> true + else -> false } - return false } \ No newline at end of file