change(notification): handle invite notification for spaces

This commit is contained in:
ganfra 2025-12-04 12:25:30 +01:00
parent 24e3705671
commit 236db9e35d
6 changed files with 63 additions and 6 deletions

View file

@ -183,7 +183,11 @@ class DefaultNotifiableEventResolver(
soundName = null,
isRedacted = false,
isUpdated = false,
description = descriptionFromRoomMembershipInvite(senderDisambiguatedDisplayName, isDirect),
description = descriptionFromRoomMembershipInvite(
senderDisambiguatedDisplayName = senderDisambiguatedDisplayName,
isDirectRoom = isDirect,
isSpace = isSpace
),
// TODO check if type is needed anymore
type = null,
// TODO check if title is needed anymore
@ -332,12 +336,19 @@ class DefaultNotifiableEventResolver(
private fun descriptionFromRoomMembershipInvite(
senderDisambiguatedDisplayName: String,
isDirectRoom: Boolean
isDirectRoom: Boolean,
isSpace: Boolean,
): String {
return if (isDirectRoom) {
stringProvider.getString(R.string.notification_invite_body_with_sender, senderDisambiguatedDisplayName)
} else {
stringProvider.getString(R.string.notification_room_invite_body_with_sender, senderDisambiguatedDisplayName)
return when {
isDirectRoom -> {
stringProvider.getString(R.string.notification_invite_body_with_sender, senderDisambiguatedDisplayName)
}
isSpace -> {
stringProvider.getString(R.string.notification_space_invite_body_with_sender, senderDisambiguatedDisplayName)
}
else -> {
stringProvider.getString(R.string.notification_room_invite_body_with_sender, senderDisambiguatedDisplayName)
}
}
}

View file

@ -38,6 +38,8 @@
<string name="notification_room_invite_body_with_sender">"%1$s invited you to join the room"</string>
<string name="notification_sender_me">"Me"</string>
<string name="notification_sender_mention_reply">"%1$s mentioned or replied"</string>
<string name="notification_space_invite_body">"Invited you to join the space"</string>
<string name="notification_space_invite_body_with_sender">"%1$s invited you to join the space"</string>
<string name="notification_test_push_notification_content">"You are viewing the notification! Click me!"</string>
<string name="notification_thread_in_room">"Thread in %1$s"</string>
<string name="notification_ticker_text_dm">"%1$s: %2$s"</string>