diff --git a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 9ae5e71f..3f2d97bd 100644 --- a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -41,7 +41,7 @@ "kind" : "remoteSourceControl", "location" : "git@github.com:passepartoutvpn/passepartoutkit-source", "state" : { - "revision" : "079fb0e57cecfc2ed128ae9bf8614fcf3c2a6582" + "revision" : "a0cb540f739c58d04756d15b9a7bb21fae52c95f" } }, { diff --git a/Passepartout/Library/Package.swift b/Passepartout/Library/Package.swift index 306d0546..6f574e3c 100644 --- a/Passepartout/Library/Package.swift +++ b/Passepartout/Library/Package.swift @@ -28,7 +28,7 @@ let package = Package( ], dependencies: [ // .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.9.0"), - .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "079fb0e57cecfc2ed128ae9bf8614fcf3c2a6582"), + .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "a0cb540f739c58d04756d15b9a7bb21fae52c95f"), // .package(path: "../../../passepartoutkit-source"), .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", from: "0.9.1"), // .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "031863a1cd683962a7dfe68e20b91fa820a1ecce"), diff --git a/Passepartout/Library/Sources/AppUI/Views/Modules/Extensions/OpenVPNModule+Extensions.swift b/Passepartout/Library/Sources/AppUI/Views/Modules/Extensions/OpenVPNModule+Extensions.swift index 953f812d..d02dbdd7 100644 --- a/Passepartout/Library/Sources/AppUI/Views/Modules/Extensions/OpenVPNModule+Extensions.swift +++ b/Passepartout/Library/Sources/AppUI/Views/Modules/Extensions/OpenVPNModule+Extensions.swift @@ -49,8 +49,15 @@ extension OpenVPNModule: ProviderEntityViewProviding { with provider: ModuleMetadata.Provider, onSelect: @escaping (any ProviderEntity & Encodable) async throws -> Void ) -> some View { - VPNProviderServerCoordinator( + let selectedEntity: VPNEntity? = try? provider + .entity + .map { + try providerEntity(from: $0) + } + + return VPNProviderServerCoordinator( providerId: provider.id, + selectedEntity: selectedEntity, onSelect: onSelect ) } diff --git a/Passepartout/Library/Sources/AppUI/Views/Modules/OpenVPNView.swift b/Passepartout/Library/Sources/AppUI/Views/Modules/OpenVPNView.swift index 2a6df1bd..e89b134c 100644 --- a/Passepartout/Library/Sources/AppUI/Views/Modules/OpenVPNView.swift +++ b/Passepartout/Library/Sources/AppUI/Views/Modules/OpenVPNView.swift @@ -131,6 +131,7 @@ private extension OpenVPNView { providerId: $0, configurationType: OpenVPN.Configuration.self, selectedEntity: providerEntity.wrappedValue, + filtersWithSelection: true, onSelect: onSelectServer ) } diff --git a/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerCoordinator.swift b/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerCoordinator.swift index 2db55d9c..221655f8 100644 --- a/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerCoordinator.swift +++ b/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerCoordinator.swift @@ -34,6 +34,8 @@ struct VPNProviderServerCoordinator: View where Configuration: Pr let providerId: ProviderID + let selectedEntity: VPNEntity? + let onSelect: (VPNEntity) async throws -> Void @StateObject @@ -44,7 +46,8 @@ struct VPNProviderServerCoordinator: View where Configuration: Pr VPNProviderServerView( providerId: providerId, configurationType: Configuration.self, - selectedEntity: nil, + selectedEntity: selectedEntity, + filtersWithSelection: false, onSelect: onSelect ) .toolbar { diff --git a/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerView.swift b/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerView.swift index b3a8c5a5..c30cc9a4 100644 --- a/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerView.swift +++ b/Passepartout/Library/Sources/AppUI/Views/Provider/VPNProviderServerView.swift @@ -41,6 +41,8 @@ struct VPNProviderServerView: View where Configuration: ProviderC let selectedEntity: VPNEntity? + let filtersWithSelection: Bool + let onSelect: (_ server: VPNServer, _ preset: VPNPreset) -> Void @StateObject @@ -74,7 +76,7 @@ struct VPNProviderServerView: View where Configuration: ProviderC for: providerId, configurationType: Configuration.self ) - if let selectedEntity { + if let selectedEntity, filtersWithSelection { filters = VPNFilters(with: selectedEntity.server.provider) } else { filters = VPNFilters() @@ -122,6 +124,7 @@ extension VPNProviderServerView { providerId: .protonvpn, configurationType: OpenVPN.Configuration.self, selectedEntity: nil, + filtersWithSelection: false, onSelect: { _, _ in } ) } diff --git a/Passepartout/Library/Sources/AppUI/Views/Provider/macOS/VPNProviderServerView+macOS.swift b/Passepartout/Library/Sources/AppUI/Views/Provider/macOS/VPNProviderServerView+macOS.swift index 6ce6633a..c9cbc4a6 100644 --- a/Passepartout/Library/Sources/AppUI/Views/Provider/macOS/VPNProviderServerView+macOS.swift +++ b/Passepartout/Library/Sources/AppUI/Views/Provider/macOS/VPNProviderServerView+macOS.swift @@ -57,7 +57,7 @@ private extension VPNProviderServerView.Subview { ThemeImage(.marked) .opacity(server.id == selectedServer?.id ? 1.0 : 0.0) } - .width(max: 20.0) + .width(10.0) TableColumn(Strings.Global.region) { server in HStack { @@ -65,7 +65,6 @@ private extension VPNProviderServerView.Subview { Text(server.region) } } - .width(max: 200.0) TableColumn(Strings.Global.address, value: \.address) @@ -76,7 +75,6 @@ private extension VPNProviderServerView.Subview { Text(Strings.Views.Provider.selectServer) } } - .width(min: 100.0, max: 100.0) } .disabled(manager.isFiltering) } @@ -99,6 +97,7 @@ private extension VPNProviderServerView.Subview { providerId: .tunnelbear, configurationType: OpenVPN.Configuration.self, selectedEntity: nil, + filtersWithSelection: false, onSelect: { _, _ in } ) } diff --git a/Passepartout/Library/Sources/AppUI/Views/UI/InstalledProfileView.swift b/Passepartout/Library/Sources/AppUI/Views/UI/InstalledProfileView.swift index 9ecd1767..19f1ad2d 100644 --- a/Passepartout/Library/Sources/AppUI/Views/UI/InstalledProfileView.swift +++ b/Passepartout/Library/Sources/AppUI/Views/UI/InstalledProfileView.swift @@ -159,7 +159,7 @@ private struct ProviderCountryFlag: View { var body: some View { ThemeCountryFlag( - code: provider.entity?.countryCode, + code: provider.entity?.header.countryCode, placeholderTip: Strings.Errors.App.Provider.missingEntity, countryTip: { $0.localizedAsRegionCode