Drop #available(iOS 14) (#317)

This commit is contained in:
Davide De Rosa 2023-04-20 21:44:32 +02:00 committed by GitHub
parent 8f066a9e48
commit c62fc4adaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 58 deletions

View File

@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/SwiftyBeaver/SwiftyBeaver", "repositoryURL": "https://github.com/SwiftyBeaver/SwiftyBeaver",
"state": { "state": {
"branch": null, "branch": null,
"revision": "2c039501d6eeb4d4cd4aec4a8d884ad28862e044", "revision": "12b5acf96d98f91d50de447369bd18df74600f1a",
"version": "1.9.5" "version": "1.9.6"
} }
}, },
{ {
@ -24,7 +24,7 @@
"repositoryURL": "https://github.com/passepartoutvpn/wireguard-apple", "repositoryURL": "https://github.com/passepartoutvpn/wireguard-apple",
"state": { "state": {
"branch": null, "branch": null,
"revision": "57f9babde0fb7567f31a75e943538022f8725f8f", "revision": "73d9152fa0cb661db0348a1ac11dbbf998422a50",
"version": "1.0.17" "version": "1.0.17"
} }
} }

View File

@ -113,28 +113,9 @@ public class InterfaceObserver: NSObject {
**/ **/
public static func fetchCurrentSSID(completionHandler: @escaping (String?) -> Void) { public static func fetchCurrentSSID(completionHandler: @escaping (String?) -> Void) {
#if os(iOS) #if os(iOS)
if #available(iOS 14, macCatalyst 14, *) {
NEHotspotNetwork.fetchCurrent { NEHotspotNetwork.fetchCurrent {
completionHandler($0?.ssid) completionHandler($0?.ssid)
} }
} else if #available(macCatalyst 14, *) {
guard let interfaceNames = CNCopySupportedInterfaces() as? [CFString] else {
completionHandler(nil)
return
}
for name in interfaceNames {
guard let iface = CNCopyCurrentNetworkInfo(name) as? [String: Any] else {
continue
}
if let ssid = iface["SSID"] as? String {
completionHandler(ssid)
return
}
}
completionHandler(nil)
} else {
completionHandler(nil)
}
#else #else
let client = CWWiFiClient.shared() let client = CWWiFiClient.shared()
let ssid = client.interfaces()?.compactMap { $0.ssid() }.first let ssid = client.interfaces()?.compactMap { $0.ssid() }.first

View File

@ -332,9 +332,7 @@ public class Keychain {
if let accessGroup = accessGroup { if let accessGroup = accessGroup {
query[kSecAttrAccessGroup as String] = accessGroup query[kSecAttrAccessGroup as String] = accessGroup
#if os(macOS) #if os(macOS)
if #available(macOS 10.15, *) {
query[kSecUseDataProtectionKeychain as String] = true query[kSecUseDataProtectionKeychain as String] = true
}
#endif #endif
} }
query[kSecAttrService as String] = context query[kSecAttrService as String] = context

View File

@ -232,7 +232,6 @@ extension NetworkSettingsBuilder {
return nil return nil
} }
var dnsSettings: NEDNSSettings? var dnsSettings: NEDNSSettings?
if #available(iOS 14, macOS 11, *) {
switch localOptions.dnsProtocol { switch localOptions.dnsProtocol {
case .https: case .https:
let dnsServers = localOptions.dnsServers ?? [] let dnsServers = localOptions.dnsServers ?? []
@ -259,7 +258,6 @@ extension NetworkSettingsBuilder {
default: default:
break break
} }
}
// fall back // fall back
if dnsSettings == nil { if dnsSettings == nil {

View File

@ -113,9 +113,7 @@ extension OpenVPN.ProviderConfiguration: NetworkExtensionConfiguration {
} }
protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false
protocolConfiguration.providerConfiguration = try asDictionary() protocolConfiguration.providerConfiguration = try asDictionary()
if #available(iOS 14, *) {
protocolConfiguration.includeAllNetworks = extra?.killSwitch ?? false protocolConfiguration.includeAllNetworks = extra?.killSwitch ?? false
}
return protocolConfiguration return protocolConfiguration
} }
} }

View File

@ -83,9 +83,7 @@ extension WireGuard.ProviderConfiguration: NetworkExtensionConfiguration {
protocolConfiguration.passwordReference = extra?.passwordReference protocolConfiguration.passwordReference = extra?.passwordReference
protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false
protocolConfiguration.providerConfiguration = try asDictionary() protocolConfiguration.providerConfiguration = try asDictionary()
if #available(iOS 14, *) {
protocolConfiguration.includeAllNetworks = extra?.killSwitch ?? false protocolConfiguration.includeAllNetworks = extra?.killSwitch ?? false
}
return protocolConfiguration return protocolConfiguration
} }
} }