Fix punteggio broadcast iOS: decodifica score e aggiornamento UI.
ScoreStateDto non leggeva home_points con convertFromSnakeCase; ScoreController assegna sempre lo stato, aggiornamento ottimistico e refresh overlay. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
80813b390b
commit
594853ed04
@@ -45,6 +45,8 @@ struct BroadcastControlsOverlay: View {
|
||||
|
||||
var body: some View {
|
||||
Color.clear
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.contentShape(Rectangle())
|
||||
.overlay(alignment: .topLeading) {
|
||||
MatchStatusBadge(
|
||||
text: statusText,
|
||||
|
||||
@@ -50,6 +50,7 @@ struct BroadcastScreen: View {
|
||||
.ignoresSafeArea()
|
||||
.allowsHitTesting(false)
|
||||
broadcastOverlay(session: session, match: match)
|
||||
.id(scoreController.score.progressKey())
|
||||
.zIndex(1)
|
||||
}
|
||||
}
|
||||
@@ -75,6 +76,9 @@ struct BroadcastScreen: View {
|
||||
await bootstrap()
|
||||
}
|
||||
.onChange(of: scoreController.score) { _ in updateOverlay() }
|
||||
.onChange(of: scoreController.lastActionError) { message in
|
||||
if let message { snackbarMessage = message }
|
||||
}
|
||||
.onChange(of: broadcastCoordinator.metrics.phase) { _ in updateOverlay() }
|
||||
.alert("Errore", isPresented: Binding(get: { error != nil }, set: { if !$0 { error = nil } })) {
|
||||
Button("OK") { onFinished() }
|
||||
@@ -143,8 +147,10 @@ struct BroadcastScreen: View {
|
||||
if usesActionScoring {
|
||||
scoreController.applyAction("home_point")
|
||||
} else if usesSetScoring {
|
||||
await scoreController.applyBoardAction("home_point")
|
||||
await liveScoreActions(for: match).afterPointChange(score: scoreController.score)
|
||||
let ok = await scoreController.applyBoardAction("home_point")
|
||||
if ok {
|
||||
await liveScoreActions(for: match).afterPointChange(score: scoreController.score)
|
||||
}
|
||||
} else {
|
||||
scoreController.incrementHome()
|
||||
}
|
||||
@@ -155,8 +161,10 @@ struct BroadcastScreen: View {
|
||||
if usesActionScoring {
|
||||
scoreController.applyAction("away_point")
|
||||
} else if usesSetScoring {
|
||||
await scoreController.applyBoardAction("away_point")
|
||||
await liveScoreActions(for: match).afterPointChange(score: scoreController.score)
|
||||
let ok = await scoreController.applyBoardAction("away_point")
|
||||
if ok {
|
||||
await liveScoreActions(for: match).afterPointChange(score: scoreController.score)
|
||||
}
|
||||
} else {
|
||||
scoreController.incrementAway()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user