Skip to content

Commit

Permalink
Migrate to UNUserNotificationCenter to set badge count
Browse files Browse the repository at this point in the history
  • Loading branch information
fwcd committed Jul 6, 2024
1 parent 916738c commit 33cc044
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DistributedChatApp/DistributedChatApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ struct DistributedChatApp: App {
}
}
state.subscriptions.append(state.messages.$unreadMessageIds.sink { unread in
DispatchQueue.main.async {
UIApplication.shared.applicationIconBadgeNumber = unread.count
Task {
try await UNUserNotificationCenter.current().setBadgeCount(unread.count)
}
})
log.info("Registered notification handler!")
Expand Down

0 comments on commit 33cc044

Please sign in to comment.