mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-01-18 03:07:02 +00:00
Deal with some xcode warnings (#216)
This performs the recommended setting updates from xcode, though I needed to turn off `ENABLE_USER_SCRIPT_SANDBOXING` as it does not seem to be fully compatible with flutter. I also dealt with a warning of: "Extension declares a conformance of imported type 'String' to imported protocol 'Error'; this will not behave correctly if the owners of 'Swift' introduce this conformance in the future", by creating and using some custom error types. Lastly, I fixed our podfile to ensure that the `IPHONEOS_DEPLOYMENT_TARGET` is at least 12, which is our project setting.
This commit is contained in:
parent
c781ac4d91
commit
46f029a91d
6 changed files with 76 additions and 23 deletions
|
@ -10,6 +10,20 @@ enum VPNStartError: Error {
|
|||
case noProviderConfig
|
||||
}
|
||||
|
||||
enum AppMessageError: Error {
|
||||
case unknownIPCType(command: String)
|
||||
}
|
||||
|
||||
extension AppMessageError: LocalizedError {
|
||||
public var description: String? {
|
||||
switch self {
|
||||
case .unknownIPCType(let command):
|
||||
return NSLocalizedString("Unknown IPC message type \(String(command))", comment: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PacketTunnelProvider: NEPacketTunnelProvider {
|
||||
private var networkMonitor: NWPathMonitor?
|
||||
|
||||
|
@ -221,7 +235,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
|||
case "closeTunnel": (data, error) = closeTunnel(args: call.arguments!)
|
||||
|
||||
default:
|
||||
error = "Unknown IPC message type \(call.command)"
|
||||
error = AppMessageError.unknownIPCType(command: call.command)
|
||||
}
|
||||
|
||||
if (error != nil) {
|
||||
|
|
|
@ -5,7 +5,41 @@ import os.log
|
|||
|
||||
let log = Logger(subsystem: "net.defined.mobileNebula", category: "Site")
|
||||
|
||||
extension String: Error {}
|
||||
enum SiteError: Error {
|
||||
case nonConforming(site: [String : Any]?)
|
||||
case noCertificate
|
||||
case keyLoad
|
||||
case keySave
|
||||
case unmanagedGetCredentials
|
||||
case dnCredentialLoad
|
||||
case dnCredentialSave
|
||||
|
||||
// Throw in all other cases
|
||||
case unexpected(code: Int)
|
||||
}
|
||||
|
||||
extension SiteError: CustomStringConvertible {
|
||||
public var description: String {
|
||||
switch self {
|
||||
case .nonConforming(let site):
|
||||
return String("Non-conforming site \(String(describing: site))")
|
||||
case .noCertificate:
|
||||
return "No certificate found"
|
||||
case .keyLoad:
|
||||
return "failed to get key from keychain"
|
||||
case .keySave:
|
||||
return "failed to store key material in keychain"
|
||||
case .unmanagedGetCredentials:
|
||||
return "Cannot get dn credentials for unmanaged site"
|
||||
case .dnCredentialLoad:
|
||||
return "failed to find dn credentials in keychain"
|
||||
case .dnCredentialSave:
|
||||
return "failed to store dn credentials in keychain"
|
||||
case .unexpected(_):
|
||||
return "An unexpected error occurred."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum IPCResponseType: String, Codable {
|
||||
case error = "error"
|
||||
|
@ -174,7 +208,7 @@ class Site: Codable {
|
|||
|
||||
let id = dict?["id"] as? String ?? nil
|
||||
if id == nil {
|
||||
throw("Non-conforming site \(String(describing: dict))")
|
||||
throw SiteError.nonConforming(site: dict)
|
||||
}
|
||||
|
||||
try self.init(path: SiteList.getSiteConfigFile(id: id!, createDir: false))
|
||||
|
@ -218,7 +252,7 @@ class Site: Codable {
|
|||
|
||||
certs = try JSONDecoder().decode([CertificateInfo].self, from: rawDetails.data(using: .utf8)!)
|
||||
if (certs.count == 0) {
|
||||
throw "No certificate found"
|
||||
throw SiteError.noCertificate
|
||||
}
|
||||
cert = certs[0]
|
||||
if (!cert!.validity.valid) {
|
||||
|
@ -285,7 +319,7 @@ class Site: Codable {
|
|||
// Gets the private key from the keystore, we don't always need it in memory
|
||||
func getKey() throws -> String {
|
||||
guard let keyData = KeyChain.load(key: "\(id).key") else {
|
||||
throw "failed to get key from keychain"
|
||||
throw SiteError.keyLoad
|
||||
}
|
||||
|
||||
//TODO: make sure this is valid on return!
|
||||
|
@ -294,12 +328,12 @@ class Site: Codable {
|
|||
|
||||
func getDNCredentials() throws -> DNCredentials {
|
||||
if (!managed) {
|
||||
throw "unmanaged site has no dn credentials"
|
||||
throw SiteError.unmanagedGetCredentials
|
||||
}
|
||||
|
||||
let rawDNCredentials = KeyChain.load(key: "\(id).dnCredentials")
|
||||
if rawDNCredentials == nil {
|
||||
throw "failed to find dn credentials in keychain"
|
||||
throw SiteError.dnCredentialLoad
|
||||
}
|
||||
|
||||
let decoder = JSONDecoder()
|
||||
|
@ -311,7 +345,7 @@ class Site: Codable {
|
|||
creds.invalid = true
|
||||
|
||||
if (!(try creds.save(siteID: self.id))) {
|
||||
throw "failed to store dn credentials in keychain"
|
||||
throw SiteError.dnCredentialLoad
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,7 +354,7 @@ class Site: Codable {
|
|||
creds.invalid = false
|
||||
|
||||
if (!(try creds.save(siteID: self.id))) {
|
||||
throw "failed to store dn credentials in keychain"
|
||||
throw SiteError.dnCredentialSave
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,13 +472,13 @@ struct IncomingSite: Codable {
|
|||
if (self.key != nil) {
|
||||
let data = self.key!.data(using: .utf8)
|
||||
if (!KeyChain.save(key: "\(self.id).key", data: data!, managed: self.managed ?? false)) {
|
||||
return callback("failed to store key material in keychain")
|
||||
return callback(SiteError.keySave)
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
if ((try self.dnCredentials?.save(siteID: self.id)) == false) {
|
||||
return callback("failed to store dn credentials in keychain")
|
||||
return callback(SiteError.dnCredentialSave)
|
||||
}
|
||||
} catch {
|
||||
return callback(error)
|
||||
|
|
|
@ -47,7 +47,7 @@ post_install do |installer|
|
|||
installer.generated_projects.each do |project|
|
||||
project.targets.each do |target|
|
||||
target.build_configurations.each do |config|
|
||||
if Gem::Version.new('11.0') > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
|
||||
if Gem::Version.new('12.0') > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
|
||||
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -67,6 +67,6 @@ SPEC CHECKSUMS:
|
|||
SwiftyJSON: f5b1bf1cd8dd53cd25887ac0eabcfd92301c6a5a
|
||||
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
|
||||
|
||||
PODFILE CHECKSUM: 6c27958b72564ad432c3d7024daffcc9edb8534a
|
||||
PODFILE CHECKSUM: b44d9de9944d89118a4ff4bfffe1c2dab91de156
|
||||
|
||||
COCOAPODS: 1.15.2
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
43871C9D2444E2EC004F9075 /* Sites.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43871C9C2444E2EC004F9075 /* Sites.swift */; };
|
||||
43AA894F2444D8BC00EDC39C /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43AA894E2444D8BC00EDC39C /* NetworkExtension.framework */; };
|
||||
43AA89572444DA6500EDC39C /* PacketTunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43AA89562444DA6500EDC39C /* PacketTunnelProvider.swift */; };
|
||||
43AA895C2444DA6500EDC39C /* NebulaNetworkExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 43AA89542444DA6500EDC39C /* NebulaNetworkExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
43AA895C2444DA6500EDC39C /* NebulaNetworkExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 43AA89542444DA6500EDC39C /* NebulaNetworkExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
43AA89622444DAA500EDC39C /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43AA894E2444D8BC00EDC39C /* NetworkExtension.framework */; };
|
||||
43ED87842912D0DD004DAFC5 /* DNUpdate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43ED87832912D0DD004DAFC5 /* DNUpdate.swift */; };
|
||||
43ED87852912D0DD004DAFC5 /* DNUpdate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43ED87832912D0DD004DAFC5 /* DNUpdate.swift */; };
|
||||
|
@ -47,15 +47,15 @@
|
|||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
43AA89612444DA6500EDC39C /* Embed App Extensions */ = {
|
||||
43AA89612444DA6500EDC39C /* Embed Foundation Extensions */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 13;
|
||||
files = (
|
||||
43AA895C2444DA6500EDC39C /* NebulaNetworkExtension.appex in Embed App Extensions */,
|
||||
43AA895C2444DA6500EDC39C /* NebulaNetworkExtension.appex in Embed Foundation Extensions */,
|
||||
);
|
||||
name = "Embed App Extensions";
|
||||
name = "Embed Foundation Extensions";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
||||
|
@ -266,7 +266,7 @@
|
|||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
43AA89612444DA6500EDC39C /* Embed App Extensions */,
|
||||
43AA89612444DA6500EDC39C /* Embed Foundation Extensions */,
|
||||
00C7A79AE88792090BDAC68B /* [CP] Embed Pods Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
);
|
||||
|
@ -286,8 +286,9 @@
|
|||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = YES;
|
||||
LastSwiftUpdateCheck = 1140;
|
||||
LastUpgradeCheck = 1510;
|
||||
LastUpgradeCheck = 1600;
|
||||
ORGANIZATIONNAME = "The Chromium Authors";
|
||||
TargetAttributes = {
|
||||
43AA89532444DA6500EDC39C = {
|
||||
|
@ -538,6 +539,7 @@
|
|||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
|
@ -548,6 +550,7 @@
|
|||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
|
@ -569,7 +572,6 @@
|
|||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
|
@ -740,6 +742,7 @@
|
|||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
|
@ -750,6 +753,7 @@
|
|||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
|
@ -795,6 +799,7 @@
|
|||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
|
@ -805,6 +810,7 @@
|
|||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
|
@ -817,6 +823,7 @@
|
|||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
|
@ -827,7 +834,6 @@
|
|||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
|
@ -863,7 +869,6 @@
|
|||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1510"
|
||||
LastUpgradeVersion = "1600"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
Loading…
Reference in a new issue