mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-22 08:20:59 +00:00
Only add notification target account if more than one account
This commit is contained in:
parent
d73b6952d9
commit
27065619d2
1 changed files with 10 additions and 3 deletions
|
@ -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 a new issue