← All repositories

crossmate

A collaborative crossword app for iPhone and iPad

git clone https://code.inqk.net/crossmate.git


commit 363b80cdef109fad4c0b182307be9c65cfa5e7c9
parent 60c2bb24bb5b795b0bc940b061404902fbf222ef
Author: Michael Camilleri <[email protected]>
Date:   Wed, 10 Jun 2026 01:11:38 +0900

Reconcile badge ledger repeatedly

Diffstat

MCrossmate/Services/AppServices.swift | 9++++++++-

1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Crossmate/Services/AppServices.swift b/Crossmate/Services/AppServices.swift

@@ -383,7 +383,6 @@ final class AppServices {
             Task { await self.refreshAppBadge() }
         }
         importVisibleNotificationReceipts()
-        await reconcileBadgeLedgerWithDeliveredNotifications()
         await refreshAppBadge()
         await logNotificationStartupSnapshot()
 
@@ -1762,6 +1761,14 @@ final class AppServices {
             reason: reason
         )
         await refreshSnapshot()
+        // Now that Core Data unread reflects server ground truth, prune any
+        // badge-ledger entry no longer backed by unread state or a delivered
+        // notification. Reconciling here (rather than once at startup, before
+        // the freshen settles) clears orphans like a game whose push stamped
+        // the ledger but was since opened — the divergence that otherwise pins
+        // the badge above the count the library list shows.
+        await reconcileBadgeLedgerWithDeliveredNotifications()
+        await refreshAppBadge()
         await reconcilePendingJournalUploads()
         if shouldRunColdLaunchArchiveReconcile {
             shouldRunColdLaunchArchiveReconcile = false