Add meal plan feature with cross-device sync and automatic stale data cleanup
Introduces weekly meal planning with a calendar-based tab view, per-recipe date assignments synced via Nextcloud Cookbook custom metadata, and 30-day automatic pruning of old entries on load, save, and sync merge. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -56,7 +56,8 @@ Additional ViewModels exist as nested classes within their views (`RecipeTabView
|
||||
```
|
||||
SwiftUI Views
|
||||
├── @EnvironmentObject appState: AppState
|
||||
├── @EnvironmentObject groceryList: GroceryList
|
||||
├── @EnvironmentObject groceryList: GroceryListManager
|
||||
├── @EnvironmentObject mealPlan: MealPlanManager
|
||||
└── Per-view @StateObject ViewModels
|
||||
│
|
||||
▼
|
||||
@@ -66,6 +67,8 @@ AppState
|
||||
└── UserSettings.shared (UserDefaults singleton)
|
||||
```
|
||||
|
||||
Both `GroceryListManager` and `MealPlanManager` use custom metadata fields (`_groceryState`, `_mealPlanAssignment`) embedded in recipe JSON on the Nextcloud Cookbook API for cross-device sync. Each has a dedicated sync manager (`GroceryStateSyncManager`, `MealPlanSyncManager`) that handles debounced push, pull reconciliation, and per-item/per-date last-writer-wins merge.
|
||||
|
||||
### Network Layer
|
||||
|
||||
- `CookbookApi` protocol defines all endpoints; `CookbookApiV1` is the concrete implementation with all `static` methods.
|
||||
@@ -83,11 +86,11 @@ AppState
|
||||
|
||||
```
|
||||
Nextcloud Cookbook iOS Client/
|
||||
├── Data/ # Models (Category, Recipe, RecipeDetail, Nutrition) + DataStore + UserSettings
|
||||
├── Data/ # Models (Category, Recipe, RecipeDetail, Nutrition) + DataStore + UserSettings + MealPlan + GroceryList
|
||||
├── Models/ # RecipeEditViewModel
|
||||
├── Network/ # ApiRequest, NetworkError, CookbookApi protocol + V1, NextcloudApi
|
||||
├── Views/
|
||||
│ ├── Tabs/ # Main tab views (RecipeTab, SearchTab, GroceryListTab)
|
||||
│ ├── Tabs/ # Main tab views (RecipeTab, SearchTab, MealPlanTab, GroceryListTab)
|
||||
│ ├── Recipes/ # Recipe detail, list, card, share, timer views
|
||||
│ ├── RecipeViewSections/ # Decomposed recipe detail sections (ingredients, instructions, etc.)
|
||||
│ ├── Onboarding/ # Login flows (V2LoginView, TokenLoginView)
|
||||
|
||||
Reference in New Issue
Block a user