mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-22 21:08:15 +01:00
Only add notification target account if more than one account
This commit is contained in:
parent
d73b6952d9
commit
27065619d2
@ -55,7 +55,9 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
}
|
||||
|
||||
bestAttemptContent.title = notification.title
|
||||
if AppAccountsManager.shared.availableAccounts.count > 1 {
|
||||
bestAttemptContent.subtitle = bestAttemptContent.userInfo["i"] as? String ?? ""
|
||||
}
|
||||
bestAttemptContent.body = notification.body.escape()
|
||||
bestAttemptContent.userInfo["plaintext"] = plaintextData
|
||||
bestAttemptContent.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: "glass.caf"))
|
||||
@ -82,8 +84,13 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
if let remoteNotification = await toRemoteNotification(localNotification: notification) {
|
||||
let intent = buildMessageIntent(remoteNotification: remoteNotification, avatarURL: fileURL)
|
||||
bestAttemptContent = try bestAttemptContent.updating(from: intent) as! UNMutableNotificationContent
|
||||
if AppAccountsManager.shared.availableAccounts.count > 1 {
|
||||
let newBody = "\(bestAttemptContent.userInfo["i"] as? String ?? "") \n\(notification.title)\n\(notification.body.escape())"
|
||||
bestAttemptContent.body = newBody
|
||||
} else {
|
||||
let newBody = "\(notification.title)\n\(notification.body.escape())"
|
||||
bestAttemptContent.body = newBody
|
||||
}
|
||||
} else {
|
||||
if let attachment = try? UNNotificationAttachment(identifier: filename, url: fileURL, options: nil) {
|
||||
bestAttemptContent.attachments = [attachment]
|
||||
|
Loading…
Reference in New Issue
Block a user