fix call notification title and content

This commit is contained in:
Ryan Zhao 2022-09-05 15:44:42 +10:00
parent e3479107f3
commit 62d730ea30
2 changed files with 9 additions and 17 deletions

View File

@ -313,24 +313,19 @@ public class NotificationPresenter: NSObject, NotificationsProtocol {
AppNotificationUserInfoKey.threadId: thread.id
]
let notificationTitle: String = interaction.previewText(db)
let threadName: String = SessionThread.displayName(
threadId: thread.id,
variant: thread.variant,
closedGroupName: nil, // Not supported
openGroupName: nil // Not supported
)
let notificationTitle: String = "Session"
let senderName: String = Profile.displayName(db, id: interaction.authorId, threadVariant: thread.variant)
let notificationBody: String? = {
switch messageInfo.state {
case .permissionDenied:
return String(
format: "modal_call_missed_tips_explanation".localized(),
threadName
senderName
)
case .missed:
return String(
format: "call_missed".localized(),
threadName
senderName
)
default:
return nil
@ -354,7 +349,7 @@ public class NotificationPresenter: NSObject, NotificationsProtocol {
previewType: previewType,
sound: sound,
threadVariant: thread.variant,
threadName: threadName,
threadName: senderName,
replacingIdentifier: UUID().uuidString
)
}

View File

@ -157,18 +157,15 @@ public class NSENotificationPresenter: NSObject, NotificationsProtocol {
notificationContent.badge = NSNumber(value: newBadgeNumber)
CurrentAppContext().appUserDefaults().set(newBadgeNumber, forKey: "currentBadgeNumber")
notificationContent.title = interaction.previewText(db)
notificationContent.title = "Session"
notificationContent.body = ""
let senderName: String = Profile.displayName(db, id: interaction.authorId, threadVariant: thread.variant)
if messageInfo.state == .permissionDenied {
notificationContent.body = String(
format: "modal_call_missed_tips_explanation".localized(),
SessionThread.displayName(
threadId: thread.id,
variant: thread.variant,
closedGroupName: nil, // Not supported
openGroupName: nil // Not supported
)
senderName
)
}