respect notification settings for remote PNs

This commit is contained in:
Ryan ZHAO 2020-09-22 13:54:58 +10:00
parent f7c2389db1
commit 937c8520f4
1 changed files with 14 additions and 1 deletions

View File

@ -110,7 +110,20 @@ final class NotificationServiceExtension : UNNotificationServiceExtension {
newNotificationBody = contentProto?.dataMessage?.body ?? "You've got a new message"
}
newNotificationBody = handleMentionIfNecessary(rawMessageBody: newNotificationBody, threadID: thread.uniqueId!, transaction: transaction)
notificationContent.body = newNotificationBody
let notificationPreference = Environment.shared.preferences
if let notificationType = notificationPreference?.notificationPreviewType() {
switch notificationType {
case .nameNoPreview:
notificationContent.body = "New Message!"
case .noNameNoPreview:
notificationContent.title = ""
notificationContent.body = "New Message!"
default:
notificationContent.body = newNotificationBody
}
}
if notificationContent.body.count < 1 {
self.completeWithFailure(content: notificationContent)
} else {