Skip to content

Commit

Permalink
fix pepper icon
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonCat4012 committed Oct 8, 2024
1 parent 460258c commit 2348fd9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions VGApp/Util/IconManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ let icons: [String: Image] = [
"avocado": Image("avocado"),
"banana": Image("banana"),
"brocolli": Image("brocolli"),
"pepper": Image("pepper"),
"pepper_sharp": Image("pepper 1"),
"pepper_sharp": Image("pepper"),
"pepper": Image("pepper 1"),
"cherry": Image("cherry"),
"lemon": Image("lemon"),
"grapes": Image("grapes"),
Expand All @@ -41,7 +41,6 @@ let names: [String: [String]] = [
"orange": ["orange", "orangen"],
"pepper_sharp": ["paprikasspitz", "paprikaspitz"],
"pepper": ["paprika", "paprikas"],

"pear": ["birne", "birnen"],
"strawberry": ["erdbeere", "erdbeeren"],
"tomato": ["tomate", "tomaten"],
Expand All @@ -53,11 +52,15 @@ let names: [String: [String]] = [

struct IconManager {
static func getIcon(_ str: String) -> Image {
var query = str.lowercased().replacingOccurrences(of: " ", with: "")
var img = Image(systemName: "questionmark.diamond")

names.forEach { entry in
entry.value.forEach { val in
if str.lowercased().replacingOccurrences(of: " ", with: "").contains(val) {
if query == val {
guard let icon = icons[entry.key] else { return }
img = icon
} else if query.contains(val) {
guard let icon = icons[entry.key] else { return }
img = icon
}
Expand Down

0 comments on commit 2348fd9

Please sign in to comment.