about summary refs log tree commit diff
path: root/modules/BlueskyNSE/NotificationService.swift
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-05-17 16:05:32 -0700
committerGitHub <noreply@github.com>2024-05-17 16:05:32 -0700
commitd2c81c9d3d6aebae9c73a7567875e0165cfb1f08 (patch)
tree428f283a80530d71603d2cad87e62d85d20d2bf7 /modules/BlueskyNSE/NotificationService.swift
parent49314e2d1f20d7471f1d05ce2b118bd030c44aa2 (diff)
downloadvoidsky-d2c81c9d3d6aebae9c73a7567875e0165cfb1f08.tar.zst
Disable badge incrementing for DMs (#4088)
* disable badge increments for dms

* revert decrementing in js for dms

* reset badge on read notifications

* remove some other code

* prevent duplicate notification events
Diffstat (limited to 'modules/BlueskyNSE/NotificationService.swift')
-rw-r--r--modules/BlueskyNSE/NotificationService.swift7
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/BlueskyNSE/NotificationService.swift b/modules/BlueskyNSE/NotificationService.swift
index c6f391e00..e6aca99c1 100644
--- a/modules/BlueskyNSE/NotificationService.swift
+++ b/modules/BlueskyNSE/NotificationService.swift
@@ -6,7 +6,7 @@ class NotificationService: UNNotificationServiceExtension {
   var prefs = UserDefaults(suiteName: APP_GROUP)
 
   override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
-    guard var bestAttempt = createCopy(request.content),
+    guard let bestAttempt = createCopy(request.content),
           let reason = request.content.userInfo["reason"] as? String
     else {
       contentHandler(request.content)
@@ -15,11 +15,10 @@ class NotificationService: UNNotificationServiceExtension {
     
     if reason == "chat-message" {
       mutateWithChatMessage(bestAttempt)
+    } else {
+      mutateWithBadge(bestAttempt)
     }
     
-    // The badge should always be incremented when in the background
-    mutateWithBadge(bestAttempt)
-    
     contentHandler(bestAttempt)
   }