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:
2026-04-19 21:38:08 -04:00
parent 89060d7177
commit 18c4ef64d6
3 changed files with 77 additions and 0 deletions
+10
View File
@@ -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()
}