feat: erweitere Benachrichtigungseinstellungen um Live-Ticker-Optionen und implementiere Push-Benachrichtigungen für Live-Spielereignisse
All checks were successful
Code Analysis and Production Deploy / analyze (push) Successful in 6m32s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 3m5s

This commit is contained in:
Torsten Schulz (local)
2026-10-23 00:25:07 +02:00
parent 6369249f40
commit bf74d41773
7 changed files with 191 additions and 3 deletions

View File

@@ -286,6 +286,9 @@ data class NotificationSettingsDto(
val newContactRequest: Boolean = false,
val newUserRegistration: Boolean = false,
val ownTtrChanges: Boolean = false,
val liveTickerStarts: Boolean = false,
val liveTickerScoreChanges: Boolean = false,
val liveTickerFinished: Boolean = false,
val selectedTeamSlugs: List<String> = emptyList(),
val selectedTeamSeason: String? = null,
val notificationTime: String = "09:00",

View File

@@ -81,6 +81,7 @@ object HarheimerNotifications {
"news", "news_expiring" -> Destinations.MemberNews.route
"event", "events_today", "events_tomorrow" -> Destinations.Termine.route
"team_matches" -> Destinations.Spielplan.route
"live_ticker_started", "live_ticker_score_changed", "live_ticker_finished" -> Destinations.MemberArea.route
"qttr_list_updated", "ttr_change" -> Destinations.Qttr.route
"birthdays" -> Destinations.MemberArea.route
"contact_request" -> Destinations.CmsContactRequests.route

View File

@@ -20,6 +20,9 @@ data class NotificationPreferences(
val newContactRequest: Boolean = false,
val newUserRegistration: Boolean = false,
val ownTtrChanges: Boolean = false,
val liveTickerStarts: Boolean = false,
val liveTickerScoreChanges: Boolean = false,
val liveTickerFinished: Boolean = false,
val selectedTeamSlugs: Set<String> = emptySet(),
val selectedTeamSeason: String? = null,
val notificationTime: String = DEFAULT_NOTIFICATION_TIME,
@@ -45,6 +48,9 @@ class NotificationPreferencesRepository @Inject constructor(
newContactRequest = preferences.getBoolean(KEY_NEW_CONTACT_REQUEST, false),
newUserRegistration = preferences.getBoolean(KEY_NEW_USER_REGISTRATION, false),
ownTtrChanges = preferences.getBoolean(KEY_OWN_TTR_CHANGES, false),
liveTickerStarts = preferences.getBoolean(KEY_LIVE_TICKER_STARTS, false),
liveTickerScoreChanges = preferences.getBoolean(KEY_LIVE_TICKER_SCORE_CHANGES, false),
liveTickerFinished = preferences.getBoolean(KEY_LIVE_TICKER_FINISHED, false),
selectedTeamSlugs = preferences.getStringSet(KEY_SELECTED_TEAM_SLUGS, emptySet()).orEmpty(),
selectedTeamSeason = preferences.getString(KEY_SELECTED_TEAM_SEASON, null)?.takeIf { it.isNotBlank() },
notificationTime = preferences.getString(KEY_NOTIFICATION_TIME, DEFAULT_NOTIFICATION_TIME) ?: DEFAULT_NOTIFICATION_TIME,
@@ -72,6 +78,9 @@ class NotificationPreferencesRepository @Inject constructor(
.putBoolean(KEY_NEW_CONTACT_REQUEST, settings.newContactRequest)
.putBoolean(KEY_NEW_USER_REGISTRATION, settings.newUserRegistration)
.putBoolean(KEY_OWN_TTR_CHANGES, settings.ownTtrChanges)
.putBoolean(KEY_LIVE_TICKER_STARTS, settings.liveTickerStarts)
.putBoolean(KEY_LIVE_TICKER_SCORE_CHANGES, settings.liveTickerScoreChanges)
.putBoolean(KEY_LIVE_TICKER_FINISHED, settings.liveTickerFinished)
.putStringSet(KEY_SELECTED_TEAM_SLUGS, settings.selectedTeamSlugs)
.putString(KEY_SELECTED_TEAM_SEASON, settings.selectedTeamSeason)
.putString(KEY_NOTIFICATION_TIME, settings.notificationTime)
@@ -102,6 +111,9 @@ class NotificationPreferencesRepository @Inject constructor(
const val KEY_NEW_CONTACT_REQUEST = "new_contact_request"
const val KEY_NEW_USER_REGISTRATION = "new_user_registration"
const val KEY_OWN_TTR_CHANGES = "own_ttr_changes"
const val KEY_LIVE_TICKER_STARTS = "live_ticker_starts"
const val KEY_LIVE_TICKER_SCORE_CHANGES = "live_ticker_score_changes"
const val KEY_LIVE_TICKER_FINISHED = "live_ticker_finished"
const val KEY_SELECTED_TEAM_SLUGS = "selected_team_slugs"
const val KEY_SELECTED_TEAM_SEASON = "selected_team_season"
const val KEY_NOTIFICATION_TIME = "notification_time"
@@ -119,6 +131,9 @@ private fun NotificationSettingsDto.toPreferences(): NotificationPreferences = N
newContactRequest = newContactRequest,
newUserRegistration = newUserRegistration,
ownTtrChanges = ownTtrChanges,
liveTickerStarts = liveTickerStarts,
liveTickerScoreChanges = liveTickerScoreChanges,
liveTickerFinished = liveTickerFinished,
selectedTeamSlugs = selectedTeamSlugs.toSet(),
selectedTeamSeason = selectedTeamSeason,
notificationTime = notificationTime,
@@ -135,6 +150,9 @@ private fun NotificationPreferences.toDto(): NotificationSettingsDto = Notificat
newContactRequest = newContactRequest,
newUserRegistration = newUserRegistration,
ownTtrChanges = ownTtrChanges,
liveTickerStarts = liveTickerStarts,
liveTickerScoreChanges = liveTickerScoreChanges,
liveTickerFinished = liveTickerFinished,
selectedTeamSlugs = selectedTeamSlugs.toList(),
selectedTeamSeason = selectedTeamSeason,
notificationTime = notificationTime,

View File

@@ -164,6 +164,15 @@ fun NotificationSettingsScreen(
ToggleRow("Punktspiele aller Mannschaften", state.settings.allTeamMatches) {
viewModel.update(state.settings.copy(allTeamMatches = it))
}
ToggleRow("Live-Spiel gestartet (Live-Ticker)", state.settings.liveTickerStarts) {
viewModel.update(state.settings.copy(liveTickerStarts = it))
}
ToggleRow("Live-Ergebnis geändert", state.settings.liveTickerScoreChanges) {
viewModel.update(state.settings.copy(liveTickerScoreChanges = it))
}
ToggleRow("Live-Spiel beendet", state.settings.liveTickerFinished) {
viewModel.update(state.settings.copy(liveTickerFinished = it))
}
TeamSelection(
teams = state.teams,
seasons = state.seasons,