feat: tap widget → opens app to food search
All checks were successful
Security Checks / secret-scanning (push) Successful in 3s
Security Checks / dockerfile-lint (push) Successful in 4s
Security Checks / dependency-audit (push) Successful in 13s

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) <noreply@anthropic.com>
This commit is contained in:
Yusuf Suleman
2026-04-04 11:41:08 -05:00
parent 3002c1f59d
commit 7cfe3eeed5
2 changed files with 7 additions and 0 deletions

View File

@@ -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

View File

@@ -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")