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:
@@ -219,6 +219,12 @@ class MainService: @unchecked Sendable {
|
||||
notificationManager.notifyGameStarted(game)
|
||||
}
|
||||
|
||||
// Game ended: transition to any over-state (OVER/FINAL/OFF)
|
||||
if let prevState = previousState, !prevState.isOver, currentState.isOver {
|
||||
logger.info("Game \(game.id) ended: \(game.awayTeam.abbrev) \(game.awayTeam.score ?? 0) — \(game.homeTeam.abbrev) \(game.homeTeam.score ?? 0)")
|
||||
notificationManager.notifyGameEnded(game)
|
||||
}
|
||||
|
||||
if game.gameType == 3,
|
||||
let prevState = previousState, !prevState.isOver, currentState.isOver {
|
||||
hadPlayoffFinalTransition = true
|
||||
|
||||
Reference in New Issue
Block a user