about summary refs log tree commit diff
path: root/modules/BlueskyNSE
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-06-07 15:15:33 -0700
committerGitHub <noreply@github.com>2024-06-07 15:15:33 -0700
commit480a40862f329f98a37772f01fd774d0e6d89a9e (patch)
treead39ad65806cb51694d0a92feee8337c7f454aa4 /modules/BlueskyNSE
parentc58aedf050ea96ece27549b4c5a084611473db9d (diff)
downloadvoidsky-480a40862f329f98a37772f01fd774d0e6d89a9e.tar.zst
Use the proper logic on iOS to increment the badge (#4233)
Diffstat (limited to 'modules/BlueskyNSE')
-rw-r--r--modules/BlueskyNSE/NotificationService.swift8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/BlueskyNSE/NotificationService.swift b/modules/BlueskyNSE/NotificationService.swift
index e6aca99c1..384180d8b 100644
--- a/modules/BlueskyNSE/NotificationService.swift
+++ b/modules/BlueskyNSE/NotificationService.swift
@@ -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) {