c0b485387d
- Target MealMoodWatch (watchOS 10, SwiftUI): vista de hoy y de la semana en TabView vertical; recibe el snapshot del iPhone por WatchConnectivity (updateApplicationContext) y lo guarda en su app group para la complicacion - Target MealMoodWatchWidget: complicacion accessoryRectangular/ Circular/Inline con las comidas de hoy (heuristica comida/cena por hora); icono del watch generado desde el logo - WatchWeekPayload compartido entre iOS app, widget iOS, watch app y complicacion — llega ya localizado desde el iPhone - Widget iOS nuevo "Semana" (systemMedium/Large) con los 7 dias; el widget de hoy pasa a WidgetBundle - Targets creados via gema xcodeproj (sin abrir Xcode); embed del watch antes del script de Crashlytics para evitar ciclo de build Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013H6bXqGX1ygwib1Dm3n3UG
55 lines
1.9 KiB
Swift
55 lines
1.9 KiB
Swift
import SwiftUI
|
|
|
|
struct TodayView: View {
|
|
@EnvironmentObject private var store: WatchWeekStore
|
|
|
|
private var today: WatchWeekPayload.Day? {
|
|
store.payload?.days.first(where: \.isToday)
|
|
}
|
|
|
|
var body: some View {
|
|
ScrollView {
|
|
VStack(alignment: .leading, spacing: 8) {
|
|
if let today {
|
|
Text(today.title)
|
|
.font(.headline)
|
|
.foregroundStyle(Color(red: 1.0, green: 0.45, blue: 0.35))
|
|
|
|
ForEach(Array(today.meals.enumerated()), id: \.offset) { _, meal in
|
|
VStack(alignment: .leading, spacing: 2) {
|
|
Label(meal.label, systemImage: WatchWeekPayload.icon(for: meal.type))
|
|
.font(.caption2)
|
|
.foregroundStyle(.secondary)
|
|
Text(meal.name ?? "—")
|
|
.font(.body.weight(.medium))
|
|
.lineLimit(2)
|
|
}
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.padding(8)
|
|
.background(.quaternary.opacity(0.5), in: RoundedRectangle(cornerRadius: 8))
|
|
}
|
|
} else {
|
|
EmptySyncView()
|
|
}
|
|
}
|
|
}
|
|
.navigationTitle("MealMood")
|
|
}
|
|
}
|
|
|
|
struct EmptySyncView: View {
|
|
var body: some View {
|
|
VStack(spacing: 8) {
|
|
Image(systemName: "iphone.and.arrow.forward")
|
|
.font(.title3)
|
|
.foregroundStyle(.secondary)
|
|
// The payload arrives fully localized from the iPhone; the watch
|
|
// bundle carries no strings of its own, so this stays neutral.
|
|
Text(verbatim: "MealMood")
|
|
.font(.caption2)
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
.padding(.top, 20)
|
|
}
|
|
}
|