Add PromiseKit dependency
- Added PromiseKit dependency
This commit is contained in:
5
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/.gitignore
vendored
Normal file
5
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
*.xcodeproj/**/xcuserdata/
|
||||
*.xcscmblueprint
|
||||
/Carthage
|
||||
/.build
|
||||
.DS_Store
|
||||
22
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/.travis.yml
vendored
Normal file
22
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/.travis.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
language: objective-c
|
||||
osx_image: xcode9.3
|
||||
env:
|
||||
- DESTINATION="arch=x86_64" PLATFORM=Mac TEST=1
|
||||
- DESTINATION="OS=11.3,name=iPhone SE" PLATFORM=iOS TEST=1
|
||||
- DESTINATION="OS=10.3.1,name=iPhone SE" PLATFORM=iOS
|
||||
- DESTINATION="OS=9.3,name=iPhone 5s" PLATFORM=iOS
|
||||
- DESTINATION="OS=8.4,name=iPhone 4s" PLATFORM=iOS
|
||||
- DESTINATION="OS=11.3,name=Apple TV" PLATFORM=tvOS TEST=1
|
||||
- DESTINATION="OS=10.2,name=Apple TV 1080p" PLATFORM=tvOS
|
||||
- DESTINATION="OS=9.2,name=Apple TV 1080p" PLATFORM=tvOS
|
||||
before_install:
|
||||
- carthage bootstrap --cache-builds --no-use-binaries --platform $PLATFORM --verbose
|
||||
install:
|
||||
- xcodebuild -scheme PMKSystemConfiguration -target PMKSystemConfiguration -destination "$DESTINATION" build
|
||||
- if [[ $TEST == "1" ]]; then
|
||||
xcodebuild -scheme PMKSystemConfiguration -target PMKSCTests -destination "$DESTINATION" build;
|
||||
fi
|
||||
script:
|
||||
- if [[ $TEST == "1" ]]; then
|
||||
xcodebuild -scheme PMKSystemConfiguration -destination "$DESTINATION" test;
|
||||
fi
|
||||
1
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/Cartfile
vendored
Normal file
1
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/Cartfile
vendored
Normal file
@@ -0,0 +1 @@
|
||||
github "mxcl/PromiseKit" ~> 6.0
|
||||
1
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/Cartfile.resolved
vendored
Normal file
1
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/Cartfile.resolved
vendored
Normal file
@@ -0,0 +1 @@
|
||||
github "mxcl/PromiseKit" "6.3.3"
|
||||
7
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/Carthage.xcconfig
vendored
Normal file
7
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/Carthage.xcconfig
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Created by Kevin Ballard on 12/14/15.
|
||||
// Copyright © 2015 Postmates. All rights reserved.
|
||||
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=macosx*] = $(SRCROOT)/Carthage/Build/Mac/ $(inherited)
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=iphone*] = $(SRCROOT)/Carthage/Build/iOS/ $(inherited)
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=watch*] = $(SRCROOT)/Carthage/Build/watchOS/ $(inherited)
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=appletv*] = $(SRCROOT)/Carthage/Build/tvOS/ $(inherited)
|
||||
24
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/Info.plist
vendored
Normal file
24
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/Info.plist
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,457 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
6358AB7A1D5D4B6700B9B157 /* PMKSystemConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 6358AB791D5D4B6700B9B157 /* PMKSystemConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
6362F84E1D5D934C0021D2DD /* SCNetworkReachability+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 6362F84C1D5D934C0021D2DD /* SCNetworkReachability+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
6362F84F1D5D934C0021D2DD /* SCNetworkReachability+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 6362F84D1D5D934C0021D2DD /* SCNetworkReachability+AnyPromise.m */; };
|
||||
6383E14B1D611E0D00897651 /* SCTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6383E14A1D611E0D00897651 /* SCTests.swift */; };
|
||||
63C7FFF71D5C020D003BAE60 /* PMKSystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63C7FFA71D5BEE09003BAE60 /* PMKSystemConfiguration.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
63C7FFF81D5C020D003BAE60 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 63C7FF9E1D5BEE09003BAE60 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 63C7FFA61D5BEE09003BAE60;
|
||||
remoteInfo = PMKSystemConfiguration;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
6358AB791D5D4B6700B9B157 /* PMKSystemConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PMKSystemConfiguration.h; path = Sources/PMKSystemConfiguration.h; sourceTree = SOURCE_ROOT; };
|
||||
6362F84C1D5D934C0021D2DD /* SCNetworkReachability+AnyPromise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "SCNetworkReachability+AnyPromise.h"; path = "Sources/SCNetworkReachability+AnyPromise.h"; sourceTree = SOURCE_ROOT; };
|
||||
6362F84D1D5D934C0021D2DD /* SCNetworkReachability+AnyPromise.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "SCNetworkReachability+AnyPromise.m"; path = "Sources/SCNetworkReachability+AnyPromise.m"; sourceTree = SOURCE_ROOT; };
|
||||
6383E14A1D611E0D00897651 /* SCTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SCTests.swift; path = Tests/SCTests.swift; sourceTree = SOURCE_ROOT; };
|
||||
63C700091D5C0253003BAE60 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
63C7FFA71D5BEE09003BAE60 /* PMKSystemConfiguration.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PMKSystemConfiguration.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
63C7FFF21D5C020D003BAE60 /* PMKSCTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PMKSCTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
63CCF8121D5C0C4E00503216 /* Cartfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cartfile; sourceTree = "<group>"; };
|
||||
63CCF8171D5C11B500503216 /* Carthage.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Carthage.xcconfig; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
63C7FFA31D5BEE09003BAE60 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
63C7FFEF1D5C020D003BAE60 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
63C7FFF71D5C020D003BAE60 /* PMKSystemConfiguration.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
63C7FF9D1D5BEE09003BAE60 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
63C700091D5C0253003BAE60 /* Info.plist */,
|
||||
63CCF8121D5C0C4E00503216 /* Cartfile */,
|
||||
63CCF8171D5C11B500503216 /* Carthage.xcconfig */,
|
||||
63C7FFA91D5BEE09003BAE60 /* Sources */,
|
||||
63C7FFF31D5C020D003BAE60 /* Tests */,
|
||||
63C7FFA81D5BEE09003BAE60 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
63C7FFA81D5BEE09003BAE60 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
63C7FFA71D5BEE09003BAE60 /* PMKSystemConfiguration.framework */,
|
||||
63C7FFF21D5C020D003BAE60 /* PMKSCTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
63C7FFA91D5BEE09003BAE60 /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6358AB791D5D4B6700B9B157 /* PMKSystemConfiguration.h */,
|
||||
6362F84C1D5D934C0021D2DD /* SCNetworkReachability+AnyPromise.h */,
|
||||
6362F84D1D5D934C0021D2DD /* SCNetworkReachability+AnyPromise.m */,
|
||||
);
|
||||
path = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
63C7FFF31D5C020D003BAE60 /* Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6383E14A1D611E0D00897651 /* SCTests.swift */,
|
||||
);
|
||||
path = Tests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
63C7FFA41D5BEE09003BAE60 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6358AB7A1D5D4B6700B9B157 /* PMKSystemConfiguration.h in Headers */,
|
||||
6362F84E1D5D934C0021D2DD /* SCNetworkReachability+AnyPromise.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
63C7FFA61D5BEE09003BAE60 /* PMKSystemConfiguration */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 63C7FFAF1D5BEE09003BAE60 /* Build configuration list for PBXNativeTarget "PMKSystemConfiguration" */;
|
||||
buildPhases = (
|
||||
63C7FFA21D5BEE09003BAE60 /* Sources */,
|
||||
63C7FFA31D5BEE09003BAE60 /* Frameworks */,
|
||||
63C7FFA41D5BEE09003BAE60 /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = PMKSystemConfiguration;
|
||||
productName = "PMK+UIKit";
|
||||
productReference = 63C7FFA71D5BEE09003BAE60 /* PMKSystemConfiguration.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
63C7FFF11D5C020D003BAE60 /* PMKSCTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 63C7FFFA1D5C020D003BAE60 /* Build configuration list for PBXNativeTarget "PMKSCTests" */;
|
||||
buildPhases = (
|
||||
63C7FFEE1D5C020D003BAE60 /* Sources */,
|
||||
63C7FFEF1D5C020D003BAE60 /* Frameworks */,
|
||||
639447051D5D011300DDAE3C /* Embed Carthage Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
63C7FFF91D5C020D003BAE60 /* PBXTargetDependency */,
|
||||
);
|
||||
name = PMKSCTests;
|
||||
productName = PMKTests/NS;
|
||||
productReference = 63C7FFF21D5C020D003BAE60 /* PMKSCTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
63C7FF9E1D5BEE09003BAE60 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0800;
|
||||
LastUpgradeCheck = 1000;
|
||||
ORGANIZATIONNAME = "Max Howell";
|
||||
TargetAttributes = {
|
||||
63C7FFA61D5BEE09003BAE60 = {
|
||||
CreatedOnToolsVersion = 8.0;
|
||||
LastSwiftMigration = 0920;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
63C7FFF11D5C020D003BAE60 = {
|
||||
CreatedOnToolsVersion = 8.0;
|
||||
LastSwiftMigration = 0920;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 63C7FFA11D5BEE09003BAE60 /* Build configuration list for PBXProject "PMKSystemConfiguration" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 63C7FF9D1D5BEE09003BAE60;
|
||||
productRefGroup = 63C7FFA81D5BEE09003BAE60 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
63C7FFA61D5BEE09003BAE60 /* PMKSystemConfiguration */,
|
||||
63C7FFF11D5C020D003BAE60 /* PMKSCTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
639447051D5D011300DDAE3C /* Embed Carthage Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
PromiseKit,
|
||||
);
|
||||
name = "Embed Carthage Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "case \"$PLATFORM_NAME\" in\nmacosx) plat=Mac;;\niphone*) plat=iOS;;\nwatch*) plat=watchOS;;\nappletv*) plat=tvOS;;\n*) echo \"error: Unknown PLATFORM_NAME: $PLATFORM_NAME\"; exit 1;;\nesac\nfor (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do\nVAR=SCRIPT_INPUT_FILE_$n\nframework=$(basename \"${!VAR}\")\nexport SCRIPT_INPUT_FILE_$n=\"$SRCROOT\"/Carthage/Build/$plat/\"$framework\".framework\ndone\n\n/usr/local/bin/carthage copy-frameworks || exit\n\nfor (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do\nVAR=SCRIPT_INPUT_FILE_$n\nsource=${!VAR}.dSYM\ndest=${BUILT_PRODUCTS_DIR}/$(basename \"$source\")\nditto \"$source\" \"$dest\" || exit\ndone";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
63C7FFA21D5BEE09003BAE60 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6362F84F1D5D934C0021D2DD /* SCNetworkReachability+AnyPromise.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
63C7FFEE1D5C020D003BAE60 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6383E14B1D611E0D00897651 /* SCTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
63C7FFF91D5C020D003BAE60 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 63C7FFA61D5BEE09003BAE60 /* PMKSystemConfiguration */;
|
||||
targetProxy = 63C7FFF81D5C020D003BAE60 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
63C7FFAD1D5BEE09003BAE60 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 63CCF8171D5C11B500503216 /* Carthage.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.Foundation;
|
||||
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
63C7FFAE1D5BEE09003BAE60 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 63CCF8171D5C11B500503216 /* Carthage.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.promisekit.Foundation;
|
||||
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
63C7FFB01D5BEE09003BAE60 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_MODULE_NAME = "${TARGET_NAME}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
63C7FFB11D5BEE09003BAE60 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_MODULE_NAME = "${TARGET_NAME}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
63C7FFFB1D5C020D003BAE60 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
GCC_WARN_INHIBIT_ALL_WARNINGS = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_SUPPRESS_WARNINGS = YES;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
63C7FFFC1D5C020D003BAE60 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
GCC_WARN_INHIBIT_ALL_WARNINGS = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_SUPPRESS_WARNINGS = YES;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
63C7FFA11D5BEE09003BAE60 /* Build configuration list for PBXProject "PMKSystemConfiguration" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
63C7FFAD1D5BEE09003BAE60 /* Debug */,
|
||||
63C7FFAE1D5BEE09003BAE60 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
63C7FFAF1D5BEE09003BAE60 /* Build configuration list for PBXNativeTarget "PMKSystemConfiguration" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
63C7FFB01D5BEE09003BAE60 /* Debug */,
|
||||
63C7FFB11D5BEE09003BAE60 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
63C7FFFA1D5C020D003BAE60 /* Build configuration list for PBXNativeTarget "PMKSCTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
63C7FFFB1D5C020D003BAE60 /* Debug */,
|
||||
63C7FFFC1D5C020D003BAE60 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 63C7FF9E1D5BEE09003BAE60 /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:/Users/mxcl/Desktop/PMK+UIKit/PMKFoundation.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1000"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "NO">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "NO"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFA61D5BEE09003BAE60"
|
||||
BuildableName = "PMKSystemConfiguration.framework"
|
||||
BlueprintName = "PMKSystemConfiguration"
|
||||
ReferencedContainer = "container:PMKSystemConfiguration.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFF11D5C020D003BAE60"
|
||||
BuildableName = "PMKSCTests.xctest"
|
||||
BlueprintName = "PMKSCTests"
|
||||
ReferencedContainer = "container:PMKSystemConfiguration.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFF11D5C020D003BAE60"
|
||||
BuildableName = "PMKSCTests.xctest"
|
||||
BlueprintName = "PMKSCTests"
|
||||
ReferencedContainer = "container:PMKSystemConfiguration.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFA61D5BEE09003BAE60"
|
||||
BuildableName = "PMKSystemConfiguration.framework"
|
||||
BlueprintName = "PMKSystemConfiguration"
|
||||
ReferencedContainer = "container:PMKSystemConfiguration.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFA61D5BEE09003BAE60"
|
||||
BuildableName = "PMKSystemConfiguration.framework"
|
||||
BlueprintName = "PMKSystemConfiguration"
|
||||
ReferencedContainer = "container:PMKSystemConfiguration.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "63C7FFA61D5BEE09003BAE60"
|
||||
BuildableName = "PMKSystemConfiguration.framework"
|
||||
BlueprintName = "PMKSystemConfiguration"
|
||||
ReferencedContainer = "container:PMKSystemConfiguration.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
34
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/README.markdown
vendored
Normal file
34
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/README.markdown
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
# PromiseKit SystemConfiguration Extensions ![Build Status]
|
||||
|
||||
This project adds promises to Apple’s SystemConfiguration framework.
|
||||
|
||||
## CocoaPods
|
||||
|
||||
```ruby
|
||||
pod "PromiseKit/SystemConfiguration" ~> 6.0
|
||||
```
|
||||
|
||||
The extensions are built into `PromiseKit.framework` thus nothing else is needed.
|
||||
|
||||
## Carthage
|
||||
|
||||
```ruby
|
||||
github "PromiseKit/SystemConfiguration" ~> 3.0
|
||||
```
|
||||
|
||||
The extensions are built into their own framework:
|
||||
|
||||
```swift
|
||||
// swift
|
||||
import PromiseKit
|
||||
import PMKSystemConfiguration
|
||||
```
|
||||
|
||||
```objc
|
||||
// objc
|
||||
@import PromiseKit;
|
||||
@import PMKSystemConfiguration;
|
||||
```
|
||||
|
||||
|
||||
[Build Status]: https://travis-ci.org/PromiseKit/Foundation.svg?branch=master
|
||||
@@ -0,0 +1 @@
|
||||
#import "SCNetworkReachability+AnyPromise.h"
|
||||
@@ -0,0 +1,18 @@
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
|
||||
/**
|
||||
Resolves as soon as the Internet is accessible. If it is already
|
||||
accessible, resolves immediately.
|
||||
|
||||
To import `SCNetworkReachability`:
|
||||
|
||||
use_frameworks!
|
||||
pod "PromiseKit/SystemConfiguration"
|
||||
|
||||
And then in your sources:
|
||||
|
||||
@import PromiseKit;
|
||||
|
||||
@return A void promise that fulfills when the Internet becomes accessible.
|
||||
*/
|
||||
AnyPromise *SCNetworkReachability();
|
||||
@@ -0,0 +1,116 @@
|
||||
#import <arpa/inet.h>
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <ifaddrs.h>
|
||||
#import <netdb.h>
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
#import <sys/socket.h>
|
||||
#import <SystemConfiguration/SystemConfiguration.h>
|
||||
|
||||
@interface JTSReachability: NSObject {
|
||||
@public
|
||||
PMKResolver resolve;
|
||||
id retainCycle;
|
||||
}
|
||||
- (BOOL)reachable;
|
||||
- (void)start;
|
||||
@end
|
||||
|
||||
|
||||
AnyPromise *SCNetworkReachability() {
|
||||
JTSReachability *reach = [JTSReachability new];
|
||||
if (reach.reachable)
|
||||
return [AnyPromise promiseWithValue:nil];
|
||||
reach->retainCycle = reach;
|
||||
[reach start];
|
||||
return [[AnyPromise alloc] initWithResolver:&reach->resolve];
|
||||
}
|
||||
|
||||
|
||||
static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info) {
|
||||
JTSReachability *reachability = (__bridge JTSReachability *)info;
|
||||
if (reachability.reachable) {
|
||||
reachability->resolve(nil);
|
||||
reachability->retainCycle = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@implementation JTSReachability {
|
||||
SCNetworkReachabilityRef reachabilityRef;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
struct sockaddr_in zeroAddress;
|
||||
bzero(&zeroAddress, sizeof(zeroAddress));
|
||||
zeroAddress.sin_len = sizeof(zeroAddress);
|
||||
zeroAddress.sin_family = AF_INET;
|
||||
|
||||
reachabilityRef = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)&zeroAddress);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)start {
|
||||
SCNetworkReachabilityContext context = {0, (__bridge void *)(self), NULL, NULL, NULL};
|
||||
SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context);
|
||||
SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||
CFRelease(reachabilityRef);
|
||||
}
|
||||
|
||||
- (BOOL)reachable {
|
||||
SCNetworkReachabilityFlags flags;
|
||||
if (!SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
||||
return NO;
|
||||
|
||||
if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
|
||||
return NO;
|
||||
|
||||
BOOL returnValue = NO;
|
||||
|
||||
if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
|
||||
{
|
||||
/*
|
||||
If the target host is reachable and no connection is required then we'll assume (for now) that you're on Wi-Fi...
|
||||
*/
|
||||
returnValue = YES;
|
||||
}
|
||||
|
||||
if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
|
||||
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
|
||||
{
|
||||
/*
|
||||
... and the connection is on-demand (or on-traffic) if the calling application is using the CFSocketStream or higher APIs...
|
||||
*/
|
||||
|
||||
if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
|
||||
{
|
||||
/*
|
||||
... and no [user] intervention is needed...
|
||||
*/
|
||||
returnValue = YES;
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
|
||||
{
|
||||
/*
|
||||
... but WWAN connections are OK if the calling application is using the CFNetwork APIs.
|
||||
*/
|
||||
if (flags & kSCNetworkReachabilityFlagsConnectionRequired) {
|
||||
returnValue = NO;
|
||||
} else {
|
||||
returnValue = YES;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,62 @@
|
||||
import SystemConfiguration
|
||||
#if !PMKCocoaPods
|
||||
import PromiseKit
|
||||
#endif
|
||||
|
||||
public extension SCNetworkReachability {
|
||||
|
||||
enum PMKError: Error {
|
||||
case couldNotInitializeReachability
|
||||
}
|
||||
|
||||
static func promise() -> Promise<Void> {
|
||||
do {
|
||||
var zeroAddress = sockaddr()
|
||||
zeroAddress.sa_len = UInt8(MemoryLayout<sockaddr>.size)
|
||||
zeroAddress.sa_family = sa_family_t(AF_INET)
|
||||
guard let ref = SCNetworkReachabilityCreateWithAddress(nil, &zeroAddress) else {
|
||||
throw PMKError.couldNotInitializeReachability
|
||||
}
|
||||
|
||||
var flags = SCNetworkReachabilityFlags()
|
||||
if SCNetworkReachabilityGetFlags(ref, &flags), flags.contains(.reachable) {
|
||||
return Promise()
|
||||
}
|
||||
|
||||
return try Helper(ref: ref).pending.promise
|
||||
} catch {
|
||||
return Promise(error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func callback(reachability: SCNetworkReachability, flags: SCNetworkReachabilityFlags, info: UnsafeMutableRawPointer?) {
|
||||
if let info = info, flags.contains(.reachable) {
|
||||
Unmanaged<Helper>.fromOpaque(info).takeUnretainedValue().pending.resolver.fulfill(())
|
||||
}
|
||||
}
|
||||
|
||||
private class Helper {
|
||||
let pending = Promise<Void>.pending()
|
||||
let ref: SCNetworkReachability
|
||||
|
||||
init(ref: SCNetworkReachability) throws {
|
||||
self.ref = ref
|
||||
|
||||
var context = SCNetworkReachabilityContext(version: 0, info: nil, retain: nil, release: nil, copyDescription: nil)
|
||||
context.info = UnsafeMutableRawPointer(Unmanaged<Helper>.passUnretained(self).toOpaque())
|
||||
|
||||
guard SCNetworkReachabilitySetCallback(ref, callback, &context) else {
|
||||
throw SCNetworkReachability.PMKError.couldNotInitializeReachability
|
||||
}
|
||||
guard SCNetworkReachabilitySetDispatchQueue(ref, .main) else {
|
||||
SCNetworkReachabilitySetCallback(ref, nil, nil)
|
||||
throw SCNetworkReachability.PMKError.couldNotInitializeReachability
|
||||
}
|
||||
|
||||
_ = pending.promise.ensure {
|
||||
SCNetworkReachabilitySetCallback(self.ref, nil, nil)
|
||||
SCNetworkReachabilitySetDispatchQueue(self.ref, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/Tests/SCTests.swift
vendored
Normal file
9
Carthage/Checkouts/PromiseKit/Extensions/SystemConfiguration/Tests/SCTests.swift
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import PMKSystemConfiguration
|
||||
import XCTest
|
||||
|
||||
class PMKSCTestCase: XCTestCase {
|
||||
func test() {
|
||||
// just verify everything links etc.
|
||||
SCNetworkReachability()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user