Sincronizza overlay video con punteggio dalla regia remota.

L'iPad accetta gli aggiornamenti ActionCable della regia, evita race con risposte API obsolete e ridisegna subito il tabellone sullo stream RTMP.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Emiliano Frascaro
2026-06-20 12:37:46 +02:00
parent 270bf680a4
commit c92099a41b
4 changed files with 94 additions and 20 deletions

View File

@@ -81,4 +81,24 @@ final class ScoreControllerTests: XCTestCase {
q2.awayPoints = 8
XCTAssertGreaterThan(q2.progressKey(), q1.progressKey())
}
func testCableRemoteCancelsStaleLocalSync() {
let controller = ScoreController(
scoreRepository: ScoreRepository(api: MatchLiveAPI()),
sessionCable: SessionCableService()
)
var local = ScoreState(boardType: "basket", period: 1, periodLabel: "Q1")
local.homePoints = 5
local.awayPoints = 4
controller.bind(sessionId: "session-1", initial: local)
controller.applyAction("home_point")
var remote = ScoreState(boardType: "basket", period: 1, periodLabel: "Q1")
remote.homePoints = 6
remote.awayPoints = 7
controller.applyRemote(remote, source: .cable)
XCTAssertEqual(controller.score.homePoints, 6)
XCTAssertEqual(controller.score.awayPoints, 7)
}
}