Add PromiseKit dependency

- Added PromiseKit dependency
This commit is contained in:
2018-11-15 22:08:00 -04:00
parent 2689d86c18
commit be7b6b5881
541 changed files with 46282 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
*.xcodeproj/**/xcuserdata/
*.xcscmblueprint
/Carthage
/.build
.DS_Store

View File

@@ -0,0 +1,26 @@
os: osx
language: objective-c
osx_image: xcode10
env:
- PLAT=macOS SWFT=3.4 DST="arch=x86_64"
- PLAT=iOS SWFT=3.4 DST="OS=11.4,name=iPhone 5s"
- PLAT=macOS SWFT=4.2 DST="arch=x86_64" TEST=1
- PLAT=iOS SWFT=4.2 DST="OS=8.4,name=iPhone 4s"
- PLAT=iOS SWFT=4.2 DST="OS=9.3,name=iPhone 5s"
- PLAT=iOS SWFT=4.2 DST="OS=10.3.1,name=iPhone SE"
- PLAT=iOS SWFT=4.2 DST="OS=11.4,name=iPhone 5s" TEST=1
cache:
directories:
- Carthage
before_install:
- carthage bootstrap --cache-builds --no-use-binaries --platform $PLAT --verbose
install:
- xcodebuild -scheme PMKSocial -target PMKSocial -quiet -destination "$DST" build SWIFT_VERSION=$SWFT SWIFT_TREAT_WARNINGS_AS_ERRORS=YES
- if [[ $TEST == "1" ]]; then
xcodebuild -scheme PMKSocial -target PMKSLTests -quiet -destination "$DST" build;
fi
script:
- if [[ $TEST == "1" ]]; then
xcodebuild -scheme PMKSocial -quiet -destination "$DST" test;
fi

View File

@@ -0,0 +1,2 @@
github "mxcl/PromiseKit" ~> 6.0
github "PromiseKit/Foundation" ~> 3.0

View File

@@ -0,0 +1,2 @@
github "PromiseKit/Foundation" "3.2.0"
github "mxcl/PromiseKit" "6.3.4"

View 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)

View 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>

View File

