Skip to content

Commit

Permalink
Visually choose Apple as vendor if none selected
Browse files Browse the repository at this point in the history
  • Loading branch information
halo committed Feb 2, 2024
1 parent 20bffdb commit ab6b101
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion LinkLiar/Views/Settings/Sections/VendorsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ extension SettingsView {
set: { value, _ in toggleVendor(value: value, vendor: vendor) })

Toggle("", isOn: isChosen)

}.width(20)

TableColumn("Name", value: \.name)
Expand Down
10 changes: 3 additions & 7 deletions LinkTools/Config/Vendors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ extension Config {
var dictionary: [String: Any]

var popular: [Vendor] {
// if let chosenVendorIDs = dictionary[Config.Key.vendors.rawValue] as? [String] {
// for vendor in allVendors {
// vendor.isChosen = (chosenVendorIDs.first { $0 == vendor.id } != nil)
// }
// }

PopularVendors.all
}

func isChosen(_ vendor: Vendor) -> Bool {
guard let chosenIDs = dictionary[Config.Key.vendors.rawValue] as? [String] else { return false }
guard let chosenIDs = dictionary[Config.Key.vendors.rawValue] as? [String] else {
return vendor.id == Config.Key.apple.rawValue
}
return chosenIDs.contains(where: { $0 == vendor.id })
}

Expand Down

0 comments on commit ab6b101

Please sign in to comment.