From 7cfe3eeed5f8690c69ddcb9a39bc27876d6948b8 Mon Sep 17 00:00:00 2001 From: Yusuf Suleman Date: Sat, 4 Apr 2026 11:41:08 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20tap=20widget=20=E2=86=92=20opens=20app?= =?UTF-8?q?=20to=20food=20search?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Widget: .widgetURL(platform://add-food) on all widget sizes App: .onOpenURL handles platform://add-food → switches to Fitness tab and opens the food assistant sheet Co-Authored-By: Claude Opus 4.6 (1M context) --- ios/Platform/Platform/ContentView.swift | 6 ++++++ ios/Platform/PlatformWidget/PlatformWidget.swift | 1 + 2 files changed, 7 insertions(+) diff --git a/ios/Platform/Platform/ContentView.swift b/ios/Platform/Platform/ContentView.swift index e74aa9a..45f320b 100644 --- a/ios/Platform/Platform/ContentView.swift +++ b/ios/Platform/Platform/ContentView.swift @@ -120,6 +120,12 @@ struct MainTabView: View { .sheet(isPresented: $showAssistant) { AssistantSheetView(onFoodAdded: foodAdded) } + .onOpenURL { url in + if url.scheme == "platform" && url.host == "add-food" { + selectedTab = 1 // Fitness tab + showAssistant = true + } + } .task { guard showReader else { return } let renderer = ArticleRenderer.shared diff --git a/ios/Platform/PlatformWidget/PlatformWidget.swift b/ios/Platform/PlatformWidget/PlatformWidget.swift index 2b44ee0..4c7768d 100644 --- a/ios/Platform/PlatformWidget/PlatformWidget.swift +++ b/ios/Platform/PlatformWidget/PlatformWidget.swift @@ -290,6 +290,7 @@ struct PlatformWidget: Widget { var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: CalorieProvider()) { entry in PlatformWidgetEntryView(entry: entry) + .widgetURL(URL(string: "platform://add-food")) .containerBackground(.fill.tertiary, for: .widget) } .configurationDisplayName("Calories")