Skip to content

Commit 4e9b9ff

Browse files
FoodFinder: increase maxFoodTypeLength from 20 to 50
The 20-char limit was truncating food names (e.g. "Baked pastry with f…") which made them unreadable in LoopInsights Meal Insights. The RowEmojiTextField maxLength only restricts keyboard input, so longer programmatic values are safe. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent abf9319 commit 4e9b9ff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Loop/View Models/FoodFinder/FoodFinder_SearchViewModel.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ final class FoodFinder_SearchViewModel: ObservableObject {
298298
}
299299

300300
// Determine food type from the AI result (truncate to fit RowEmojiTextField maxLength)
301-
let maxFoodTypeLength = 20
301+
let maxFoodTypeLength = 50
302302
let foodType: String = {
303303
let names = included.map { $0.name }
304304
let raw: String
@@ -857,7 +857,7 @@ final class FoodFinder_SearchViewModel: ObservableObject {
857857
downloadProductThumbnail(for: product)
858858

859859
// Populate food type (truncate to 20 chars to fit RowEmojiTextField maxLength)
860-
let maxFoodTypeLength = 20
860+
let maxFoodTypeLength = 50
861861
let foodType: String
862862
if product.displayName.count > maxFoodTypeLength {
863863
let truncatedName = String(product.displayName.prefix(maxFoodTypeLength - 1)) + ""
@@ -989,7 +989,7 @@ final class FoodFinder_SearchViewModel: ObservableObject {
989989
#endif
990990

991991
// Determine food type from the selected product
992-
let maxFoodTypeLength = 20
992+
let maxFoodTypeLength = 50
993993
let foodType: String
994994
if selectedFood.displayName.count > maxFoodTypeLength {
995995
foodType = String(selectedFood.displayName.prefix(maxFoodTypeLength - 1)) + ""
@@ -1315,7 +1315,7 @@ final class FoodFinder_SearchViewModel: ObservableObject {
13151315
lastAIAnalysisResult = currentResult
13161316

13171317
// Determine food type (truncate to fit RowEmojiTextField maxLength)
1318-
let maxFoodTypeLength = 20
1318+
let maxFoodTypeLength = 50
13191319
let foodNames = currentResult.foodItemsDetailed.map { $0.name }
13201320
let foodType: String
13211321
let rawFoodType: String

0 commit comments

Comments
 (0)