Avoid reusing category thumbnail images in all recipes preview mosaic

Track which recipe IDs are used as category thumbnails and prefer
different images for the all recipes 2x2 mosaic, falling back to
category thumbnails only when not enough other images are available.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-15 07:52:18 +01:00
parent 5307b502e9
commit 151e69ff28
2 changed files with 17 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ import UIKit
@Published var recipeDetails: [Int: RecipeDetail] = [:]
@Published var timers: [String: RecipeTimer] = [:]
@Published var categoryImages: [String: UIImage] = [:]
@Published var categoryImageRecipeIds: Set<Int> = []
@Published var recentRecipes: [Recipe] = []
@Published var categoryAccessDates: [String: Date] = [:]
@Published var manualCategoryOrder: [String] = []
@@ -320,6 +321,7 @@ import UIKit
for recipe in recipes {
if let image = await getImage(id: recipe.recipe_id, size: .THUMB, fetchMode: .preferLocal) {
self.categoryImages[categoryName] = image
self.categoryImageRecipeIds.insert(recipe.recipe_id)
return
}
}