fix call notification title and content

pull/687/head
Ryan Zhao 3 years ago
parent e3479107f3
commit 62d730ea30

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

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

Loading…
Cancel
Save