songyc macbook 06d13b2f3d feat(keging): 준비 시간(0~10초, 기본 3초) — 시작 버튼 후 카운트다운 뒤 첫 수축
- KegelPhase에 prepare 국면 추가(무진동 — 첫 수축 진동이 시작 신호), 준비 0초면 즉시 수축
- 세팅에 '준비' 스테퍼(0~10초), 워치 자동 동기화, 구버전 설정 decodeIfPresent 보존
- 진행 화면: 준비=회그린 원이 작게 시작해 천천히 부풀며 첫 수축으로 연결(기존 그래픽 문법 유지),
  진행 링 0·카운터 색 연동. 워치·Live Activity도 준비 국면 색/표시 대응
- 기록·건강의 시작 시각은 준비를 뺀 첫 수축 기준. Live Activity는 sync 단일 진입점으로 정리
- 도움말·세팅 푸터 문구 갱신, 신규 문자열 번역(en/ja)·stale 정리 — 전 카탈로그 0/0
- 검증: Debug·Release·워치 빌드 그린, 준비→수축 전환·세팅 화면 QA

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UPmp29DQHY6Ahfss5SRopT
2026-08-29 20:55:10 +09:00

120 lines
3.9 KiB
Swift

//
// ContentView.swift
// KegingWatch Watch App
//
// .
// /· · .
//
import SwiftUI
struct WatchContentView: View {
@EnvironmentObject private var engine: KegelEngine
var body: some View {
ZStack {
AppTheme.background.ignoresSafeArea()
switch engine.state {
case .idle:
startScreen
case let .running(phase, rep, phaseStart, phaseEnd):
runningScreen(phase: phase, rep: rep, phaseStart: phaseStart, phaseEnd: phaseEnd)
case let .finished(reps):
finishedScreen(reps: reps)
}
}
.onAppear {
#if DEBUG
if CommandLine.arguments.contains("-autoStart") { WatchCoordinator.shared.startWorkout() }
#endif
}
}
private var startScreen: some View {
VStack(spacing: 8) {
Button {
WatchCoordinator.shared.startWorkout()
} label: {
ZStack {
Circle()
.fill(
LinearGradient(
colors: [AppTheme.green, AppTheme.green.opacity(0.8)],
startPoint: .top, endPoint: .bottom
)
)
VStack(spacing: 2) {
Image(systemName: "play.fill").font(.title3)
Text("시작").font(.headline)
}
.foregroundStyle(Color(hex: "#0F2018"))
}
.frame(width: 108, height: 108)
}
.buttonStyle(.plain)
.accessibilityLabel(Text("케겔 운동 시작"))
Text(SettingsStore.shared.config.summaryText)
.font(.system(size: 11))
.foregroundStyle(.secondary)
.lineLimit(1)
.minimumScaleFactor(0.7)
}
}
private func runningScreen(phase: KegelPhase, rep: Int, phaseStart: Date, phaseEnd: Date) -> some View {
VStack(spacing: 3) {
Text(phase.label)
.font(.title3.bold())
.foregroundStyle(phaseColor(phase))
Text(timerInterval: phaseStart...phaseEnd, countsDown: true)
.font(.system(size: 30, weight: .semibold))
.monospacedDigit()
.multilineTextAlignment(.center)
Text("\(rep) / \(engine.config.reps)")
.font(.footnote)
.monospacedDigit()
.foregroundStyle(.secondary)
.accessibilityLabel(Text("현재 \(rep)번째, 전체 \(engine.config.reps)"))
Button {
WatchCoordinator.shared.stopWorkout()
} label: {
Text("중단")
.font(.footnote)
}
.buttonStyle(.bordered)
.tint(.red)
.padding(.top, 2)
}
}
private func phaseColor(_ phase: KegelPhase) -> Color {
switch phase {
case .prepare: .gray
case .contract: AppTheme.green
case .relax: AppTheme.yellow
}
}
private func finishedScreen(reps: Int) -> some View {
VStack(spacing: 6) {
Image(systemName: "checkmark.circle.fill")
.font(.system(size: 34))
.foregroundStyle(AppTheme.green)
Text("완료!")
.font(.headline)
Text("\(reps)회 완주")
.font(.footnote)
.foregroundStyle(.secondary)
Button {
engine.acknowledgeFinish()
} label: {
Text("확인")
.font(.footnote)
}
.buttonStyle(.bordered)
.padding(.top, 2)
}
}
}