Fix initial country filters (#771)
- iOS: skip filter to speed up selection of another country - macOS: initial country filter was lost due to category/country chaining
This commit is contained in:
parent
92cf1985e2
commit
d60ab97922
|
@ -52,15 +52,21 @@ struct VPNFiltersView: View {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
.onChange(of: model.filters.categoryName) { _ in
|
||||
model.filters.countryCode = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension VPNFiltersView {
|
||||
var categoryNameBinding: Binding<String?> {
|
||||
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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue