From f65025f841251d0a9e7eade37783a97a39131dd7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 25 Apr 2024 17:40:18 +0200 Subject: [PATCH] Clearer code. --- .../timeline/components/event/TimelineItemEncryptedView.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemEncryptedView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemEncryptedView.kt index e6ea67359e..57cf3e0ecc 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemEncryptedView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemEncryptedView.kt @@ -36,8 +36,8 @@ fun TimelineItemEncryptedView( onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit, modifier: Modifier = Modifier ) { - val (textId, iconId) = if (content.data is UnableToDecryptContent.Data.MegolmV1AesSha2 && - content.data.utdCause == UtdCause.Membership) { + val isMembershipUtd = (content.data as? UnableToDecryptContent.Data.MegolmV1AesSha2)?.utdCause == UtdCause.Membership + val (textId, iconId) = if (isMembershipUtd) { (CommonStrings.common_unable_to_decrypt_no_access to CompoundDrawables.ic_compound_block) } else { (CommonStrings.common_waiting_for_decryption_key to CompoundDrawables.ic_compound_time)