Skip to content

Commit b40cb3c

Browse files
committed
add missing srguments, be consistent with imageUrl case
1 parent b40a220 commit b40cb3c

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Loop/Models/OpenFoodFactsModels.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,16 +419,16 @@ extension OpenFoodFactsProduct {
419419
}
420420

421421
// Simplified initializer for programmatic creation
422-
init(id: String, productName: String, brands: String, nutriments: Nutriments, servingSize: String, imageURL: String?) {
422+
init(id: String, productName: String, brands: String, nutriments: Nutriments, servingSize: String, imageUrl: String?) {
423423
self.id = id
424424
self.productName = productName
425425
self.brands = brands
426426
self.categories = nil
427427
self.nutriments = nutriments
428428
self.servingSize = servingSize
429429
self.servingQuantity = 100.0
430-
self.imageUrl = imageURL
431-
self.imageFrontUrl = imageURL
430+
self.imageUrl = imageUrl
431+
self.imageFrontUrl = imageUrl
432432
self.code = nil
433433
}
434434
}

Loop/Services/FoodSearchRouter.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ class FoodSearchRouter {
243243
brands: "Claude AI Analysis",
244244
nutriments: nutriments,
245245
servingSize: result.foodItemsDetailed.first?.portionEstimate ?? "1 serving",
246-
imageURL: nil
246+
servingQuantity: nil,
247+
imageUrl: nil,
248+
imageFrontUrl: nil,
249+
code: nil
247250
)
248251

249252
return [placeholderProduct]

Loop/Views/CarbEntryView.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ struct CarbEntryView: View, HorizontalSizeClassOverride {
231231
.frame(width: 120, height: 90)
232232
.clipped()
233233
.cornerRadius(12)
234-
} else if let imageURL = selectedFood.imageFrontUrl ?? selectedFood.imageUrl, !imageURL.isEmpty {
234+
} else if let imageUrl = selectedFood.imageFrontUrl ?? selectedFood.imageUrl, !imageUrl.isEmpty {
235235
// Show barcode product image from URL
236-
AsyncImage(url: URL(string: imageURL)) { image in
236+
AsyncImage(url: URL(string: imageUrl)) { image in
237237
image
238238
.resizable()
239239
.aspectRatio(contentMode: .fill)
@@ -1151,7 +1151,7 @@ struct QuickSearchSuggestions: View {
11511151

11521152
/// Product image view for displaying scanned product photos
11531153
struct ProductImageView: View {
1154-
let imageURL: String
1154+
let imageUrl: String
11551155
let productName: String
11561156

11571157
@State private var isLoading = true
@@ -1177,7 +1177,7 @@ struct ProductImageView: View {
11771177
}
11781178
} else {
11791179
// Async image loading
1180-
AsyncImage(url: URL(string: imageURL)) { image in
1180+
AsyncImage(url: URL(string: imageUrl)) { image in
11811181
image
11821182
.resizable()
11831183
.aspectRatio(contentMode: .fill)
@@ -1203,7 +1203,7 @@ struct ProductImageView: View {
12031203
isLoading = true
12041204
loadError = false
12051205
}
1206-
.onChange(of: imageURL) { _ in
1206+
.onChange(of: imageUrl) { _ in
12071207
isLoading = true
12081208
loadError = false
12091209
}

0 commit comments

Comments
 (0)