diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2023-06-08 12:32:36 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2023-06-08 12:32:36 +0200 |
| commit | 0ca8f82db446df494b400f0b467de1bef9e051e4 (patch) | |
| tree | 4025167bef31e927785b9bfd1d4ed00036c7f15e | |
| parent | 05c8a1f8fa425dbc0a144892ddc869fbe45cc48b (diff) | |
| parent | 1c31fcb96c52b05d8570c3377cc01667d1beb9f9 (diff) | |
| download | mullvadvpn-0ca8f82db446df494b400f0b467de1bef9e051e4.tar.xz mullvadvpn-0ca8f82db446df494b400f0b467de1bef9e051e4.zip | |
Merge branch 'relayconstraints-fails-to-deserialize-existing-data-ios-190'
| -rw-r--r-- | ios/MullvadTypes/RelayConstraints.swift | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ios/MullvadTypes/RelayConstraints.swift b/ios/MullvadTypes/RelayConstraints.swift index 22a84aea0e..9b32fdf16e 100644 --- a/ios/MullvadTypes/RelayConstraints.swift +++ b/ios/MullvadTypes/RelayConstraints.swift @@ -10,6 +10,8 @@ import Foundation public struct RelayConstraints: Codable, Equatable, CustomDebugStringConvertible { public var location: RelayConstraint<RelayLocation> + + // Added in 2023.3 public var port: RelayConstraint<UInt16> public var debugDescription: String { @@ -23,4 +25,12 @@ public struct RelayConstraints: Codable, Equatable, CustomDebugStringConvertible self.location = location self.port = port } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + location = try container.decode(RelayConstraint<RelayLocation>.self, forKey: .location) + + // Added in 2023.3 + port = try container.decodeIfPresent(RelayConstraint<UInt16>.self, forKey: .port) ?? .any + } } |
