diff --git a/Passepartout/Library/Sources/AppUI/Views/Provider/VPNFiltersView.swift b/Passepartout/Library/Sources/AppUI/Views/Provider/VPNFiltersView.swift index 2c0a1567..aab44d2a 100644 --- a/Passepartout/Library/Sources/AppUI/Views/Provider/VPNFiltersView.swift +++ b/Passepartout/Library/Sources/AppUI/Views/Provider/VPNFiltersView.swift @@ -52,15 +52,21 @@ struct VPNFiltersView: View { #endif } } - .onChange(of: model.filters.categoryName) { _ in - model.filters.countryCode = nil - } } } private extension VPNFiltersView { + var categoryNameBinding: Binding { + Binding { + model.filters.categoryName + } set: { + model.filters.categoryName = $0 + model.filters.countryCode = nil + } + } + var categoryPicker: some View { - Picker(Strings.Global.category, selection: $model.filters.categoryName) { + Picker(Strings.Global.category, selection: categoryNameBinding) { Text(Strings.Global.any) .tag(nil as String?) ForEach(model.categories, id: \.self) { diff --git a/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerView.swift b/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerView.swift index 3bfe3197..48aedd52 100644 --- a/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerView.swift +++ b/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerView.swift @@ -81,7 +81,12 @@ extension VPNProviderServerView { guard let selectedEntity, filtersWithSelection else { return nil } - return VPNFilters(with: selectedEntity.server.provider) + var filters = VPNFilters() + filters.categoryName = selectedEntity.server.provider.categoryName +#if os(macOS) + filters.countryCode = selectedEntity.server.provider.countryCode +#endif + return filters }(), selectTitle: selectTitle, onSelect: onSelect,