@@ -0,0 +1,466 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
637B4A741D5D5FC600E1BC6C /* PMKSocial.h in Headers */ = {isa = PBXBuildFile; fileRef = 637B4A731D5D5FC600E1BC6C /* PMKSocial.h */; settings = {ATTRIBUTES = (Public, ); }; };
63B8B9A81D5D621F007AAB62 /* SLComposeViewController+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B8B9A41D5D621F007AAB62 /* SLComposeViewController+Promise.swift */; };
63B8B9A91D5D621F007AAB62 /* SLRequest+AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 63B8B9A51D5D621F007AAB62 /* SLRequest+AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; };
63B8B9AA1D5D621F007AAB62 /* SLRequest+AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B8B9A61D5D621F007AAB62 /* SLRequest+AnyPromise.m */; };
63B8B9AB1D5D621F007AAB62 /* SLRequest+Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B8B9A71D5D621F007AAB62 /* SLRequest+Promise.swift */; };
63B8B9AE1D5D622E007AAB62 /* TestSocial.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B8B9AC1D5D622E007AAB62 /* TestSocial.m */; };
63B8B9AF1D5D622E007AAB62 /* TestSocial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B8B9AD1D5D622E007AAB62 /* TestSocial.swift */; };
63C7FFF71D5C020D003BAE60 /* PMKSocial.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63C7FFA71D5BEE09003BAE60 /* PMKSocial.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
63C7FFF81D5C020D003BAE60 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 63C7FF9E1D5BEE09003BAE60 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 63C7FFA61D5BEE09003BAE60;
remoteInfo = PMKSocial;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
637B4A731D5D5FC600E1BC6C /* PMKSocial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PMKSocial.h; path = Sources/PMKSocial.h; sourceTree = SOURCE_ROOT; };
63B8B9A41D5D621F007AAB62 /* SLComposeViewController+Promise.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "SLComposeViewController+Promise.swift"; path = "Sources/SLComposeViewController+Promise.swift"; sourceTree = SOURCE_ROOT; };
63B8B9A51D5D621F007AAB62 /* SLRequest+AnyPromise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "SLRequest+AnyPromise.h"; path = "Sources/SLRequest+AnyPromise.h"; sourceTree = SOURCE_ROOT; };
63B8B9A61D5D621F007AAB62 /* SLRequest+AnyPromise.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "SLRequest+AnyPromise.m"; path = "Sources/SLRequest+AnyPromise.m"; sourceTree = SOURCE_ROOT; };
63B8B9A71D5D621F007AAB62 /* SLRequest+Promise.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "SLRequest+Promise.swift"; path = "Sources/SLRequest+Promise.swift"; sourceTree = SOURCE_ROOT; };
63B8B9AC1D5D622E007AAB62 /* TestSocial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TestSocial.m; path = Tests/TestSocial.m; sourceTree = SOURCE_ROOT; };
63B8B9AD1D5D622E007AAB62 /* TestSocial.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TestSocial.swift; path = Tests/TestSocial.swift; sourceTree = SOURCE_ROOT; };
63C700091D5C0253003BAE60 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
63C7FFA71D5BEE09003BAE60 /* PMKSocial.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PMKSocial.framework; sourceTree = BUILT_PRODUCTS_DIR; };
63C7FFF21D5C020D003BAE60 /* PMKSLTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PMKSLTests.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 /* PMKSocial.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 /* PMKSocial.framework */,
63C7FFF21D5C020D003BAE60 /* PMKSLTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
63C7FFA91D5BEE09003BAE60 /* Sources */ = {
isa = PBXGroup;
children = (
637B4A731D5D5FC600E1BC6C /* PMKSocial.h */,
63B8B9A41D5D621F007AAB62 /* SLComposeViewController+Promise.swift */,
63B8B9A51D5D621F007AAB62 /* SLRequest+AnyPromise.h */,
63B8B9A61D5D621F007AAB62 /* SLRequest+AnyPromise.m */,
63B8B9A71D5D621F007AAB62 /* SLRequest+Promise.swift */,
);
path = Sources;
sourceTree = SOURCE_ROOT;
};
63C7FFF31D5C020D003BAE60 /* Tests */ = {
isa = PBXGroup;
children = (
63B8B9AC1D5D622E007AAB62 /* TestSocial.m */,
63B8B9AD1D5D622E007AAB62 /* TestSocial.swift */,
);
path = Tests;
sourceTree = SOURCE_ROOT;
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
63C7FFA41D5BEE09003BAE60 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
637B4A741D5D5FC600E1BC6C /* PMKSocial.h in Headers */,
63B8B9A91D5D621F007AAB62 /* SLRequest+AnyPromise.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
63C7FFA61D5BEE09003BAE60 /* PMKSocial */ = {
isa = PBXNativeTarget;
buildConfigurationList = 63C7FFAF1D5BEE09003BAE60 /* Build configuration list for PBXNativeTarget "PMKSocial" */;
buildPhases = (
63C7FFA21D5BEE09003BAE60 /* Sources */,
63C7FFA31D5BEE09003BAE60 /* Frameworks */,
63C7FFA41D5BEE09003BAE60 /* Headers */,
);
buildRules = (
);
dependencies = (
);
name = PMKSocial;
productName = "PMK+UIKit";
productReference = 63C7FFA71D5BEE09003BAE60 /* PMKSocial.framework */;
productType = "com.apple.product-type.framework";
};
63C7FFF11D5C020D003BAE60 /* PMKSLTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 63C7FFFA1D5C020D003BAE60 /* Build configuration list for PBXNativeTarget "PMKSLTests" */;
buildPhases = (
63C7FFEE1D5C020D003BAE60 /* Sources */,
63C7FFEF1D5C020D003BAE60 /* Frameworks */,
639447051D5D011300DDAE3C /* Embed Carthage Frameworks */,
);
buildRules = (
);
dependencies = (
63C7FFF91D5C020D003BAE60 /* PBXTargetDependency */,
);
name = PMKSLTests;
productName = PMKTests/NS;
productReference = 63C7FFF21D5C020D003BAE60 /* PMKSLTests.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 = 0900;
ProvisioningStyle = Automatic;
};
63C7FFF11D5C020D003BAE60 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = 63C7FFA11D5BEE09003BAE60 /* Build configuration list for PBXProject "PMKSocial" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 63C7FF9D1D5BEE09003BAE60;
productRefGroup = 63C7FFA81D5BEE09003BAE60 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
63C7FFA61D5BEE09003BAE60 /* PMKSocial */,
63C7FFF11D5C020D003BAE60 /* PMKSLTests */,
);
};
/* End PBXProject section */
/* Begin PBXShellScriptBuildPhase section */
639447051D5D011300DDAE3C /* Embed Carthage Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
PromiseKit,
PMKFoundation,
);
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 = (
63B8B9A81D5D621F007AAB62 /* SLComposeViewController+Promise.swift in Sources */,
63B8B9AB1D5D621F007AAB62 /* SLRequest+Promise.swift in Sources */,
63B8B9AA1D5D621F007AAB62 /* SLRequest+AnyPromise.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
63C7FFEE1D5C020D003BAE60 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63B8B9AF1D5D622E007AAB62 /* TestSocial.swift in Sources */,
63B8B9AE1D5D622E007AAB62 /* TestSocial.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
63C7FFF91D5C020D003BAE60 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 63C7FFA61D5BEE09003BAE60 /* PMKSocial */;
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.StoreKit;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
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.StoreKit;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
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";
};
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)";
};
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_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_VERSION = 4.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
63C7FFA11D5BEE09003BAE60 /* Build configuration list for PBXProject "PMKSocial" */ = {
isa = XCConfigurationList;
buildConfigurations = (
63C7FFAD1D5BEE09003BAE60 /* Debug */,
63C7FFAE1D5BEE09003BAE60 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
63C7FFAF1D5BEE09003BAE60 /* Build configuration list for PBXNativeTarget "PMKSocial" */ = {
isa = XCConfigurationList;
buildConfigurations = (
63C7FFB01D5BEE09003BAE60 /* Debug */,
63C7FFB11D5BEE09003BAE60 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
63C7FFFA1D5C020D003BAE60 /* Build configuration list for PBXNativeTarget "PMKSLTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
63C7FFFB1D5C020D003BAE60 /* Debug */,
63C7FFFC1D5C020D003BAE60 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 63C7FF9E1D5BEE09003BAE60 /* Project object */;
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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 = "PMKSocial.framework"
BlueprintName = "PMKSocial"
ReferencedContainer = "container:PMKSocial.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63C7FFF11D5C020D003BAE60"
BuildableName = "PMKSLTests.xctest"
BlueprintName = "PMKSLTests"
ReferencedContainer = "container:PMKSocial.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 = "PMKSLTests.xctest"
BlueprintName = "PMKSLTests"
ReferencedContainer = "container:PMKSocial.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63C7FFA61D5BEE09003BAE60"
BuildableName = "PMKSocial.framework"
BlueprintName = "PMKSocial"
ReferencedContainer = "container:PMKSocial.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 = "PMKSocial.framework"
BlueprintName = "PMKSocial"
ReferencedContainer = "container:PMKSocial.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63C7FFA61D5BEE09003BAE60"
BuildableName = "PMKSocial.framework"
BlueprintName = "PMKSocial"
ReferencedContainer = "container:PMKSocial.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,34 @@
# PromiseKit Social Extensions ![Build Status]
This project adds promises to Apples Social framework.
## CocoaPods
```ruby
pod "PromiseKit/Social", "~> 6.0"
```
The extensions are built into `PromiseKit.framework` thus nothing else is needed.
## Carthage
```ruby
github "PromiseKit/Social" ~> 3.0
```
The extensions are built into their own framework:
```swift
// swift
import PromiseKit
import PMKSocial
```
```objc
// objc
@import PromiseKit;
@import PMKSocial;
```
[Build Status]: https://travis-ci.org/PromiseKit/Social.svg?branch=master

View File

@@ -0,0 +1 @@
#import "SLRequest+AnyPromise.h"

View File

@@ -0,0 +1,48 @@
#if !os(OSX)
import Social.SLComposeViewController
import UIKit.UIViewController
#if !PMKCocoaPods
import PromiseKit
#endif
/**
To import this `UIViewController` category:
use_frameworks!
pod "PromiseKit/Social"
And then in your sources:
import PromiseKit
*/
extension UIViewController {
/// Presents the message view controller and resolves with the user action.
public func promise(_ vc: SLComposeViewController, animated: Bool = true, completion: (() -> Void)? = nil) -> Promise<Void> {
present(vc, animated: animated, completion: completion)
return Promise { seal in
vc.completionHandler = { result in
if result == .cancelled {
seal.reject(SLComposeViewController.PMKError.cancelled)
} else {
seal.fulfill(())
}
}
}
}
}
extension SLComposeViewController {
/// Errors representing PromiseKit SLComposeViewController failures
public enum PMKError: CancellableError {
/// The user cancelled the view controller.
case cancelled
/// - Returns: true
public var isCancelled: Bool {
switch self { case .cancelled: return true }
}
}
}
#endif

View File

@@ -0,0 +1,36 @@
//
// Created by merowing on 09/05/2014.
//
//
//
#import <PromiseKit/AnyPromise.h>
#import <Social/SLRequest.h>
/**
To import the `SLRequest` category:
use_frameworks!
pod "PromiseKit/Social"
And then in your sources:
@import PromiseKit;
*/
@interface SLRequest (PromiseKit)
/**
Performs the request asynchronously.
@return A promise that fulfills with three parameters:
1) The response decoded as JSON.
2) The `NSHTTPURLResponse`.
3) The raw `NSData` response.
@warning *Note* If PromiseKit determines the response is not JSON, the first
parameter will instead be plain `NSData`.
*/
- (AnyPromise *)promise NS_REFINED_FOR_SWIFT;
@end

View File

@@ -0,0 +1,51 @@
//
// Created by merowing on 09/05/2014.
//
//
//
#import <PromiseKit/PromiseKit.h>
#import "SLRequest+AnyPromise.h"
#if COCOAPODS
#import "NSURLSession+AnyPromise.h"
#else
#import <PMKFoundation/NSURLSession+AnyPromise.h>
#endif
@implementation SLRequest (PromiseKit)
- (AnyPromise *)promise {
return [AnyPromise promiseWithResolverBlock:^(PMKResolver resolve) {
[self performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
assert(![NSThread isMainThread]);
if (error)
return resolve(error);
NSInteger const statusCode = urlResponse.statusCode;
if (statusCode < 200 || statusCode >= 300) {
id userInfo = [NSMutableDictionary new];
userInfo[PMKURLErrorFailingURLResponseKey] = urlResponse;
userInfo[NSLocalizedDescriptionKey] = [NSHTTPURLResponse localizedStringForStatusCode:statusCode];
if (responseData) {
id str = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
userInfo[PMKURLErrorFailingStringKey] = str;
}
resolve([NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorBadServerResponse userInfo:userInfo]);
}
else if (PMKHTTPURLResponseIsJSON(urlResponse)) {
id err = nil;
id json = [NSJSONSerialization JSONObjectWithData:responseData options:PMKJSONDeserializationOptions error:&err];
resolve(err ?: PMKManifold(json, urlResponse, responseData));
} else {
resolve(PMKManifold(responseData, urlResponse, responseData));
}
}];
}];
}
@end

View File

@@ -0,0 +1,37 @@
#if !PMKCocoaPods
import PMKFoundation
import PromiseKit
#endif
import Social
/**
To import the `SLRequest` category:
use_frameworks!
pod "PromiseKit/Social"
And then in your sources:
import PromiseKit
*/
extension SLRequest {
/**
Performs the request asynchronously.
- Returns: A promise that fulfills with the response.
- SeeAlso: `URLDataPromise`
*/
public func perform() -> Promise<(data: Data, response: HTTPURLResponse)> {
return Promise { seal in
perform { data, rsp, error in
if let data = data, let rsp = rsp {
seal.fulfill((data, rsp))
} else if let error = error {
seal.reject(error)
} else {
seal.reject(PMKError.invalidCallingConvention)
}
}
}
}
}

View File

@@ -0,0 +1,16 @@
import XCTest
class UITest_SLComposeViewController_Swift: PMKiOSUITestCase {
func test_can_cancel() {
let app = XCUIApplication()
app.tables.staticTexts["5"].tap()
sleep(5) // takes longer than usual
app.alerts.buttons["Cancel"].tap()
sleep(3) // takes longer than usual (this may only pass when you look at it)
XCTAssertTrue(value)
}
}

View File

@@ -0,0 +1,136 @@
@import PMKSocial;
@import XCTest;
@interface MockSLRequest: SLRequest
@property id response;
@property id data;
@property id error;
@end
@implementation MockSLRequest
- (void)performRequestWithHandler:(SLRequestHandler)handler {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
handler(_data, _response, _error);
});
}
@end
@implementation Test_SLRequest_ObjC: XCTestCase
- (void)test1 {
id url = [NSURL URLWithString:@"http://example.com"];
id input = @{@"3": @4};
MockSLRequest *request = (id) [MockSLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:url parameters:@{@"1": @2}];
request.response = [[NSHTTPURLResponse alloc] initWithURL:url statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/json"}];
request.data = [NSJSONSerialization dataWithJSONObject:input options:0 error:nil];
id ex = [self expectationWithDescription:@""];
[request promise].then(^(id json){
XCTAssertEqualObjects(json, input);
[ex fulfill];
});
[self waitForExpectationsWithTimeout:1 handler:nil];
}
- (void)test2 {
id url = [NSURL URLWithString:@"http://example.com"];
MockSLRequest *request = (id) [MockSLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:url parameters:@{@"1": @2}];
request.response = [[NSHTTPURLResponse alloc] initWithURL:url statusCode:500 HTTPVersion:@"1.1" headerFields:@{}];
id ex = [self expectationWithDescription:@""];
[request promise].catch(^(id err){
XCTAssertEqualObjects(NSURLErrorDomain, [err domain]);
XCTAssertEqual([err code], NSURLErrorBadServerResponse);
[ex fulfill];
});
[self waitForExpectationsWithTimeout:1 handler:nil];
}
- (void)test3 {
id url = [NSURL URLWithString:@"http://example.com"];
id data = [NSData dataWithBytes:"abc" length:3];
MockSLRequest *request = (id) [MockSLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:url parameters:@{@"1": @2}];
request.response = [[NSHTTPURLResponse alloc] initWithURL:url statusCode:200 HTTPVersion:@"1.1" headerFields:@{}];
request.data = data;
id ex = [self expectationWithDescription:@""];
[request promise].then(^(id rspdata){
XCTAssertEqualObjects(data, rspdata);
[ex fulfill];
});
[self waitForExpectationsWithTimeout:1 handler:nil];
}
- (void)test4 {
id url = [NSURL URLWithString:@"http://example.com"];
MockSLRequest *request = (id) [MockSLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:url parameters:@{@"1": @2}];
request.response = [[NSHTTPURLResponse alloc] initWithURL:url statusCode:200 HTTPVersion:@"1.1" headerFields:@{}];
request.error = [NSError errorWithDomain:@"Cat" code:123 userInfo:nil];
id ex = [self expectationWithDescription:@""];
[request promise].catch(^(NSError *error){
XCTAssertEqual(error.code, 123);
XCTAssertEqualObjects(error.domain, @"Cat");
[ex fulfill];
});
[self waitForExpectationsWithTimeout:1 handler:nil];
}
@end
#ifndef TARGET_OS_MAC
#import <PromiseKit/NSError+Cancellation.h>
@import Social.SLComposeViewController;
@import Stubbilino;
#import "UIViewController+AnyPromise.h"
@implementation Test_SLComposeViewController_ObjC: XCTestCase
- (void)__test:(SLComposeViewControllerResult)dummy :(void (^)(AnyPromise *, id expectation))block {
id rootvc = [UIViewController new];
id ex = [self expectationWithDescription:@""];
SLComposeViewController *composevc = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
id stub = [Stubbilino stubObject:rootvc];
[stub stubMethod:@selector(presentViewController:animated:completion:) withBlock:^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
composevc.completionHandler(dummy);
});
}];
block([rootvc promiseViewController:composevc animated:NO completion:nil], ex);
[self waitForExpectationsWithTimeout:1 handler:nil];
}
- (void)test1 {
NSInteger dummy = SLComposeViewControllerResultDone;
[self __test:dummy :^(AnyPromise *promise, id expectation) {
promise.then(^(id result){
XCTAssertEqual([result integerValue], dummy);
[expectation fulfill];
});
}];
}
- (void)test2 {
[self __test:SLComposeViewControllerResultCancelled :^(AnyPromise *promise, id expectation) {
promise.catchWithPolicy(PMKCatchPolicyAllErrors, ^(NSError *error){
XCTAssertTrue(error.cancelled);
[expectation fulfill];
});
}];
}
@end
#endif

