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",
"state": {
"branch": null,
"revision": "2c039501d6eeb4d4cd4aec4a8d884ad28862e044",
"version": "1.9.5"
"revision": "12b5acf96d98f91d50de447369bd18df74600f1a",
"version": "1.9.6"
}
},
{
@ -24,7 +24,7 @@
"repositoryURL": "https://github.com/passepartoutvpn/wireguard-apple",
"state": {
"branch": null,
"revision": "57f9babde0fb7567f31a75e943538022f8725f8f",
"revision": "73d9152fa0cb661db0348a1ac11dbbf998422a50",
"version": "1.0.17"
}
}

View File

@ -113,27 +113,8 @@ public class InterfaceObserver: NSObject {
**/
public static func fetchCurrentSSID(completionHandler: @escaping (String?) -> Void) {
#if os(iOS)
if #available(iOS 14, macCatalyst 14, *) {
NEHotspotNetwork.fetchCurrent {
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)
NEHotspotNetwork.fetchCurrent {
completionHandler($0?.ssid)
}
#else
let client = CWWiFiClient.shared()

View File

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

View File

@ -232,33 +232,31 @@ extension NetworkSettingsBuilder {
return nil
}
var dnsSettings: NEDNSSettings?
if #available(iOS 14, macOS 11, *) {
switch localOptions.dnsProtocol {
case .https:
let dnsServers = localOptions.dnsServers ?? []
guard let serverURL = localOptions.dnsHTTPSURL else {
break
}
let specific = NEDNSOverHTTPSSettings(servers: dnsServers)
specific.serverURL = serverURL
dnsSettings = specific
log.info("DNS over HTTPS: Using servers \(dnsServers)")
log.info("\tHTTPS URL: \(serverURL)")
case .tls:
let dnsServers = localOptions.dnsServers ?? []
guard let serverName = localOptions.dnsTLSServerName else {
break
}
let specific = NEDNSOverTLSSettings(servers: dnsServers)
specific.serverName = serverName
dnsSettings = specific
log.info("DNS over TLS: Using servers \(dnsServers)")
log.info("\tTLS server name: \(serverName)")
default:
switch localOptions.dnsProtocol {
case .https:
let dnsServers = localOptions.dnsServers ?? []
guard let serverURL = localOptions.dnsHTTPSURL else {
break
}
let specific = NEDNSOverHTTPSSettings(servers: dnsServers)
specific.serverURL = serverURL
dnsSettings = specific
log.info("DNS over HTTPS: Using servers \(dnsServers)")
log.info("\tHTTPS URL: \(serverURL)")
case .tls:
let dnsServers = localOptions.dnsServers ?? []
guard let serverName = localOptions.dnsTLSServerName else {
break
}
let specific = NEDNSOverTLSSettings(servers: dnsServers)
specific.serverName = serverName
dnsSettings = specific
log.info("DNS over TLS: Using servers \(dnsServers)")
log.info("\tTLS server name: \(serverName)")
default:
break
}
// fall back

View File

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

View File

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