From 537c5fd12c6b5530f4ea96db0f5ae470cfd89e34 Mon Sep 17 00:00:00 2001 From: Davide Date: Sun, 12 Jan 2025 23:12:05 +0100 Subject: [PATCH] Provide default values for non-frozen enums (#1054) --- .../Domain/VPNServerParameters+CoreData.swift | 3 +++ .../Sources/AppUIMain/Views/Modules/DNSView.swift | 3 +++ .../AppUIMain/Views/Modules/OnDemandView.swift | 3 +++ .../UILibrary/L10n/Modules/DNSModule+L10n.swift | 4 ++-- .../UILibrary/L10n/Modules/OpenVPNModule+L10n.swift | 13 ++++++++++--- .../UILibrary/L10n/PassepartoutKit+L10n.swift | 9 +++++++++ README.md | 3 ++- 7 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Library/Sources/AppDataProviders/Domain/VPNServerParameters+CoreData.swift b/Library/Sources/AppDataProviders/Domain/VPNServerParameters+CoreData.swift index f75ba2c7..fcaa8bf0 100644 --- a/Library/Sources/AppDataProviders/Domain/VPNServerParameters+CoreData.swift +++ b/Library/Sources/AppDataProviders/Domain/VPNServerParameters+CoreData.swift @@ -51,6 +51,9 @@ extension VPNSortField { case .serverId: return NSSortDescriptor(key: "serverId", ascending: true) + + @unknown default: + return NSSortDescriptor() } } } diff --git a/Library/Sources/AppUIMain/Views/Modules/DNSView.swift b/Library/Sources/AppUIMain/Views/Modules/DNSView.swift index 7f2b8d11..6c8a9d11 100644 --- a/Library/Sources/AppUIMain/Views/Modules/DNSView.swift +++ b/Library/Sources/AppUIMain/Views/Modules/DNSView.swift @@ -84,6 +84,9 @@ private extension DNSView { case .tls: ThemeTextField(Strings.Global.Nouns.hostname, text: draft.dotHostname, placeholder: Strings.Unlocalized.Placeholders.dotHostname) .labelsHidden() + + @unknown default: + EmptyView() } } } diff --git a/Library/Sources/AppUIMain/Views/Modules/OnDemandView.swift b/Library/Sources/AppUIMain/Views/Modules/OnDemandView.swift index c6e58aaa..e7c37ec3 100644 --- a/Library/Sources/AppUIMain/Views/Modules/OnDemandView.swift +++ b/Library/Sources/AppUIMain/Views/Modules/OnDemandView.swift @@ -112,6 +112,9 @@ private extension OnDemandView { } else { suffix = Strings.Modules.OnDemand.Policy.Footer.excluding } + + @unknown default: + suffix = Strings.Modules.OnDemand.Policy.Footer.any } return Strings.Modules.OnDemand.Policy.footer(suffix) } diff --git a/Library/Sources/UILibrary/L10n/Modules/DNSModule+L10n.swift b/Library/Sources/UILibrary/L10n/Modules/DNSModule+L10n.swift index 333be5fb..d5befc6c 100644 --- a/Library/Sources/UILibrary/L10n/Modules/DNSModule+L10n.swift +++ b/Library/Sources/UILibrary/L10n/Modules/DNSModule+L10n.swift @@ -32,12 +32,12 @@ extension DNSProtocol: LocalizableEntity { switch self { case .cleartext: return Strings.Entities.DnsProtocol.cleartext - case .https: return Strings.Entities.DnsProtocol.https - case .tls: return Strings.Entities.DnsProtocol.tls + @unknown default: + return "" } } } diff --git a/Library/Sources/UILibrary/L10n/Modules/OpenVPNModule+L10n.swift b/Library/Sources/UILibrary/L10n/Modules/OpenVPNModule+L10n.swift index df927108..b24d743f 100644 --- a/Library/Sources/UILibrary/L10n/Modules/OpenVPNModule+L10n.swift +++ b/Library/Sources/UILibrary/L10n/Modules/OpenVPNModule+L10n.swift @@ -38,6 +38,9 @@ extension OpenVPN.PullMask: LocalizableEntity { case .proxy: return Strings.Unlocalized.proxy + + @unknown default: + return "" } } } @@ -66,7 +69,7 @@ extension OpenVPN.CompressionFraming: LocalizableEntity { case .compress, .compressV2: return Strings.Unlocalized.OpenVPN.compress - default: + @unknown default: return Strings.Global.Nouns.unknown } } @@ -84,7 +87,7 @@ extension OpenVPN.CompressionAlgorithm: LocalizableEntity { case .other: return Strings.Entities.Openvpn.CompressionAlgorithm.other - default: + @unknown default: return Strings.Global.Nouns.unknown } } @@ -121,6 +124,9 @@ extension OpenVPN.XORMethod: StyledLocalizableEntity { case .obfuscate: return V.obfuscate.rawValue + + @unknown default: + return "" } } @@ -199,9 +205,10 @@ private extension Optional where Wrapped == OpenVPN.TLSWrap { switch strategy { case .auth: return "--tls-auth" - case .crypt: return "--tls-crypt" + @unknown default: + return "" } } } diff --git a/Library/Sources/UILibrary/L10n/PassepartoutKit+L10n.swift b/Library/Sources/UILibrary/L10n/PassepartoutKit+L10n.swift index c135bdf8..a1656d9e 100644 --- a/Library/Sources/UILibrary/L10n/PassepartoutKit+L10n.swift +++ b/Library/Sources/UILibrary/L10n/PassepartoutKit+L10n.swift @@ -168,6 +168,9 @@ extension OnDemandModule.Policy: LocalizableEntity { case .including: return Strings.Entities.OnDemand.Policy.including + + @unknown default: + return Strings.Entities.OnDemand.Policy.any } } } @@ -223,6 +226,9 @@ extension OpenVPN.Credentials.OTPMethod: StyledLocalizableEntity { case .encode: return V.encode + + @unknown default: + return V.none } case .approachDescription: @@ -236,6 +242,9 @@ extension OpenVPN.Credentials.OTPMethod: StyledLocalizableEntity { case .encode: return V.encode + + @unknown default: + return "" } } } diff --git a/README.md b/README.md index 7f520a7c..93e86da2 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ Tailored for Apple platforms: ### Requirements - iOS 16+ / macOS 13+ / tvOS 17+ -- Xcode 15+ (SwiftPM 5.5) +- Xcode 16+ +- SwiftPM 6.0 - Git (preinstalled with Xcode Command Line Tools) - Ruby (preinstalled with macOS)