Add game center, per-model shuffle, audio focus fixes, README, tests
- README.md with build/architecture overview - Game Center screen with at-bat timeline, pitch sequence, spray chart, and strike zone component views - VideoShuffle service: per-model bucketed random selection with no-back-to-back guarantee; replaces flat shuffle-bag approach - Refresh JWT token for authenticated NSFW feed; add josie-hamming-2 and dani-speegle-2 to the user list - MultiStreamView audio focus: remove redundant isMuted writes during startStream and playNextWerkoutClip so audio stops ducking during clip transitions; gate AVAudioSession.setCategory(.playback) behind a one-shot flag - GamesViewModel.attachPlayer: skip mute recalculation when the same player is re-attached (prevents toggle flicker on item replace) - mlbTVOSTests target wired through project.yml with GENERATE_INFOPLIST_FILE; VideoShuffleTests covers groupByModel, pickRandomFromBuckets, real-distribution no-back-to-back invariant, and uniform model distribution over 6000 picks Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
68
mlbTVOS/Views/Components/PitchSequenceView.swift
Normal file
68
mlbTVOS/Views/Components/PitchSequenceView.swift
Normal file
@@ -0,0 +1,68 @@
|
||||
import SwiftUI
|
||||
|
||||
struct PitchSequenceView: View {
|
||||
let pitches: [LiveFeedPlayEvent]
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Text("PITCH SEQUENCE")
|
||||
.font(.system(size: 12, weight: .bold, design: .rounded))
|
||||
.foregroundStyle(.white.opacity(0.5))
|
||||
.kerning(1.2)
|
||||
|
||||
ForEach(Array(pitches.enumerated()), id: \.offset) { index, pitch in
|
||||
HStack(spacing: 10) {
|
||||
Text("#\(pitch.pitchNumber ?? (index + 1))")
|
||||
.font(.system(size: 13, weight: .bold, design: .rounded))
|
||||
.foregroundStyle(.white.opacity(0.5))
|
||||
.frame(width: 28, alignment: .leading)
|
||||
|
||||
Text(pitch.pitchTypeDescription)
|
||||
.font(.system(size: 14, weight: .semibold, design: .rounded))
|
||||
.foregroundStyle(.white)
|
||||
.lineLimit(1)
|
||||
|
||||
Spacer()
|
||||
|
||||
if let speed = pitch.speedMPH {
|
||||
Text("\(speed, specifier: "%.1f") mph")
|
||||
.font(.system(size: 13, weight: .medium).monospacedDigit())
|
||||
.foregroundStyle(.white.opacity(0.7))
|
||||
}
|
||||
|
||||
pitchResultPill(code: pitch.callCode, description: pitch.callDescription)
|
||||
}
|
||||
.padding(.vertical, 4)
|
||||
.padding(.horizontal, 8)
|
||||
.background(
|
||||
index == pitches.count - 1
|
||||
? RoundedRectangle(cornerRadius: 8, style: .continuous).fill(.white.opacity(0.06))
|
||||
: RoundedRectangle(cornerRadius: 8, style: .continuous).fill(.clear)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func pitchResultPill(code: String, description: String) -> some View {
|
||||
let color = pitchCallColor(code)
|
||||
let label: String
|
||||
switch code {
|
||||
case "B": label = "Ball"
|
||||
case "C": label = "Called Strike"
|
||||
case "S": label = "Swinging Strike"
|
||||
case "F": label = "Foul"
|
||||
case "X": label = "In Play"
|
||||
case "D": label = "In Play (Out)"
|
||||
case "E": label = "In Play (Error)"
|
||||
default: label = description
|
||||
}
|
||||
|
||||
return Text(label)
|
||||
.font(.system(size: 11, weight: .bold, design: .rounded))
|
||||
.foregroundStyle(color)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 4)
|
||||
.background(color.opacity(0.15))
|
||||
.clipShape(Capsule())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user