2.0: breakfast and snack meal types across the app
- MealType gains breakfast/snack (chronological order drives slot/row order). - AppSettings.activeMealTypes: single source of truth for enabled meals, backed by new optional enabledMealTypesRaw with legacy mealWindows fallback — additive migration, keeps pre-2.0 installs and iCloud snapshots working. Legacy field kept coherent by the setter. time(for:) resolves per-meal event times (breakfast 8:00 / snack 17:00 defaults on old stores). - Replaced the 5 duplicated mealWindows→[MealType] derivations (slot sync, default plan creation, week calendar, export view) with activeMealTypes. - CalendarService: per-type event names and times. - Export styles: per-type accent colors and gradients. - Widget: generic meals list (N rows) instead of hardcoded lunch/dinner; compact families fall back to main meals when >2 are active. - Settings: 4 meal toggles (min 1) replace the 3-option picker. - Onboarding: meal step is now multi-select over the 4 types. - iCloud sync: enabledMealTypesRaw synced (optional, pre-2.0 compatible). - Localized breakfast/snack in all 6 languages. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BkanrydYtrme8wipTzWssG
This commit is contained in:
@@ -59,6 +59,7 @@ final class ICloudSyncService {
|
||||
settings: settings.map {
|
||||
SettingsPayload(
|
||||
mealWindows: $0.mealWindows,
|
||||
enabledMealTypesRaw: $0.enabledMealTypesRaw,
|
||||
includeWeekends: $0.includeWeekends,
|
||||
language: $0.language,
|
||||
calendarId: $0.calendarId,
|
||||
@@ -141,6 +142,7 @@ final class ICloudSyncService {
|
||||
if let settingsPayload = snapshot.settings {
|
||||
let settings = AppSettings()
|
||||
settings.mealWindows = settingsPayload.mealWindows
|
||||
settings.enabledMealTypesRaw = settingsPayload.enabledMealTypesRaw
|
||||
settings.includeWeekends = settingsPayload.includeWeekends
|
||||
settings.language = settingsPayload.language
|
||||
settings.calendarId = settingsPayload.calendarId
|
||||
@@ -227,6 +229,8 @@ private struct SyncSnapshot: Codable {
|
||||
|
||||
private struct SettingsPayload: Codable {
|
||||
let mealWindows: String
|
||||
// Optional for backward-compatibility with pre-2.0 snapshots.
|
||||
let enabledMealTypesRaw: String?
|
||||
let includeWeekends: Bool
|
||||
let language: String
|
||||
let calendarId: String?
|
||||
|
||||
Reference in New Issue
Block a user