aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/Shared/Model/ActivationType.swift
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--WireGuard/Shared/Model/ActivationType.swift66
1 files changed, 0 insertions, 66 deletions
diff --git a/WireGuard/Shared/Model/ActivationType.swift b/WireGuard/Shared/Model/ActivationType.swift
deleted file mode 100644
index ea5927d6..00000000
--- a/WireGuard/Shared/Model/ActivationType.swift
+++ /dev/null
@@ -1,66 +0,0 @@
-// SPDX-License-Identifier: MIT
-// Copyright © 2018 WireGuard LLC. All Rights Reserved.
-
-enum ActivationType {
- case activateManually
- case useOnDemandOverWifiAndCellular
- case useOnDemandOverWifiOnly
- case useOnDemandOverCellularOnly
-}
-
-extension ActivationType: Codable {
- // We use separate coding keys in case we might have a enum with associated values in the future
- enum CodingKeys: CodingKey {
- case activateManually
- case useOnDemandOverWifiAndCellular
- case useOnDemandOverWifiOnly
- case useOnDemandOverCellularOnly
- }
-
- // Decoding error
- enum DecodingError: Error {
- case invalidInput
- }
-
- // Encoding
- func encode(to encoder: Encoder) throws {
- var container = encoder.container(keyedBy: CodingKeys.self)
- switch self {
- case .activateManually:
- try container.encode(true, forKey: CodingKeys.activateManually)
- case .useOnDemandOverWifiAndCellular:
- try container.encode(true, forKey: CodingKeys.useOnDemandOverWifiAndCellular)
- case .useOnDemandOverWifiOnly:
- try container.encode(true, forKey: CodingKeys.useOnDemandOverWifiOnly)
- case .useOnDemandOverCellularOnly:
- try container.encode(true, forKey: CodingKeys.useOnDemandOverCellularOnly)
- }
- }
-
- // Decoding
- init(from decoder: Decoder) throws {
- let container = try decoder.container(keyedBy: CodingKeys.self)
-
- if let isValid = try? container.decode(Bool.self, forKey: CodingKeys.activateManually), isValid {
- self = .activateManually
- return
- }
-
- if let isValid = try? container.decode(Bool.self, forKey: CodingKeys.useOnDemandOverWifiAndCellular), isValid {
- self = .useOnDemandOverWifiAndCellular
- return
- }
-
- if let isValid = try? container.decode(Bool.self, forKey: CodingKeys.useOnDemandOverWifiOnly), isValid {
- self = .useOnDemandOverWifiOnly
- return
- }
-
- if let isValid = try? container.decode(Bool.self, forKey: CodingKeys.useOnDemandOverCellularOnly), isValid {
- self = .useOnDemandOverCellularOnly
- return
- }
-
- throw DecodingError.invalidInput
- }
-}