Add a specific notification body for space invites. (#4808)

This commit is contained in:
Doug
2025-12-02 17:07:03 +00:00
committed by GitHub
parent 5614564600
commit 3ef7ad4c4d
7 changed files with 24 additions and 8 deletions

View File

@@ -442,6 +442,7 @@
"notification_room_invite_body_with_sender" = "%1$@ invited you to join the room";
"notification_sender_me" = "Me";
"notification_sender_mention_reply" = "%1$@ mentioned or replied";
"notification_space_invite_body" = "Invited you to join the space";
"notification_test_push_notification_content" = "You are viewing the notification! Click me!";
"notification_ticker_text_dm" = "%1$@: %2$@";
"notification_ticker_text_group" = "%1$@: %2$@ %3$@";

View File

@@ -442,6 +442,7 @@
"notification_room_invite_body_with_sender" = "%1$@ invited you to join the room";
"notification_sender_me" = "Me";
"notification_sender_mention_reply" = "%1$@ mentioned or replied";
"notification_space_invite_body" = "Invited you to join the space";
"notification_test_push_notification_content" = "You are viewing the notification! Click me!";
"notification_ticker_text_dm" = "%1$@: %2$@";
"notification_ticker_text_group" = "%1$@: %2$@ %3$@";

View File

@@ -1034,6 +1034,8 @@ internal enum L10n {
internal static func notificationSenderMentionReply(_ p1: Any) -> String {
return L10n.tr("Localizable", "notification_sender_mention_reply", String(describing: p1))
}
/// Invited you to join the space
internal static var notificationSpaceInviteBody: String { return L10n.tr("Localizable", "notification_space_invite_body") }
/// You are viewing the notification! Click me!
internal static var notificationTestPushNotificationContent: String { return L10n.tr("Localizable", "notification_test_push_notification_content") }
/// Thread in %1$@

View File

@@ -11776,6 +11776,11 @@ class NotificationItemProxyMock: NotificationItemProxyProtocol, @unchecked Senda
set(value) { underlyingRoomJoinedMembers = value }
}
var underlyingRoomJoinedMembers: Int!
var isRoomSpace: Bool {
get { return underlyingIsRoomSpace }
set(value) { underlyingIsRoomSpace = value }
}
var underlyingIsRoomSpace: Bool!
var isRoomDirect: Bool {
get { return underlyingIsRoomDirect }
set(value) { underlyingIsRoomDirect = value }

View File

@@ -99,15 +99,14 @@ struct NotificationContentBuilder {
notificationItem: NotificationItemProxyProtocol,
mediaProvider: MediaProviderProtocol) async {
notificationContent.categoryIdentifier = NotificationConstants.Category.invite
let body: String
if !notificationItem.isDM {
body = L10n.notificationRoomInviteBody
} else {
body = L10n.notificationInviteBody
}
notificationContent.body = body
notificationContent.body = if notificationItem.isDM {
L10n.notificationInviteBody
} else if notificationItem.isRoomSpace {
L10n.notificationSpaceInviteBody
} else {
L10n.notificationRoomInviteBody
}
let name = notificationItem.senderDisplayName ?? notificationItem.roomDisplayName
await addCommunicationContext(notificationContent: &notificationContent,

View File

@@ -36,6 +36,10 @@ struct NotificationItemProxy: NotificationItemProxyProtocol {
var roomDisplayName: String {
notificationItem.roomInfo.displayName
}
var isRoomSpace: Bool {
notificationItem.roomInfo.isSpace
}
var isRoomDirect: Bool {
notificationItem.roomInfo.isDirect
@@ -102,6 +106,8 @@ struct EmptyNotificationItemProxy: NotificationItemProxyProtocol {
var isNoisy: Bool { false }
var isRoomSpace: Bool { false }
var isRoomDirect: Bool { false }
var isRoomPrivate: Bool { false }

View File

@@ -29,6 +29,8 @@ protocol NotificationItemProxyProtocol {
var roomAvatarMediaSource: MediaSourceProxy? { get }
var roomJoinedMembers: Int { get }
var isRoomSpace: Bool { get }
var isRoomDirect: Bool { get }