diff --git a/Passepartout/Sources/Model/ConnectionService.swift b/Passepartout/Sources/Model/ConnectionService.swift index 5afb68cf..6f202eaa 100644 --- a/Passepartout/Sources/Model/ConnectionService.swift +++ b/Passepartout/Sources/Model/ConnectionService.swift @@ -275,6 +275,9 @@ public class ConnectionService: Codable { providerProfile.poolId = fallbackPool.id } + // XXX: fix unsupported preset + providerProfile.setSupportedPreset() + profile = providerProfile case .host: diff --git a/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift b/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift index b7feb08d..04c76279 100644 --- a/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift +++ b/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift @@ -76,6 +76,16 @@ public class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable { presetId = infrastructure.defaults.preset } + public func setSupportedPreset() { + guard let pool = pool else { + return + } + let supported = pool.supportedPresetIds(in: infrastructure) + if let current = preset?.id, !supported.contains(current), let fallback = supported.first { + presetId = fallback + } + } + private func validateEndpoint() { guard let pool = pool, let preset = preset else { manualAddress = nil