Skip to content

Commit

Permalink
Revert "Move VPNProtocolType serialization to Data layer" (#319)
Browse files Browse the repository at this point in the history
Reverts #318

`Codable` compliance at the domain layer (`Profile` etc.) makes this
change in serialization destructive.
  • Loading branch information
keeshux authored Jul 3, 2023
1 parent ddf3dc3 commit e960943
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@

import Foundation

public enum VPNProtocolType: CaseIterable, Codable {
case openVPN
// IMPORTANT: do NOT change these raw values, as they affect serialization
public enum VPNProtocolType: String, CaseIterable, Codable {
case openVPN = "ovpn"

case wireGuard
case wireGuard = "wg"
}

public protocol VPNProtocolProviding {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extension ProviderServer: Identifiable {
}

public static func id(withName providerName: ProviderName, vpnProtocol: VPNProtocolType, apiId: String) -> String? {
let idSource = [providerName, "\(vpnProtocol)", apiId].joined(separator: ":")
let idSource = [providerName, vpnProtocol.rawValue, apiId].joined(separator: ":")
guard let data = idSource.data(using: .utf8) else {
return nil
}
Expand Down

This file was deleted.

0 comments on commit e960943

Please sign in to comment.