feat: erweitere Benachrichtigungseinstellungen um Live-Ticker-Optionen und implementiere Push-Benachrichtigungen für Live-Spielereignisse
This commit is contained in:
@@ -347,6 +347,61 @@ export async function sendQttrListUpdatedPush({ importedAt, rowCount }) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function sendLiveTickerStartedPush(match) {
|
||||
const homeTeam = String(match?.homeTeam || 'Heimmannschaft').trim()
|
||||
const awayTeam = String(match?.awayTeam || 'Gastmannschaft').trim()
|
||||
const meetingId = String(match?.meetingId || '').trim()
|
||||
return sendPushToUsers({
|
||||
title: 'Live-Spiel gestartet',
|
||||
body: `${homeTeam} – ${awayTeam}: Live-Ticker ist verfügbar.`,
|
||||
data: {
|
||||
type: 'live_ticker_started',
|
||||
meetingId,
|
||||
notificationId: notificationIdFor(`live-ticker-start:${meetingId}`)
|
||||
},
|
||||
predicate: (_user, settings) => settings.liveTickerStarts,
|
||||
failureLabel: 'FCM Live-Ticker-Start-Push'
|
||||
})
|
||||
}
|
||||
|
||||
export async function sendLiveTickerScoreChangedPush(match) {
|
||||
const homeTeam = String(match?.homeTeam || 'Heimmannschaft').trim()
|
||||
const awayTeam = String(match?.awayTeam || 'Gastmannschaft').trim()
|
||||
const score = String(match?.score || '–').trim()
|
||||
const meetingId = String(match?.meetingId || '').trim()
|
||||
return sendPushToUsers({
|
||||
title: 'Live-Ergebnis geändert',
|
||||
body: `${homeTeam} – ${awayTeam}: ${score}`,
|
||||
data: {
|
||||
type: 'live_ticker_score_changed',
|
||||
meetingId,
|
||||
score,
|
||||
notificationId: notificationIdFor(`live-ticker-score:${meetingId}:${score}`)
|
||||
},
|
||||
predicate: (_user, settings) => settings.liveTickerScoreChanges,
|
||||
failureLabel: 'FCM Live-Ticker-Ergebnis-Push'
|
||||
})
|
||||
}
|
||||
|
||||
export async function sendLiveTickerFinishedPush(match) {
|
||||
const homeTeam = String(match?.homeTeam || 'Heimmannschaft').trim()
|
||||
const awayTeam = String(match?.awayTeam || 'Gastmannschaft').trim()
|
||||
const score = String(match?.score || '–').trim()
|
||||
const meetingId = String(match?.meetingId || '').trim()
|
||||
return sendPushToUsers({
|
||||
title: 'Spiel beendet',
|
||||
body: `${homeTeam} – ${awayTeam}: ${score}`,
|
||||
data: {
|
||||
type: 'live_ticker_finished',
|
||||
meetingId,
|
||||
score,
|
||||
notificationId: notificationIdFor(`live-ticker-finished:${meetingId}`)
|
||||
},
|
||||
predicate: (_user, settings) => settings.liveTickerFinished,
|
||||
failureLabel: 'FCM Live-Ticker-Ende-Push'
|
||||
})
|
||||
}
|
||||
|
||||
export async function sendTestPushToUser(userId) {
|
||||
return sendPushToUsers({
|
||||
title: 'Harheimer TC: Push-Test',
|
||||
|
||||
Reference in New Issue
Block a user