From 9fe9d88dc8d6ee37dcb6c598940a2bde22fab1b1 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 23 Nov 2023 17:41:28 +0100 Subject: [PATCH] Small rework code to avoid dead code. --- .../notifications/NotifiableEventResolver.kt | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventResolver.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventResolver.kt index 2710e119fd..8474e9a045 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventResolver.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventResolver.kt @@ -113,7 +113,7 @@ class NotifiableEventResolver @Inject constructor( soundName = null, isRedacted = false, isUpdated = false, - description = descriptionFromRoomMembershipContent(content, isDirect) ?: return null, + description = descriptionFromRoomMembershipInvite(isDirect), type = null, // TODO check if type is needed anymore title = null, // TODO check if title is needed anymore ) @@ -226,19 +226,13 @@ class NotifiableEventResolver @Inject constructor( } } - private fun descriptionFromRoomMembershipContent( - content: NotificationContent.StateEvent.RoomMemberContent, + private fun descriptionFromRoomMembershipInvite( isDirectRoom: Boolean - ): String? { - return when (content.membershipState) { - RoomMembershipState.INVITE -> { - if (isDirectRoom) { - stringProvider.getString(R.string.notification_invite_body) - } else { - stringProvider.getString(R.string.notification_room_invite_body) - } - } - else -> null + ): String { + return if (isDirectRoom) { + stringProvider.getString(R.string.notification_invite_body) + } else { + stringProvider.getString(R.string.notification_room_invite_body) } } }