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

Clear push notifications on open #2336

Merged
merged 1 commit into from
Oct 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Classes/Notifications/NotificationSectionController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ final class NotificationSectionController: ListSwiftSectionController<Notificati
modelController.markNotificationRead(id: model.id)
}

BadgeNotifications.clear(for: model)

switch model.number {
case .hash(let hash):
viewController?.presentCommit(owner: model.owner, repo: model.repo, hash: hash)
case .number(let number):

let controller = IssuesViewController(
client: modelController.githubClient,
model: IssueDetailsModel(owner: model.owner, repo: model.repo, number: number),
Expand Down
6 changes: 6 additions & 0 deletions Classes/Systems/BadgeNotifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,10 @@ final class BadgeNotifications {
application.applicationIconBadgeNumber = isBadgeEnabled ? count : 0
}

static func clear(for notification: NotificationViewModel) {
UNUserNotificationCenter.current().removeDeliveredNotifications(
withIdentifiers: [notification.identifier]
)
}

}