Use the proper logic on iOS to increment the badge (#4233)
This commit is contained in:
parent
c58aedf050
commit
480a40862f
7 changed files with 34 additions and 15 deletions
|
@ -1,4 +1,5 @@
|
|||
import UserNotifications
|
||||
import UIKit
|
||||
|
||||
let APP_GROUP = "group.app.bsky"
|
||||
|
||||
|
@ -31,7 +32,12 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
}
|
||||
|
||||
func mutateWithBadge(_ content: UNMutableNotificationContent) {
|
||||
content.badge = 1
|
||||
var count = prefs?.integer(forKey: "badgeCount") ?? 0
|
||||
count += 1
|
||||
|
||||
// Set the new badge number for the notification, then store that value for using later
|
||||
content.badge = NSNumber(value: count)
|
||||
prefs?.setValue(count, forKey: "badgeCount")
|
||||
}
|
||||
|
||||
func mutateWithChatMessage(_ content: UNMutableNotificationContent) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue