diff --git a/Library/Package.resolved b/Library/Package.resolved index 63a8c22d..7a7eabac 100644 --- a/Library/Package.resolved +++ b/Library/Package.resolved @@ -41,7 +41,7 @@ "kind" : "remoteSourceControl", "location" : "git@github.com:passepartoutvpn/passepartoutkit-source", "state" : { - "revision" : "ff9a47ee0aad9a2a2947f5ce23346ced93d3d3d2" + "revision" : "f4786bf573ce30f85107b422590d7633d17fb87a" } }, { diff --git a/Library/Package.swift b/Library/Package.swift index 48154905..298fea30 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: "ff9a47ee0aad9a2a2947f5ce23346ced93d3d3d2"), + .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "f4786bf573ce30f85107b422590d7633d17fb87a"), // .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/Domain/CDProviderV3.swift b/Library/Sources/AppDataProviders/Domain/CDProviderV3.swift index 6f1ef822..dd117248 100644 --- a/Library/Sources/AppDataProviders/Domain/CDProviderV3.swift +++ b/Library/Sources/AppDataProviders/Domain/CDProviderV3.swift @@ -35,6 +35,6 @@ final class CDProviderV3: NSManagedObject { @NSManaged var providerId: String? @NSManaged var fullName: String? @NSManaged var supportedConfigurationIds: String? - @NSManaged var encodedConfigurations: Data? // [String: ProviderMetadata.Configuration] + @NSManaged var encodedCustomizations: Data? // [String: ProviderMetadata.Customization] @NSManaged var lastUpdate: Date? } diff --git a/Library/Sources/AppDataProviders/Domain/CoreDataMapper.swift b/Library/Sources/AppDataProviders/Domain/CoreDataMapper.swift index 351a7a5a..093f0628 100644 --- a/Library/Sources/AppDataProviders/Domain/CoreDataMapper.swift +++ b/Library/Sources/AppDataProviders/Domain/CoreDataMapper.swift @@ -36,8 +36,8 @@ struct CoreDataMapper { entity.providerId = metadata.id.rawValue entity.fullName = metadata.description entity.lastUpdate = lastUpdate - entity.supportedConfigurationIds = metadata.configurations.map(\.key).joined(separator: ",") - entity.encodedConfigurations = try JSONEncoder().encode(metadata.configurations) + entity.supportedConfigurationIds = metadata.customizations.map(\.key).joined(separator: ",") + entity.encodedCustomizations = try JSONEncoder().encode(metadata.customizations) return entity } diff --git a/Library/Sources/AppDataProviders/Domain/DomainMapper.swift b/Library/Sources/AppDataProviders/Domain/DomainMapper.swift index 6079f3db..27110f3b 100644 --- a/Library/Sources/AppDataProviders/Domain/DomainMapper.swift +++ b/Library/Sources/AppDataProviders/Domain/DomainMapper.swift @@ -32,24 +32,24 @@ struct DomainMapper { guard let id = entity.providerId, let fullName = entity.fullName else { return nil } - let configurations: [String: ProviderMetadata.Configuration] - if let encodedConfigurations = entity.encodedConfigurations { + let customizations: [String: ProviderMetadata.Customization] + if let encodedCustomizations = entity.encodedCustomizations { do { - configurations = try JSONDecoder().decode([String: ProviderMetadata.Configuration].self, from: encodedConfigurations) + customizations = try JSONDecoder().decode([String: ProviderMetadata.Customization].self, from: encodedCustomizations) } catch { return nil } } else if let supportedConfigurationIds = entity.supportedConfigurationIds?.components(separatedBy: ",") { - configurations = supportedConfigurationIds.reduce(into: [:]) { + customizations = supportedConfigurationIds.reduce(into: [:]) { $0[$1] = .init() } } else { - configurations = [:] + customizations = [:] } return ProviderMetadata( id, description: fullName, - configurations: configurations + customizations: customizations ) } diff --git a/Library/Sources/AppDataProviders/Providers.xcdatamodeld/Providers.xcdatamodel/contents b/Library/Sources/AppDataProviders/Providers.xcdatamodeld/Providers.xcdatamodel/contents index 2583460d..64e5550c 100644 --- a/Library/Sources/AppDataProviders/Providers.xcdatamodeld/Providers.xcdatamodel/contents +++ b/Library/Sources/AppDataProviders/Providers.xcdatamodeld/Providers.xcdatamodel/contents @@ -1,7 +1,7 @@ - + diff --git a/Library/Sources/CommonLibrary/Domain/ProfileAttributes.swift b/Library/Sources/CommonLibrary/Domain/ProfileAttributes.swift index 524bef73..dad2a7ab 100644 --- a/Library/Sources/CommonLibrary/Domain/ProfileAttributes.swift +++ b/Library/Sources/CommonLibrary/Domain/ProfileAttributes.swift @@ -66,9 +66,9 @@ extension ProfileAttributes: CustomDebugStringConvertible { } } -// MARK: - UserInfoTransformable +// MARK: - UserInfoCodable -extension ProfileAttributes: UserInfoTransformable { +extension ProfileAttributes: UserInfoCodable { public var userInfo: [String: AnyHashable]? { do { let data = try JSONEncoder().encode(self) diff --git a/Library/Sources/UILibrary/Views/Modules/OpenVPNView+Credentials.swift b/Library/Sources/UILibrary/Views/Modules/OpenVPNView+Credentials.swift index 0eff9a56..01e5d47a 100644 --- a/Library/Sources/UILibrary/Views/Modules/OpenVPNView+Credentials.swift +++ b/Library/Sources/UILibrary/Views/Modules/OpenVPNView+Credentials.swift @@ -59,7 +59,7 @@ public struct OpenVPNCredentialsView: View { private var builder = OpenVPN.Credentials.Builder() @State - private var providerConfiguration: OpenVPN.Credentials.ProviderConfiguration? + private var providerCustomization: OpenVPN.ProviderCustomization? @State private var paywallReason: PaywallReason? @@ -148,7 +148,7 @@ private extension OpenVPNCredentialsView { @ViewBuilder var guidanceSection: some View { - if let url = providerConfiguration?.url { + if let url = providerCustomization?.credentials.url { Link(Strings.Modules.Openvpn.Credentials.Guidance.link, destination: url) } } @@ -157,12 +157,12 @@ private extension OpenVPNCredentialsView { if isAuthenticating { return builder.otpMethod.localizedDescription(style: .approachDescription) .nilIfEmpty - } else if let providerConfiguration { - switch providerConfiguration.purpose { - case .web: - return Strings.Modules.Openvpn.Credentials.Guidance.web + } else if providerId != nil { + switch providerCustomization?.credentials.purpose { case .specific: return Strings.Modules.Openvpn.Credentials.Guidance.specific + default: + return Strings.Modules.Openvpn.Credentials.Guidance.web } } return nil @@ -215,12 +215,12 @@ private extension OpenVPNCredentialsView { } var ignoresPassword: Bool { - providerConfiguration?.options?.contains(.noPassword) ?? false + providerCustomization?.credentials.options?.contains(.noPassword) ?? false } func onLoad() { if let providerId, let metadata = providerManager.provider(withId: providerId) { - providerConfiguration = OpenVPN.Credentials.configuration(forProvider: metadata) + providerCustomization = metadata.customization(for: OpenVPN.Configuration.self) } builder = credentials?.builder() ?? OpenVPN.Credentials.Builder() if ignoresPassword {