2.0: weekly shopping list from planned dishes

- ShoppingItem model (per-week lines; dish-derived or free-text) + schema.
- ShoppingListService.reconcile mirrors planned dishes' ingredients into the
  list, preserving check-off state and user items; plain-text export helper.
- ShoppingListView: grouped by dish, check-off, swipe-delete, free-text adds,
  clear-checked, ShareLink export, and inline on-device "Generate" for planned
  dishes without ingredients (paywall after 3 free generations,
  source=ingredient_generation).
- Home toolbar: cart entry point (all users) + sheet.
- Analytics: shopping_list_opened, shopping_item_added, ingredients_generated.
- Localized 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:
alexandrev-tibco
2026-07-12 17:47:41 +02:00
parent a5c304e209
commit ce88d7b265
14 changed files with 513 additions and 1 deletions
+16
View File
@@ -24,6 +24,7 @@ struct HomeView: View {
@State private var weekPickerDate: Date = Date()
@State private var showCopyPreviousConfirm: Bool = false
@State private var copyPreviousSource: String = "menu"
@State private var showShoppingList: Bool = false
@State private var showReviewSentimentPrompt: Bool = false
@State private var showReviewSupportPrompt: Bool = false
@State private var showPostOnboardingAutoAssignPrompt: Bool = false
@@ -68,6 +69,14 @@ struct HomeView: View {
.foregroundColor(.mealMoodTextPrimary)
}
Button {
showShoppingList = true
} label: {
Image(systemName: "cart")
.foregroundColor(.mealMoodTextPrimary)
}
.accessibilityLabel(Text("shopping_list_title"))
if settings?.isPremium == true {
Button {
showStats = true
@@ -521,6 +530,13 @@ struct HomeView: View {
.sheet(isPresented: $showStats) {
StatsView(weekPlans: weekPlans, allDishes: dishes, allTags: tags, language: settings.languageEnum.resolved())
}
.sheet(isPresented: $showShoppingList) {
ShoppingListView(
weekStartDate: viewModel.currentWeekStart,
plan: plan,
settings: settings
)
}
.task {
// Permission is now requested contextually (onboarding Week Ready step or
// the Settings toggle) no cold OS prompt on first Home load.