84d45a6d41
DEBUG-only screenshot support (seeded sample data via ScreenshotSeed, per-screen launch args, screenshot roots for both apps) so iPhone + Apple Watch App Store shots can be captured deterministically from the simulator — all excluded from release builds. Also seed ExerciseView's set-grid progress in init so it renders correctly on the first frame. Adds Scripts/metadata/ as the listing source of truth (copy, URLs, review notes, and the captured screenshots). Claude-Session: https://claude.ai/code/session_018gg69MaUetDNzWzBXisfMV
44 lines
1.5 KiB
Swift
44 lines
1.5 KiB
Swift
#if DEBUG
|
|
import SwiftUI
|
|
import SwiftData
|
|
|
|
/// DEBUG-only root used for App Store screenshot capture. Bypasses the iCloud gate and
|
|
/// renders one fully-formed screen (chosen by `--screen`) against the seeded cache, so
|
|
/// captures are deterministic with no UI automation. Never compiled into release.
|
|
struct ScreenshotRootView: View {
|
|
let services: AppServices
|
|
|
|
private var activeWorkout: Workout? {
|
|
let context = services.container.mainContext
|
|
var descriptor = FetchDescriptor<Workout>(sortBy: [SortDescriptor(\.start, order: .reverse)])
|
|
descriptor.fetchLimit = 25
|
|
let workouts = (try? context.fetch(descriptor)) ?? []
|
|
return workouts.first { $0.status == .inProgress } ?? workouts.first
|
|
}
|
|
|
|
var body: some View {
|
|
content
|
|
.environment(services)
|
|
.environment(services.syncEngine)
|
|
.modelContainer(services.container)
|
|
}
|
|
|
|
@ViewBuilder
|
|
private var content: some View {
|
|
if let workout = activeWorkout {
|
|
switch ScreenshotSeed.screen(default: "workouts") {
|
|
case "exercise":
|
|
let logID = WorkoutDocument(from: workout).logs.first { $0.exerciseName == "Bench Press" }?.id
|
|
NavigationStack { ExerciseView(workout: workout, logID: logID ?? "") }
|
|
case "settings":
|
|
SettingsView()
|
|
default:
|
|
NavigationStack { WorkoutLogListView(workout: workout) }
|
|
}
|
|
} else {
|
|
Color(.systemBackground)
|
|
}
|
|
}
|
|
}
|
|
#endif
|