Add game-ended notification
Fires the first time a game transitions from non-over to any over-state
(OVER/FINAL/OFF), so the notification lands when the clock runs out
rather than hours later when NHL statisticians stamp OFF. Shows the
winning team's logo with a "{TEAM} wins" title and final score body.
Deduped by game ID via gameEndsSent; cleared on resetForNewDay.
Dev menu: "Test Game Ended Notification" for manual trigger.
This commit is contained in:
@@ -220,6 +220,9 @@ class MenuManager: @unchecked Sendable {
|
||||
devSubmenu.addItem(
|
||||
NSMenuItem(title: "Test Goal Scored Notification", action: #selector(triggerTestGoalScored), keyEquivalent: "").withTarget(self)
|
||||
)
|
||||
devSubmenu.addItem(
|
||||
NSMenuItem(title: "Test Game Ended Notification", action: #selector(triggerTestGameEnded), keyEquivalent: "").withTarget(self)
|
||||
)
|
||||
devSubmenu.addItem(
|
||||
NSMenuItem(title: "Thumbnail Size Test", action: #selector(triggerThumbnailSizeTest), keyEquivalent: "").withTarget(self)
|
||||
)
|
||||
@@ -308,6 +311,13 @@ class MenuManager: @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func triggerTestGameEnded() {
|
||||
let notificationManager = NotificationManager.shared
|
||||
if let game = mainService.gamesByDate.flatMap(\.games).first {
|
||||
notificationManager.notifyGameEnded(game, bypassDedup: true)
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func triggerThumbnailSizeTest() {
|
||||
NotificationManager.shared.sendThumbnailSizeTest()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user