Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit a9aa6a5

Browse files
authored
clear push notifications on open (#2336)
1 parent 332534e commit a9aa6a5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Classes/Notifications/NotificationSectionController.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,13 @@ final class NotificationSectionController: ListSwiftSectionController<Notificati
8383
modelController.markNotificationRead(id: model.id)
8484
}
8585

86+
BadgeNotifications.clear(for: model)
87+
8688
switch model.number {
8789
case .hash(let hash):
8890
viewController?.presentCommit(owner: model.owner, repo: model.repo, hash: hash)
8991
case .number(let number):
92+
9093
let controller = IssuesViewController(
9194
client: modelController.githubClient,
9295
model: IssueDetailsModel(owner: model.owner, repo: model.repo, number: number),

Classes/Systems/BadgeNotifications.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,10 @@ final class BadgeNotifications {
158158
application.applicationIconBadgeNumber = isBadgeEnabled ? count : 0
159159
}
160160

161+
static func clear(for notification: NotificationViewModel) {
162+
UNUserNotificationCenter.current().removeDeliveredNotifications(
163+
withIdentifiers: [notification.identifier]
164+
)
165+
}
166+
161167
}

0 commit comments

Comments
 (0)