diff --git a/Library/Package.resolved b/Library/Package.resolved index 9bbc8192..367acf85 100644 --- a/Library/Package.resolved +++ b/Library/Package.resolved @@ -41,7 +41,7 @@ "kind" : "remoteSourceControl", "location" : "git@github.com:passepartoutvpn/passepartoutkit-source", "state" : { - "revision" : "97f2662bcfa8dff6983fe19320c85611047ab73d" + "revision" : "51288509f90b0d4dd2c4ceee2af5cfb36e6319f1" } }, { diff --git a/Library/Package.swift b/Library/Package.swift index 9abc174d..82083ded 100644 --- a/Library/Package.swift +++ b/Library/Package.swift @@ -52,7 +52,7 @@ let package = Package( ], dependencies: [ // .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.12.0"), - .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "97f2662bcfa8dff6983fe19320c85611047ab73d"), + .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "51288509f90b0d4dd2c4ceee2af5cfb36e6319f1"), // .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/Library/Sources/AppDataProviders/Strategy/CDVPNProviderServerRepositoryV3.swift b/Library/Sources/AppDataProviders/Strategy/CDVPNProviderServerRepositoryV3.swift index 1629a08f..9f5f2cd4 100644 --- a/Library/Sources/AppDataProviders/Strategy/CDVPNProviderServerRepositoryV3.swift +++ b/Library/Sources/AppDataProviders/Strategy/CDVPNProviderServerRepositoryV3.swift @@ -39,7 +39,7 @@ final class CDVPNProviderServerRepositoryV3: VPNProviderServerRepository { self.providerId = providerId } - func availableOptions(for configurationType: Configuration.Type) async throws -> VPNFilterOptions where Configuration: ProviderConfigurationIdentifiable { + func availableOptions(for configurationType: Configuration.Type) async throws -> VPNFilterOptions where Configuration: ConfigurationIdentifiable { try await context.perform { let mapper = DomainMapper() @@ -69,7 +69,7 @@ final class CDVPNProviderServerRepositoryV3: VPNProviderServerRepository { let presetsRequest = CDVPNPresetV3.fetchRequest() presetsRequest.predicate = NSPredicate( format: "providerId == %@ AND configurationId == %@", self.providerId.rawValue, - Configuration.providerConfigurationIdentifier + Configuration.configurationIdentifier ) let presetsResults = try presetsRequest.execute() diff --git a/Library/Sources/AppUIMain/Views/App/AddProfileMenu.swift b/Library/Sources/AppUIMain/Views/App/AddProfileMenu.swift index 7df48870..e955a12e 100644 --- a/Library/Sources/AppUIMain/Views/App/AddProfileMenu.swift +++ b/Library/Sources/AppUIMain/Views/App/AddProfileMenu.swift @@ -135,7 +135,7 @@ private struct ProvidersSubmenu: View { var editable = EditableProfile() editable.name = provider.description let newModule = moduleType.newModule(with: registry, providerId: provider.id) - if let providerBuilder = newModule as? any ProviderBuilder { + if let providerBuilder = newModule as? any ProviderSelecting { assert(providerBuilder.providerId == provider.id) } editable.modules.append(newModule) diff --git a/Library/Sources/AppUIMain/Views/Modules/OpenVPNView.swift b/Library/Sources/AppUIMain/Views/Modules/OpenVPNView.swift index 1811be01..40d76a62 100644 --- a/Library/Sources/AppUIMain/Views/Modules/OpenVPNView.swift +++ b/Library/Sources/AppUIMain/Views/Modules/OpenVPNView.swift @@ -218,7 +218,6 @@ private extension OpenVPNView { VPNProviderServerView( moduleId: module.id, providerId: $0.id, - configurationType: OpenVPN.Configuration.self, selectedEntity: $0.entity, filtersWithSelection: true, onSelect: onSelectServer diff --git a/Library/Sources/AppUIMain/Views/Modules/WireGuardView.swift b/Library/Sources/AppUIMain/Views/Modules/WireGuardView.swift index eee0b954..025189b0 100644 --- a/Library/Sources/AppUIMain/Views/Modules/WireGuardView.swift +++ b/Library/Sources/AppUIMain/Views/Modules/WireGuardView.swift @@ -115,7 +115,6 @@ private extension WireGuardView { VPNProviderServerView( moduleId: module.id, providerId: $0.id, - configurationType: WireGuard.Configuration.self, selectedEntity: $0.entity, filtersWithSelection: true, onSelect: onSelectServer diff --git a/Library/Sources/AppUIMain/Views/Providers/ProviderContentModifier.swift b/Library/Sources/AppUIMain/Views/Providers/ProviderContentModifier.swift index f2d3ee94..9db663e1 100644 --- a/Library/Sources/AppUIMain/Views/Providers/ProviderContentModifier.swift +++ b/Library/Sources/AppUIMain/Views/Providers/ProviderContentModifier.swift @@ -122,7 +122,7 @@ private extension ProviderContentModifier { providerManager .providers .filter { - $0.supports(Entity.ConfigurationType.self) + $0.supports(Entity.Template.self) } } diff --git a/Library/Sources/AppUIMain/Views/VPN/VPNProviderContentModifier.swift b/Library/Sources/AppUIMain/Views/VPN/VPNProviderContentModifier.swift index 95cf4e79..b9f8dfb4 100644 --- a/Library/Sources/AppUIMain/Views/VPN/VPNProviderContentModifier.swift +++ b/Library/Sources/AppUIMain/Views/VPN/VPNProviderContentModifier.swift @@ -28,7 +28,7 @@ import CommonLibrary import PassepartoutKit import SwiftUI -struct VPNProviderContentModifier: ViewModifier where Configuration: ProviderConfigurationIdentifiable, ProviderRows: View { +struct VPNProviderContentModifier: ViewModifier where Configuration: ConfigurationIdentifiable, ProviderRows: View { var apis: [APIMapper] = API.shared @Binding diff --git a/Library/Sources/AppUIMain/Views/VPN/VPNProviderServerCoordinator.swift b/Library/Sources/AppUIMain/Views/VPN/VPNProviderServerCoordinator.swift index acec82f3..86e5ea46 100644 --- a/Library/Sources/AppUIMain/Views/VPN/VPNProviderServerCoordinator.swift +++ b/Library/Sources/AppUIMain/Views/VPN/VPNProviderServerCoordinator.swift @@ -27,7 +27,7 @@ import CommonUtils import PassepartoutKit import SwiftUI -struct VPNProviderServerCoordinator: View where Configuration: ProviderConfigurationIdentifiable { +struct VPNProviderServerCoordinator: View where Configuration: ConfigurationIdentifiable { @Environment(\.dismiss) private var dismiss @@ -47,7 +47,6 @@ struct VPNProviderServerCoordinator: View where Configuration: Pr VPNProviderServerView( moduleId: moduleId, providerId: providerId, - configurationType: Configuration.self, selectedEntity: selectedEntity, filtersWithSelection: false, selectTitle: Strings.Global.Actions.connect, diff --git a/Library/Sources/AppUIMain/Views/VPN/VPNProviderServerView.swift b/Library/Sources/AppUIMain/Views/VPN/VPNProviderServerView.swift index ff3c3859..0ccd2f52 100644 --- a/Library/Sources/AppUIMain/Views/VPN/VPNProviderServerView.swift +++ b/Library/Sources/AppUIMain/Views/VPN/VPNProviderServerView.swift @@ -29,7 +29,7 @@ import CommonUtils import PassepartoutKit import SwiftUI -struct VPNProviderServerView: View where Configuration: ProviderConfigurationIdentifiable { +struct VPNProviderServerView: View where Configuration: ConfigurationIdentifiable { @EnvironmentObject private var providerManager: ProviderManager @@ -40,8 +40,6 @@ struct VPNProviderServerView: View where Configuration: ProviderC let providerId: ProviderID - let configurationType: Configuration.Type - let selectedEntity: VPNEntity? let filtersWithSelection: Bool @@ -202,7 +200,7 @@ private extension VPNProviderServerView { func onSelectServer(_ server: VPNServer) { guard let preset = compatiblePreset(with: server) else { pp_log(.app, .error, "Unable to find a compatible preset. Supported IDs: \(server.provider.supportedPresetIds ?? [])") - assertionFailure("No compatible presets for server \(server.serverId) (provider=\(vpnManager.providerId), configuration=\(Configuration.providerConfigurationIdentifier), supported=\(server.provider.supportedPresetIds ?? []))") + assertionFailure("No compatible presets for server \(server.serverId) (provider=\(vpnManager.providerId), configuration=\(Configuration.configurationIdentifier), supported=\(server.provider.supportedPresetIds ?? []))") return } onSelect(server, preset) @@ -217,8 +215,7 @@ private extension VPNProviderServerView { apis: [API.bundled], moduleId: UUID(), providerId: .protonvpn, - configurationType: OpenVPN.Configuration.self, - selectedEntity: nil, + selectedEntity: nil as VPNEntity?, filtersWithSelection: false, selectTitle: "Select", onSelect: { _, _ in } diff --git a/Library/Sources/UILibrary/Extensions/ModuleDraftEditing+UI.swift b/Library/Sources/UILibrary/Extensions/ModuleDraftEditing+UI.swift index 31722167..f57efab9 100644 --- a/Library/Sources/UILibrary/Extensions/ModuleDraftEditing+UI.swift +++ b/Library/Sources/UILibrary/Extensions/ModuleDraftEditing+UI.swift @@ -34,7 +34,7 @@ extension ModuleDraftEditing { } @MainActor -extension ModuleDraftEditing where Draft: ProviderBuilder { +extension ModuleDraftEditing where Draft: MutableProviderSelecting { public var providerId: Binding { Binding { draft.providerId.wrappedValue @@ -43,7 +43,7 @@ extension ModuleDraftEditing where Draft: ProviderBuilder { } } - public var providerEntity: Binding { + public var providerEntity: Binding { Binding { draft.providerEntity.wrappedValue } set: { @@ -51,7 +51,7 @@ extension ModuleDraftEditing where Draft: ProviderBuilder { } } - public var providerOptions: Binding?> { + public var providerOptions: Binding?> { Binding { draft.providerOptions.wrappedValue } set: { diff --git a/Passepartout/Shared/Testing/ProfileManager+Testing.swift b/Passepartout/Shared/Testing/ProfileManager+Testing.swift index c2ee889b..d462b8a3 100644 --- a/Passepartout/Shared/Testing/ProfileManager+Testing.swift +++ b/Passepartout/Shared/Testing/ProfileManager+Testing.swift @@ -49,7 +49,7 @@ extension ProfileManager { var moduleBuilder = moduleType.newModule(with: registry, providerId: parameters.providerId) if moduleBuilder.buildsConnectionModule { - assert((moduleBuilder as? any ProviderBuilder)?.providerId == parameters.providerId) + assert((moduleBuilder as? any ProviderSelecting)?.providerId == parameters.providerId) } if parameters.name == "Hide.me",