commit d0f776b69a7f9c80c8b678b581160c2b8dda6b1c
parent 6547352f9bb61891576f36f9f031b71f2d99f031
Author: Michael Camilleri <[email protected]>
Date: Sat, 9 May 2026 00:00:45 +0900
Disable author tinting for local games
Diffstat:
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/Crossmate/Views/GridView.swift b/Crossmate/Views/GridView.swift
@@ -2,24 +2,20 @@ import SwiftUI
struct GridView: View {
@Bindable var session: PlayerSession
- var roster: PlayerRoster? = nil
+ let roster: PlayerRoster
+ let showsSharedAnnotations: Bool
private let spacing: CGFloat = 1
var body: some View {
let width = session.puzzle.width
let height = session.puzzle.height
- // Index remote selections by cell so each CellView only receives the
- // value it needs. Multiple peers landing on the same cell collapse
- // to the most recent.
- let (outlineByCell, tintByCell) = remoteOverlays()
- // In shared games, faintly tint each cell's background by its
- // letter's author. Single-player games (`roster == nil`) skip this.
- let authorTintByID: [String: Color] = roster.map { roster in
- Dictionary(
+ let (outlineByCell, tintByCell) = showsSharedAnnotations ? remoteOverlays() : ([:], [:])
+ let authorTintByID: [String: Color] = showsSharedAnnotations
+ ? Dictionary(
uniqueKeysWithValues: roster.entries.map { ($0.authorID, $0.color.tint) }
)
- } ?? [:]
+ : [:]
let relatedCells = session.puzzle.relatedCells(
atRow: session.selectedRow,
col: session.selectedCol,
@@ -66,7 +62,6 @@ struct GridView: View {
outline: [GridPosition: Color],
tint: [GridPosition: Color]
) {
- guard let roster else { return ([:], [:]) }
var outline: [GridPosition: (Date, Color)] = [:]
var tint: [GridPosition: (Date, Color)] = [:]
for (_, sel) in roster.remoteSelections {
diff --git a/Crossmate/Views/PuzzleView.swift b/Crossmate/Views/PuzzleView.swift
@@ -232,7 +232,11 @@ struct PuzzleView: View {
ZStack {
VStack(spacing: 4) {
PuzzleTitle(title: titleParts.title, subtitle: titleParts.subtitle)
- GridView(session: session, roster: roster)
+ GridView(
+ session: session,
+ roster: roster,
+ showsSharedAnnotations: session.mutator.isShared
+ )
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.padding(.top, -8)