Skip to content

Commit

Permalink
Bring back vendors list
Browse files Browse the repository at this point in the history
  • Loading branch information
halo committed Jan 6, 2024
1 parent 71b1e33 commit 60771ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion LinkLiar/Views/Settings/Sections/VendorsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extension SettingsView {
VStack {
Table(state.config.vendors.popularMarked) {

TableColumn("Active") { vendor in
TableColumn("On") { vendor in
let isChosen = Binding<Bool>(
get: { vendor.isChosen },
set: { value, _ in toggleVendor(value: value, vendor: vendor) })
Expand Down
7 changes: 4 additions & 3 deletions LinkTools/Config/Vendors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ extension Config {

var popularMarked: [Vendor] {
let allVendors = PopularVendors.all
guard let chosenVendorIDs = dictionary[Config.Key.vendors.rawValue] as? [String] else { return [] }

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

return allVendors
Expand Down

0 comments on commit 60771ee

Please sign in to comment.