├── Pods ├── Headers │ └── Private │ │ ├── Bolts │ │ ├── BFURL.h │ │ ├── BFTask.h │ │ ├── Bolts.h │ │ ├── BFAppLink.h │ │ ├── BFDefines.h │ │ ├── BFExecutor.h │ │ ├── BoltsVersion.h │ │ ├── BFAppLinkTarget.h │ │ ├── BFURL_Internal.h │ │ ├── BFAppLinkResolving.h │ │ ├── BFAppLink_Internal.h │ │ ├── BFMeasurementEvent.h │ │ ├── BFAppLinkNavigation.h │ │ ├── BFCancellationToken.h │ │ ├── BFTaskCompletionSource.h │ │ ├── BFWebViewAppLinkResolver.h │ │ ├── BFAppLinkReturnToRefererView.h │ │ ├── BFCancellationTokenSource.h │ │ ├── BFMeasurementEvent_Internal.h │ │ ├── BFCancellationTokenRegistration.h │ │ ├── BFAppLinkReturnToRefererController.h │ │ └── BFAppLinkReturnToRefererView_Internal.h │ │ └── AFNetworking │ │ ├── AFNetworking.h │ │ ├── AFSecurityPolicy.h │ │ ├── AFHTTPSessionManager.h │ │ ├── AFImageDownloader.h │ │ ├── AFURLSessionManager.h │ │ ├── UIKit+AFNetworking.h │ │ ├── AFURLRequestSerialization.h │ │ ├── UIButton+AFNetworking.h │ │ ├── UIImage+AFNetworking.h │ │ ├── UIWebView+AFNetworking.h │ │ ├── AFAutoPurgingImageCache.h │ │ ├── AFURLResponseSerialization.h │ │ ├── UIImageView+AFNetworking.h │ │ ├── AFNetworkReachabilityManager.h │ │ ├── UIProgressView+AFNetworking.h │ │ ├── UIRefreshControl+AFNetworking.h │ │ ├── AFNetworkActivityIndicatorManager.h │ │ └── UIActivityIndicatorView+AFNetworking.h ├── Bolts │ ├── Bolts │ │ ├── Common │ │ │ ├── BoltsVersion.h │ │ │ ├── Bolts.m │ │ │ ├── BFDefines.h │ │ │ ├── BFCancellationTokenRegistration.h │ │ │ ├── BFCancellationToken.h │ │ │ ├── BFCancellationTokenSource.m │ │ │ ├── Bolts.h │ │ │ ├── BFExecutor.h │ │ │ ├── BFCancellationTokenSource.h │ │ │ ├── BFTaskCompletionSource.m │ │ │ ├── BFCancellationTokenRegistration.m │ │ │ ├── BFTaskCompletionSource.h │ │ │ ├── BFExecutor.m │ │ │ └── BFCancellationToken.m │ │ └── iOS │ │ │ ├── BFURL_Internal.h │ │ │ ├── BFAppLinkReturnToRefererView_Internal.h │ │ │ ├── BFMeasurementEvent_Internal.h │ │ │ ├── BFWebViewAppLinkResolver.h │ │ │ ├── BFAppLink_Internal.h │ │ │ ├── BFAppLinkResolving.h │ │ │ ├── BFAppLinkTarget.m │ │ │ ├── BFAppLinkTarget.h │ │ │ ├── BFAppLink.h │ │ │ ├── BFMeasurementEvent.h │ │ │ ├── BFMeasurementEvent.m │ │ │ ├── BFAppLink.m │ │ │ ├── BFAppLinkReturnToRefererView.h │ │ │ ├── BFURL.h │ │ │ ├── BFAppLinkReturnToRefererController.h │ │ │ └── BFAppLinkNavigation.h │ └── LICENSE ├── Target Support Files │ ├── Bolts │ │ ├── Bolts-prefix.pch │ │ ├── Bolts.modulemap │ │ ├── Bolts-dummy.m │ │ ├── Bolts.xcconfig │ │ ├── Bolts-umbrella.h │ │ └── Info.plist │ ├── AFNetworking │ │ ├── AFNetworking.modulemap │ │ ├── AFNetworking-dummy.m │ │ ├── AFNetworking-prefix.pch │ │ ├── AFNetworking.xcconfig │ │ ├── AFNetworking-umbrella.h │ │ └── Info.plist │ └── Pods-KK_Operation │ │ ├── Pods-KK_Operation.modulemap │ │ ├── Pods-KK_Operation-dummy.m │ │ ├── Pods-KK_Operation-umbrella.h │ │ ├── Pods-KK_Operation.debug.xcconfig │ │ ├── Pods-KK_Operation.release.xcconfig │ │ ├── Info.plist │ │ ├── Pods-KK_Operation-acknowledgements.markdown │ │ ├── Pods-KK_Operation-frameworks.sh │ │ ├── Pods-KK_Operation-acknowledgements.plist │ │ └── Pods-KK_Operation-resources.sh ├── Pods.xcodeproj │ └── xcuserdata │ │ └── htaiwan.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ ├── Bolts.xcscheme │ │ ├── AFNetworking.xcscheme │ │ └── Pods-KK_Operation.xcscheme ├── Manifest.lock └── AFNetworking │ ├── LICENSE │ ├── UIKit+AFNetworking │ ├── UIImage+AFNetworking.h │ ├── UIKit+AFNetworking.h │ ├── UIActivityIndicatorView+AFNetworking.h │ ├── UIRefreshControl+AFNetworking.h │ ├── UIProgressView+AFNetworking.h │ ├── AFNetworkActivityIndicatorManager.h │ ├── UIWebView+AFNetworking.h │ ├── UIRefreshControl+AFNetworking.m │ ├── UIActivityIndicatorView+AFNetworking.m │ ├── UIProgressView+AFNetworking.m │ ├── UIImageView+AFNetworking.h │ ├── AFNetworkActivityIndicatorManager.m │ ├── AFAutoPurgingImageCache.h │ └── UIImageView+AFNetworking.m │ └── AFNetworking │ ├── AFNetworking.h │ └── AFSecurityPolicy.h ├── Podfile ├── KK_Operation.xcworkspace ├── xcuserdata │ └── htaiwan.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── UserInterfaceState.xcuserstate └── contents.xcworkspacedata ├── KK_Operation.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── htaiwan.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── htaiwan.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── KK_Operation.xcscheme ├── KK_OperationTests ├── Info.plist ├── KK_OperationTests.swift └── ApiManagerTests.swift ├── KK_OperationUITests ├── Info.plist └── KK_OperationUITests.swift ├── Podfile.lock ├── KK_Operation ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.swift └── AppDelegate.swift ├── README.md ├── AsynOperation.swift ├── ApiManager.swift ├── HTTPBinManager.swift └── HTTPBinManagerOperation.swift /Pods/Headers/Private/Bolts/BFURL.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFURL.h -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BoltsVersion.h: -------------------------------------------------------------------------------- 1 | #define BOLTS_VERSION @"1.3.0" 2 | -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFTask.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/Common/BFTask.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/Bolts.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/Common/Bolts.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFAppLink.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFAppLink.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFDefines.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/Common/BFDefines.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFExecutor.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/Common/BFExecutor.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BoltsVersion.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/Common/BoltsVersion.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFAppLinkTarget.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFAppLinkTarget.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFURL_Internal.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFURL_Internal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFAppLinkResolving.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFAppLinkResolving.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFAppLink_Internal.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFAppLink_Internal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFMeasurementEvent.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFMeasurementEvent.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFAppLinkNavigation.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFAppLinkNavigation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFCancellationToken.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/Common/BFCancellationToken.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFTaskCompletionSource.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/Common/BFTaskCompletionSource.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFSecurityPolicy.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFWebViewAppLinkResolver.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFWebViewAppLinkResolver.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/AFHTTPSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFHTTPSessionManager.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/AFImageDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/AFImageDownloader.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/AFURLSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFURLSessionManager.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFAppLinkReturnToRefererView.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFAppLinkReturnToRefererView.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFCancellationTokenSource.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/Common/BFCancellationTokenSource.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFMeasurementEvent_Internal.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFMeasurementEvent_Internal.h -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Bolts-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/AFURLRequestSerialization.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFURLRequestSerialization.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/UIButton+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/UIImage+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/UIWebView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFCancellationTokenRegistration.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/Common/BFCancellationTokenRegistration.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/AFAutoPurgingImageCache.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/AFURLResponseSerialization.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFURLResponseSerialization.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/UIImageView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFAppLinkReturnToRefererController.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/AFNetworkReachabilityManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/UIProgressView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Bolts/BFAppLinkReturnToRefererView_Internal.h: -------------------------------------------------------------------------------- 1 | ../../../Bolts/Bolts/iOS/BFAppLinkReturnToRefererView_Internal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/AFNetworkActivityIndicatorManager.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h -------------------------------------------------------------------------------- /Pods/Headers/Private/AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Bolts.modulemap: -------------------------------------------------------------------------------- 1 | framework module Bolts { 2 | umbrella header "Bolts-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Bolts-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Bolts : NSObject 3 | @end 4 | @implementation PodsDummy_Bolts 5 | @end 6 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '8.0' 2 | use_frameworks! 3 | 4 | target 'KK_Operation' do 5 | 6 | pod 'Bolts', '~> 1.3.0' 7 | pod 'AFNetworking', '~> 3.0.0-beta.1' 8 | 9 | end 10 | 11 | -------------------------------------------------------------------------------- /KK_Operation.xcworkspace/xcuserdata/htaiwan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AFNetworking/AFNetworking.modulemap: -------------------------------------------------------------------------------- 1 | framework module AFNetworking { 2 | umbrella header "AFNetworking-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AFNetworking/AFNetworking-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_AFNetworking : NSObject 3 | @end 4 | @implementation PodsDummy_AFNetworking 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-KK_Operation/Pods-KK_Operation.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_KK_Operation { 2 | umbrella header "Pods-KK_Operation-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-KK_Operation/Pods-KK_Operation-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_KK_Operation : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_KK_Operation 5 | @end 6 | -------------------------------------------------------------------------------- /KK_Operation.xcworkspace/xcuserdata/htaiwan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/htaiwan/KKBoxPractice/HEAD/KK_Operation.xcworkspace/xcuserdata/htaiwan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /KK_Operation.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-KK_Operation/Pods-KK_Operation-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double Pods_KK_OperationVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char Pods_KK_OperationVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /KK_Operation.xcodeproj/project.xcworkspace/xcuserdata/htaiwan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/htaiwan/KKBoxPractice/HEAD/KK_Operation.xcodeproj/project.xcworkspace/xcuserdata/htaiwan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Bolts.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Bolts" "${PODS_ROOT}/Headers/Public" 3 | PODS_ROOT = ${SRCROOT} 4 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /KK_Operation.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AFNetworking/AFNetworking-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #ifndef TARGET_OS_IOS 6 | #define TARGET_OS_IOS TARGET_OS_IPHONE 7 | #endif 8 | 9 | #ifndef TARGET_OS_WATCH 10 | #define TARGET_OS_WATCH 0 11 | #endif 12 | 13 | #ifndef TARGET_OS_TV 14 | #define TARGET_OS_TV 0 15 | #endif 16 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AFNetworking/AFNetworking.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworking" "${PODS_ROOT}/Headers/Public" 3 | OTHER_LDFLAGS = -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration" 4 | PODS_ROOT = ${SRCROOT} 5 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFURL_Internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | @interface BFURL (Internal) 14 | + (BFURL *)URLForRenderBackToReferrerBarURL:(NSURL *)url; 15 | @end 16 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererView_Internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | @interface BFAppLinkReturnToRefererView (Internal) 14 | 15 | - (CGFloat)statusBarHeight; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/Bolts.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "Bolts.h" 12 | 13 | NSInteger const kBFMultipleErrorsError = 80175001; 14 | 15 | @implementation Bolts 16 | 17 | + (NSString *)version { 18 | return BOLTS_VERSION; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-KK_Operation/Pods-KK_Operation.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 3 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Bolts.framework/Headers" 4 | OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "Bolts" 5 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-KK_Operation 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-KK_Operation/Pods-KK_Operation.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 3 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Bolts.framework/Headers" 4 | OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "Bolts" 5 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-KK_Operation 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFDefines.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | #if __has_feature(objc_generics) || __has_extension(objc_generics) 14 | # define BF_GENERIC(type) 15 | #else 16 | # define BF_GENERIC(type) 17 | # define BFGenericType id 18 | #endif 19 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFMeasurementEvent_Internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | /*! 13 | Provides methods for posting notifications from the Bolts framework 14 | */ 15 | @interface BFMeasurementEvent (Internal) 16 | 17 | + (void)postNotificationForEventName:(NSString *)name args:(NSDictionary *)args; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFWebViewAppLinkResolver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | #import 14 | 15 | /*! 16 | A reference implementation for an App Link resolver that uses a hidden UIWebView 17 | to parse the HTML containing App Link metadata. 18 | */ 19 | @interface BFWebViewAppLinkResolver : NSObject 20 | 21 | /*! 22 | Gets the instance of a BFWebViewAppLinkResolver. 23 | */ 24 | + (instancetype)sharedInstance; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /KK_OperationTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /KK_OperationUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | /*! 14 | Represents the registration of a cancellation observer with a cancellation token. 15 | Can be used to unregister the observer at a later time. 16 | */ 17 | @interface BFCancellationTokenRegistration : NSObject 18 | 19 | /*! 20 | Removes the cancellation observer registered with the token 21 | and releases all resources associated with this registration. 22 | */ 23 | - (void)dispose; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLink_Internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | @interface BFAppLink (Internal) 14 | 15 | + (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL 16 | targets:(NSArray *)targets 17 | webURL:(NSURL *)webURL 18 | isBackToReferrer:(BOOL)isBackToReferrer; 19 | 20 | /*! return if this AppLink is to go back to referrer. */ 21 | @property (nonatomic, assign, readonly, getter=isBackToReferrer) BOOL backToReferrer; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /KK_Operation.xcodeproj/xcuserdata/htaiwan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | KK_Operation.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 432BA0DB1BEB7B2D00453C15 16 | 17 | primary 18 | 19 | 20 | 432BA0EF1BEB7B2D00453C15 21 | 22 | primary 23 | 24 | 25 | 432BA0FA1BEB7B2D00453C15 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AFNetworking/AFNetworking-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AFNetworking.h" 4 | #import "AFHTTPSessionManager.h" 5 | #import "AFURLSessionManager.h" 6 | #import "AFNetworkReachabilityManager.h" 7 | #import "AFSecurityPolicy.h" 8 | #import "AFURLRequestSerialization.h" 9 | #import "AFURLResponseSerialization.h" 10 | #import "AFAutoPurgingImageCache.h" 11 | #import "AFImageDownloader.h" 12 | #import "AFNetworkActivityIndicatorManager.h" 13 | #import "UIActivityIndicatorView+AFNetworking.h" 14 | #import "UIButton+AFNetworking.h" 15 | #import "UIImage+AFNetworking.h" 16 | #import "UIImageView+AFNetworking.h" 17 | #import "UIKit+AFNetworking.h" 18 | #import "UIProgressView+AFNetworking.h" 19 | #import "UIRefreshControl+AFNetworking.h" 20 | #import "UIWebView+AFNetworking.h" 21 | 22 | FOUNDATION_EXPORT double AFNetworkingVersionNumber; 23 | FOUNDATION_EXPORT const unsigned char AFNetworkingVersionString[]; 24 | 25 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Bolts-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "BFAppLink.h" 4 | #import "BFAppLink_Internal.h" 5 | #import "BFAppLinkNavigation.h" 6 | #import "BFAppLinkResolving.h" 7 | #import "BFAppLinkReturnToRefererController.h" 8 | #import "BFAppLinkReturnToRefererView.h" 9 | #import "BFAppLinkReturnToRefererView_Internal.h" 10 | #import "BFAppLinkTarget.h" 11 | #import "BFMeasurementEvent.h" 12 | #import "BFMeasurementEvent_Internal.h" 13 | #import "BFURL.h" 14 | #import "BFURL_Internal.h" 15 | #import "BFWebViewAppLinkResolver.h" 16 | #import "BFCancellationToken.h" 17 | #import "BFCancellationTokenRegistration.h" 18 | #import "BFCancellationTokenSource.h" 19 | #import "BFDefines.h" 20 | #import "BFExecutor.h" 21 | #import "BFTask.h" 22 | #import "BFTaskCompletionSource.h" 23 | #import "Bolts.h" 24 | #import "BoltsVersion.h" 25 | 26 | FOUNDATION_EXPORT double BoltsVersionNumber; 27 | FOUNDATION_EXPORT const unsigned char BoltsVersionString[]; 28 | 29 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.3.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-KK_Operation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/AFNetworking/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 3.0.0-beta.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkResolving.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | @class BFTask; 14 | 15 | /*! 16 | Implement this protocol to provide an alternate strategy for resolving 17 | App Links that may include pre-fetching, caching, or querying for App Link 18 | data from an index provided by a service provider. 19 | */ 20 | @protocol BFAppLinkResolving 21 | 22 | /*! 23 | Asynchronously resolves App Link data for a given URL. 24 | 25 | @param url The URL to resolve into an App Link. 26 | @returns A BFTask that will return a BFAppLink for the given URL. 27 | */ 28 | - (BFTask *)appLinkFromURLInBackground:(NSURL *)url; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkTarget.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFAppLinkTarget.h" 12 | 13 | @interface BFAppLinkTarget () 14 | 15 | @property (nonatomic, strong, readwrite) NSURL *URL; 16 | @property (nonatomic, copy, readwrite) NSString *appStoreId; 17 | @property (nonatomic, copy, readwrite) NSString *appName; 18 | 19 | @end 20 | 21 | @implementation BFAppLinkTarget 22 | 23 | + (instancetype)appLinkTargetWithURL:(NSURL *)url 24 | appStoreId:(NSString *)appStoreId 25 | appName:(NSString *)appName { 26 | BFAppLinkTarget *target = [[self alloc] init]; 27 | target.URL = url; 28 | target.appStoreId = appStoreId; 29 | target.appName = appName; 30 | return target; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/htaiwan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AFNetworking.xcscheme 8 | 9 | isShown 10 | 11 | 12 | Bolts.xcscheme 13 | 14 | isShown 15 | 16 | 17 | Pods-KK_Operation.xcscheme 18 | 19 | isShown 20 | 21 | 22 | 23 | SuppressBuildableAutocreation 24 | 25 | 1C3436CEA5C3D39764C5F54374794ECB 26 | 27 | primary 28 | 29 | 30 | 57ADC05E440A960212657DE6DA1FEDD5 31 | 32 | primary 33 | 34 | 35 | D6B797A28A1D9672969A9F05B172E46F 36 | 37 | primary 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (3.0.0-beta.1): 3 | - AFNetworking/NSURLSession (= 3.0.0-beta.1) 4 | - AFNetworking/Reachability (= 3.0.0-beta.1) 5 | - AFNetworking/Security (= 3.0.0-beta.1) 6 | - AFNetworking/Serialization (= 3.0.0-beta.1) 7 | - AFNetworking/UIKit (= 3.0.0-beta.1) 8 | - AFNetworking/NSURLSession (3.0.0-beta.1): 9 | - AFNetworking/Reachability 10 | - AFNetworking/Security 11 | - AFNetworking/Serialization 12 | - AFNetworking/Reachability (3.0.0-beta.1) 13 | - AFNetworking/Security (3.0.0-beta.1) 14 | - AFNetworking/Serialization (3.0.0-beta.1) 15 | - AFNetworking/UIKit (3.0.0-beta.1): 16 | - AFNetworking/NSURLSession 17 | - Bolts (1.3.0): 18 | - Bolts/AppLinks (= 1.3.0) 19 | - Bolts/Tasks (= 1.3.0) 20 | - Bolts/AppLinks (1.3.0): 21 | - Bolts/Tasks 22 | - Bolts/Tasks (1.3.0) 23 | 24 | DEPENDENCIES: 25 | - AFNetworking (~> 3.0.0-beta.1) 26 | - Bolts (~> 1.3.0) 27 | 28 | SPEC CHECKSUMS: 29 | AFNetworking: 1100906802d9479aa0949e8e2cbc1d4e6beba327 30 | Bolts: 805a4a87413e49d4a0c2b7d469084cbc46b09342 31 | 32 | COCOAPODS: 0.39.0 33 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (3.0.0-beta.1): 3 | - AFNetworking/NSURLSession (= 3.0.0-beta.1) 4 | - AFNetworking/Reachability (= 3.0.0-beta.1) 5 | - AFNetworking/Security (= 3.0.0-beta.1) 6 | - AFNetworking/Serialization (= 3.0.0-beta.1) 7 | - AFNetworking/UIKit (= 3.0.0-beta.1) 8 | - AFNetworking/NSURLSession (3.0.0-beta.1): 9 | - AFNetworking/Reachability 10 | - AFNetworking/Security 11 | - AFNetworking/Serialization 12 | - AFNetworking/Reachability (3.0.0-beta.1) 13 | - AFNetworking/Security (3.0.0-beta.1) 14 | - AFNetworking/Serialization (3.0.0-beta.1) 15 | - AFNetworking/UIKit (3.0.0-beta.1): 16 | - AFNetworking/NSURLSession 17 | - Bolts (1.3.0): 18 | - Bolts/AppLinks (= 1.3.0) 19 | - Bolts/Tasks (= 1.3.0) 20 | - Bolts/AppLinks (1.3.0): 21 | - Bolts/Tasks 22 | - Bolts/Tasks (1.3.0) 23 | 24 | DEPENDENCIES: 25 | - AFNetworking (~> 3.0.0-beta.1) 26 | - Bolts (~> 1.3.0) 27 | 28 | SPEC CHECKSUMS: 29 | AFNetworking: 1100906802d9479aa0949e8e2cbc1d4e6beba327 30 | Bolts: 805a4a87413e49d4a0c2b7d469084cbc46b09342 31 | 32 | COCOAPODS: 0.39.0 33 | -------------------------------------------------------------------------------- /KK_OperationTests/KK_OperationTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KK_OperationTests.swift 3 | // KK_OperationTests 4 | // 5 | // Created by CHENG-TAI CHENG on 11/5/15. 6 | // Copyright © 2015 CHENG-TAI CHENG. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import KK_Operation 11 | 12 | class KK_OperationTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Pods/AFNetworking/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkTarget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | /*! 14 | Represents a target defined in App Link metadata, consisting of at least 15 | a URL, and optionally an App Store ID and name. 16 | */ 17 | @interface BFAppLinkTarget : NSObject 18 | 19 | /*! Creates a BFAppLinkTarget with the given app site and target URL. */ 20 | + (instancetype)appLinkTargetWithURL:(NSURL *)url 21 | appStoreId:(NSString *)appStoreId 22 | appName:(NSString *)appName; 23 | 24 | /*! The URL prefix for this app link target */ 25 | @property (nonatomic, strong, readonly) NSURL *URL; 26 | 27 | /*! The app ID for the app store */ 28 | @property (nonatomic, copy, readonly) NSString *appStoreId; 29 | 30 | /*! The name of the app */ 31 | @property (nonatomic, copy, readonly) NSString *appName; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationToken.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | #import 14 | 15 | /*! 16 | A block that will be called when a token is cancelled. 17 | */ 18 | typedef void(^BFCancellationBlock)(); 19 | 20 | /*! 21 | The consumer view of a CancellationToken. 22 | Propagates notification that operations should be canceled. 23 | A BFCancellationToken has methods to inspect whether the token has been cancelled. 24 | */ 25 | @interface BFCancellationToken : NSObject 26 | 27 | /*! 28 | Whether cancellation has been requested for this token source. 29 | */ 30 | @property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested; 31 | 32 | /*! 33 | Register a block to be notified when the token is cancelled. 34 | If the token is already cancelled the delegate will be notified immediately. 35 | */ 36 | - (BFCancellationTokenRegistration *)registerCancellationObserverWithBlock:(BFCancellationBlock)block; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /KK_Operation/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationTokenSource.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFCancellationTokenSource.h" 12 | 13 | #import "BFCancellationToken.h" 14 | 15 | @interface BFCancellationToken (BFCancellationTokenSource) 16 | 17 | - (void)cancel; 18 | - (void)cancelAfterDelay:(int)millis; 19 | 20 | - (void)dispose; 21 | - (void)throwIfDisposed; 22 | 23 | @end 24 | 25 | @implementation BFCancellationTokenSource 26 | 27 | #pragma mark - Initializer 28 | 29 | - (instancetype)init { 30 | self = [super init]; 31 | if (!self) return nil; 32 | 33 | _token = [BFCancellationToken new]; 34 | 35 | return self; 36 | } 37 | 38 | + (instancetype)cancellationTokenSource { 39 | return [BFCancellationTokenSource new]; 40 | } 41 | 42 | #pragma mark - Custom Setters/Getters 43 | 44 | - (BOOL)isCancellationRequested { 45 | return _token.isCancellationRequested; 46 | } 47 | 48 | - (void)cancel { 49 | [_token cancel]; 50 | } 51 | 52 | - (void)cancelAfterDelay:(int)millis { 53 | [_token cancelAfterDelay:millis]; 54 | } 55 | 56 | - (void)dispose { 57 | [_token dispose]; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /KK_OperationUITests/KK_OperationUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KK_OperationUITests.swift 3 | // KK_OperationUITests 4 | // 5 | // Created by CHENG-TAI CHENG on 11/5/15. 6 | // Copyright © 2015 CHENG-TAI CHENG. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class KK_OperationUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+AFNetworking.h 3 | // 4 | // 5 | // Created by Paulo Ferreira on 08/07/15. 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #if TARGET_OS_IOS || TARGET_OS_TV 26 | 27 | #import 28 | 29 | @interface UIImage (AFNetworking) 30 | 31 | + (UIImage*) safeImageWithData:(NSData*)data; 32 | 33 | @end 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/Bolts.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import 19 | 20 | #if __has_include() && TARGET_OS_IPHONE && !TARGET_OS_WATCH && !TARGET_OS_TV 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #endif 31 | 32 | /*! @abstract 80175001: There were multiple errors. */ 33 | extern NSInteger const kBFMultipleErrorsError; 34 | 35 | @interface Bolts : NSObject 36 | 37 | /*! 38 | Returns the version of the Bolts Framework as an NSString. 39 | @returns The NSString representation of the current version. 40 | */ 41 | + (NSString *)version; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Pods/Bolts/LICENSE: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For Bolts software 4 | 5 | Copyright (c) 2013-present, Facebook, Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name Facebook nor the names of its contributors may be used to 18 | endorse or promote products derived from this software without specific 19 | prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KKBoxPractice 2 | 3 | KKBox iOS/mac OSX 基本開發教材中 4 | 5 | threading這個章節中的練習題,我覺得滿多基本觀念都有練習到 6 | 7 | 所以抽點時間寫了這個專案,實作這些練習的內容 8 | 9 | ================================================================ 10 | 11 | 練習內容 12 | 13 | 1. 先拿出我們在 練習:將 Web Service API 包裝成 SDK 當中完成的作業。 14 | 15 | 2. 寫一個叫做 HTTPBinManager 的 singleton 物件。 16 | 17 | 3. 在這個 HTTPBinManager 中,增加一個 NSOperationQueue 的成員變數 18 | 19 | 4. 寫一個叫做 HTTPBinManagerOperation 的 NSOperation subclass, HTTPBinManagerOperation 使用 delegate 向外部傳遞自己的狀態。 HTTPBinManagerOperation 裡頭的 main method 依序要執行: 20 | 21 | 4.1 對我們之前寫的 SDK 發送 fetchGetResponseWithCallback: 並等候回應。 22 | 23 | 4.2 如果前一步成功,先告訴 delegate 我們的執行進度到了 33%,如果失敗就整個取消作業,並且告訴 delegate 失敗。delegate method 要在 main thread 當中執行。 24 | 25 | 4.3 對我們之前寫的 SDK 發送 postCustomerName:callback: 並等候回應。 26 | 27 | 4.4 如果前一步成功,先告訴 delegate 我們的執行進度到了 66%,如果失敗就整個取消作業,並且告訴 delegate 失敗。delegate method 要在 main thread 當中執行 28 | 29 | 4.5 對我們之前寫的 SDK 發送 fetchImageWithCallback: 並等候回應。 30 | 31 | 4.6 如果前一步成功,先告訴 delegate 我們的執行進度到了 100%,並且告訴 delegate 執行成功,並回傳前面抓取到的兩個 NSDcitionary 與一個 UIImage 物件;如果失敗就整個取消作業,並且告訴 delegate 失敗。 delegate method 要在 main thread 當中執行。 32 | 33 | 5. 這個 operation 要實作 cancel,發送 cancel 時,要立刻讓operation 停止,包括清除所有進行中的連線。 34 | 6. HTTPBinManager 要加入一個叫做 executeOperation 的 method,這個 method 首先會清除 operation queue 裡頭所有的 operation,然後加入新的 HTTPBinManagerOperation。 35 | 7. HTTPBinManagerOperation 的 delegate 是 HTTPBinManager。 HTTPBinManager 也有自己的 delegate,在 HTTPBinManagerOperation 成功抓取資料、發生錯誤的時候,HTTPBinManager 也會將這些事情告訴自己的 delegate。 36 | 37 | 8. 撰寫單元測試。 38 | 39 | 9. 寫一個 UI,上面有一個按鈕與進度條,按鈕按下後,就會執行 HTTPBinManager 的 executeOperation,然後進度條會顯示 HTTPBinManagerOperation 的執行進度。 40 | -------------------------------------------------------------------------------- /KK_Operation/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Pods/AFNetworking/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | // AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | #import 26 | 27 | #ifndef _AFNETWORKING_ 28 | #define _AFNETWORKING_ 29 | 30 | #import "AFURLRequestSerialization.h" 31 | #import "AFURLResponseSerialization.h" 32 | #import "AFSecurityPolicy.h" 33 | 34 | #if !TARGET_OS_WATCH 35 | #import "AFNetworkReachabilityManager.h" 36 | #endif 37 | 38 | #import "AFURLSessionManager.h" 39 | #import "AFHTTPSessionManager.h" 40 | 41 | #endif /* _AFNETWORKING_ */ 42 | -------------------------------------------------------------------------------- /KK_Operation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSAppTransportSecurity 6 | 7 | NSAllowsArbitraryLoads 8 | 9 | 10 | CFBundleDevelopmentRegion 11 | en 12 | CFBundleExecutable 13 | $(EXECUTABLE_NAME) 14 | CFBundleIdentifier 15 | $(PRODUCT_BUNDLE_IDENTIFIER) 16 | CFBundleInfoDictionaryVersion 17 | 6.0 18 | CFBundleName 19 | $(PRODUCT_NAME) 20 | CFBundlePackageType 21 | APPL 22 | CFBundleShortVersionString 23 | 1.0 24 | CFBundleSignature 25 | ???? 26 | CFBundleVersion 27 | 1 28 | LSRequiresIPhoneOS 29 | 30 | UILaunchStoryboardName 31 | LaunchScreen 32 | UIMainStoryboardFile 33 | Main 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UISupportedInterfaceOrientations~ipad 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationPortraitUpsideDown 48 | UIInterfaceOrientationLandscapeLeft 49 | UIInterfaceOrientationLandscapeRight 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /AsynOperation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AsynOperation.swift 3 | // BoltsDemo 4 | // 5 | // Created by CHENG-TAI CHENG on 11/5/15. 6 | // Copyright © 2015 CHENG-TAI CHENG. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | // 將operation改成Asyn 12 | class AsynOperation: NSOperation { 13 | 14 | override var asynchronous: Bool { 15 | return true 16 | } 17 | 18 | // 1. override executing 19 | private var _executing = false { 20 | willSet { 21 | willChangeValueForKey("isExecuting") 22 | } 23 | didSet { 24 | didChangeValueForKey("isExecuting") 25 | } 26 | } 27 | 28 | override var executing: Bool { 29 | return _executing 30 | } 31 | 32 | // 2. override finished 33 | private var _finished = false { 34 | willSet { 35 | willChangeValueForKey("isFinished") 36 | } 37 | didSet { 38 | didChangeValueForKey("isFinished") 39 | } 40 | } 41 | 42 | override var finished: Bool { 43 | return _finished 44 | } 45 | 46 | // 3. override cancel 47 | private var _cancel = false { 48 | willSet { 49 | willChangeValueForKey("isCancelled") 50 | } 51 | didSet { 52 | didChangeValueForKey("isCancelled") 53 | } 54 | } 55 | 56 | override var cancelled: Bool { 57 | return _cancel 58 | } 59 | 60 | override func start() { 61 | _executing = true 62 | execute() 63 | } 64 | 65 | func cancels() { 66 | _cancel = true 67 | finish() 68 | } 69 | 70 | func execute() { 71 | fatalError("必須在子類別複寫此方法") 72 | } 73 | 74 | func finish() { 75 | _executing = false 76 | _finished = true 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | /*! The version of the App Link protocol that this library supports */ 14 | FOUNDATION_EXPORT NSString *const BFAppLinkVersion; 15 | 16 | /*! 17 | Contains App Link metadata relevant for navigation on this device 18 | derived from the HTML at a given URL. 19 | */ 20 | @interface BFAppLink : NSObject 21 | 22 | /*! 23 | Creates a BFAppLink with the given list of BFAppLinkTargets and target URL. 24 | 25 | Generally, this will only be used by implementers of the BFAppLinkResolving protocol, 26 | as these implementers will produce App Link metadata for a given URL. 27 | 28 | @param sourceURL the URL from which this App Link is derived 29 | @param targets an ordered list of BFAppLinkTargets for this platform derived 30 | from App Link metadata. 31 | @param webURL the fallback web URL, if any, for the app link. 32 | */ 33 | + (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL 34 | targets:(NSArray *)targets 35 | webURL:(NSURL *)webURL; 36 | 37 | /*! The URL from which this BFAppLink was derived */ 38 | @property (nonatomic, strong, readonly) NSURL *sourceURL; 39 | 40 | /*! 41 | The ordered list of targets applicable to this platform that will be used 42 | for navigation. 43 | */ 44 | @property (nonatomic, copy, readonly) NSArray *targets; 45 | 46 | /*! The fallback web URL to use if no targets are installed on this device. */ 47 | @property (nonatomic, strong, readonly) NSURL *webURL; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFExecutor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | /*! 14 | An object that can run a given block. 15 | */ 16 | @interface BFExecutor : NSObject 17 | 18 | /*! 19 | Returns a default executor, which runs continuations immediately until the call stack gets too 20 | deep, then dispatches to a new GCD queue. 21 | */ 22 | + (instancetype)defaultExecutor; 23 | 24 | /*! 25 | Returns an executor that runs continuations on the thread where the previous task was completed. 26 | */ 27 | + (instancetype)immediateExecutor; 28 | 29 | /*! 30 | Returns an executor that runs continuations on the main thread. 31 | */ 32 | + (instancetype)mainThreadExecutor; 33 | 34 | /*! 35 | Returns a new executor that uses the given block to execute continuations. 36 | @param block The block to use. 37 | */ 38 | + (instancetype)executorWithBlock:(void(^)(void(^block)()))block; 39 | 40 | /*! 41 | Returns a new executor that runs continuations on the given queue. 42 | @param queue The instance of `dispatch_queue_t` to dispatch all continuations onto. 43 | */ 44 | + (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue; 45 | 46 | /*! 47 | Returns a new executor that runs continuations on the given queue. 48 | @param queue The instance of `NSOperationQueue` to run all continuations on. 49 | */ 50 | + (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue; 51 | 52 | /*! 53 | Runs the given block using this executor's particular strategy. 54 | @param block The block to execute. 55 | */ 56 | - (void)execute:(void(^)())block; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationTokenSource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | @class BFCancellationToken; 14 | 15 | /*! 16 | BFCancellationTokenSource represents the producer side of a CancellationToken. 17 | Signals to a CancellationToken that it should be canceled. 18 | It is a cancellation token that also has methods 19 | for changing the state of a token by cancelling it. 20 | */ 21 | @interface BFCancellationTokenSource : NSObject 22 | 23 | /*! 24 | Creates a new cancellation token source. 25 | */ 26 | + (instancetype)cancellationTokenSource; 27 | 28 | /*! 29 | The cancellation token associated with this CancellationTokenSource. 30 | */ 31 | @property (nonatomic, strong, readonly) BFCancellationToken *token; 32 | 33 | /*! 34 | Whether cancellation has been requested for this token source. 35 | */ 36 | @property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested; 37 | 38 | /*! 39 | Cancels the token if it has not already been cancelled. 40 | */ 41 | - (void)cancel; 42 | 43 | /*! 44 | Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds. 45 | @param millis The number of milliseconds to wait before completing the returned task. 46 | If delay is `0` the cancel is executed immediately. If delay is `-1` any scheduled cancellation is stopped. 47 | */ 48 | - (void)cancelAfterDelay:(int)millis; 49 | 50 | /*! 51 | Releases all resources associated with this token source, 52 | including disposing of all registrations. 53 | */ 54 | - (void)dispose; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIKit+AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #if TARGET_OS_IOS || TARGET_OS_TV 24 | #import 25 | 26 | #ifndef _UIKIT_AFNETWORKING_ 27 | #define _UIKIT_AFNETWORKING_ 28 | 29 | #if TARGET_OS_IOS 30 | #import "AFAutoPurgingImageCache.h" 31 | #import "AFImageDownloader.h" 32 | #import "AFNetworkActivityIndicatorManager.h" 33 | #import "UIRefreshControl+AFNetworking.h" 34 | #import "UIWebView+AFNetworking.h" 35 | #endif 36 | 37 | #import "UIActivityIndicatorView+AFNetworking.h" 38 | #import "UIButton+AFNetworking.h" 39 | #import "UIImageView+AFNetworking.h" 40 | #import "UIProgressView+AFNetworking.h" 41 | #endif /* _UIKIT_AFNETWORKING_ */ 42 | #endif 43 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFMeasurementEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | /*! The name of the notification posted by BFMeasurementEvent */ 14 | FOUNDATION_EXPORT NSString *const BFMeasurementEventNotificationName; 15 | 16 | /*! Defines keys in the userInfo object for the notification named BFMeasurementEventNotificationName */ 17 | /*! The string field for the name of the event */ 18 | FOUNDATION_EXPORT NSString *const BFMeasurementEventNameKey; 19 | /*! The dictionary field for the arguments of the event */ 20 | FOUNDATION_EXPORT NSString *const BFMeasurementEventArgsKey; 21 | 22 | /*! Bolts Events raised by BFMeasurementEvent for Applink */ 23 | /*! 24 | The name of the event posted when [BFURL URLWithURL:] is called successfully. This represents the successful parsing of an app link URL. 25 | */ 26 | FOUNDATION_EXPORT NSString *const BFAppLinkParseEventName; 27 | 28 | /*! 29 | The name of the event posted when [BFURL URLWithInboundURL:] is called successfully. 30 | This represents parsing an inbound app link URL from a different application 31 | */ 32 | FOUNDATION_EXPORT NSString *const BFAppLinkNavigateInEventName; 33 | 34 | /*! The event raised when the user navigates from your app to other apps */ 35 | FOUNDATION_EXPORT NSString *const BFAppLinkNavigateOutEventName; 36 | 37 | /*! 38 | The event raised when the user navigates out from your app and back to the referrer app. 39 | e.g when the user leaves your app after tapping the back-to-referrer navigation bar 40 | */ 41 | FOUNDATION_EXPORT NSString *const BFAppLinkNavigateBackToReferrerEventName; 42 | 43 | @interface BFMeasurementEvent : NSObject 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /KK_Operation/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // KK_Operation 4 | // 5 | // Created by CHENG-TAI CHENG on 11/5/15. 6 | // Copyright © 2015 CHENG-TAI CHENG. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | // 9. 寫一個 UI,上面有一個按鈕與進度條,按鈕按下後,就會執行 HTTPBinManager 的 executeOperation,然後進度條會顯示 HTTPBinManagerOperation 的執行進度。 12 | class ViewController: UIViewController,HTTPBinManagerDelegate { 13 | 14 | @IBOutlet weak var progressView: UIProgressView! 15 | @IBOutlet weak var imageView: UIImageView! 16 | 17 | let manager = HTTPBinManager.sharedInstance 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | // Do any additional setup after loading the view, typically from a nib. 22 | manager.delegate = self 23 | 24 | } 25 | 26 | override func didReceiveMemoryWarning() { 27 | super.didReceiveMemoryWarning() 28 | // Dispose of any resources that can be recreated. 29 | } 30 | 31 | // MARK: - Button 32 | 33 | @IBAction func start(sender: UIButton) { 34 | manager.executeOperation() 35 | } 36 | 37 | @IBAction func cancel(sender: UIButton) { 38 | manager.cancelOperation() 39 | } 40 | 41 | 42 | // MARK: - HTTPBinManagerDelegate 43 | 44 | func HTTPBinManagerDidFail() { 45 | print("HTTPBinManagerDidFail") 46 | 47 | } 48 | 49 | func HTTPBinManagerDidCancel() { 50 | print("HTTPBinManagerDidCancel") 51 | } 52 | 53 | func HTTPBinManagerDidSuccess(dic1: NSDictionary, dic2: NSDictionary, image: UIImage) { 54 | print("HTTPBinManagerDidSuccess") 55 | print("dic1: \(dic1)") 56 | print("dic2: \(dic2)") 57 | 58 | imageView.image = image 59 | } 60 | 61 | func HTTPBinManagerUpdateProgress(progrss: Float) { 62 | print("HTTPBinManagerUpdateProgress \(progrss)") 63 | progressView.progress = progrss 64 | } 65 | 66 | } 67 | 68 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFTaskCompletionSource.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFTaskCompletionSource.h" 12 | 13 | #import "BFTask.h" 14 | 15 | @interface BFTaskCompletionSource () 16 | 17 | @property (nonatomic, strong, readwrite) BFTask *task; 18 | 19 | @end 20 | 21 | @interface BFTask (BFTaskCompletionSource) 22 | 23 | - (void)setResult:(id)result; 24 | - (void)setError:(NSError *)error; 25 | - (void)setException:(NSException *)exception; 26 | - (void)cancel; 27 | - (BOOL)trySetResult:(id)result; 28 | - (BOOL)trySetError:(NSError *)error; 29 | - (BOOL)trySetException:(NSException *)exception; 30 | - (BOOL)trySetCancelled; 31 | 32 | @end 33 | 34 | @implementation BFTaskCompletionSource 35 | 36 | #pragma mark - Initializer 37 | 38 | + (instancetype)taskCompletionSource { 39 | return [[self alloc] init]; 40 | } 41 | 42 | - (instancetype)init { 43 | if (self = [super init]) { 44 | _task = [[BFTask alloc] init]; 45 | } 46 | return self; 47 | } 48 | 49 | #pragma mark - Custom Setters/Getters 50 | 51 | - (void)setResult:(id)result { 52 | [self.task setResult:result]; 53 | } 54 | 55 | - (void)setError:(NSError *)error { 56 | [self.task setError:error]; 57 | } 58 | 59 | - (void)setException:(NSException *)exception { 60 | [self.task setException:exception]; 61 | } 62 | 63 | - (void)cancel { 64 | [self.task cancel]; 65 | } 66 | 67 | - (BOOL)trySetResult:(id)result { 68 | return [self.task trySetResult:result]; 69 | } 70 | 71 | - (BOOL)trySetError:(NSError *)error { 72 | return [self.task trySetError:error]; 73 | } 74 | 75 | - (BOOL)trySetException:(NSException *)exception { 76 | return [self.task trySetException:exception]; 77 | } 78 | 79 | - (BOOL)trySetCancelled { 80 | return [self.task trySetCancelled]; 81 | } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFCancellationTokenRegistration.h" 12 | 13 | #import "BFCancellationToken.h" 14 | 15 | @interface BFCancellationTokenRegistration () 16 | 17 | @property (nonatomic, weak) BFCancellationToken *token; 18 | @property (nonatomic, strong) BFCancellationBlock cancellationObserverBlock; 19 | @property (nonatomic, strong) NSObject *lock; 20 | @property (nonatomic) BOOL disposed; 21 | 22 | @end 23 | 24 | @interface BFCancellationToken (BFCancellationTokenRegistration) 25 | 26 | - (void)unregisterRegistration:(BFCancellationTokenRegistration *)registration; 27 | 28 | @end 29 | 30 | @implementation BFCancellationTokenRegistration 31 | 32 | + (instancetype)registrationWithToken:(BFCancellationToken *)token delegate:(BFCancellationBlock)delegate { 33 | BFCancellationTokenRegistration *registration = [BFCancellationTokenRegistration new]; 34 | registration.token = token; 35 | registration.cancellationObserverBlock = delegate; 36 | return registration; 37 | } 38 | 39 | - (instancetype)init { 40 | if (self = [super init]) { 41 | _lock = [NSObject new]; 42 | } 43 | return self; 44 | } 45 | 46 | - (void)dispose { 47 | @synchronized(self.lock) { 48 | if (self.disposed) { 49 | return; 50 | } 51 | self.disposed = YES; 52 | } 53 | 54 | BFCancellationToken *token = self.token; 55 | if (token != nil) { 56 | [token unregisterRegistration:self]; 57 | self.token = nil; 58 | } 59 | self.cancellationObserverBlock = nil; 60 | } 61 | 62 | - (void)notifyDelegate { 63 | @synchronized(self.lock) { 64 | [self throwIfDisposed]; 65 | self.cancellationObserverBlock(); 66 | } 67 | } 68 | 69 | - (void)throwIfDisposed { 70 | NSAssert(!self.disposed, @"Object already disposed"); 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /ApiManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ApiManager.swift 3 | // BoltsDemo 4 | // 5 | // Created by CHENG-TAI CHENG on 11/4/15. 6 | // Copyright © 2015 CHENG-TAI CHENG. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import AFNetworking 11 | import Bolts 12 | 13 | // 1. 先拿出我們在 練習:將 Web Service API 包裝成 SDK 當中完成的作業。 14 | class ApiManager: NSObject { 15 | 16 | let baseURL = "http://httpbin.org" 17 | let manager = AFHTTPSessionManager() 18 | 19 | func fetchGetResponse() -> BFTask { 20 | 21 | let source = BFTaskCompletionSource() 22 | let url = "\(baseURL)/get" 23 | 24 | manager.GET(url, parameters: nil, success: { (task, respondObject) -> Void in 25 | let dic = respondObject as! NSDictionary 26 | source.setResult(dic) 27 | 28 | }) { (task, error) -> Void in 29 | source.setError(error) 30 | } 31 | 32 | return source.task 33 | } 34 | 35 | func postCustomerName(name: String) -> BFTask { 36 | 37 | let source = BFTaskCompletionSource() 38 | let url = "\(baseURL)/post" 39 | 40 | let parameters = NSMutableDictionary() 41 | parameters.setObject(name, forKey: "custname") 42 | 43 | manager.POST(url, parameters: parameters, success: { (task, respondObject) -> Void in 44 | let dic = respondObject as! NSDictionary 45 | source.setResult(dic) 46 | 47 | }) { (task, error) -> Void in 48 | source.setError(error) 49 | 50 | } 51 | 52 | return source.task 53 | } 54 | 55 | func fetchImage() -> BFTask { 56 | let source = BFTaskCompletionSource() 57 | let url = "\(baseURL)/image/png" 58 | 59 | manager.responseSerializer = AFImageResponseSerializer() 60 | manager.GET(url, parameters: nil, success: { (task, respondObject) -> Void in 61 | let image = respondObject as! UIImage 62 | source.setResult(image) 63 | 64 | }) { (task, error) -> Void in 65 | source.setError(error) 66 | } 67 | 68 | return source.task 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIActivityIndicatorView+AFNetworking.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if TARGET_OS_IOS || TARGET_OS_TV 27 | 28 | #import 29 | 30 | /** 31 | This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a session task. 32 | */ 33 | @interface UIActivityIndicatorView (AFNetworking) 34 | 35 | ///---------------------------------- 36 | /// @name Animating for Session Tasks 37 | ///---------------------------------- 38 | 39 | /** 40 | Binds the animating state to the state of the specified task. 41 | 42 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. 43 | */ 44 | - (void)setAnimatingWithStateOfTask:(nullable NSURLSessionTask *)task; 45 | 46 | @end 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIRefreshControl+AFNetworking.m 2 | // 3 | // Copyright (c) 2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import 26 | 27 | #if TARGET_OS_IOS 28 | 29 | #import 30 | 31 | NS_ASSUME_NONNULL_BEGIN 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically beginning and ending refreshing depending on the loading state of a session task. 35 | */ 36 | @interface UIRefreshControl (AFNetworking) 37 | 38 | ///----------------------------------- 39 | /// @name Refreshing for Session Tasks 40 | ///----------------------------------- 41 | 42 | /** 43 | Binds the refreshing state to the state of the specified task. 44 | 45 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. 46 | */ 47 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; 48 | 49 | @end 50 | 51 | NS_ASSUME_NONNULL_END 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFMeasurementEvent.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFMeasurementEvent_Internal.h" 12 | 13 | NSString *const BFMeasurementEventNotificationName = @"com.parse.bolts.measurement_event"; 14 | 15 | NSString *const BFMeasurementEventNameKey = @"event_name"; 16 | NSString *const BFMeasurementEventArgsKey = @"event_args"; 17 | 18 | /* app Link Event raised by this BFURL */ 19 | NSString *const BFAppLinkParseEventName = @"al_link_parse"; 20 | NSString *const BFAppLinkNavigateInEventName = @"al_nav_in"; 21 | 22 | /*! AppLink events raised in this class */ 23 | NSString *const BFAppLinkNavigateOutEventName = @"al_nav_out"; 24 | NSString *const BFAppLinkNavigateBackToReferrerEventName = @"al_ref_back_out"; 25 | 26 | __attribute__((noinline)) void warnOnMissingEventName() { 27 | NSLog(@"Warning: Missing event name when logging bolts measurement event. \n" 28 | " Ignoring this event in logging."); 29 | } 30 | 31 | @implementation BFMeasurementEvent { 32 | NSString *_name; 33 | NSDictionary *_args; 34 | } 35 | 36 | - (void)postNotification { 37 | if (!_name) { 38 | warnOnMissingEventName(); 39 | return; 40 | } 41 | NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; 42 | NSDictionary *userInfo = @{BFMeasurementEventNameKey : _name, 43 | BFMeasurementEventArgsKey : _args}; 44 | 45 | [center postNotificationName:BFMeasurementEventNotificationName 46 | object:self 47 | userInfo:userInfo]; 48 | } 49 | 50 | - (instancetype)initEventWithName:(NSString *)name args:(NSDictionary *)args { 51 | if ((self = [super init])) { 52 | _name = name; 53 | _args = args ? args : @{}; 54 | } 55 | return self; 56 | } 57 | 58 | + (void)postNotificationForEventName:(NSString *)name args:(NSDictionary *)args { 59 | [[[self alloc] initEventWithName:name args:args] postNotification]; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /HTTPBinManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HTTPBinManager.swift 3 | // KK_Operation 4 | // 5 | // Created by CHENG-TAI CHENG on 11/5/15. 6 | // Copyright © 2015 CHENG-TAI CHENG. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol HTTPBinManagerDelegate { 12 | 13 | func HTTPBinManagerDidFail() 14 | func HTTPBinManagerDidCancel() 15 | func HTTPBinManagerDidSuccess(dic1: NSDictionary, dic2: NSDictionary, image: UIImage) 16 | func HTTPBinManagerUpdateProgress(progrss: Float) 17 | 18 | } 19 | 20 | class HTTPBinManager: NSObject,HTTPBinManagerOperationDelegate { 21 | 22 | // 7. HTTPBinManager 也有自己的 delegate 23 | var delegate: HTTPBinManagerDelegate? 24 | 25 | let operation = HTTPBinManagerOperation() 26 | 27 | // 2. 寫一個叫做 HTTPBinManager 的 singleton 物件。 28 | static let sharedInstance: HTTPBinManager = { 29 | let instance = HTTPBinManager() 30 | return instance 31 | }() 32 | 33 | // 3. 在這個 HTTPBinManager 中,增加一個 NSOperationQueue 的成員變數 34 | let operationQueue = NSOperationQueue() 35 | 36 | // 6. HTTPBinManager 要加入一個叫做 executeOperation 的 method,這個 method 首先會清除 operation queue 裡頭所有的 operation,然後加入新的 HTTPBinManagerOperation。 37 | func executeOperation() { 38 | operationQueue.cancelAllOperations() 39 | 40 | // 7. HTTPBinManagerOperation 的 delegate 是 HTTPBinManager。 41 | operation.delegate = self 42 | operationQueue.addOperation(operation) 43 | } 44 | 45 | func cancelOperation() { 46 | operation.cancel() 47 | } 48 | 49 | // MARK: - HTTPBinManagerOperationDelegate 50 | 51 | // 7. 在 HTTPBinManagerOperation 成功抓取資料、發生錯誤的時候,HTTPBinManager 也會將這些事情告訴自己的 delegate。 52 | func HTTPBinManagerOperationDidFail() { 53 | self.delegate?.HTTPBinManagerDidFail() 54 | } 55 | 56 | func HTTPBinManagerOperationDidSuccess(dic1: NSDictionary, dic2: NSDictionary, image: UIImage) { 57 | self.delegate?.HTTPBinManagerDidSuccess(dic1, dic2: dic2, image: image) 58 | } 59 | 60 | func HTTPBinManagerOperationUpdateProgress(progrss: Float) { 61 | self.delegate?.HTTPBinManagerUpdateProgress(progrss) 62 | } 63 | 64 | func HTTPBinManagerOperationDidCancel() { 65 | self.delegate?.HTTPBinManagerDidCancel() 66 | } 67 | 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /KK_Operation/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // KK_Operation 4 | // 5 | // Created by CHENG-TAI CHENG on 11/5/15. 6 | // Copyright © 2015 CHENG-TAI CHENG. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLink.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFAppLink_Internal.h" 12 | 13 | NSString *const BFAppLinkDataParameterName = @"al_applink_data"; 14 | NSString *const BFAppLinkTargetKeyName = @"target_url"; 15 | NSString *const BFAppLinkUserAgentKeyName = @"user_agent"; 16 | NSString *const BFAppLinkExtrasKeyName = @"extras"; 17 | NSString *const BFAppLinkRefererAppLink = @"referer_app_link"; 18 | NSString *const BFAppLinkRefererAppName = @"app_name"; 19 | NSString *const BFAppLinkRefererUrl = @"url"; 20 | NSString *const BFAppLinkVersionKeyName = @"version"; 21 | NSString *const BFAppLinkVersion = @"1.0"; 22 | 23 | @interface BFAppLink () 24 | 25 | @property (nonatomic, strong, readwrite) NSURL *sourceURL; 26 | @property (nonatomic, copy, readwrite) NSArray *targets; 27 | @property (nonatomic, strong, readwrite) NSURL *webURL; 28 | 29 | @property (nonatomic, assign, readwrite, getter=isBackToReferrer) BOOL backToReferrer; 30 | 31 | @end 32 | 33 | @implementation BFAppLink 34 | 35 | + (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL 36 | targets:(NSArray *)targets 37 | webURL:(NSURL *)webURL 38 | isBackToReferrer:(BOOL)isBackToReferrer { 39 | BFAppLink *link = [[self alloc] initWithIsBackToReferrer:isBackToReferrer]; 40 | link.sourceURL = sourceURL; 41 | link.targets = [targets copy]; 42 | link.webURL = webURL; 43 | return link; 44 | } 45 | 46 | + (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL 47 | targets:(NSArray *)targets 48 | webURL:(NSURL *)webURL { 49 | return [self appLinkWithSourceURL:sourceURL 50 | targets:targets 51 | webURL:webURL 52 | isBackToReferrer:NO]; 53 | } 54 | 55 | - (BFAppLink *)initWithIsBackToReferrer:(BOOL)backToReferrer { 56 | if ((self = [super init])) { 57 | _backToReferrer = backToReferrer; 58 | } 59 | return self; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/htaiwan.xcuserdatad/xcschemes/Bolts.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/htaiwan.xcuserdatad/xcschemes/AFNetworking.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/htaiwan.xcuserdatad/xcschemes/Pods-KK_Operation.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFTaskCompletionSource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | #import 14 | 15 | @class BFTask BF_GENERIC(BFGenericType); 16 | 17 | /*! 18 | A BFTaskCompletionSource represents the producer side of tasks. 19 | It is a task that also has methods for changing the state of the 20 | task by settings its completion values. 21 | */ 22 | @interface BFTaskCompletionSource BF_GENERIC(__covariant BFGenericType) : NSObject 23 | 24 | /*! 25 | Creates a new unfinished task. 26 | */ 27 | + (instancetype)taskCompletionSource; 28 | 29 | /*! 30 | The task associated with this TaskCompletionSource. 31 | */ 32 | @property (nonatomic, strong, readonly) BFTask BF_GENERIC(BFGenericType) *task; 33 | 34 | /*! 35 | Completes the task by setting the result. 36 | Attempting to set this for a completed task will raise an exception. 37 | @param result The result of the task. 38 | */ 39 | - (void)setResult:(BFGenericType)result; 40 | 41 | /*! 42 | Completes the task by setting the error. 43 | Attempting to set this for a completed task will raise an exception. 44 | @param error The error for the task. 45 | */ 46 | - (void)setError:(NSError *)error; 47 | 48 | /*! 49 | Completes the task by setting an exception. 50 | Attempting to set this for a completed task will raise an exception. 51 | @param exception The exception for the task. 52 | */ 53 | - (void)setException:(NSException *)exception; 54 | 55 | /*! 56 | Completes the task by marking it as cancelled. 57 | Attempting to set this for a completed task will raise an exception. 58 | */ 59 | - (void)cancel; 60 | 61 | /*! 62 | Sets the result of the task if it wasn't already completed. 63 | @returns whether the new value was set. 64 | */ 65 | - (BOOL)trySetResult:(BFGenericType)result; 66 | 67 | /*! 68 | Sets the error of the task if it wasn't already completed. 69 | @param error The error for the task. 70 | @returns whether the new value was set. 71 | */ 72 | - (BOOL)trySetError:(NSError *)error; 73 | 74 | /*! 75 | Sets the exception of the task if it wasn't already completed. 76 | @param exception The exception for the task. 77 | @returns whether the new value was set. 78 | */ 79 | - (BOOL)trySetException:(NSException *)exception; 80 | 81 | /*! 82 | Sets the cancellation state of the task if it wasn't already completed. 83 | @returns whether the new value was set. 84 | */ 85 | - (BOOL)trySetCancelled; 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIProgressView+AFNetworking.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if TARGET_OS_IOS || TARGET_OS_TV 27 | 28 | #import 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIProgressView` class. The methods in this category provide support for binding the progress to the upload and download progress of a session task. 35 | */ 36 | @interface UIProgressView (AFNetworking) 37 | 38 | ///------------------------------------ 39 | /// @name Setting Session Task Progress 40 | ///------------------------------------ 41 | 42 | /** 43 | Binds the progress to the upload progress of the specified session task. 44 | 45 | @param task The session task. 46 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 47 | */ 48 | - (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task 49 | animated:(BOOL)animated; 50 | 51 | /** 52 | Binds the progress to the download progress of the specified session task. 53 | 54 | @param task The session task. 55 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 56 | */ 57 | - (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task 58 | animated:(BOOL)animated; 59 | 60 | @end 61 | 62 | NS_ASSUME_NONNULL_END 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | #import 13 | 14 | #import 15 | 16 | @class BFAppLinkReturnToRefererView; 17 | @class BFURL; 18 | 19 | typedef NS_ENUM(NSUInteger, BFIncludeStatusBarInSize) { 20 | BFIncludeStatusBarInSizeNever, 21 | BFIncludeStatusBarInSizeIOS7AndLater, 22 | BFIncludeStatusBarInSizeAlways, 23 | }; 24 | 25 | /*! 26 | Protocol that a class can implement in order to be notified when the user has navigated back 27 | to the referer of an App Link. 28 | */ 29 | @protocol BFAppLinkReturnToRefererViewDelegate 30 | 31 | /*! 32 | Called when the user has tapped inside the close button. 33 | */ 34 | - (void)returnToRefererViewDidTapInsideCloseButton:(BFAppLinkReturnToRefererView *)view; 35 | 36 | /*! 37 | Called when the user has tapped inside the App Link portion of the view. 38 | */ 39 | - (void)returnToRefererViewDidTapInsideLink:(BFAppLinkReturnToRefererView *)view 40 | link:(BFAppLink *)link; 41 | 42 | @end 43 | 44 | /*! 45 | Provides a UIView that displays a button allowing users to navigate back to the 46 | application that launched the App Link currently being handled, if the App Link 47 | contained referer data. The user can also close the view by clicking a close button 48 | rather than navigating away. If the view is provided an App Link that does not contain 49 | referer data, it will have zero size and no UI will be displayed. 50 | */ 51 | @interface BFAppLinkReturnToRefererView : UIView 52 | 53 | /*! 54 | The delegate that will be notified when the user navigates back to the referer. 55 | */ 56 | @property (nonatomic, weak) id delegate; 57 | 58 | /*! 59 | The color of the text label and close button. 60 | */ 61 | @property (nonatomic, strong) UIColor *textColor; 62 | 63 | @property (nonatomic, strong) BFAppLink *refererAppLink; 64 | 65 | /*! 66 | Indicates whether to extend the size of the view to include the current status bar 67 | size, for use in scenarios where the view might extend under the status bar on iOS 7 and 68 | above; this property has no effect on earlier versions of iOS. 69 | */ 70 | @property (nonatomic, assign) BFIncludeStatusBarInSize includeStatusBarInSize; 71 | 72 | /*! 73 | Indicates whether the user has closed the view by clicking the close button. 74 | */ 75 | @property (nonatomic, assign) BOOL closed; 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFURL.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | @class BFAppLink; 14 | 15 | /*! 16 | Provides a set of utilities for working with NSURLs, such as parsing of query parameters 17 | and handling for App Link requests. 18 | */ 19 | @interface BFURL : NSObject 20 | 21 | /*! 22 | Creates a link target from a raw URL. 23 | On success, this posts the BFAppLinkParseEventName measurement event. If you are constructing the BFURL within your application delegate's 24 | application:openURL:sourceApplication:annotation:, you should instead use URLWithInboundURL:sourceApplication: 25 | to support better BFMeasurementEvent notifications 26 | @param url The instance of `NSURL` to create BFURL from. 27 | */ 28 | + (BFURL *)URLWithURL:(NSURL *)url; 29 | 30 | /*! 31 | Creates a link target from a raw URL received from an external application. This is typically called from the app delegate's 32 | application:openURL:sourceApplication:annotation: and will post the BFAppLinkNavigateInEventName measurement event. 33 | @param url The instance of `NSURL` to create BFURL from. 34 | @param sourceApplication the bundle ID of the app that is requesting your app to open the URL. The same sourceApplication in application:openURL:sourceApplication:annotation: 35 | */ 36 | + (BFURL *)URLWithInboundURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication; 37 | 38 | /*! 39 | Gets the target URL. If the link is an App Link, this is the target of the App Link. 40 | Otherwise, it is the url that created the target. 41 | */ 42 | @property (nonatomic, strong, readonly) NSURL *targetURL; 43 | 44 | /*! 45 | Gets the query parameters for the target, parsed into an NSDictionary. 46 | */ 47 | @property (nonatomic, strong, readonly) NSDictionary *targetQueryParameters; 48 | 49 | /*! 50 | If this link target is an App Link, this is the data found in al_applink_data. 51 | Otherwise, it is nil. 52 | */ 53 | @property (nonatomic, strong, readonly) NSDictionary *appLinkData; 54 | 55 | /*! 56 | If this link target is an App Link, this is the data found in extras. 57 | */ 58 | @property (nonatomic, strong, readonly) NSDictionary *appLinkExtras; 59 | 60 | /*! 61 | The App Link indicating how to navigate back to the referer app, if any. 62 | */ 63 | @property (nonatomic, strong, readonly) BFAppLink *appLinkReferer; 64 | 65 | /*! 66 | The URL that was used to create this BFURL. 67 | */ 68 | @property (nonatomic, strong, readonly) NSURL *inputURL; 69 | 70 | /*! 71 | The query parameters of the inputURL, parsed into an NSDictionary. 72 | */ 73 | @property (nonatomic, strong, readonly) NSDictionary *inputQueryParameters; 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-KK_Operation/Pods-KK_Operation-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## AFNetworking 5 | 6 | Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | 27 | ## Bolts 28 | 29 | BSD License 30 | 31 | For Bolts software 32 | 33 | Copyright (c) 2013-present, Facebook, Inc. All rights reserved. 34 | 35 | Redistribution and use in source and binary forms, with or without modification, 36 | are permitted provided that the following conditions are met: 37 | 38 | * Redistributions of source code must retain the above copyright notice, this 39 | list of conditions and the following disclaimer. 40 | 41 | * Redistributions in binary form must reproduce the above copyright notice, 42 | this list of conditions and the following disclaimer in the documentation 43 | and/or other materials provided with the distribution. 44 | 45 | * Neither the name Facebook nor the names of its contributors may be used to 46 | endorse or promote products derived from this software without specific 47 | prior written permission. 48 | 49 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 50 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 51 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 52 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 53 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 54 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 55 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 56 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 57 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 58 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 59 | Generated by CocoaPods - http://cocoapods.org 60 | -------------------------------------------------------------------------------- /KK_OperationTests/ApiManagerTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ApiManagerTests.swift 3 | // BoltsDemo 4 | // 5 | // Created by CHENG-TAI CHENG on 11/4/15. 6 | // Copyright © 2015 CHENG-TAI CHENG. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import KK_Operation 11 | 12 | class ApiManagerTests: XCTestCase { 13 | 14 | let manager = ApiManager() 15 | 16 | override func setUp() { 17 | super.setUp() 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | } 20 | 21 | override func tearDown() { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | super.tearDown() 24 | } 25 | 26 | func testFetchGetResponse() { 27 | let expectation = expectationWithDescription("此API fetchGetResponse()呼叫要成功") 28 | 29 | manager.fetchGetResponse().continueWithBlock { (task) -> AnyObject! in 30 | if task.error == nil { 31 | expectation.fulfill() // 要成功 32 | XCTAssertNotNil(task.result, "應該要取得dic物件") 33 | XCTAssertNotNil(task.result["headers"], "此dic物件要有key值 header") 34 | XCTAssertNotNil(task.result["origin"], "此dic物件要有key值 origin") 35 | XCTAssertNotNil(task.result["url"], "此dic物件要有key值 url") 36 | } else { 37 | XCTFail() // 不應該失敗 38 | } 39 | return nil 40 | } 41 | 42 | // 等待Asyn Task回復 43 | waitForExpectationsWithTimeout(3.0, handler: nil) 44 | } 45 | 46 | func testPostCustomerName() { 47 | let expectation = expectationWithDescription("此API PostCustomerName()呼叫要成功") 48 | 49 | manager.postCustomerName("Alex").continueWithBlock { (task) -> AnyObject! in 50 | if task.error == nil { 51 | expectation.fulfill() 52 | XCTAssertNotNil(task.result, "應該要取得dic物件") 53 | XCTAssertNotNil(task.result["form"], "此dic物件要有key值 form") 54 | XCTAssertEqual(task.result["form"], ["custname": "Alex"], "此custname對應的value要為Dic") 55 | } else { 56 | XCTFail() // 不應該失敗 57 | } 58 | return nil 59 | } 60 | 61 | // 等待Asyn Task回復 62 | waitForExpectationsWithTimeout(3.0, handler: nil) 63 | } 64 | 65 | func testFetchImage() { 66 | let expectation = expectationWithDescription("此API FetchImage()呼叫要成功") 67 | 68 | manager.fetchImage().continueWithBlock { (task) -> AnyObject! in 69 | if task.error == nil { 70 | expectation.fulfill() 71 | XCTAssertNotNil(task.result, "應該要取得值") 72 | XCTAssertTrue(task.result.isKindOfClass(UIImage), "回來的值應該是一個image物件") 73 | } else { 74 | XCTFail() // 不應該失敗 75 | } 76 | return nil 77 | } 78 | 79 | // 等待Asyn Task回復 80 | waitForExpectationsWithTimeout(3.0, handler: nil) 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | #import 13 | 14 | #import 15 | 16 | @class BFAppLink; 17 | @class BFAppLinkReturnToRefererController; 18 | 19 | /*! 20 | Protocol that a class can implement in order to be notified when the user has navigated back 21 | to the referer of an App Link. 22 | */ 23 | @protocol BFAppLinkReturnToRefererControllerDelegate 24 | 25 | @optional 26 | 27 | /*! Called when the user has tapped to navigate, but before the navigation has been performed. */ 28 | - (void)returnToRefererController:(BFAppLinkReturnToRefererController *)controller 29 | willNavigateToAppLink:(BFAppLink *)appLink; 30 | 31 | /*! Called after the navigation has been attempted, with an indication of whether the referer 32 | app link was successfully opened. */ 33 | - (void)returnToRefererController:(BFAppLinkReturnToRefererController *)controller 34 | didNavigateToAppLink:(BFAppLink *)url 35 | type:(BFAppLinkNavigationType)type; 36 | 37 | @end 38 | 39 | /*! 40 | A controller class that implements default behavior for a BFAppLinkReturnToRefererView, including 41 | the ability to display the view above the navigation bar for navigation-based apps. 42 | */ 43 | @interface BFAppLinkReturnToRefererController : NSObject 44 | 45 | /*! 46 | The delegate that will be notified when the user navigates back to the referer. 47 | */ 48 | @property (nonatomic, weak) id delegate; 49 | 50 | /*! 51 | The BFAppLinkReturnToRefererView this controller is controlling. 52 | */ 53 | @property (nonatomic, strong) BFAppLinkReturnToRefererView *view; 54 | 55 | /*! 56 | Initializes a controller suitable for controlling a BFAppLinkReturnToRefererView that is to be displayed 57 | contained within another UIView (i.e., not displayed above the navigation bar). 58 | */ 59 | - (instancetype)init; 60 | 61 | /*! 62 | Initializes a controller suitable for controlling a BFAppLinkReturnToRefererView that is to be displayed 63 | displayed above the navigation bar. 64 | */ 65 | - (instancetype)initForDisplayAboveNavController:(UINavigationController *)navController; 66 | 67 | /*! 68 | Removes the view entirely from the navigation controller it is currently displayed in. 69 | */ 70 | - (void)removeFromNavController; 71 | 72 | /*! 73 | Shows the BFAppLinkReturnToRefererView with the specified referer information. If nil or missing data, 74 | the view will not be displayed. */ 75 | - (void)showViewForRefererAppLink:(BFAppLink *)refererAppLink; 76 | 77 | /*! 78 | Shows the BFAppLinkReturnToRefererView with referer information extracted from the specified URL. 79 | If nil or missing referer App Link data, the view will not be displayed. */ 80 | - (void)showViewForRefererURL:(NSURL *)url; 81 | 82 | /*! 83 | Closes the view, possibly animating it. 84 | */ 85 | - (void)closeViewAnimated:(BOOL)animated; 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /HTTPBinManagerOperation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HTTPBinManagerOperation.swift 3 | // KK_Operation 4 | // 5 | // Created by CHENG-TAI CHENG on 11/5/15. 6 | // Copyright © 2015 CHENG-TAI CHENG. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | // 4. HTTPBinManagerOperation 使用 delegate 向外部傳遞自己的狀態。 12 | protocol HTTPBinManagerOperationDelegate { 13 | 14 | func HTTPBinManagerOperationDidFail() 15 | func HTTPBinManagerOperationDidCancel() 16 | func HTTPBinManagerOperationDidSuccess(dic1: NSDictionary, dic2: NSDictionary, image: UIImage) 17 | func HTTPBinManagerOperationUpdateProgress(progrss: Float) 18 | 19 | } 20 | 21 | // 4. 寫一個叫做 HTTPBinManagerOperation 的 NSOperation subclass 22 | class HTTPBinManagerOperation: AsynOperation { 23 | 24 | private let manager = ApiManager() 25 | private var dic1: NSDictionary? 26 | private var dic2: NSDictionary? 27 | private var image: UIImage? 28 | 29 | var delegate: HTTPBinManagerOperationDelegate? 30 | 31 | override func execute() { 32 | 33 | // cancal 好像不該這樣寫 34 | sleep(1) 35 | if self.cancelled { return } 36 | 37 | // 4.1 對我們之前寫的 SDK 發送 fetchGetResponseWithCallback: 並等候回應。 38 | manager.fetchGetResponse() 39 | .continueWithSuccessBlock { (task) -> AnyObject! in 40 | print("fetchGetResponse 成功了") 41 | self.dic1 = task.result as? NSDictionary 42 | // 4.2 如果前一步成功,先告訴 delegate 我們的執行進度到了 33% 43 | dispatch_async(dispatch_get_main_queue(), { () -> Void in 44 | self.delegate?.HTTPBinManagerOperationUpdateProgress(0.33) 45 | }) 46 | // 4.3 對我們之前寫的 SDK 發送 postCustomerName:callback: 並等候回應。 47 | return self.manager.postCustomerName("Alex") 48 | }.continueWithSuccessBlock { (task) -> AnyObject! in 49 | print("postCustomerName 成功了") 50 | self.dic2 = task.result as? NSDictionary 51 | // 4.4 如果前一步成功,先告訴 delegate 我們的執行進度到了 66% 52 | dispatch_async(dispatch_get_main_queue(), { () -> Void in 53 | self.delegate?.HTTPBinManagerOperationUpdateProgress(0.66) 54 | }) 55 | // 4.5 對我們之前寫的 SDK 發送 fetchImageWithCallback: 並等候回應。 56 | return self.manager.fetchImage() 57 | }.continueWithSuccessBlock { (task) -> AnyObject! in 58 | print("fetchImage 成功了") 59 | self.image = task.result as? UIImage 60 | // 4.6 如果前一步成功,先告訴 delegate 我們的執行進度到了 100%,並且告訴 delegate 執行成功,並回傳前面抓取到的兩個 NSDcitionary 與一個 UIImage 物件 61 | self.finish() 62 | dispatch_async(dispatch_get_main_queue(), { () -> Void in 63 | self.delegate?.HTTPBinManagerOperationUpdateProgress(1) 64 | self.delegate?.HTTPBinManagerOperationDidSuccess(self.dic1!, dic2: self.dic2!, image: self.image!) 65 | }) 66 | 67 | return nil 68 | }.continueWithBlock { (task) -> AnyObject! in 69 | if task.error != nil { 70 | print("失敗了") 71 | print("\(task.error)") 72 | // 如果失敗就整個取消作業,並且告訴 delegate 失敗。 delegate method 要在 main thread 當中執行。 73 | self.finish() 74 | dispatch_async(dispatch_get_main_queue(), { () -> Void in 75 | self.delegate?.HTTPBinManagerOperationDidFail() 76 | }) 77 | } 78 | 79 | return nil 80 | } 81 | 82 | } 83 | 84 | // 5. 這個 operation 要實作 cancel,發送 cancel 時,要立刻讓operation 停止,包括清除所有進行中的連線。 85 | override func cancel() { 86 | self.cancels() 87 | dispatch_async(dispatch_get_main_queue(), { () -> Void in 88 | self.delegate?.HTTPBinManagerOperationDidCancel() 89 | }) 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkNavigation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | #import 14 | 15 | /*! 16 | The result of calling navigate on a BFAppLinkNavigation 17 | */ 18 | typedef NS_ENUM(NSInteger, BFAppLinkNavigationType) { 19 | /*! Indicates that the navigation failed and no app was opened */ 20 | BFAppLinkNavigationTypeFailure, 21 | /*! Indicates that the navigation succeeded by opening the URL in the browser */ 22 | BFAppLinkNavigationTypeBrowser, 23 | /*! Indicates that the navigation succeeded by opening the URL in an app on the device */ 24 | BFAppLinkNavigationTypeApp 25 | }; 26 | 27 | @protocol BFAppLinkResolving; 28 | @class BFTask; 29 | 30 | /*! 31 | Represents a pending request to navigate to an App Link. Most developers will 32 | simply use navigateToURLInBackground: to open a URL, but developers can build 33 | custom requests with additional navigation and app data attached to them by 34 | creating BFAppLinkNavigations themselves. 35 | */ 36 | @interface BFAppLinkNavigation : NSObject 37 | 38 | /*! 39 | The extras for the AppLinkNavigation. This will generally contain application-specific 40 | data that should be passed along with the request, such as advertiser or affiliate IDs or 41 | other such metadata relevant on this device. 42 | */ 43 | @property (nonatomic, copy, readonly) NSDictionary *extras; 44 | 45 | /*! 46 | The al_applink_data for the AppLinkNavigation. This will generally contain data common to 47 | navigation attempts such as back-links, user agents, and other information that may be used 48 | in routing and handling an App Link request. 49 | */ 50 | @property (nonatomic, copy, readonly) NSDictionary *appLinkData; 51 | 52 | /*! The AppLink to navigate to */ 53 | @property (nonatomic, strong, readonly) BFAppLink *appLink; 54 | 55 | /*! Creates an AppLinkNavigation with the given link, extras, and App Link data */ 56 | + (instancetype)navigationWithAppLink:(BFAppLink *)appLink 57 | extras:(NSDictionary *)extras 58 | appLinkData:(NSDictionary *)appLinkData; 59 | 60 | /*! Performs the navigation */ 61 | - (BFAppLinkNavigationType)navigate:(NSError **)error; 62 | 63 | /*! Returns a BFAppLink for the given URL */ 64 | + (BFTask *)resolveAppLinkInBackground:(NSURL *)destination; 65 | 66 | /*! Returns a BFAppLink for the given URL using the given App Link resolution strategy */ 67 | + (BFTask *)resolveAppLinkInBackground:(NSURL *)destination resolver:(id)resolver; 68 | 69 | /*! Navigates to a BFAppLink and returns whether it opened in-app or in-browser */ 70 | + (BFAppLinkNavigationType)navigateToAppLink:(BFAppLink *)link error:(NSError **)error; 71 | 72 | /*! Navigates to a URL (an asynchronous action) and returns a BFNavigationType */ 73 | + (BFTask *)navigateToURLInBackground:(NSURL *)destination; 74 | 75 | /*! 76 | Navigates to a URL (an asynchronous action) using the given App Link resolution 77 | strategy and returns a BFNavigationType 78 | */ 79 | + (BFTask *)navigateToURLInBackground:(NSURL *)destination resolver:(id)resolver; 80 | 81 | /*! 82 | Gets the default resolver to be used for App Link resolution. If the developer has not set one explicitly, 83 | a basic, built-in resolver will be used. 84 | */ 85 | + (id)defaultResolver; 86 | 87 | /*! 88 | Sets the default resolver to be used for App Link resolution. Setting this to nil will revert the 89 | default resolver to the basic, built-in resolver provided by Bolts. 90 | */ 91 | + (void)setDefaultResolver:(id)resolver; 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFExecutor.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFExecutor.h" 12 | 13 | @interface BFExecutor () 14 | 15 | @property (nonatomic, copy) void(^block)(void(^block)()); 16 | 17 | @end 18 | 19 | @implementation BFExecutor 20 | 21 | #pragma mark - Executor methods 22 | 23 | + (instancetype)defaultExecutor { 24 | static BFExecutor *defaultExecutor = NULL; 25 | static dispatch_once_t onceToken; 26 | dispatch_once(&onceToken, ^{ 27 | defaultExecutor = [self executorWithBlock:^void(void(^block)()) { 28 | static const NSString *BFTaskDepthKey = @"BFTaskDepth"; 29 | static const int BFTaskDefaultExecutorMaxDepth = 20; 30 | 31 | // We prefer to run everything possible immediately, so that there is callstack information 32 | // when debugging. However, we don't want the stack to get too deep, so if the number of 33 | // recursive calls to this method exceeds a certain depth, we dispatch to another GCD queue. 34 | NSMutableDictionary *threadLocal = [[NSThread currentThread] threadDictionary]; 35 | NSNumber *depth = threadLocal[BFTaskDepthKey]; 36 | if (!depth) { 37 | depth = @0; 38 | } 39 | if (depth.intValue > BFTaskDefaultExecutorMaxDepth) { 40 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block); 41 | } else { 42 | NSNumber *previousDepth = depth; 43 | threadLocal[BFTaskDepthKey] = @(previousDepth.intValue + 1); 44 | @try { 45 | block(); 46 | } @finally { 47 | threadLocal[BFTaskDepthKey] = previousDepth; 48 | } 49 | } 50 | }]; 51 | }); 52 | return defaultExecutor; 53 | } 54 | 55 | + (instancetype)immediateExecutor { 56 | static BFExecutor *immediateExecutor = NULL; 57 | static dispatch_once_t onceToken; 58 | dispatch_once(&onceToken, ^{ 59 | immediateExecutor = [self executorWithBlock:^void(void(^block)()) { 60 | block(); 61 | }]; 62 | }); 63 | return immediateExecutor; 64 | } 65 | 66 | + (instancetype)mainThreadExecutor { 67 | static BFExecutor *mainThreadExecutor = NULL; 68 | static dispatch_once_t onceToken; 69 | dispatch_once(&onceToken, ^{ 70 | mainThreadExecutor = [self executorWithBlock:^void(void(^block)()) { 71 | if (![NSThread isMainThread]) { 72 | dispatch_async(dispatch_get_main_queue(), block); 73 | } else { 74 | block(); 75 | } 76 | }]; 77 | }); 78 | return mainThreadExecutor; 79 | } 80 | 81 | + (instancetype)executorWithBlock:(void(^)(void(^block)()))block { 82 | return [[self alloc] initWithBlock:block]; 83 | } 84 | 85 | + (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue { 86 | return [self executorWithBlock:^void(void(^block)()) { 87 | dispatch_async(queue, block); 88 | }]; 89 | } 90 | 91 | + (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue { 92 | return [self executorWithBlock:^void(void(^block)()) { 93 | [queue addOperation:[NSBlockOperation blockOperationWithBlock:block]]; 94 | }]; 95 | } 96 | 97 | #pragma mark - Initializer 98 | 99 | - (instancetype)initWithBlock:(void(^)(void(^block)()))block { 100 | if (self = [super init]) { 101 | _block = block; 102 | } 103 | return self; 104 | } 105 | 106 | #pragma mark - Execution 107 | 108 | - (void)execute:(void(^)())block { 109 | self.block(block); 110 | } 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-KK_Operation/Pods-KK_Operation-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | 86 | if [[ "$CONFIGURATION" == "Debug" ]]; then 87 | install_framework "Pods-KK_Operation/AFNetworking.framework" 88 | install_framework "Pods-KK_Operation/Bolts.framework" 89 | fi 90 | if [[ "$CONFIGURATION" == "Release" ]]; then 91 | install_framework "Pods-KK_Operation/AFNetworking.framework" 92 | install_framework "Pods-KK_Operation/Bolts.framework" 93 | fi 94 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-KK_Operation/Pods-KK_Operation-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | Title 38 | AFNetworking 39 | Type 40 | PSGroupSpecifier 41 | 42 | 43 | FooterText 44 | BSD License 45 | 46 | For Bolts software 47 | 48 | Copyright (c) 2013-present, Facebook, Inc. All rights reserved. 49 | 50 | Redistribution and use in source and binary forms, with or without modification, 51 | are permitted provided that the following conditions are met: 52 | 53 | * Redistributions of source code must retain the above copyright notice, this 54 | list of conditions and the following disclaimer. 55 | 56 | * Redistributions in binary form must reproduce the above copyright notice, 57 | this list of conditions and the following disclaimer in the documentation 58 | and/or other materials provided with the distribution. 59 | 60 | * Neither the name Facebook nor the names of its contributors may be used to 61 | endorse or promote products derived from this software without specific 62 | prior written permission. 63 | 64 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 65 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 66 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 67 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 68 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 69 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 70 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 71 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 72 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 73 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 74 | Title 75 | Bolts 76 | Type 77 | PSGroupSpecifier 78 | 79 | 80 | FooterText 81 | Generated by CocoaPods - http://cocoapods.org 82 | Title 83 | 84 | Type 85 | PSGroupSpecifier 86 | 87 | 88 | StringsTable 89 | Acknowledgements 90 | Title 91 | Acknowledgements 92 | 93 | 94 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h: -------------------------------------------------------------------------------- 1 | // AFNetworkActivityIndicatorManager.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if TARGET_OS_IOS 27 | 28 | #import 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | /** 33 | `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a session task has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero. 34 | 35 | You should enable the shared instance of `AFNetworkActivityIndicatorManager` when your application finishes launching. In `AppDelegate application:didFinishLaunchingWithOptions:` you can do so with the following code: 36 | 37 | [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]; 38 | 39 | By setting `enabled` to `YES` for `sharedManager`, the network activity indicator will show and hide automatically as requests start and finish. You should not ever need to call `incrementActivityCount` or `decrementActivityCount` yourself. 40 | 41 | See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information: 42 | http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44 43 | */ 44 | NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.") 45 | @interface AFNetworkActivityIndicatorManager : NSObject 46 | 47 | /** 48 | A Boolean value indicating whether the manager is enabled. 49 | 50 | If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO. 51 | */ 52 | @property (nonatomic, assign, getter = isEnabled) BOOL enabled; 53 | 54 | /** 55 | A Boolean value indicating whether the network activity indicator is currently displayed in the status bar. 56 | */ 57 | @property (readonly, nonatomic, assign) BOOL isNetworkActivityIndicatorVisible; 58 | 59 | /** 60 | Returns the shared network activity indicator manager object for the system. 61 | 62 | @return The systemwide network activity indicator manager. 63 | */ 64 | + (instancetype)sharedManager; 65 | 66 | /** 67 | Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator. 68 | */ 69 | - (void)incrementActivityCount; 70 | 71 | /** 72 | Decrements the number of active network requests. If this number becomes zero after decrementing, this will stop animating the status bar network activity indicator. 73 | */ 74 | - (void)decrementActivityCount; 75 | 76 | @end 77 | 78 | NS_ASSUME_NONNULL_END 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationToken.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFCancellationToken.h" 12 | #import "BFCancellationTokenRegistration.h" 13 | 14 | @interface BFCancellationToken () 15 | 16 | @property (atomic, assign, getter=isCancellationRequested) BOOL cancellationRequested; 17 | @property (nonatomic, strong) NSMutableArray *registrations; 18 | @property (nonatomic, strong) NSObject *lock; 19 | @property (nonatomic) BOOL disposed; 20 | 21 | @end 22 | 23 | @interface BFCancellationTokenRegistration (BFCancellationToken) 24 | 25 | + (instancetype)registrationWithToken:(BFCancellationToken *)token delegate:(BFCancellationBlock)delegate; 26 | 27 | - (void)notifyDelegate; 28 | 29 | @end 30 | 31 | @implementation BFCancellationToken 32 | 33 | #pragma mark - Initializer 34 | 35 | - (instancetype)init { 36 | if (self = [super init]) { 37 | _registrations = [NSMutableArray array]; 38 | _lock = [NSObject new]; 39 | } 40 | return self; 41 | } 42 | 43 | #pragma mark - Custom Setters/Getters 44 | 45 | - (BOOL)isCancellationRequested { 46 | @synchronized(self.lock) { 47 | [self throwIfDisposed]; 48 | return _cancellationRequested; 49 | } 50 | } 51 | 52 | - (void)cancel { 53 | NSArray *registrations; 54 | @synchronized(self.lock) { 55 | [self throwIfDisposed]; 56 | if (_cancellationRequested) { 57 | return; 58 | } 59 | [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancelPrivate) object:nil]; 60 | _cancellationRequested = YES; 61 | registrations = [self.registrations copy]; 62 | } 63 | 64 | [self notifyCancellation:registrations]; 65 | } 66 | 67 | - (void)notifyCancellation:(NSArray *)registrations { 68 | for (BFCancellationTokenRegistration *registration in registrations) { 69 | [registration notifyDelegate]; 70 | } 71 | } 72 | 73 | - (BFCancellationTokenRegistration *)registerCancellationObserverWithBlock:(BFCancellationBlock)block { 74 | @synchronized(self.lock) { 75 | BFCancellationTokenRegistration *registration = [BFCancellationTokenRegistration registrationWithToken:self delegate:[block copy]]; 76 | [self.registrations addObject:registration]; 77 | 78 | return registration; 79 | } 80 | } 81 | 82 | - (void)unregisterRegistration:(BFCancellationTokenRegistration *)registration { 83 | @synchronized(self.lock) { 84 | [self throwIfDisposed]; 85 | [self.registrations removeObject:registration]; 86 | } 87 | } 88 | 89 | // Delay on a non-public method to prevent interference with a user calling performSelector or 90 | // cancelPreviousPerformRequestsWithTarget on the public method 91 | - (void)cancelPrivate { 92 | [self cancel]; 93 | } 94 | 95 | - (void)cancelAfterDelay:(int)millis { 96 | [self throwIfDisposed]; 97 | if (millis < -1) { 98 | [NSException raise:NSInvalidArgumentException format:@"Delay must be >= -1"]; 99 | } 100 | 101 | if (millis == 0) { 102 | [self cancel]; 103 | return; 104 | } 105 | 106 | @synchronized(self.lock) { 107 | [self throwIfDisposed]; 108 | [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancelPrivate) object:nil]; 109 | if (self.cancellationRequested) { 110 | return; 111 | } 112 | 113 | if (millis != -1) { 114 | double delay = (double)millis / 1000; 115 | [self performSelector:@selector(cancelPrivate) withObject:nil afterDelay:delay]; 116 | } 117 | } 118 | } 119 | 120 | - (void)dispose { 121 | @synchronized(self.lock) { 122 | if (self.disposed) { 123 | return; 124 | } 125 | self.disposed = YES; 126 | for (BFCancellationTokenRegistration *registration in self.registrations) { 127 | [registration dispose]; 128 | } 129 | [self.registrations removeAllObjects]; 130 | } 131 | } 132 | 133 | - (void)throwIfDisposed { 134 | if (self.disposed) { 135 | [NSException raise:NSInternalInconsistencyException format:@"Object already disposed"]; 136 | } 137 | } 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIWebView+AFNetworking.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if TARGET_OS_IOS 27 | 28 | #import 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | @class AFHTTPSessionManager; 33 | 34 | /** 35 | This category adds methods to the UIKit framework's `UIWebView` class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling. 36 | 37 | @discussion When using these category methods, make sure to assign `delegate` for the web view, which implements `–webView:shouldStartLoadWithRequest:navigationType:` appropriately. This allows for tapped links to be loaded through AFNetworking, and can ensure that `canGoBack` & `canGoForward` update their values correctly. 38 | */ 39 | @interface UIWebView (AFNetworking) 40 | 41 | /** 42 | The session manager used to download all requests. 43 | */ 44 | @property (nonatomic, strong) AFHTTPSessionManager *sessionManager; 45 | 46 | /** 47 | Asynchronously loads the specified request. 48 | 49 | @param request A URL request identifying the location of the content to load. This must not be `nil`. 50 | @param progress A progress object monitoring the current download progress. 51 | @param success A block object to be executed when the request finishes loading successfully. This block returns the HTML string to be loaded by the web view, and takes two arguments: the response, and the response string. 52 | @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. 53 | */ 54 | - (void)loadRequest:(NSURLRequest *)request 55 | progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress 56 | success:(nullable NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success 57 | failure:(nullable void (^)(NSError *error))failure; 58 | 59 | /** 60 | Asynchronously loads the data associated with a particular request with a specified MIME type and text encoding. 61 | 62 | @param request A URL request identifying the location of the content to load. This must not be `nil`. 63 | @param MIMEType The MIME type of the content. Defaults to the content type of the response if not specified. 64 | @param textEncodingName The IANA encoding name, as in `utf-8` or `utf-16`. Defaults to the response text encoding if not specified. 65 | @param progress A progress object monitoring the current download progress. 66 | @param success A block object to be executed when the request finishes loading successfully. This block returns the data to be loaded by the web view and takes two arguments: the response, and the downloaded data. 67 | @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. 68 | */ 69 | - (void)loadRequest:(NSURLRequest *)request 70 | MIMEType:(nullable NSString *)MIMEType 71 | textEncodingName:(nullable NSString *)textEncodingName 72 | progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress 73 | success:(nullable NSData * (^)(NSHTTPURLResponse *response, NSData *data))success 74 | failure:(nullable void (^)(NSError *error))failure; 75 | 76 | @end 77 | 78 | NS_ASSUME_NONNULL_END 79 | 80 | #endif -------------------------------------------------------------------------------- /KK_Operation.xcodeproj/xcuserdata/htaiwan.xcuserdatad/xcschemes/KK_Operation.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-KK_Operation/Pods-KK_Operation-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY="$(cd "${1%/*}" && pwd)" 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | 61 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 62 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 63 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 64 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 65 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 66 | fi 67 | rm -f "$RESOURCES_TO_COPY" 68 | 69 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 70 | then 71 | case "${TARGETED_DEVICE_FAMILY}" in 72 | 1,2) 73 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 74 | ;; 75 | 1) 76 | TARGET_DEVICE_ARGS="--target-device iphone" 77 | ;; 78 | 2) 79 | TARGET_DEVICE_ARGS="--target-device ipad" 80 | ;; 81 | *) 82 | TARGET_DEVICE_ARGS="--target-device mac" 83 | ;; 84 | esac 85 | 86 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 87 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 88 | while read line; do 89 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 90 | XCASSET_FILES+=("$line") 91 | fi 92 | done <<<"$OTHER_XCASSETS" 93 | 94 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 95 | fi 96 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIRefreshControl+AFNetworking.m 2 | // 3 | // Copyright (c) 2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import "UIRefreshControl+AFNetworking.h" 24 | #import 25 | 26 | #if TARGET_OS_IOS 27 | 28 | #import "AFURLSessionManager.h" 29 | 30 | @interface AFRefreshControlNotificationObserver : NSObject 31 | @property (readonly, nonatomic, weak) UIRefreshControl *refreshControl; 32 | - (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl; 33 | 34 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; 35 | 36 | @end 37 | 38 | @implementation UIRefreshControl (AFNetworking) 39 | 40 | - (AFRefreshControlNotificationObserver *)af_notificationObserver { 41 | AFRefreshControlNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver)); 42 | if (notificationObserver == nil) { 43 | notificationObserver = [[AFRefreshControlNotificationObserver alloc] initWithActivityRefreshControl:self]; 44 | objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 45 | } 46 | return notificationObserver; 47 | } 48 | 49 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task { 50 | [[self af_notificationObserver] setRefreshingWithStateOfTask:task]; 51 | } 52 | 53 | @end 54 | 55 | @implementation AFRefreshControlNotificationObserver 56 | 57 | - (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl 58 | { 59 | self = [super init]; 60 | if (self) { 61 | _refreshControl = refreshControl; 62 | } 63 | return self; 64 | } 65 | 66 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task { 67 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 68 | 69 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 70 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 71 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 72 | 73 | if (task) { 74 | #pragma clang diagnostic push 75 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 76 | #pragma clang diagnostic ignored "-Warc-repeated-use-of-weak" 77 | if (task.state == NSURLSessionTaskStateRunning) { 78 | [self.refreshControl beginRefreshing]; 79 | 80 | [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingTaskDidResumeNotification object:task]; 81 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidCompleteNotification object:task]; 82 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidSuspendNotification object:task]; 83 | } else { 84 | [self.refreshControl endRefreshing]; 85 | } 86 | #pragma clang diagnostic pop 87 | } 88 | } 89 | 90 | #pragma mark - 91 | 92 | - (void)af_beginRefreshing { 93 | dispatch_async(dispatch_get_main_queue(), ^{ 94 | #pragma clang diagnostic push 95 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 96 | [self.refreshControl beginRefreshing]; 97 | #pragma clang diagnostic pop 98 | }); 99 | } 100 | 101 | - (void)af_endRefreshing { 102 | dispatch_async(dispatch_get_main_queue(), ^{ 103 | #pragma clang diagnostic push 104 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 105 | [self.refreshControl endRefreshing]; 106 | #pragma clang diagnostic pop 107 | }); 108 | } 109 | 110 | #pragma mark - 111 | 112 | - (void)dealloc { 113 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 114 | 115 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 116 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 117 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 118 | } 119 | 120 | @end 121 | 122 | #endif 123 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIActivityIndicatorView+AFNetworking.m 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "UIActivityIndicatorView+AFNetworking.h" 23 | #import 24 | 25 | #if TARGET_OS_IOS || TARGET_OS_TV 26 | 27 | #import "AFURLSessionManager.h" 28 | 29 | @interface AFActivityIndicatorViewNotificationObserver : NSObject 30 | @property (readonly, nonatomic, weak) UIActivityIndicatorView *activityIndicatorView; 31 | - (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView; 32 | 33 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task; 34 | 35 | @end 36 | 37 | @implementation UIActivityIndicatorView (AFNetworking) 38 | 39 | - (AFActivityIndicatorViewNotificationObserver *)af_notificationObserver { 40 | AFActivityIndicatorViewNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver)); 41 | if (notificationObserver == nil) { 42 | notificationObserver = [[AFActivityIndicatorViewNotificationObserver alloc] initWithActivityIndicatorView:self]; 43 | objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 44 | } 45 | return notificationObserver; 46 | } 47 | 48 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task { 49 | [[self af_notificationObserver] setAnimatingWithStateOfTask:task]; 50 | } 51 | 52 | @end 53 | 54 | @implementation AFActivityIndicatorViewNotificationObserver 55 | 56 | - (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView 57 | { 58 | self = [super init]; 59 | if (self) { 60 | _activityIndicatorView = activityIndicatorView; 61 | } 62 | return self; 63 | } 64 | 65 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task { 66 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 67 | 68 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 69 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 70 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 71 | 72 | if (task) { 73 | if (task.state != NSURLSessionTaskStateCompleted) { 74 | 75 | #pragma clang diagnostic push 76 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 77 | #pragma clang diagnostic ignored "-Warc-repeated-use-of-weak" 78 | if (task.state == NSURLSessionTaskStateRunning) { 79 | [self.activityIndicatorView startAnimating]; 80 | } else { 81 | [self.activityIndicatorView stopAnimating]; 82 | } 83 | #pragma clang diagnostic pop 84 | 85 | [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingTaskDidResumeNotification object:task]; 86 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidCompleteNotification object:task]; 87 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidSuspendNotification object:task]; 88 | } 89 | } 90 | } 91 | 92 | #pragma mark - 93 | 94 | - (void)af_startAnimating { 95 | dispatch_async(dispatch_get_main_queue(), ^{ 96 | #pragma clang diagnostic push 97 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 98 | [self.activityIndicatorView startAnimating]; 99 | #pragma clang diagnostic pop 100 | }); 101 | } 102 | 103 | - (void)af_stopAnimating { 104 | dispatch_async(dispatch_get_main_queue(), ^{ 105 | #pragma clang diagnostic push 106 | #pragma clang diagnostic ignored "-Wreceiver-is-weak" 107 | [self.activityIndicatorView stopAnimating]; 108 | #pragma clang diagnostic pop 109 | }); 110 | } 111 | 112 | #pragma mark - 113 | 114 | - (void)dealloc { 115 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 116 | 117 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 118 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 119 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 120 | } 121 | 122 | @end 123 | 124 | #endif 125 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIProgressView+AFNetworking.m 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "UIProgressView+AFNetworking.h" 23 | 24 | #import 25 | 26 | #if TARGET_OS_IOS || TARGET_OS_TV 27 | 28 | #import "AFURLSessionManager.h" 29 | 30 | static void * AFTaskCountOfBytesSentContext = &AFTaskCountOfBytesSentContext; 31 | static void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedContext; 32 | 33 | #pragma mark - 34 | 35 | @implementation UIProgressView (AFNetworking) 36 | 37 | - (BOOL)af_uploadProgressAnimated { 38 | return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_uploadProgressAnimated)) boolValue]; 39 | } 40 | 41 | - (void)af_setUploadProgressAnimated:(BOOL)animated { 42 | objc_setAssociatedObject(self, @selector(af_uploadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 43 | } 44 | 45 | - (BOOL)af_downloadProgressAnimated { 46 | return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_downloadProgressAnimated)) boolValue]; 47 | } 48 | 49 | - (void)af_setDownloadProgressAnimated:(BOOL)animated { 50 | objc_setAssociatedObject(self, @selector(af_downloadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 51 | } 52 | 53 | #pragma mark - 54 | 55 | - (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task 56 | animated:(BOOL)animated 57 | { 58 | [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext]; 59 | [task addObserver:self forKeyPath:@"countOfBytesSent" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext]; 60 | 61 | [self af_setUploadProgressAnimated:animated]; 62 | } 63 | 64 | - (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task 65 | animated:(BOOL)animated 66 | { 67 | [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext]; 68 | [task addObserver:self forKeyPath:@"countOfBytesReceived" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext]; 69 | 70 | [self af_setDownloadProgressAnimated:animated]; 71 | } 72 | 73 | #pragma mark - NSKeyValueObserving 74 | 75 | - (void)observeValueForKeyPath:(NSString *)keyPath 76 | ofObject:(id)object 77 | change:(__unused NSDictionary *)change 78 | context:(void *)context 79 | { 80 | if (context == AFTaskCountOfBytesSentContext || context == AFTaskCountOfBytesReceivedContext) { 81 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) { 82 | if ([object countOfBytesExpectedToSend] > 0) { 83 | dispatch_async(dispatch_get_main_queue(), ^{ 84 | [self setProgress:[object countOfBytesSent] / ([object countOfBytesExpectedToSend] * 1.0f) animated:self.af_uploadProgressAnimated]; 85 | }); 86 | } 87 | } 88 | 89 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) { 90 | if ([object countOfBytesExpectedToReceive] > 0) { 91 | dispatch_async(dispatch_get_main_queue(), ^{ 92 | [self setProgress:[object countOfBytesReceived] / ([object countOfBytesExpectedToReceive] * 1.0f) animated:self.af_downloadProgressAnimated]; 93 | }); 94 | } 95 | } 96 | 97 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(state))]) { 98 | if ([(NSURLSessionTask *)object state] == NSURLSessionTaskStateCompleted) { 99 | @try { 100 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(state))]; 101 | 102 | if (context == AFTaskCountOfBytesSentContext) { 103 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))]; 104 | } 105 | 106 | if (context == AFTaskCountOfBytesReceivedContext) { 107 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))]; 108 | } 109 | } 110 | @catch (NSException * __unused exception) {} 111 | } 112 | } 113 | } 114 | } 115 | 116 | @end 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIImageView+AFNetworking.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if TARGET_OS_IOS || TARGET_OS_TV 27 | 28 | #import 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | @class AFImageDownloader; 33 | 34 | /** 35 | This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL. 36 | */ 37 | @interface UIImageView (AFNetworking) 38 | 39 | ///------------------------------------ 40 | /// @name Accessing the Image Downloader 41 | ///------------------------------------ 42 | 43 | /** 44 | Set the shared image downloader used to download images. 45 | 46 | @param imageDownloader The shared image downloader used to download images. 47 | */ 48 | + (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader; 49 | 50 | /** 51 | The shared image downloader used to download images. 52 | */ 53 | + (AFImageDownloader *)sharedImageDownloader; 54 | 55 | ///-------------------- 56 | /// @name Setting Image 57 | ///-------------------- 58 | 59 | /** 60 | Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. 61 | 62 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. 63 | 64 | By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` 65 | 66 | @param url The URL used for the image request. 67 | */ 68 | - (void)setImageWithURL:(NSURL *)url; 69 | 70 | /** 71 | Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. 72 | 73 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. 74 | 75 | By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` 76 | 77 | @param url The URL used for the image request. 78 | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. 79 | */ 80 | - (void)setImageWithURL:(NSURL *)url 81 | placeholderImage:(nullable UIImage *)placeholderImage; 82 | 83 | /** 84 | Asynchronously downloads an image from the specified URL request, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. 85 | 86 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. 87 | 88 | If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is applied. 89 | 90 | @param urlRequest The URL request used for the image request. 91 | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. 92 | @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. 93 | @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. 94 | */ 95 | - (void)setImageWithURLRequest:(NSURLRequest *)urlRequest 96 | placeholderImage:(nullable UIImage *)placeholderImage 97 | success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success 98 | failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure; 99 | 100 | /** 101 | Cancels any executing image operation for the receiver, if one exists. 102 | */ 103 | - (void)cancelImageDownloadTask; 104 | 105 | @end 106 | 107 | NS_ASSUME_NONNULL_END 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m: -------------------------------------------------------------------------------- 1 | // AFNetworkActivityIndicatorManager.m 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "AFNetworkActivityIndicatorManager.h" 23 | 24 | #if TARGET_OS_IOS 25 | #import "AFURLSessionManager.h" 26 | 27 | static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.17; 28 | 29 | static NSURLRequest * AFNetworkRequestFromNotification(NSNotification *notification) { 30 | if ([[notification object] respondsToSelector:@selector(originalRequest)]) { 31 | return [(NSURLSessionTask *)[notification object] originalRequest]; 32 | } else { 33 | return nil; 34 | } 35 | } 36 | 37 | @interface AFNetworkActivityIndicatorManager () 38 | @property (readwrite, nonatomic, assign) NSInteger activityCount; 39 | @property (readwrite, nonatomic, strong) NSTimer *activityIndicatorVisibilityTimer; 40 | @property (readonly, nonatomic, getter = isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; 41 | 42 | - (void)updateNetworkActivityIndicatorVisibility; 43 | - (void)updateNetworkActivityIndicatorVisibilityDelayed; 44 | @end 45 | 46 | @implementation AFNetworkActivityIndicatorManager 47 | @dynamic networkActivityIndicatorVisible; 48 | 49 | + (instancetype)sharedManager { 50 | static AFNetworkActivityIndicatorManager *_sharedManager = nil; 51 | static dispatch_once_t oncePredicate; 52 | dispatch_once(&oncePredicate, ^{ 53 | _sharedManager = [[self alloc] init]; 54 | }); 55 | 56 | return _sharedManager; 57 | } 58 | 59 | + (NSSet *)keyPathsForValuesAffectingIsNetworkActivityIndicatorVisible { 60 | return [NSSet setWithObject:@"activityCount"]; 61 | } 62 | 63 | - (instancetype)init { 64 | self = [super init]; 65 | if (!self) { 66 | return nil; 67 | } 68 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingTaskDidResumeNotification object:nil]; 69 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidSuspendNotification object:nil]; 70 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidCompleteNotification object:nil]; 71 | 72 | return self; 73 | } 74 | 75 | - (void)dealloc { 76 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 77 | 78 | [_activityIndicatorVisibilityTimer invalidate]; 79 | } 80 | 81 | - (void)updateNetworkActivityIndicatorVisibilityDelayed { 82 | if (self.enabled) { 83 | // Delay hiding of activity indicator for a short interval, to avoid flickering 84 | if (![self isNetworkActivityIndicatorVisible]) { 85 | [self.activityIndicatorVisibilityTimer invalidate]; 86 | self.activityIndicatorVisibilityTimer = [NSTimer timerWithTimeInterval:kAFNetworkActivityIndicatorInvisibilityDelay target:self selector:@selector(updateNetworkActivityIndicatorVisibility) userInfo:nil repeats:NO]; 87 | [[NSRunLoop mainRunLoop] addTimer:self.activityIndicatorVisibilityTimer forMode:NSRunLoopCommonModes]; 88 | } else { 89 | [self performSelectorOnMainThread:@selector(updateNetworkActivityIndicatorVisibility) withObject:nil waitUntilDone:NO modes:@[NSRunLoopCommonModes]]; 90 | } 91 | } 92 | } 93 | 94 | - (BOOL)isNetworkActivityIndicatorVisible { 95 | return self.activityCount > 0; 96 | } 97 | 98 | - (void)updateNetworkActivityIndicatorVisibility { 99 | [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:[self isNetworkActivityIndicatorVisible]]; 100 | } 101 | 102 | - (void)setActivityCount:(NSInteger)activityCount { 103 | @synchronized(self) { 104 | _activityCount = activityCount; 105 | } 106 | 107 | dispatch_async(dispatch_get_main_queue(), ^{ 108 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 109 | }); 110 | } 111 | 112 | - (void)incrementActivityCount { 113 | [self willChangeValueForKey:@"activityCount"]; 114 | @synchronized(self) { 115 | _activityCount++; 116 | } 117 | [self didChangeValueForKey:@"activityCount"]; 118 | 119 | dispatch_async(dispatch_get_main_queue(), ^{ 120 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 121 | }); 122 | } 123 | 124 | - (void)decrementActivityCount { 125 | [self willChangeValueForKey:@"activityCount"]; 126 | @synchronized(self) { 127 | #pragma clang diagnostic push 128 | #pragma clang diagnostic ignored "-Wgnu" 129 | _activityCount = MAX(_activityCount - 1, 0); 130 | #pragma clang diagnostic pop 131 | } 132 | [self didChangeValueForKey:@"activityCount"]; 133 | 134 | dispatch_async(dispatch_get_main_queue(), ^{ 135 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 136 | }); 137 | } 138 | 139 | - (void)networkRequestDidStart:(NSNotification *)notification { 140 | if ([AFNetworkRequestFromNotification(notification) URL]) { 141 | [self incrementActivityCount]; 142 | } 143 | } 144 | 145 | - (void)networkRequestDidFinish:(NSNotification *)notification { 146 | if ([AFNetworkRequestFromNotification(notification) URL]) { 147 | [self decrementActivityCount]; 148 | } 149 | } 150 | 151 | @end 152 | 153 | #endif 154 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h: -------------------------------------------------------------------------------- 1 | // AFAutoPurgingImageCache.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | #import 24 | 25 | #if TARGET_OS_IOS || TARGET_OS_TV 26 | #import 27 | 28 | NS_ASSUME_NONNULL_BEGIN 29 | 30 | /** 31 | The `AFImageCache` protocol defines a set of APIs for adding, removing and fetching images from a cache synchronously. 32 | */ 33 | @protocol AFImageCache 34 | 35 | /** 36 | Adds the image to the cache with the given identifier. 37 | 38 | @param image The image to cache. 39 | @param identifier The unique identifier for the image in the cache. 40 | */ 41 | - (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier; 42 | 43 | /** 44 | Removes the image from the cache matching the given identifier. 45 | 46 | @param identifier The unique identifier for the image in the cache. 47 | 48 | @return A BOOL indicating whether or not the image was removed from the cache. 49 | */ 50 | - (BOOL)removeImageWithIdentifier:(NSString *)identifier; 51 | 52 | /** 53 | Removes all images from the cache. 54 | 55 | @return A BOOL indicating whether or not all images were removed from the cache. 56 | */ 57 | - (BOOL)removeAllImages; 58 | 59 | /** 60 | Returns the image in the cache associated with the given identifier. 61 | 62 | @param identifier The unique identifier for the image in the cache. 63 | 64 | @return An image for the matching identifier, or nil. 65 | */ 66 | - (nullable UIImage *)imageWithIdentifier:(NSString *)identifier; 67 | @end 68 | 69 | 70 | /** 71 | The `ImageRequestCache` protocol extends the `ImageCache` protocol by adding methods for adding, removing and fetching images from a cache given an `NSURLRequest` and additional identifier. 72 | */ 73 | @protocol AFImageRequestCache 74 | 75 | /** 76 | Adds the image to the cache using an identifier created from the request and additional identifier. 77 | 78 | @param image The image to cache. 79 | @param request The unique URL request identifing the image asset. 80 | @param identifier The additional identifier to apply to the URL request to identify the image. 81 | */ 82 | - (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier; 83 | 84 | /** 85 | Removes the image from the cache using an identifier created from the request and additional identifier. 86 | 87 | @param request The unique URL request identifing the image asset. 88 | @param identifier The additional identifier to apply to the URL request to identify the image. 89 | 90 | @return A BOOL indicating whether or not all images were removed from the cache. 91 | */ 92 | - (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier; 93 | 94 | /** 95 | Returns the image from the cache associated with an identifier created from the request and additional identifier. 96 | 97 | @param request The unique URL request identifing the image asset. 98 | @param identifier The additional identifier to apply to the URL request to identify the image. 99 | 100 | @return An image for the matching request and identifier, or nil. 101 | */ 102 | - (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier; 103 | 104 | @end 105 | 106 | /** 107 | The `AutoPurgingImageCache` in an in-memory image cache used to store images up to a given memory capacity. When the memory capacity is reached, the image cache is sorted by last access date, then the oldest image is continuously purged until the preferred memory usage after purge is met. Each time an image is accessed through the cache, the internal access date of the image is updated. 108 | */ 109 | @interface AFAutoPurgingImageCache : NSObject 110 | 111 | /** 112 | The total memory capacity of the cache in bytes. 113 | */ 114 | @property (nonatomic, assign) UInt64 memoryCapacity; 115 | 116 | /** 117 | The preferred memory usage after purge in bytes. During a purge, images will be purged until the memory capacity drops below this limit. 118 | */ 119 | @property (nonatomic, assign) UInt64 preferredMemoryUsageAfterPurge; 120 | 121 | /** 122 | The current total memory usage in bytes of all images stored within the cache. 123 | */ 124 | @property (nonatomic, assign, readonly) UInt64 memoryUsage; 125 | 126 | /** 127 | Initialies the `AutoPurgingImageCache` instance with default values for memory capacity and preferred memory usage after purge limit. `memoryCapcity` defaults to `100 MB`. `preferredMemoryUsageAfterPurge` defaults to `60 MB`. 128 | 129 | @return The new `AutoPurgingImageCache` instance. 130 | */ 131 | - (instancetype)init; 132 | 133 | /** 134 | Initialies the `AutoPurgingImageCache` instance with the given memory capacity and preferred memory usage 135 | after purge limit. 136 | 137 | @param memoryCapacity The total memory capacity of the cache in bytes. 138 | @param preferredMemoryUsageAfterPurge The preferred memory usage after purge in bytes. 139 | 140 | @return The new `AutoPurgingImageCache` instance. 141 | */ 142 | - (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity; 143 | 144 | @end 145 | 146 | NS_ASSUME_NONNULL_END 147 | 148 | #endif 149 | 150 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIImageView+AFNetworking.m 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import "UIImageView+AFNetworking.h" 23 | 24 | #import 25 | 26 | #if TARGET_OS_IOS || TARGET_OS_TV 27 | 28 | #import "AFImageDownloader.h" 29 | 30 | @interface UIImageView (_AFNetworking) 31 | @property (readwrite, nonatomic, strong, setter = af_setActiveImageDownloadReceipt:) AFImageDownloadReceipt *af_activeImageDownloadReceipt; 32 | @end 33 | 34 | @implementation UIImageView (_AFNetworking) 35 | 36 | - (AFImageDownloadReceipt *)af_activeImageDownloadReceipt { 37 | return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, @selector(af_activeImageDownloadReceipt)); 38 | } 39 | 40 | - (void)af_setActiveImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt { 41 | objc_setAssociatedObject(self, @selector(af_activeImageDownloadReceipt), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 42 | } 43 | 44 | @end 45 | 46 | #pragma mark - 47 | 48 | @implementation UIImageView (AFNetworking) 49 | 50 | + (AFImageDownloader *)sharedImageDownloader { 51 | 52 | #pragma clang diagnostic push 53 | #pragma clang diagnostic ignored "-Wgnu" 54 | return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance]; 55 | #pragma clang diagnostic pop 56 | } 57 | 58 | + (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader { 59 | objc_setAssociatedObject(self, @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 60 | } 61 | 62 | #pragma mark - 63 | 64 | - (void)setImageWithURL:(NSURL *)url { 65 | [self setImageWithURL:url placeholderImage:nil]; 66 | } 67 | 68 | - (void)setImageWithURL:(NSURL *)url 69 | placeholderImage:(UIImage *)placeholderImage 70 | { 71 | NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; 72 | [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; 73 | 74 | [self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; 75 | } 76 | 77 | - (void)setImageWithURLRequest:(NSURLRequest *)urlRequest 78 | placeholderImage:(UIImage *)placeholderImage 79 | success:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success 80 | failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure 81 | { 82 | if ([self isActiveTaskURLEqualToURLRequest:urlRequest]){ 83 | return; 84 | } 85 | 86 | [self cancelImageDownloadTask]; 87 | 88 | AFImageDownloader *downloader = [[self class] sharedImageDownloader]; 89 | id imageCache = downloader.imageCache; 90 | 91 | //Use the image from the image cache if it exists 92 | UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil]; 93 | if (cachedImage) { 94 | if (success) { 95 | success(urlRequest, nil, cachedImage); 96 | } else { 97 | self.image = cachedImage; 98 | } 99 | self.af_activeImageDownloadReceipt = nil; 100 | } else { 101 | if (placeholderImage) { 102 | self.image = placeholderImage; 103 | } 104 | 105 | __weak __typeof(self)weakSelf = self; 106 | AFImageDownloadReceipt *receipt; 107 | receipt = [downloader 108 | downloadImageForURLRequest:urlRequest 109 | success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { 110 | __strong __typeof(weakSelf)strongSelf = weakSelf; 111 | if ([strongSelf isActiveTaskURLEqualToURLRequest:request]) { 112 | if (success) { 113 | success(request, response, responseObject); 114 | } else if(responseObject) { 115 | strongSelf.image = responseObject; 116 | } 117 | strongSelf.af_activeImageDownloadReceipt = nil; 118 | } 119 | 120 | } 121 | failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) { 122 | __strong __typeof(weakSelf)strongSelf = weakSelf; 123 | if ([strongSelf isActiveTaskURLEqualToURLRequest:request]) { 124 | if (failure) { 125 | failure(request, response, error); 126 | } 127 | strongSelf.af_activeImageDownloadReceipt = nil; 128 | } 129 | }]; 130 | 131 | self.af_activeImageDownloadReceipt = receipt; 132 | } 133 | } 134 | 135 | - (void)cancelImageDownloadTask { 136 | if (self.af_activeImageDownloadReceipt != nil) { 137 | [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:self.af_activeImageDownloadReceipt]; 138 | self.af_activeImageDownloadReceipt = nil; 139 | } 140 | } 141 | 142 | - (BOOL)isActiveTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest { 143 | return [self.af_activeImageDownloadReceipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString]; 144 | } 145 | 146 | @end 147 | 148 | #endif 149 | -------------------------------------------------------------------------------- /KK_Operation/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | // AFSecurityPolicy.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | #import 24 | 25 | typedef NS_ENUM(NSUInteger, AFSSLPinningMode) { 26 | AFSSLPinningModeNone, 27 | AFSSLPinningModePublicKey, 28 | AFSSLPinningModeCertificate, 29 | }; 30 | 31 | /** 32 | `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections. 33 | 34 | Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled. 35 | */ 36 | 37 | NS_ASSUME_NONNULL_BEGIN 38 | 39 | @interface AFSecurityPolicy : NSObject 40 | 41 | /** 42 | The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`. 43 | */ 44 | @property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode; 45 | 46 | /** 47 | The certificates used to evaluate server trust according to the SSL pinning mode. 48 | 49 | By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`. 50 | 51 | Note that if you create an array with duplicate certificates, the duplicate certificates will be removed. Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches. 52 | */ 53 | @property (nonatomic, strong, nullable) NSArray *pinnedCertificates; 54 | 55 | /** 56 | Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`. 57 | */ 58 | @property (nonatomic, assign) BOOL allowInvalidCertificates; 59 | 60 | /** 61 | Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`. 62 | */ 63 | @property (nonatomic, assign) BOOL validatesDomainName; 64 | 65 | ///----------------------------------------- 66 | /// @name Getting Certificates from the Bundle 67 | ///----------------------------------------- 68 | 69 | /** 70 | Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`. 71 | 72 | @return The default security policy. 73 | */ 74 | + (NSArray *)certificatesInBundle:(NSBundle *)bundle; 75 | 76 | ///----------------------------------------- 77 | /// @name Getting Specific Security Policies 78 | ///----------------------------------------- 79 | 80 | /** 81 | Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys. 82 | 83 | @return The default security policy. 84 | */ 85 | + (instancetype)defaultPolicy; 86 | 87 | ///--------------------- 88 | /// @name Initialization 89 | ///--------------------- 90 | 91 | /** 92 | Creates and returns a security policy with the specified pinning mode. 93 | 94 | @param pinningMode The SSL pinning mode. 95 | 96 | @return A new security policy. 97 | */ 98 | + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode; 99 | 100 | /** 101 | Creates and returns a security policy with the specified pinning mode. 102 | 103 | @param pinningMode The SSL pinning mode. 104 | @param pinnedCertificates The certificates to pin against. 105 | 106 | @return A new security policy. 107 | */ 108 | + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSArray *)pinnedCertificates; 109 | 110 | ///------------------------------ 111 | /// @name Evaluating Server Trust 112 | ///------------------------------ 113 | 114 | /** 115 | Whether or not the specified server trust should be accepted, based on the security policy. 116 | 117 | This method should be used when responding to an authentication challenge from a server. 118 | 119 | @param serverTrust The X.509 certificate trust of the server. 120 | 121 | @return Whether or not to trust the server. 122 | 123 | @warning This method has been deprecated in favor of `-evaluateServerTrust:forDomain:`. 124 | */ 125 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust DEPRECATED_ATTRIBUTE; 126 | 127 | /** 128 | Whether or not the specified server trust should be accepted, based on the security policy. 129 | 130 | This method should be used when responding to an authentication challenge from a server. 131 | 132 | @param serverTrust The X.509 certificate trust of the server. 133 | @param domain The domain of serverTrust. If `nil`, the domain will not be validated. 134 | 135 | @return Whether or not to trust the server. 136 | */ 137 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust 138 | forDomain:(nullable NSString *)domain; 139 | 140 | @end 141 | 142 | NS_ASSUME_NONNULL_END 143 | 144 | ///---------------- 145 | /// @name Constants 146 | ///---------------- 147 | 148 | /** 149 | ## SSL Pinning Modes 150 | 151 | The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes. 152 | 153 | enum { 154 | AFSSLPinningModeNone, 155 | AFSSLPinningModePublicKey, 156 | AFSSLPinningModeCertificate, 157 | } 158 | 159 | `AFSSLPinningModeNone` 160 | Do not used pinned certificates to validate servers. 161 | 162 | `AFSSLPinningModePublicKey` 163 | Validate host certificates against public keys of pinned certificates. 164 | 165 | `AFSSLPinningModeCertificate` 166 | Validate host certificates against pinned certificates. 167 | */ 168 | --------------------------------------------------------------------------------