mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Placeholders added in push notifications (#1176)
* placeholders added in push notifications * this code is a bit easier to read * code improvement
This commit is contained in:
@@ -185,6 +185,15 @@ extension NotificationItemProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
var icon: NotificationIcon {
|
||||
if isDirect {
|
||||
return NotificationIcon(mediaSource: senderAvatarMediaSource, groupInfo: nil)
|
||||
} else {
|
||||
return NotificationIcon(mediaSource: roomAvatarMediaSource,
|
||||
groupInfo: .init(name: roomDisplayName, id: roomID))
|
||||
}
|
||||
}
|
||||
|
||||
/// Process the receiver item proxy
|
||||
/// - Parameters:
|
||||
/// - receiverId: identifier of the user that has received the notification
|
||||
@@ -236,13 +245,10 @@ extension NotificationItemProxyProtocol {
|
||||
|
||||
notification.categoryIdentifier = NotificationConstants.Category.invite
|
||||
|
||||
let icon: NotificationIcon
|
||||
let body: String
|
||||
if !isDirect {
|
||||
icon = NotificationIcon(mediaSource: roomAvatarMediaSource, groupName: roomDisplayName)
|
||||
body = L10n.notificationRoomInviteBody
|
||||
} else {
|
||||
icon = NotificationIcon(mediaSource: senderAvatarMediaSource, groupName: nil)
|
||||
body = L10n.notificationInviteBody
|
||||
}
|
||||
|
||||
@@ -292,17 +298,9 @@ extension NotificationItemProxyProtocol {
|
||||
}
|
||||
notification.categoryIdentifier = NotificationConstants.Category.message
|
||||
|
||||
let senderName = senderDisplayName ?? roomDisplayName
|
||||
let icon: NotificationIcon
|
||||
if !isDirect {
|
||||
icon = NotificationIcon(mediaSource: roomAvatarMediaSource, groupName: roomDisplayName)
|
||||
} else {
|
||||
icon = NotificationIcon(mediaSource: senderAvatarMediaSource, groupName: nil)
|
||||
}
|
||||
|
||||
notification = try await notification.addSenderIcon(using: mediaProvider,
|
||||
senderID: event.senderID,
|
||||
senderName: senderName,
|
||||
senderName: senderDisplayName ?? roomDisplayName,
|
||||
icon: icon)
|
||||
return notification
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user