fix: update the app icon badge in multi-instance mode

loadUnreadCount only called UNUserNotificationCenter.setBadgeCount in the
single-instance branch, so the system app icon badge went stale for merged
accounts. Set the badge from the resolved unread count in both modes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
systemBlue 2026-06-02 18:48:25 -04:00
parent b0f50eca38
commit 05636b0795

View file

@ -99,11 +99,15 @@ struct HomeView: View {
} else if let notificationService {
do {
unreadCount = try await notificationService.fetchUnreadCount()
try? await UNUserNotificationCenter.current().setBadgeCount(unreadCount)
} catch {
// Silently ignore badge is non-critical
// Silently ignore badge is non-critical, keep the prior count
return
}
} else {
return
}
// Mirror the in-app tab badge to the system app icon badge in both modes
try? await UNUserNotificationCenter.current().setBadgeCount(unreadCount)
}
}