View File

@@ -0,0 +1,56 @@
import PromiseKit
import PMKSocial
import Social
import XCTest
class SLRequestTests: XCTestCase {
func testSLRequest() {
// I tried to just override SLRequest, but Swift wouldn't let me
// then use the long initializer, and an exception is thrown inside
// init()
swizzle(SLRequest.self, #selector(SLRequest.perform(handler:))) {
let url = URL(string: "https://api.twitter.com/1.1/statuses/user_timeline.json")
let params = ["foo": "bar"]
let rq = SLRequest(forServiceType: SLServiceTypeTwitter, requestMethod: .GET, url: url, parameters: params)!
let ex = expectation(description: "")
rq.perform().done {
XCTAssertEqual($0.data, Data())
ex.fulfill()
}.catch {
XCTFail("\($0)")
}
waitForExpectations(timeout: 1, handler: nil)
}
}
}
extension SLRequest {
@objc private func pmk_performRequestWithHandler(_ handler: @escaping SLRequestHandler) {
after(seconds: 0).done { _ in
let rsp = HTTPURLResponse(url: URL(string: "http://example.com")!, statusCode: 200, httpVersion: "2.0", headerFields: [:])
handler(Data(), rsp, nil)
}
}
}
import ObjectiveC
func swizzle(_ foo: AnyClass, _ from: Selector, isClassMethod: Bool = false, body: () -> Void) {
let originalMethod: Method!
let swizzledMethod: Method!
if isClassMethod {
originalMethod = class_getClassMethod(foo, from)
swizzledMethod = class_getClassMethod(foo, Selector("pmk_\(from)"))
} else {
originalMethod = class_getInstanceMethod(foo, from)
swizzledMethod = class_getInstanceMethod(foo, Selector("pmk_\(from)"))
}
method_exchangeImplementations(originalMethod, swizzledMethod)
body()
method_exchangeImplementations(swizzledMethod, originalMethod)
}