├── Pods ├── Headers │ └── AFNetworking │ │ ├── AFNetworking.h │ │ ├── AFSecurityPolicy.h │ │ ├── AFHTTPSessionManager.h │ │ ├── AFURLSessionManager.h │ │ ├── AFHTTPRequestOperation.h │ │ ├── UIKit+AFNetworking.h │ │ ├── AFURLConnectionOperation.h │ │ ├── AFURLRequestSerialization.h │ │ ├── UIButton+AFNetworking.h │ │ ├── UIWebView+AFNetworking.h │ │ ├── AFNetworkReachabilityManager.h │ │ ├── AFURLResponseSerialization.h │ │ ├── UIAlertView+AFNetworking.h │ │ ├── UIImageView+AFNetworking.h │ │ ├── AFHTTPRequestOperationManager.h │ │ ├── UIProgressView+AFNetworking.h │ │ ├── UIRefreshControl+AFNetworking.h │ │ ├── AFNetworkActivityIndicatorManager.h │ │ └── UIActivityIndicatorView+AFNetworking.h ├── BuildHeaders │ └── AFNetworking │ │ ├── AFNetworking.h │ │ ├── AFSecurityPolicy.h │ │ ├── AFHTTPSessionManager.h │ │ ├── AFURLSessionManager.h │ │ ├── AFHTTPRequestOperation.h │ │ ├── UIKit+AFNetworking.h │ │ ├── AFURLConnectionOperation.h │ │ ├── AFURLRequestSerialization.h │ │ ├── UIButton+AFNetworking.h │ │ ├── UIWebView+AFNetworking.h │ │ ├── AFNetworkReachabilityManager.h │ │ ├── AFURLResponseSerialization.h │ │ ├── UIAlertView+AFNetworking.h │ │ ├── UIImageView+AFNetworking.h │ │ ├── AFHTTPRequestOperationManager.h │ │ ├── UIProgressView+AFNetworking.h │ │ ├── UIRefreshControl+AFNetworking.h │ │ ├── AFNetworkActivityIndicatorManager.h │ │ └── UIActivityIndicatorView+AFNetworking.h ├── Pods-Injection-AFNetworking-prefix.pch ├── Pods-InjectionTests-AFNetworking-prefix.pch ├── Pods-Injection-dummy.m ├── Pods-Injection-AFNetworking.xcconfig ├── Pods-InjectionTests-dummy.m ├── Pods-InjectionTests-AFNetworking.xcconfig ├── Pods-Injection-AFNetworking-dummy.m ├── Pods-InjectionTests-AFNetworking-dummy.m ├── Pods-Injection-AFNetworking-Private.xcconfig ├── Pods-InjectionTests-AFNetworking-Private.xcconfig ├── Pods-Injection.xcconfig ├── Pods-InjectionTests.xcconfig ├── Manifest.lock ├── AFNetworking │ ├── LICENSE │ ├── UIKit+AFNetworking │ │ ├── UIKit+AFNetworking.h │ │ ├── UIRefreshControl+AFNetworking.h │ │ ├── UIActivityIndicatorView+AFNetworking.h │ │ ├── UIProgressView+AFNetworking.h │ │ ├── AFNetworkActivityIndicatorManager.h │ │ ├── UIRefreshControl+AFNetworking.m │ │ ├── UIActivityIndicatorView+AFNetworking.m │ │ ├── UIAlertView+AFNetworking.h │ │ ├── UIWebView+AFNetworking.h │ │ ├── UIAlertView+AFNetworking.m │ │ ├── UIWebView+AFNetworking.m │ │ ├── AFNetworkActivityIndicatorManager.m │ │ ├── UIImageView+AFNetworking.h │ │ ├── UIButton+AFNetworking.m │ │ ├── UIButton+AFNetworking.h │ │ ├── UIProgressView+AFNetworking.m │ │ └── UIImageView+AFNetworking.m │ └── AFNetworking │ │ ├── AFNetworking.h │ │ ├── AFHTTPRequestOperation.h │ │ ├── AFSecurityPolicy.h │ │ ├── AFNetworkReachabilityManager.h │ │ ├── AFHTTPRequestOperation.m │ │ ├── AFNetworkReachabilityManager.m │ │ └── AFURLResponseSerialization.h ├── Pods.xcodeproj │ └── xcuserdata │ │ └── sean.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ ├── Pods-Injection.xcscheme │ │ ├── Pods-InjectionTests.xcscheme │ │ ├── Pods-Injection-AFNetworking.xcscheme │ │ └── Pods-InjectionTests-AFNetworking.xcscheme ├── Pods-Injection-acknowledgements.markdown ├── Pods-InjectionTests-acknowledgements.markdown ├── Pods-Injection-environment.h ├── Pods-InjectionTests-environment.h ├── Pods-Injection-acknowledgements.plist ├── Pods-InjectionTests-acknowledgements.plist ├── Pods-Injection-resources.sh └── Pods-InjectionTests-resources.sh ├── Injection ├── en.lproj │ └── InfoPlist.strings ├── UIViewController+Injections.h ├── AppDelegate.h ├── AppDelegate.m ├── UIViewController+Injections.m ├── Environment.h ├── ViewController.h ├── main.m ├── Injection-Prefix.pch ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── ViewController.m ├── Environment.m ├── Injection-Info.plist └── Base.lproj │ └── Main.storyboard ├── InjectionTests ├── en.lproj │ └── InfoPlist.strings ├── Environment+Fake.h ├── Environment+Fake.m ├── FakeReachabilityManager.h ├── FakeReachabilityManager.m ├── InjectionTests-Info.plist └── ViewControllerTests.m ├── Injection.xcworkspace ├── xcuserdata │ └── sean.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── WorkspaceSettings.xcsettings └── contents.xcworkspacedata ├── README.md ├── Injection.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── sean.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── Injection.xcscheme ├── Podfile └── Podfile.lock /Pods/Headers/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFNetworking.h -------------------------------------------------------------------------------- /Injection/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFNetworking.h -------------------------------------------------------------------------------- /InjectionTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFSecurityPolicy.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFSecurityPolicy.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFHTTPSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPSessionManager.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFURLSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLSessionManager.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFHTTPSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPSessionManager.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFURLSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLSessionManager.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFHTTPRequestOperation.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPRequestOperation.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPRequestOperation.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFURLConnectionOperation.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLConnectionOperation.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFURLRequestSerialization.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLRequestSerialization.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIButton+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIWebView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h -------------------------------------------------------------------------------- /InjectionTests/Environment+Fake.h: -------------------------------------------------------------------------------- 1 | #import "Environment.h" 2 | 3 | @interface Environment (Fake) 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLConnectionOperation.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFURLRequestSerialization.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLRequestSerialization.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIButton+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIWebView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFNetworkReachabilityManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFURLResponseSerialization.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLResponseSerialization.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIAlertView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIImageView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFNetworkReachabilityManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFURLResponseSerialization.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLResponseSerialization.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIAlertView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFHTTPRequestOperationManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPRequestOperationManager.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIProgressView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperationManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPRequestOperationManager.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIProgressView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h -------------------------------------------------------------------------------- /Injection/UIViewController+Injections.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | @interface UIViewController (Injections) 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Pods-Injection-AFNetworking-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-Injection-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/Pods-InjectionTests-AFNetworking-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-InjectionTests-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/Pods-Injection-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Injection : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Injection 5 | @end 6 | -------------------------------------------------------------------------------- /Injection/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AppDelegate : UIResponder 4 | 5 | @property (strong, nonatomic) UIWindow *window; 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /Pods/Pods-Injection-AFNetworking.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_INJECTION_AFNETWORKING_OTHER_LDFLAGS = -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration -------------------------------------------------------------------------------- /Injection.xcworkspace/xcuserdata/sean.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Pods/Pods-InjectionTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_InjectionTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_InjectionTests 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Pods-InjectionTests-AFNetworking.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_INJECTIONTESTS_AFNETWORKING_OTHER_LDFLAGS = -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | injections 2 | ========== 3 | 4 | An example application for the Dependency Injection for Objective-C blog post at http://seancdougherty.com/blog/2014/05/28/dependency-injection-for-objective-c/ 5 | -------------------------------------------------------------------------------- /Injection.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Pods/Pods-Injection-AFNetworking-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Injection_AFNetworking : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Injection_AFNetworking 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Pods-InjectionTests-AFNetworking-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_InjectionTests_AFNetworking : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_InjectionTests_AFNetworking 5 | @end 6 | -------------------------------------------------------------------------------- /Injection.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Injection/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | @implementation AppDelegate 4 | 5 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 6 | { 7 | return YES; 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, "6.0" 3 | 4 | target "Injection" do 5 | pod 'AFNetworking', '~> 2.2' 6 | end 7 | 8 | target "InjectionTests" do 9 | pod 'AFNetworking', '~> 2.2' 10 | end 11 | 12 | -------------------------------------------------------------------------------- /InjectionTests/Environment+Fake.m: -------------------------------------------------------------------------------- 1 | #import "Environment+Fake.h" 2 | #import "FakeReachabilityManager.h" 3 | 4 | @implementation Environment (Fake) 5 | 6 | - (void)initializeFakeServices 7 | { 8 | [self setValue:[FakeReachabilityManager sharedManager] forKey:@"reachabilityManager"]; 9 | } 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /Injection/UIViewController+Injections.m: -------------------------------------------------------------------------------- 1 | #import "UIViewController+Injections.h" 2 | #import "Environment.h" 3 | 4 | 5 | @implementation UIViewController (Injections) 6 | 7 | - (AFNetworkReachabilityManager *)reachabilityManager 8 | { 9 | return [Environment singleton].reachabilityManager; 10 | } 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /Injection/Environment.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class AFNetworkReachabilityManager; 4 | 5 | @interface Environment : NSObject 6 | 7 | @property (strong, nonatomic, readonly) AFNetworkReachabilityManager *reachabilityManager; 8 | 9 | + (Environment *)singleton; 10 | - (BOOL)isTestEnvironment; 11 | 12 | @end -------------------------------------------------------------------------------- /Pods/Pods-Injection-AFNetworking-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-Injection-AFNetworking.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/AFNetworking" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" 4 | OTHER_LDFLAGS = -ObjC ${PODS_INJECTION_AFNETWORKING_OTHER_LDFLAGS} 5 | PODS_ROOT = ${SRCROOT} -------------------------------------------------------------------------------- /Pods/Pods-InjectionTests-AFNetworking-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-InjectionTests-AFNetworking.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/AFNetworking" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" 4 | OTHER_LDFLAGS = -ObjC ${PODS_INJECTIONTESTS_AFNETWORKING_OTHER_LDFLAGS} 5 | PODS_ROOT = ${SRCROOT} -------------------------------------------------------------------------------- /InjectionTests/FakeReachabilityManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // FakeReachabilityManager.h 3 | // Injection 4 | // 5 | // Created by Sean Dougherty on 5/28/14. 6 | // Copyright (c) 2014 Sean Dougherty. All rights reserved. 7 | // 8 | 9 | #import "AFNetworkReachabilityManager.h" 10 | 11 | @interface FakeReachabilityManager : AFNetworkReachabilityManager 12 | 13 | - (void)setOffline; 14 | - (void)setOnline; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Injection/ViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class AFNetworkReachabilityManager; 4 | 5 | 6 | @interface ViewController : UIViewController 7 | 8 | @property (nonatomic, weak) IBOutlet UILabel *internetStatusLabel; 9 | 10 | /* "Injected" properties -- Each should have a corresponding @dynamic directive */ 11 | @property (strong, nonatomic) AFNetworkReachabilityManager *reachabilityManager; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Pods-Injection.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers" -isystem "${PODS_ROOT}/Headers/AFNetworking" 4 | OTHER_LDFLAGS = -ObjC -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Pods-InjectionTests.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers" -isystem "${PODS_ROOT}/Headers/AFNetworking" 4 | OTHER_LDFLAGS = -ObjC -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Injection/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Injection 4 | // 5 | // Created by Sean Dougherty on 5/28/14. 6 | // Copyright (c) 2014 Sean Dougherty. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Injection/Injection-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Injection.xcworkspace/xcuserdata/sean.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Injection/Images.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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Injection/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Injection/ViewController.m: -------------------------------------------------------------------------------- 1 | #import "ViewController.h" 2 | #import 3 | 4 | @implementation ViewController 5 | 6 | @dynamic reachabilityManager; 7 | 8 | - (void)viewDidLoad 9 | { 10 | [super viewDidLoad]; 11 | [self displayOnlineStatus]; 12 | } 13 | 14 | - (void)displayOnlineStatus 15 | { 16 | BOOL reachable = self.reachabilityManager.networkReachabilityStatus != AFNetworkReachabilityStatusNotReachable; 17 | 18 | if (reachable) 19 | { 20 | self.internetStatusLabel.text = NSLocalizedString(@"online", nil); 21 | } 22 | else 23 | { 24 | self.internetStatusLabel.text = NSLocalizedString(@"offline", nil); 25 | } 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Injection.xcodeproj/xcuserdata/sean.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Injection.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 14CEF6E71936E17E0006A05D 16 | 17 | primary 18 | 19 | 20 | 14CEF7081936E17E0006A05D 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /InjectionTests/FakeReachabilityManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // FakeReachabilityManager.m 3 | // Injection 4 | // 5 | // Created by Sean Dougherty on 5/28/14. 6 | // Copyright (c) 2014 Sean Dougherty. All rights reserved. 7 | // 8 | 9 | #import "FakeReachabilityManager.h" 10 | 11 | @interface FakeReachabilityManager() 12 | @property (nonatomic, assign) AFNetworkReachabilityStatus fakeStatus; 13 | @end 14 | 15 | 16 | @implementation FakeReachabilityManager 17 | 18 | - (void)setOffline 19 | { 20 | self.fakeStatus = AFNetworkReachabilityStatusNotReachable; 21 | } 22 | 23 | - (void)setOnline 24 | { 25 | self.fakeStatus = AFNetworkReachabilityStatusReachableViaWWAN; 26 | } 27 | 28 | - (AFNetworkReachabilityStatus)networkReachabilityStatus 29 | { 30 | return self.fakeStatus; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /InjectionTests/InjectionTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.seancdougherty.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (2.2.4): 3 | - AFNetworking/NSURLConnection 4 | - AFNetworking/NSURLSession 5 | - AFNetworking/Reachability 6 | - AFNetworking/Security 7 | - AFNetworking/Serialization 8 | - AFNetworking/UIKit 9 | - AFNetworking/NSURLConnection (2.2.4): 10 | - AFNetworking/Reachability 11 | - AFNetworking/Security 12 | - AFNetworking/Serialization 13 | - AFNetworking/NSURLSession (2.2.4): 14 | - AFNetworking/NSURLConnection 15 | - AFNetworking/Reachability (2.2.4) 16 | - AFNetworking/Security (2.2.4) 17 | - AFNetworking/Serialization (2.2.4) 18 | - AFNetworking/UIKit (2.2.4): 19 | - AFNetworking/NSURLConnection 20 | - AFNetworking/NSURLSession 21 | 22 | DEPENDENCIES: 23 | - AFNetworking (~> 2.2) 24 | 25 | SPEC CHECKSUMS: 26 | AFNetworking: ab63e259fe91eef4519b371ef0a4955af0e73e64 27 | 28 | COCOAPODS: 0.33.1 29 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (2.2.4): 3 | - AFNetworking/NSURLConnection 4 | - AFNetworking/NSURLSession 5 | - AFNetworking/Reachability 6 | - AFNetworking/Security 7 | - AFNetworking/Serialization 8 | - AFNetworking/UIKit 9 | - AFNetworking/NSURLConnection (2.2.4): 10 | - AFNetworking/Reachability 11 | - AFNetworking/Security 12 | - AFNetworking/Serialization 13 | - AFNetworking/NSURLSession (2.2.4): 14 | - AFNetworking/NSURLConnection 15 | - AFNetworking/Reachability (2.2.4) 16 | - AFNetworking/Security (2.2.4) 17 | - AFNetworking/Serialization (2.2.4) 18 | - AFNetworking/UIKit (2.2.4): 19 | - AFNetworking/NSURLConnection 20 | - AFNetworking/NSURLSession 21 | 22 | DEPENDENCIES: 23 | - AFNetworking (~> 2.2) 24 | 25 | SPEC CHECKSUMS: 26 | AFNetworking: ab63e259fe91eef4519b371ef0a4955af0e73e64 27 | 28 | COCOAPODS: 0.33.1 29 | -------------------------------------------------------------------------------- /Injection/Environment.m: -------------------------------------------------------------------------------- 1 | #import "Environment.h" 2 | #import 3 | 4 | static Environment *_singleton = nil; 5 | 6 | @interface Environment() 7 | @property (strong, nonatomic, readwrite) AFNetworkReachabilityManager *reachabilityManager; 8 | @end 9 | 10 | 11 | @implementation Environment 12 | 13 | + (Environment *)singleton 14 | { 15 | @synchronized(self) 16 | { 17 | if (_singleton == nil) 18 | { 19 | _singleton = [self new]; 20 | } 21 | 22 | return _singleton; 23 | } 24 | } 25 | 26 | - (id)init 27 | { 28 | if (self = [super init]) 29 | { 30 | [self initializeServices]; 31 | } 32 | return self; 33 | } 34 | 35 | 36 | - (void)initializeServices 37 | { 38 | if ([self isTestEnvironment]) 39 | { 40 | [self performSelector:@selector(initializeFakeServices)]; 41 | return; 42 | } 43 | 44 | self.reachabilityManager = [AFNetworkReachabilityManager sharedManager]; 45 | } 46 | 47 | - (BOOL)isTestEnvironment { 48 | return [self respondsToSelector:@selector(initializeFakeServices)]; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Pods/AFNetworking/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com/) 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/Pods.xcodeproj/xcuserdata/sean.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods-Injection-AFNetworking.xcscheme 8 | 9 | isShown 10 | 11 | 12 | Pods-Injection.xcscheme 13 | 14 | isShown 15 | 16 | 17 | Pods-InjectionTests-AFNetworking.xcscheme 18 | 19 | isShown 20 | 21 | 22 | Pods-InjectionTests.xcscheme 23 | 24 | isShown 25 | 26 | 27 | 28 | SuppressBuildableAutocreation 29 | 30 | 2BB68644146C413C8CCA1CF5 31 | 32 | primary 33 | 34 | 35 | BD72B86F3C8F4A13BA839E79 36 | 37 | primary 38 | 39 | 40 | D0B14786FD8744F38B269F6E 41 | 42 | primary 43 | 44 | 45 | F8BE2266153848A1B502B6CF 46 | 47 | primary 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Pods/Pods-Injection-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## AFNetworking 5 | 6 | Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com/) 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 | Generated by CocoaPods - http://cocoapods.org 27 | -------------------------------------------------------------------------------- /Pods/Pods-InjectionTests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## AFNetworking 5 | 6 | Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com/) 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 | Generated by CocoaPods - http://cocoapods.org 27 | -------------------------------------------------------------------------------- /Injection/Injection-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.seancdougherty.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /InjectionTests/ViewControllerTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "Environment+Fake.h" 3 | #import "ViewController.h" 4 | #import "FakeReachabilityManager.h" 5 | 6 | 7 | @interface ViewControllerTests : XCTestCase 8 | 9 | @property (nonatomic, strong) ViewController *controller; 10 | 11 | @end 12 | 13 | 14 | @implementation ViewControllerTests 15 | 16 | - (void)setUp 17 | { 18 | [super setUp]; 19 | UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; 20 | self.controller = (ViewController *)[storyboard instantiateInitialViewController]; 21 | [self.controller loadView]; 22 | } 23 | 24 | - (void)tearDown 25 | { 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testOnlineLabelDisplaysOfflineWhenOffline 30 | { 31 | FakeReachabilityManager *manager = (FakeReachabilityManager *)self.controller.reachabilityManager; 32 | [manager setOffline]; 33 | 34 | [self.controller viewDidLoad]; 35 | 36 | NSString *expectedResult = @"offline"; 37 | NSString *text = self.controller.internetStatusLabel.text; 38 | 39 | XCTAssertTrue([text isEqualToString:expectedResult], @"Strings are not equal %@ %@", text, expectedResult); 40 | } 41 | 42 | - (void)testOnlineLabelDisplaysOnlineWhenOnline 43 | { 44 | FakeReachabilityManager *manager = (FakeReachabilityManager *)self.controller.reachabilityManager; 45 | [manager setOnline]; 46 | 47 | [self.controller viewDidLoad]; 48 | 49 | NSString *expectedResult = @"online"; 50 | NSString *text = self.controller.internetStatusLabel.text; 51 | 52 | XCTAssertTrue([text isEqualToString:expectedResult], @"Strings are not equal %@ %@", text, expectedResult); 53 | } 54 | 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 | #import 24 | 25 | #ifndef _UIKIT_AFNETWORKING_ 26 | #define _UIKIT_AFNETWORKING_ 27 | 28 | #import "AFNetworkActivityIndicatorManager.h" 29 | 30 | #import "UIActivityIndicatorView+AFNetworking.h" 31 | #import "UIAlertView+AFNetworking.h" 32 | #import "UIButton+AFNetworking.h" 33 | #import "UIImageView+AFNetworking.h" 34 | #import "UIKit+AFNetworking.h" 35 | #import "UIProgressView+AFNetworking.h" 36 | #import "UIRefreshControl+AFNetworking.h" 37 | #import "UIWebView+AFNetworking.h" 38 | #endif /* _UIKIT_AFNETWORKING_ */ 39 | -------------------------------------------------------------------------------- /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 | 26 | #ifndef _AFNETWORKING_ 27 | #define _AFNETWORKING_ 28 | 29 | #import "AFURLRequestSerialization.h" 30 | #import "AFURLResponseSerialization.h" 31 | #import "AFSecurityPolicy.h" 32 | #import "AFNetworkReachabilityManager.h" 33 | 34 | #import "AFURLConnectionOperation.h" 35 | #import "AFHTTPRequestOperation.h" 36 | #import "AFHTTPRequestOperationManager.h" 37 | 38 | #if ( ( defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) || \ 39 | ( defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 ) ) 40 | #import "AFURLSessionManager.h" 41 | #import "AFHTTPSessionManager.h" 42 | #endif 43 | 44 | #endif /* _AFNETWORKING_ */ 45 | -------------------------------------------------------------------------------- /Pods/Pods-Injection-environment.h: -------------------------------------------------------------------------------- 1 | 2 | // To check if a library is compiled with CocoaPods you 3 | // can use the `COCOAPODS` macro definition which is 4 | // defined in the xcconfigs so it is available in 5 | // headers also when they are imported in the client 6 | // project. 7 | 8 | 9 | // AFNetworking 10 | #define COCOAPODS_POD_AVAILABLE_AFNetworking 11 | #define COCOAPODS_VERSION_MAJOR_AFNetworking 2 12 | #define COCOAPODS_VERSION_MINOR_AFNetworking 2 13 | #define COCOAPODS_VERSION_PATCH_AFNetworking 4 14 | 15 | // AFNetworking/NSURLConnection 16 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_NSURLConnection 17 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_NSURLConnection 2 18 | #define COCOAPODS_VERSION_MINOR_AFNetworking_NSURLConnection 2 19 | #define COCOAPODS_VERSION_PATCH_AFNetworking_NSURLConnection 4 20 | 21 | // AFNetworking/NSURLSession 22 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_NSURLSession 23 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_NSURLSession 2 24 | #define COCOAPODS_VERSION_MINOR_AFNetworking_NSURLSession 2 25 | #define COCOAPODS_VERSION_PATCH_AFNetworking_NSURLSession 4 26 | 27 | // AFNetworking/Reachability 28 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_Reachability 29 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_Reachability 2 30 | #define COCOAPODS_VERSION_MINOR_AFNetworking_Reachability 2 31 | #define COCOAPODS_VERSION_PATCH_AFNetworking_Reachability 4 32 | 33 | // AFNetworking/Security 34 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_Security 35 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_Security 2 36 | #define COCOAPODS_VERSION_MINOR_AFNetworking_Security 2 37 | #define COCOAPODS_VERSION_PATCH_AFNetworking_Security 4 38 | 39 | // AFNetworking/Serialization 40 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_Serialization 41 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_Serialization 2 42 | #define COCOAPODS_VERSION_MINOR_AFNetworking_Serialization 2 43 | #define COCOAPODS_VERSION_PATCH_AFNetworking_Serialization 4 44 | 45 | // AFNetworking/UIKit 46 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_UIKit 47 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_UIKit 2 48 | #define COCOAPODS_VERSION_MINOR_AFNetworking_UIKit 2 49 | #define COCOAPODS_VERSION_PATCH_AFNetworking_UIKit 4 50 | 51 | -------------------------------------------------------------------------------- /Pods/Pods-InjectionTests-environment.h: -------------------------------------------------------------------------------- 1 | 2 | // To check if a library is compiled with CocoaPods you 3 | // can use the `COCOAPODS` macro definition which is 4 | // defined in the xcconfigs so it is available in 5 | // headers also when they are imported in the client 6 | // project. 7 | 8 | 9 | // AFNetworking 10 | #define COCOAPODS_POD_AVAILABLE_AFNetworking 11 | #define COCOAPODS_VERSION_MAJOR_AFNetworking 2 12 | #define COCOAPODS_VERSION_MINOR_AFNetworking 2 13 | #define COCOAPODS_VERSION_PATCH_AFNetworking 4 14 | 15 | // AFNetworking/NSURLConnection 16 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_NSURLConnection 17 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_NSURLConnection 2 18 | #define COCOAPODS_VERSION_MINOR_AFNetworking_NSURLConnection 2 19 | #define COCOAPODS_VERSION_PATCH_AFNetworking_NSURLConnection 4 20 | 21 | // AFNetworking/NSURLSession 22 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_NSURLSession 23 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_NSURLSession 2 24 | #define COCOAPODS_VERSION_MINOR_AFNetworking_NSURLSession 2 25 | #define COCOAPODS_VERSION_PATCH_AFNetworking_NSURLSession 4 26 | 27 | // AFNetworking/Reachability 28 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_Reachability 29 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_Reachability 2 30 | #define COCOAPODS_VERSION_MINOR_AFNetworking_Reachability 2 31 | #define COCOAPODS_VERSION_PATCH_AFNetworking_Reachability 4 32 | 33 | // AFNetworking/Security 34 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_Security 35 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_Security 2 36 | #define COCOAPODS_VERSION_MINOR_AFNetworking_Security 2 37 | #define COCOAPODS_VERSION_PATCH_AFNetworking_Security 4 38 | 39 | // AFNetworking/Serialization 40 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_Serialization 41 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_Serialization 2 42 | #define COCOAPODS_VERSION_MINOR_AFNetworking_Serialization 2 43 | #define COCOAPODS_VERSION_PATCH_AFNetworking_Serialization 4 44 | 45 | // AFNetworking/UIKit 46 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_UIKit 47 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_UIKit 2 48 | #define COCOAPODS_VERSION_MINOR_AFNetworking_UIKit 2 49 | #define COCOAPODS_VERSION_PATCH_AFNetworking_UIKit 4 50 | 51 | -------------------------------------------------------------------------------- /Pods/Pods-Injection-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) 2013-2014 AFNetworking (http://afnetworking.com/) 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 | Generated by CocoaPods - http://cocoapods.org 45 | Title 46 | 47 | Type 48 | PSGroupSpecifier 49 | 50 | 51 | StringsTable 52 | Acknowledgements 53 | Title 54 | Acknowledgements 55 | 56 | 57 | -------------------------------------------------------------------------------- /Pods/Pods-InjectionTests-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) 2013-2014 AFNetworking (http://afnetworking.com/) 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 | Generated by CocoaPods - http://cocoapods.org 45 | Title 46 | 47 | Type 48 | PSGroupSpecifier 49 | 50 | 51 | StringsTable 52 | Acknowledgements 53 | Title 54 | Acknowledgements 55 | 56 | 57 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/sean.xcuserdatad/xcschemes/Pods-Injection.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/sean.xcuserdatad/xcschemes/Pods-InjectionTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/sean.xcuserdatad/xcschemes/Pods-Injection-AFNetworking.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/sean.xcuserdatad/xcschemes/Pods-InjectionTests-AFNetworking.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /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 defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @class AFURLConnectionOperation; 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically begining and ending refreshing depending on the loading state of a request operation or 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 diabled. 46 | */ 47 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 48 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; 49 | #endif 50 | 51 | ///---------------------------------------- 52 | /// @name Refreshing for Request Operations 53 | ///---------------------------------------- 54 | 55 | /** 56 | Binds the refreshing state to the execution state of the specified operation. 57 | 58 | @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled. 59 | */ 60 | - (void)setRefreshingWithStateOfOperation:(AFURLConnectionOperation *)operation; 61 | 62 | @end 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIActivityIndicatorView+AFNetworking.h 2 | // 3 | // Copyright (c) 2013-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 defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @class AFURLConnectionOperation; 32 | 33 | /** 34 | 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 request operation or session task. 35 | */ 36 | @interface UIActivityIndicatorView (AFNetworking) 37 | 38 | ///---------------------------------- 39 | /// @name Animating for Session Tasks 40 | ///---------------------------------- 41 | 42 | /** 43 | Binds the animating 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 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 48 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task; 49 | #endif 50 | 51 | ///--------------------------------------- 52 | /// @name Animating for Request Operations 53 | ///--------------------------------------- 54 | 55 | /** 56 | Binds the animating state to the execution state of the specified operation. 57 | 58 | @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled. 59 | */ 60 | - (void)setAnimatingWithStateOfOperation:(AFURLConnectionOperation *)operation; 61 | 62 | @end 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Injection/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Pods/Pods-Injection-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 5 | > "$RESOURCES_TO_COPY" 6 | 7 | install_resource() 8 | { 9 | case $1 in 10 | *.storyboard) 11 | 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}" 12 | 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}" 13 | ;; 14 | *.xib) 15 | 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}" 16 | 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}" 17 | ;; 18 | *.framework) 19 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 21 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 22 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 23 | ;; 24 | *.xcdatamodel) 25 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 26 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 27 | ;; 28 | *.xcdatamodeld) 29 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 30 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 31 | ;; 32 | *.xcassets) 33 | ;; 34 | /*) 35 | echo "$1" 36 | echo "$1" >> "$RESOURCES_TO_COPY" 37 | ;; 38 | *) 39 | echo "${PODS_ROOT}/$1" 40 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 41 | ;; 42 | esac 43 | } 44 | 45 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 46 | if [[ "${ACTION}" == "install" ]]; then 47 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 48 | fi 49 | rm -f "$RESOURCES_TO_COPY" 50 | 51 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ `xcrun --find actool` ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] 52 | then 53 | case "${TARGETED_DEVICE_FAMILY}" in 54 | 1,2) 55 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 56 | ;; 57 | 1) 58 | TARGET_DEVICE_ARGS="--target-device iphone" 59 | ;; 60 | 2) 61 | TARGET_DEVICE_ARGS="--target-device ipad" 62 | ;; 63 | *) 64 | TARGET_DEVICE_ARGS="--target-device mac" 65 | ;; 66 | esac 67 | find "${PWD}" -name "*.xcassets" -print0 | xargs -0 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}" 68 | fi 69 | -------------------------------------------------------------------------------- /Pods/Pods-InjectionTests-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 5 | > "$RESOURCES_TO_COPY" 6 | 7 | install_resource() 8 | { 9 | case $1 in 10 | *.storyboard) 11 | 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}" 12 | 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}" 13 | ;; 14 | *.xib) 15 | 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}" 16 | 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}" 17 | ;; 18 | *.framework) 19 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 21 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 22 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 23 | ;; 24 | *.xcdatamodel) 25 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 26 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 27 | ;; 28 | *.xcdatamodeld) 29 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 30 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 31 | ;; 32 | *.xcassets) 33 | ;; 34 | /*) 35 | echo "$1" 36 | echo "$1" >> "$RESOURCES_TO_COPY" 37 | ;; 38 | *) 39 | echo "${PODS_ROOT}/$1" 40 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 41 | ;; 42 | esac 43 | } 44 | 45 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 46 | if [[ "${ACTION}" == "install" ]]; then 47 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 48 | fi 49 | rm -f "$RESOURCES_TO_COPY" 50 | 51 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ `xcrun --find actool` ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] 52 | then 53 | case "${TARGETED_DEVICE_FAMILY}" in 54 | 1,2) 55 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 56 | ;; 57 | 1) 58 | TARGET_DEVICE_ARGS="--target-device iphone" 59 | ;; 60 | 2) 61 | TARGET_DEVICE_ARGS="--target-device ipad" 62 | ;; 63 | *) 64 | TARGET_DEVICE_ARGS="--target-device mac" 65 | ;; 66 | esac 67 | find "${PWD}" -name "*.xcassets" -print0 | xargs -0 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}" 68 | fi 69 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIProgressView+AFNetworking.h 2 | // 3 | // Copyright (c) 2013-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 defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @class AFURLConnectionOperation; 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 or request operation. 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 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 49 | - (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task 50 | animated:(BOOL)animated; 51 | #endif 52 | 53 | /** 54 | Binds the progress to the download progress of the specified session task. 55 | 56 | @param task The session task. 57 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 58 | */ 59 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 60 | - (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task 61 | animated:(BOOL)animated; 62 | #endif 63 | 64 | ///------------------------------------ 65 | /// @name Setting Session Task Progress 66 | ///------------------------------------ 67 | 68 | /** 69 | Binds the progress to the upload progress of the specified request operation. 70 | 71 | @param operation The request operation. 72 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 73 | */ 74 | - (void)setProgressWithUploadProgressOfOperation:(AFURLConnectionOperation *)operation 75 | animated:(BOOL)animated; 76 | 77 | /** 78 | Binds the progress to the download progress of the specified request operation. 79 | 80 | @param operation The request operation. 81 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 82 | */ 83 | - (void)setProgressWithDownloadProgressOfOperation:(AFURLConnectionOperation *)operation 84 | animated:(BOOL)animated; 85 | 86 | @end 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /Injection.xcodeproj/xcuserdata/sean.xcuserdatad/xcschemes/Injection.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h: -------------------------------------------------------------------------------- 1 | // AFNetworkActivityIndicatorManager.h 2 | // 3 | // Copyright (c) 2013-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 defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | /** 32 | `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a network request operation 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. 33 | 34 | 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: 35 | 36 | [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]; 37 | 38 | By setting `isNetworkActivityIndicatorVisible` 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. 39 | 40 | See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information: 41 | http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44 42 | */ 43 | @interface AFNetworkActivityIndicatorManager : NSObject 44 | 45 | /** 46 | A Boolean value indicating whether the manager is enabled. 47 | 48 | If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO. 49 | */ 50 | @property (nonatomic, assign, getter = isEnabled) BOOL enabled; 51 | 52 | /** 53 | A Boolean value indicating whether the network activity indicator is currently displayed in the status bar. 54 | */ 55 | @property (readonly, nonatomic, assign) BOOL isNetworkActivityIndicatorVisible; 56 | 57 | /** 58 | Returns the shared network activity indicator manager object for the system. 59 | 60 | @return The systemwide network activity indicator manager. 61 | */ 62 | + (instancetype)sharedManager; 63 | 64 | /** 65 | Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator. 66 | */ 67 | - (void)incrementActivityCount; 68 | 69 | /** 70 | Decrements the number of active network requests. If this number becomes zero after decrementing, this will stop animating the status bar network activity indicator. 71 | */ 72 | - (void)decrementActivityCount; 73 | 74 | @end 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /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 | 25 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 26 | 27 | #import "AFHTTPRequestOperation.h" 28 | 29 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 30 | #import "AFURLSessionManager.h" 31 | #endif 32 | 33 | @implementation UIRefreshControl (AFNetworking) 34 | 35 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 36 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task { 37 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 38 | 39 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 40 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 41 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 42 | 43 | if (task) { 44 | if (task.state != NSURLSessionTaskStateCompleted) { 45 | if (task.state == NSURLSessionTaskStateRunning) { 46 | [self beginRefreshing]; 47 | } else { 48 | [self endRefreshing]; 49 | } 50 | 51 | [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingTaskDidResumeNotification object:task]; 52 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidCompleteNotification object:task]; 53 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidSuspendNotification object:task]; 54 | } 55 | } 56 | } 57 | #endif 58 | 59 | - (void)setRefreshingWithStateOfOperation:(AFURLConnectionOperation *)operation { 60 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 61 | 62 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidStartNotification object:nil]; 63 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidFinishNotification object:nil]; 64 | 65 | if (operation) { 66 | if (![operation isFinished]) { 67 | if ([operation isExecuting]) { 68 | [self beginRefreshing]; 69 | } else { 70 | [self endRefreshing]; 71 | } 72 | 73 | [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingOperationDidStartNotification object:operation]; 74 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingOperationDidFinishNotification object:operation]; 75 | } 76 | } 77 | } 78 | 79 | #pragma mark - 80 | 81 | - (void)af_beginRefreshing { 82 | dispatch_async(dispatch_get_main_queue(), ^{ 83 | [self beginRefreshing]; 84 | }); 85 | } 86 | 87 | - (void)af_endRefreshing { 88 | dispatch_async(dispatch_get_main_queue(), ^{ 89 | [self endRefreshing]; 90 | }); 91 | } 92 | 93 | @end 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIActivityIndicatorView+AFNetworking.m 2 | // 3 | // Copyright (c) 2013-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 "UIActivityIndicatorView+AFNetworking.h" 24 | 25 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 26 | 27 | #import "AFHTTPRequestOperation.h" 28 | 29 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 30 | #import "AFURLSessionManager.h" 31 | #endif 32 | 33 | @implementation UIActivityIndicatorView (AFNetworking) 34 | 35 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 36 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task { 37 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 38 | 39 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 40 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 41 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 42 | 43 | if (task) { 44 | if (task.state != NSURLSessionTaskStateCompleted) { 45 | if (task.state == NSURLSessionTaskStateRunning) { 46 | [self startAnimating]; 47 | } else { 48 | [self stopAnimating]; 49 | } 50 | 51 | [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingTaskDidResumeNotification object:task]; 52 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidCompleteNotification object:task]; 53 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidSuspendNotification object:task]; 54 | } 55 | } 56 | } 57 | #endif 58 | 59 | #pragma mark - 60 | 61 | - (void)setAnimatingWithStateOfOperation:(AFURLConnectionOperation *)operation { 62 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 63 | 64 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidStartNotification object:nil]; 65 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidFinishNotification object:nil]; 66 | 67 | if (operation) { 68 | if (![operation isFinished]) { 69 | if ([operation isExecuting]) { 70 | [self startAnimating]; 71 | } else { 72 | [self stopAnimating]; 73 | } 74 | 75 | [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingOperationDidStartNotification object:operation]; 76 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingOperationDidFinishNotification object:operation]; 77 | } 78 | } 79 | } 80 | 81 | #pragma mark - 82 | 83 | - (void)af_startAnimating { 84 | dispatch_async(dispatch_get_main_queue(), ^{ 85 | [self startAnimating]; 86 | }); 87 | } 88 | 89 | - (void)af_stopAnimating { 90 | dispatch_async(dispatch_get_main_queue(), ^{ 91 | [self stopAnimating]; 92 | }); 93 | } 94 | 95 | @end 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h: -------------------------------------------------------------------------------- 1 | // AFHTTPRequestOperation.h 2 | // 3 | // Copyright (c) 2013-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 | #import "AFURLConnectionOperation.h" 25 | #import "AFURLResponseSerialization.h" 26 | 27 | /** 28 | `AFHTTPRequestOperation` is a subclass of `AFURLConnectionOperation` for requests using the HTTP or HTTPS protocols. It encapsulates the concept of acceptable status codes and content types, which determine the success or failure of a request. 29 | */ 30 | @interface AFHTTPRequestOperation : AFURLConnectionOperation 31 | 32 | ///------------------------------------------------ 33 | /// @name Getting HTTP URL Connection Information 34 | ///------------------------------------------------ 35 | 36 | /** 37 | The last HTTP response received by the operation's connection. 38 | */ 39 | @property (readonly, nonatomic, strong) NSHTTPURLResponse *response; 40 | 41 | /** 42 | Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an AFHTTPResponse serializer, which uses the raw data as its response object. The serializer validates the status code to be in the `2XX` range, denoting success. If the response serializer generates an error in `-responseObjectForResponse:data:error:`, the `failure` callback of the session task or request operation will be executed; otherwise, the `success` callback will be executed. 43 | 44 | @warning `responseSerializer` must not be `nil`. Setting a response serializer will clear out any cached value 45 | */ 46 | @property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; 47 | 48 | /** 49 | An object constructed by the `responseSerializer` from the response and response data. Returns `nil` unless the operation `isFinished`, has a `response`, and has `responseData` with non-zero content length. If an error occurs during serialization, `nil` will be returned, and the `error` property will be populated with the serialization error. 50 | */ 51 | @property (readonly, nonatomic, strong) id responseObject; 52 | 53 | ///----------------------------------------------------------- 54 | /// @name Setting Completion Block Success / Failure Callbacks 55 | ///----------------------------------------------------------- 56 | 57 | /** 58 | Sets the `completionBlock` property with a block that executes either the specified success or failure block, depending on the state of the request on completion. If `error` returns a value, which can be caused by an unacceptable status code or content type, then `failure` is executed. Otherwise, `success` is executed. 59 | 60 | This method should be overridden in subclasses in order to specify the response object passed into the success block. 61 | 62 | @param success The block to be executed on the completion of a successful request. This block has no return value and takes two arguments: the receiver operation and the object constructed from the response data of the request. 63 | @param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occurred during the request. 64 | */ 65 | - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success 66 | failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIAlertView+AFNetworking.h 2 | // 3 | // Copyright (c) 2013-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 defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @class AFURLConnectionOperation; 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIAlertView` class. The methods in this category provide support for automatically showing an alert if a session task or request operation finishes with an error. Alert title and message are filled from the corresponding `localizedDescription` & `localizedRecoverySuggestion` or `localizedFailureReason` of the error. 35 | */ 36 | @interface UIAlertView (AFNetworking) 37 | 38 | ///------------------------------------- 39 | /// @name Showing Alert for Session Task 40 | ///------------------------------------- 41 | 42 | /** 43 | Shows an alert view with the error of the specified session task, if any. 44 | 45 | @param task The session task. 46 | @param delegate The alert view delegate. 47 | */ 48 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 49 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 50 | delegate:(id)delegate; 51 | #endif 52 | 53 | /** 54 | Shows an alert view with the error of the specified session task, if any, with a custom cancel button title and other button titles. 55 | 56 | @param task The session task. 57 | @param delegate The alert view delegate. 58 | @param cancelButtonTitle The title of the cancel button or nil if there is no cancel button. Using this argument is equivalent to setting the cancel button index to the value returned by invoking addButtonWithTitle: specifying this title. 59 | @param otherButtonTitles The title of another button. Using this argument is equivalent to invoking addButtonWithTitle: with this title to add more buttons. Too many buttons can cause the alert view to scroll. For guidelines on the best ways to use an alert in an app, see "Temporary Views". Titles of additional buttons to add to the receiver, terminated with `nil`. 60 | */ 61 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 62 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 63 | delegate:(id)delegate 64 | cancelButtonTitle:(NSString *)cancelButtonTitle 65 | otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION; 66 | #endif 67 | 68 | ///------------------------------------------ 69 | /// @name Showing Alert for Request Operation 70 | ///------------------------------------------ 71 | 72 | /** 73 | Shows an alert view with the error of the specified request operation, if any. 74 | 75 | @param operation The request operation. 76 | @param delegate The alert view delegate. 77 | */ 78 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 79 | delegate:(id)delegate; 80 | 81 | /** 82 | Shows an alert view with the error of the specified request operation, if any, with a custom cancel button title and other button titles. 83 | 84 | @param operation The request operation. 85 | @param delegate The alert view delegate. 86 | @param cancelButtonTitle The title of the cancel button or nil if there is no cancel button. Using this argument is equivalent to setting the cancel button index to the value returned by invoking addButtonWithTitle: specifying this title. 87 | @param otherButtonTitles The title of another button. Using this argument is equivalent to invoking addButtonWithTitle: with this title to add more buttons. Too many buttons can cause the alert view to scroll. For guidelines on the best ways to use an alert in an app, see "Temporary Views". Titles of additional buttons to add to the receiver, terminated with `nil`. 88 | */ 89 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 90 | delegate:(id)delegate 91 | cancelButtonTitle:(NSString *)cancelButtonTitle 92 | otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION; 93 | 94 | @end 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | // AFSecurity.h 2 | // 3 | // Copyright (c) 2013-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 | #import 25 | 26 | typedef NS_ENUM(NSUInteger, AFSSLPinningMode) { 27 | AFSSLPinningModeNone, 28 | AFSSLPinningModePublicKey, 29 | AFSSLPinningModeCertificate, 30 | }; 31 | 32 | /** 33 | `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections. 34 | 35 | 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. 36 | */ 37 | @interface AFSecurityPolicy : NSObject 38 | 39 | /** 40 | The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`. 41 | */ 42 | @property (nonatomic, assign) AFSSLPinningMode SSLPinningMode; 43 | 44 | /** 45 | Whether to evaluate an entire SSL certificate chain, or just the leaf certificate. Defaults to `YES`. 46 | */ 47 | @property (nonatomic, assign) BOOL validatesCertificateChain; 48 | 49 | /** 50 | The certificates used to evaluate server trust according to the SSL pinning mode. By default, this property is set to any (`.cer`) certificates included in the app bundle. 51 | */ 52 | @property (nonatomic, strong) NSArray *pinnedCertificates; 53 | 54 | /** 55 | Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`. 56 | */ 57 | @property (nonatomic, assign) BOOL allowInvalidCertificates; 58 | 59 | /** 60 | Whether or not to validate the domain name in the certificates CN field. Defaults to `YES` for `AFSSLPinningModePublicKey` or `AFSSLPinningModeCertificate`, otherwise `NO`. 61 | */ 62 | @property (nonatomic, assign) BOOL validatesDomainName; 63 | 64 | ///----------------------------------------- 65 | /// @name Getting Specific Security Policies 66 | ///----------------------------------------- 67 | 68 | /** 69 | Returns the shared default security policy, which does not accept invalid certificates, and does not validate against pinned certificates or public keys. 70 | 71 | @return The default security policy. 72 | */ 73 | + (instancetype)defaultPolicy; 74 | 75 | ///--------------------- 76 | /// @name Initialization 77 | ///--------------------- 78 | 79 | /** 80 | Creates and returns a security policy with the specified pinning mode. 81 | 82 | @param pinningMode The SSL pinning mode. 83 | 84 | @return A new security policy. 85 | */ 86 | + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode; 87 | 88 | ///------------------------------ 89 | /// @name Evaluating Server Trust 90 | ///------------------------------ 91 | 92 | /** 93 | Whether or not the specified server trust should be accepted, based on the security policy. 94 | 95 | This method should be used when responding to an authentication challenge from a server. 96 | 97 | @param serverTrust The X.509 certificate trust of the server. 98 | 99 | @return Whether or not to trust the server. 100 | 101 | @warning This method has been deprecated in favor of `-evaluateServerTrust:forDomain:`. 102 | */ 103 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust DEPRECATED_ATTRIBUTE; 104 | 105 | /** 106 | Whether or not the specified server trust should be accepted, based on the security policy. 107 | 108 | This method should be used when responding to an authentication challenge from a server. 109 | 110 | @param serverTrust The X.509 certificate trust of the server. 111 | @param domain The domain of serverTrust. If `nil`, the domain will not be validated. 112 | 113 | @return Whether or not to trust the server. 114 | */ 115 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust 116 | forDomain:(NSString *)domain; 117 | 118 | @end 119 | 120 | ///---------------- 121 | /// @name Constants 122 | ///---------------- 123 | 124 | /** 125 | ## SSL Pinning Modes 126 | 127 | The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes. 128 | 129 | enum { 130 | AFSSLPinningModeNone, 131 | AFSSLPinningModePublicKey, 132 | AFSSLPinningModeCertificate, 133 | } 134 | 135 | `AFSSLPinningModeNone` 136 | Do not used pinned certificates to validate servers. 137 | 138 | `AFSSLPinningModePublicKey` 139 | Validate host certificates against public keys of pinned certificates. 140 | 141 | `AFSSLPinningModeCertificate` 142 | Validate host certificates against pinned certificates. 143 | */ 144 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIWebView+AFNetworking.h 2 | // 3 | // Copyright (c) 2013-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 defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @class AFHTTPRequestSerializer, AFHTTPResponseSerializer; 32 | @protocol AFURLRequestSerialization, AFURLResponseSerialization; 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 request serializer used to serialize requests made with the `-loadRequest:...` category methods. By default, this is an instance of `AFHTTPRequestSerializer`. 43 | */ 44 | @property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer; 45 | 46 | /** 47 | The response serializer used to serialize responses made with the `-loadRequest:...` category methods. By default, this is an instance of `AFHTTPResponseSerializer`. 48 | */ 49 | @property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; 50 | 51 | /** 52 | Asynchronously loads the specified request. 53 | 54 | @param request A URL request identifying the location of the content to load. This must not be `nil`. 55 | @param progress A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the main thread. 56 | @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. 57 | @param failure A block object to be executed when the request operation 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. 58 | */ 59 | - (void)loadRequest:(NSURLRequest *)request 60 | progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 61 | success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success 62 | failure:(void (^)(NSError *error))failure; 63 | 64 | /** 65 | Asynchronously loads the data associated with a particular request with a specified MIME type and text encoding. 66 | 67 | @param request A URL request identifying the location of the content to load. This must not be `nil`. 68 | @param MIMEType The MIME type of the content. Defaults to the content type of the response if not specified. 69 | @param textEncodingName The IANA encoding name, as in `utf-8` or `utf-16`. Defaults to the response text encoding if not specified. 70 | @param progress A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the main thread. 71 | @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. 72 | @param failure A block object to be executed when the request operation 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. 73 | */ 74 | - (void)loadRequest:(NSURLRequest *)request 75 | MIMEType:(NSString *)MIMEType 76 | textEncodingName:(NSString *)textEncodingName 77 | progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 78 | success:(NSData * (^)(NSHTTPURLResponse *response, NSData *data))success 79 | failure:(void (^)(NSError *error))failure; 80 | 81 | @end 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIAlertView+AFNetworking.m 2 | // 3 | // Copyright (c) 2013-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 "UIAlertView+AFNetworking.h" 24 | 25 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 26 | 27 | #import "AFURLConnectionOperation.h" 28 | 29 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 30 | #import "AFURLSessionManager.h" 31 | #endif 32 | 33 | static void AFGetAlertViewTitleAndMessageFromError(NSError *error, NSString * __autoreleasing *title, NSString * __autoreleasing *message) { 34 | if (error.localizedDescription && (error.localizedRecoverySuggestion || error.localizedFailureReason)) { 35 | *title = error.localizedDescription; 36 | 37 | if (error.localizedRecoverySuggestion) { 38 | *message = error.localizedRecoverySuggestion; 39 | } else { 40 | *message = error.localizedFailureReason; 41 | } 42 | } else if (error.localizedDescription) { 43 | *title = NSLocalizedStringFromTable(@"Error", @"AFNetworking", @"Fallback Error Description"); 44 | *message = error.localizedDescription; 45 | } else { 46 | *title = NSLocalizedStringFromTable(@"Error", @"AFNetworking", @"Fallback Error Description"); 47 | *message = [NSString stringWithFormat:NSLocalizedStringFromTable(@"%@ Error: %ld", @"AFNetworking", @"Fallback Error Failure Reason Format"), error.domain, (long)error.code]; 48 | } 49 | } 50 | 51 | @implementation UIAlertView (AFNetworking) 52 | 53 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 54 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 55 | delegate:(id)delegate 56 | { 57 | [self showAlertViewForTaskWithErrorOnCompletion:task delegate:delegate cancelButtonTitle:NSLocalizedStringFromTable(@"Dismiss", @"AFNetworking", @"UIAlertView Cancel Button Title") otherButtonTitles:nil, nil]; 58 | } 59 | 60 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 61 | delegate:(id)delegate 62 | cancelButtonTitle:(NSString *)cancelButtonTitle 63 | otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION 64 | { 65 | __block id observer = [[NSNotificationCenter defaultCenter] addObserverForName:AFNetworkingTaskDidCompleteNotification object:task queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) { 66 | 67 | NSError *error = notification.userInfo[AFNetworkingTaskDidCompleteErrorKey]; 68 | if (error) { 69 | NSString *title, *message; 70 | AFGetAlertViewTitleAndMessageFromError(error, &title, &message); 71 | 72 | [[[UIAlertView alloc] initWithTitle:title message:message delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:otherButtonTitles, nil] show]; 73 | } 74 | 75 | [[NSNotificationCenter defaultCenter] removeObserver:observer name:AFNetworkingTaskDidCompleteNotification object:notification.object]; 76 | }]; 77 | } 78 | #endif 79 | 80 | #pragma mark - 81 | 82 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 83 | delegate:(id)delegate 84 | { 85 | [self showAlertViewForRequestOperationWithErrorOnCompletion:operation delegate:delegate cancelButtonTitle:NSLocalizedStringFromTable(@"Dismiss", @"AFNetworking", @"UIAlert View Cancel Button Title") otherButtonTitles:nil, nil]; 86 | } 87 | 88 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 89 | delegate:(id)delegate 90 | cancelButtonTitle:(NSString *)cancelButtonTitle 91 | otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION 92 | { 93 | __block id observer = [[NSNotificationCenter defaultCenter] addObserverForName:AFNetworkingOperationDidFinishNotification object:operation queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) { 94 | 95 | if (notification.object && [notification.object isKindOfClass:[AFURLConnectionOperation class]]) { 96 | NSError *error = [(AFURLConnectionOperation *)notification.object error]; 97 | if (error) { 98 | NSString *title, *message; 99 | AFGetAlertViewTitleAndMessageFromError(error, &title, &message); 100 | 101 | [[[UIAlertView alloc] initWithTitle:title message:message delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:otherButtonTitles, nil] show]; 102 | } 103 | } 104 | 105 | [[NSNotificationCenter defaultCenter] removeObserver:observer name:AFNetworkingOperationDidFinishNotification object:notification.object]; 106 | }]; 107 | } 108 | 109 | @end 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIWebView+AFNetworking.m 2 | // 3 | // Copyright (c) 2013-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 "UIWebView+AFNetworking.h" 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import "AFHTTPRequestOperation.h" 30 | #import "AFURLResponseSerialization.h" 31 | #import "AFURLRequestSerialization.h" 32 | 33 | @interface UIWebView (_AFNetworking) 34 | @property (readwrite, nonatomic, strong, setter = af_setHTTPRequestOperation:) AFHTTPRequestOperation *af_HTTPRequestOperation; 35 | @end 36 | 37 | @implementation UIWebView (_AFNetworking) 38 | 39 | - (AFHTTPRequestOperation *)af_HTTPRequestOperation { 40 | return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, @selector(af_HTTPRequestOperation)); 41 | } 42 | 43 | - (void)af_setHTTPRequestOperation:(AFHTTPRequestOperation *)operation { 44 | objc_setAssociatedObject(self, @selector(af_HTTPRequestOperation), operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 45 | } 46 | 47 | @end 48 | 49 | #pragma mark - 50 | 51 | @implementation UIWebView (AFNetworking) 52 | 53 | - (AFHTTPRequestSerializer *)requestSerializer { 54 | static AFHTTPRequestSerializer *_af_defaultRequestSerializer = nil; 55 | static dispatch_once_t onceToken; 56 | dispatch_once(&onceToken, ^{ 57 | _af_defaultRequestSerializer = [AFHTTPRequestSerializer serializer]; 58 | }); 59 | 60 | #pragma clang diagnostic push 61 | #pragma clang diagnostic ignored "-Wgnu" 62 | return objc_getAssociatedObject(self, @selector(requestSerializer)) ?: _af_defaultRequestSerializer; 63 | #pragma clang diagnostic pop 64 | } 65 | 66 | - (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer { 67 | objc_setAssociatedObject(self, @selector(requestSerializer), requestSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 68 | } 69 | 70 | - (AFHTTPResponseSerializer *)responseSerializer { 71 | static AFHTTPResponseSerializer *_af_defaultResponseSerializer = nil; 72 | static dispatch_once_t onceToken; 73 | dispatch_once(&onceToken, ^{ 74 | _af_defaultResponseSerializer = [AFHTTPResponseSerializer serializer]; 75 | }); 76 | 77 | #pragma clang diagnostic push 78 | #pragma clang diagnostic ignored "-Wgnu" 79 | return objc_getAssociatedObject(self, @selector(responseSerializer)) ?: _af_defaultResponseSerializer; 80 | #pragma clang diagnostic pop 81 | } 82 | 83 | - (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { 84 | objc_setAssociatedObject(self, @selector(responseSerializer), responseSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 85 | } 86 | 87 | #pragma mark - 88 | 89 | - (void)loadRequest:(NSURLRequest *)request 90 | progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 91 | success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success 92 | failure:(void (^)(NSError *error))failure 93 | { 94 | [self loadRequest:request MIMEType:nil textEncodingName:nil progress:progress success:^NSData *(NSHTTPURLResponse *response, NSData *data) { 95 | NSStringEncoding stringEncoding = NSUTF8StringEncoding; 96 | if (response.textEncodingName) { 97 | CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName); 98 | if (encoding != kCFStringEncodingInvalidId) { 99 | stringEncoding = CFStringConvertEncodingToNSStringEncoding(encoding); 100 | } 101 | } 102 | 103 | NSString *string = [[NSString alloc] initWithData:data encoding:stringEncoding]; 104 | if (success) { 105 | string = success(response, string); 106 | } 107 | 108 | return [string dataUsingEncoding:stringEncoding]; 109 | } failure:failure]; 110 | } 111 | 112 | - (void)loadRequest:(NSURLRequest *)request 113 | MIMEType:(NSString *)MIMEType 114 | textEncodingName:(NSString *)textEncodingName 115 | progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 116 | success:(NSData * (^)(NSHTTPURLResponse *response, NSData *data))success 117 | failure:(void (^)(NSError *error))failure 118 | { 119 | NSParameterAssert(request); 120 | 121 | if (self.af_HTTPRequestOperation) { 122 | [self.af_HTTPRequestOperation cancel]; 123 | } 124 | 125 | request = [self.requestSerializer requestBySerializingRequest:request withParameters:nil error:nil]; 126 | 127 | self.af_HTTPRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; 128 | self.af_HTTPRequestOperation.responseSerializer = self.responseSerializer; 129 | 130 | __weak __typeof(self)weakSelf = self; 131 | [self.af_HTTPRequestOperation setDownloadProgressBlock:progress]; 132 | [self.af_HTTPRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id __unused responseObject) { 133 | NSData *data = success ? success(operation.response, operation.responseData) : operation.responseData; 134 | 135 | #pragma clang diagnostic push 136 | #pragma clang diagnostic ignored "-Wgnu" 137 | __strong __typeof(weakSelf) strongSelf = weakSelf; 138 | [strongSelf loadData:data MIMEType:(MIMEType ?: [operation.response MIMEType]) textEncodingName:(textEncodingName ?: [operation.response textEncodingName]) baseURL:[operation.response URL]]; 139 | #pragma clang diagnostic pop 140 | } failure:^(AFHTTPRequestOperation * __unused operation, NSError *error) { 141 | if (failure) { 142 | failure(error); 143 | } 144 | }]; 145 | 146 | [self.af_HTTPRequestOperation start]; 147 | } 148 | 149 | @end 150 | 151 | #endif 152 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m: -------------------------------------------------------------------------------- 1 | // AFNetworkActivityIndicatorManager.m 2 | // 3 | // Copyright (c) 2013-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 "AFNetworkActivityIndicatorManager.h" 24 | 25 | #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) 26 | 27 | #import "AFHTTPRequestOperation.h" 28 | 29 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 30 | #import "AFURLSessionManager.h" 31 | #endif 32 | 33 | static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.17; 34 | 35 | static NSURLRequest * AFNetworkRequestFromNotification(NSNotification *notification) { 36 | if ([[notification object] isKindOfClass:[AFURLConnectionOperation class]]) { 37 | return [(AFURLConnectionOperation *)[notification object] request]; 38 | } 39 | 40 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 41 | if ([[notification object] respondsToSelector:@selector(originalRequest)]) { 42 | return [(NSURLSessionTask *)[notification object] originalRequest]; 43 | } 44 | #endif 45 | 46 | return nil; 47 | } 48 | 49 | @interface AFNetworkActivityIndicatorManager () 50 | @property (readwrite, nonatomic, assign) NSInteger activityCount; 51 | @property (readwrite, nonatomic, strong) NSTimer *activityIndicatorVisibilityTimer; 52 | @property (readonly, nonatomic, getter = isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; 53 | 54 | - (void)updateNetworkActivityIndicatorVisibility; 55 | - (void)updateNetworkActivityIndicatorVisibilityDelayed; 56 | @end 57 | 58 | @implementation AFNetworkActivityIndicatorManager 59 | @dynamic networkActivityIndicatorVisible; 60 | 61 | + (instancetype)sharedManager { 62 | static AFNetworkActivityIndicatorManager *_sharedManager = nil; 63 | static dispatch_once_t oncePredicate; 64 | dispatch_once(&oncePredicate, ^{ 65 | _sharedManager = [[self alloc] init]; 66 | }); 67 | 68 | return _sharedManager; 69 | } 70 | 71 | + (NSSet *)keyPathsForValuesAffectingIsNetworkActivityIndicatorVisible { 72 | return [NSSet setWithObject:@"activityCount"]; 73 | } 74 | 75 | - (id)init { 76 | self = [super init]; 77 | if (!self) { 78 | return nil; 79 | } 80 | 81 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingOperationDidStartNotification object:nil]; 82 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingOperationDidFinishNotification object:nil]; 83 | 84 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 85 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingTaskDidResumeNotification object:nil]; 86 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidSuspendNotification object:nil]; 87 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidCompleteNotification object:nil]; 88 | #endif 89 | 90 | return self; 91 | } 92 | 93 | - (void)dealloc { 94 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 95 | 96 | [_activityIndicatorVisibilityTimer invalidate]; 97 | } 98 | 99 | - (void)updateNetworkActivityIndicatorVisibilityDelayed { 100 | if (self.enabled) { 101 | // Delay hiding of activity indicator for a short interval, to avoid flickering 102 | if (![self isNetworkActivityIndicatorVisible]) { 103 | [self.activityIndicatorVisibilityTimer invalidate]; 104 | self.activityIndicatorVisibilityTimer = [NSTimer timerWithTimeInterval:kAFNetworkActivityIndicatorInvisibilityDelay target:self selector:@selector(updateNetworkActivityIndicatorVisibility) userInfo:nil repeats:NO]; 105 | [[NSRunLoop mainRunLoop] addTimer:self.activityIndicatorVisibilityTimer forMode:NSRunLoopCommonModes]; 106 | } else { 107 | [self performSelectorOnMainThread:@selector(updateNetworkActivityIndicatorVisibility) withObject:nil waitUntilDone:NO modes:@[NSRunLoopCommonModes]]; 108 | } 109 | } 110 | } 111 | 112 | - (BOOL)isNetworkActivityIndicatorVisible { 113 | return self.activityCount > 0; 114 | } 115 | 116 | - (void)updateNetworkActivityIndicatorVisibility { 117 | [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:[self isNetworkActivityIndicatorVisible]]; 118 | } 119 | 120 | - (void)setActivityCount:(NSInteger)activityCount { 121 | @synchronized(self) { 122 | _activityCount = activityCount; 123 | } 124 | 125 | dispatch_async(dispatch_get_main_queue(), ^{ 126 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 127 | }); 128 | } 129 | 130 | - (void)incrementActivityCount { 131 | [self willChangeValueForKey:@"activityCount"]; 132 | @synchronized(self) { 133 | _activityCount++; 134 | } 135 | [self didChangeValueForKey:@"activityCount"]; 136 | 137 | dispatch_async(dispatch_get_main_queue(), ^{ 138 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 139 | }); 140 | } 141 | 142 | - (void)decrementActivityCount { 143 | [self willChangeValueForKey:@"activityCount"]; 144 | @synchronized(self) { 145 | #pragma clang diagnostic push 146 | #pragma clang diagnostic ignored "-Wgnu" 147 | _activityCount = MAX(_activityCount - 1, 0); 148 | #pragma clang diagnostic pop 149 | } 150 | [self didChangeValueForKey:@"activityCount"]; 151 | 152 | dispatch_async(dispatch_get_main_queue(), ^{ 153 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 154 | }); 155 | } 156 | 157 | - (void)networkRequestDidStart:(NSNotification *)notification { 158 | if ([AFNetworkRequestFromNotification(notification) URL]) { 159 | [self incrementActivityCount]; 160 | } 161 | } 162 | 163 | - (void)networkRequestDidFinish:(NSNotification *)notification { 164 | if ([AFNetworkRequestFromNotification(notification) URL]) { 165 | [self decrementActivityCount]; 166 | } 167 | } 168 | 169 | @end 170 | 171 | #endif 172 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIImageView+AFNetworking.h 2 | // 3 | // Copyright (c) 2013-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 defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @protocol AFURLResponseSerialization, AFImageCache; 32 | 33 | @class AFImageResponseSerializer; 34 | 35 | /** 36 | 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. 37 | */ 38 | @interface UIImageView (AFNetworking) 39 | 40 | ///---------------------------- 41 | /// @name Accessing Image Cache 42 | ///---------------------------- 43 | 44 | /** 45 | The image cache used to improve image loadiing performance on scroll views. By default, this is an `NSCache` subclass conforming to the `AFImageCache` protocol, which listens for notification warnings and evicts objects accordingly. 46 | */ 47 | + (id )sharedImageCache; 48 | 49 | /** 50 | Set the cache used for image loading. 51 | 52 | @param imageCache The image cache. 53 | */ 54 | + (void)setSharedImageCache:(id )imageCache; 55 | 56 | ///------------------------------------ 57 | /// @name Accessing Response Serializer 58 | ///------------------------------------ 59 | 60 | /** 61 | The response serializer used to create an image representation from the server response and response data. By default, this is an instance of `AFImageResponseSerializer`. 62 | 63 | @discussion Subclasses of `AFImageResponseSerializer` could be used to perform post-processing, such as color correction, face detection, or other effects. See https://github.com/AFNetworking/AFCoreImageSerializer 64 | */ 65 | @property (nonatomic, strong) AFImageResponseSerializer * imageResponseSerializer; 66 | 67 | ///-------------------- 68 | /// @name Setting Image 69 | ///-------------------- 70 | 71 | /** 72 | 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. 73 | 74 | 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. 75 | 76 | 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:` 77 | 78 | @param url The URL used for the image request. 79 | */ 80 | - (void)setImageWithURL:(NSURL *)url; 81 | 82 | /** 83 | 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. 84 | 85 | 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. 86 | 87 | 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:` 88 | 89 | @param url The URL used for the image request. 90 | @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. 91 | */ 92 | - (void)setImageWithURL:(NSURL *)url 93 | placeholderImage:(UIImage *)placeholderImage; 94 | 95 | /** 96 | 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. 97 | 98 | 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. 99 | 100 | 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. 101 | 102 | @param urlRequest The URL request used for the image request. 103 | @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. 104 | @param success A block to be executed when the image request operation 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 request and response parameters will be `nil`. 105 | @param failure A block object to be executed when the image request operation 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. 106 | */ 107 | - (void)setImageWithURLRequest:(NSURLRequest *)urlRequest 108 | placeholderImage:(UIImage *)placeholderImage 109 | success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success 110 | failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure; 111 | 112 | /** 113 | Cancels any executing image operation for the receiver, if one exists. 114 | */ 115 | - (void)cancelImageRequestOperation; 116 | 117 | @end 118 | 119 | #pragma mark - 120 | 121 | /** 122 | The `AFImageCache` protocol is adopted by an object used to cache images loaded by the AFNetworking category on `UIImageView`. 123 | */ 124 | @protocol AFImageCache 125 | 126 | /** 127 | Returns a cached image for the specififed request, if available. 128 | 129 | @param request The image request. 130 | 131 | @return The cached image. 132 | */ 133 | - (UIImage *)cachedImageForRequest:(NSURLRequest *)request; 134 | 135 | /** 136 | Caches a particular image for the specified request. 137 | 138 | @param image The image to cache. 139 | @param request The request to be used as a cache key. 140 | */ 141 | - (void)cacheImage:(UIImage *)image 142 | forRequest:(NSURLRequest *)request; 143 | @end 144 | 145 | #endif 146 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIButton+AFNetworking.m 2 | // 3 | // Copyright (c) 2013-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 "UIButton+AFNetworking.h" 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import "AFHTTPRequestOperation.h" 30 | 31 | @interface UIButton (_AFNetworking) 32 | @property (readwrite, nonatomic, strong, setter = af_setImageRequestOperation:) AFHTTPRequestOperation *af_imageRequestOperation; 33 | @property (readwrite, nonatomic, strong, setter = af_setBackgroundImageRequestOperation:) AFHTTPRequestOperation *af_backgroundImageRequestOperation; 34 | @end 35 | 36 | @implementation UIButton (_AFNetworking) 37 | 38 | + (NSOperationQueue *)af_sharedImageRequestOperationQueue { 39 | static NSOperationQueue *_af_sharedImageRequestOperationQueue = nil; 40 | static dispatch_once_t onceToken; 41 | dispatch_once(&onceToken, ^{ 42 | _af_sharedImageRequestOperationQueue = [[NSOperationQueue alloc] init]; 43 | _af_sharedImageRequestOperationQueue.maxConcurrentOperationCount = NSOperationQueueDefaultMaxConcurrentOperationCount; 44 | }); 45 | 46 | return _af_sharedImageRequestOperationQueue; 47 | } 48 | 49 | - (AFHTTPRequestOperation *)af_imageRequestOperation { 50 | return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, @selector(af_imageRequestOperation)); 51 | } 52 | 53 | - (void)af_setImageRequestOperation:(AFHTTPRequestOperation *)imageRequestOperation { 54 | objc_setAssociatedObject(self, @selector(af_imageRequestOperation), imageRequestOperation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 55 | } 56 | 57 | - (AFHTTPRequestOperation *)af_backgroundImageRequestOperation { 58 | return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, @selector(af_backgroundImageRequestOperation)); 59 | } 60 | 61 | - (void)af_setBackgroundImageRequestOperation:(AFHTTPRequestOperation *)imageRequestOperation { 62 | objc_setAssociatedObject(self, @selector(af_backgroundImageRequestOperation), imageRequestOperation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 63 | } 64 | 65 | @end 66 | 67 | #pragma mark - 68 | 69 | @implementation UIButton (AFNetworking) 70 | 71 | - (void)setImageForState:(UIControlState)state 72 | withURL:(NSURL *)url 73 | { 74 | [self setImageForState:state withURL:url placeholderImage:nil]; 75 | } 76 | 77 | - (void)setImageForState:(UIControlState)state 78 | withURL:(NSURL *)url 79 | placeholderImage:(UIImage *)placeholderImage 80 | { 81 | NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; 82 | [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; 83 | 84 | [self setImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; 85 | } 86 | 87 | - (void)setImageForState:(UIControlState)state 88 | withURLRequest:(NSURLRequest *)urlRequest 89 | placeholderImage:(UIImage *)placeholderImage 90 | success:(void (^)(NSHTTPURLResponse *response, UIImage *image))success 91 | failure:(void (^)(NSError *error))failure 92 | { 93 | [self cancelImageRequestOperation]; 94 | 95 | [self setImage:placeholderImage forState:state]; 96 | 97 | __weak __typeof(self)weakSelf = self; 98 | self.af_imageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; 99 | self.af_imageRequestOperation.responseSerializer = [AFImageResponseSerializer serializer]; 100 | [self.af_imageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { 101 | __strong __typeof(weakSelf)strongSelf = weakSelf; 102 | if ([[urlRequest URL] isEqual:[operation.request URL]]) { 103 | if (success) { 104 | success(operation.response, responseObject); 105 | } else if (responseObject) { 106 | [strongSelf setImage:responseObject forState:state]; 107 | } 108 | } 109 | } failure:^(AFHTTPRequestOperation *operation, NSError *error) { 110 | if ([[urlRequest URL] isEqual:[operation.response URL]]) { 111 | if (failure) { 112 | failure(error); 113 | } 114 | } 115 | }]; 116 | 117 | [[[self class] af_sharedImageRequestOperationQueue] addOperation:self.af_imageRequestOperation]; 118 | } 119 | 120 | #pragma mark - 121 | 122 | - (void)setBackgroundImageForState:(UIControlState)state 123 | withURL:(NSURL *)url 124 | { 125 | [self setBackgroundImageForState:state withURL:url placeholderImage:nil]; 126 | } 127 | 128 | - (void)setBackgroundImageForState:(UIControlState)state 129 | withURL:(NSURL *)url 130 | placeholderImage:(UIImage *)placeholderImage 131 | { 132 | NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; 133 | [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; 134 | 135 | [self setBackgroundImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; 136 | } 137 | 138 | - (void)setBackgroundImageForState:(UIControlState)state 139 | withURLRequest:(NSURLRequest *)urlRequest 140 | placeholderImage:(UIImage *)placeholderImage 141 | success:(void (^)(NSHTTPURLResponse *response, UIImage *image))success 142 | failure:(void (^)(NSError *error))failure 143 | { 144 | [self cancelBackgroundImageRequestOperation]; 145 | 146 | [self setBackgroundImage:placeholderImage forState:state]; 147 | 148 | __weak __typeof(self)weakSelf = self; 149 | self.af_backgroundImageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; 150 | self.af_backgroundImageRequestOperation.responseSerializer = [AFImageResponseSerializer serializer]; 151 | [self.af_backgroundImageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { 152 | __strong __typeof(weakSelf)strongSelf = weakSelf; 153 | if ([[urlRequest URL] isEqual:[operation.request URL]]) { 154 | if (success) { 155 | success(operation.response, responseObject); 156 | } else if (responseObject) { 157 | [strongSelf setBackgroundImage:responseObject forState:state]; 158 | } 159 | } 160 | } failure:^(AFHTTPRequestOperation *operation, NSError *error) { 161 | if ([[urlRequest URL] isEqual:[operation.response URL]]) { 162 | if (failure) { 163 | failure(error); 164 | } 165 | } 166 | }]; 167 | 168 | [[[self class] af_sharedImageRequestOperationQueue] addOperation:self.af_backgroundImageRequestOperation]; 169 | } 170 | 171 | #pragma mark - 172 | 173 | - (void)cancelImageRequestOperation { 174 | [self.af_imageRequestOperation cancel]; 175 | self.af_imageRequestOperation = nil; 176 | } 177 | 178 | - (void)cancelBackgroundImageRequestOperation { 179 | [self.af_backgroundImageRequestOperation cancel]; 180 | self.af_backgroundImageRequestOperation = nil; 181 | } 182 | 183 | @end 184 | 185 | #endif 186 | -------------------------------------------------------------------------------- /Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h: -------------------------------------------------------------------------------- 1 | // AFNetworkReachabilityManager.h 2 | // 3 | // Copyright (c) 2013-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 | #import 25 | 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | 32 | typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) { 33 | AFNetworkReachabilityStatusUnknown = -1, 34 | AFNetworkReachabilityStatusNotReachable = 0, 35 | AFNetworkReachabilityStatusReachableViaWWAN = 1, 36 | AFNetworkReachabilityStatusReachableViaWiFi = 2, 37 | }; 38 | 39 | /** 40 | `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces. 41 | 42 | See Apple's Reachability Sample Code (https://developer.apple.com/library/ios/samplecode/reachability/) 43 | 44 | @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined. 45 | */ 46 | @interface AFNetworkReachabilityManager : NSObject 47 | 48 | /** 49 | The current network reachability status. 50 | */ 51 | @property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; 52 | 53 | /** 54 | Whether or not the network is currently reachable. 55 | */ 56 | @property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable; 57 | 58 | /** 59 | Whether or not the network is currently reachable via WWAN. 60 | */ 61 | @property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN; 62 | 63 | /** 64 | Whether or not the network is currently reachable via WiFi. 65 | */ 66 | @property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi; 67 | 68 | ///--------------------- 69 | /// @name Initialization 70 | ///--------------------- 71 | 72 | /** 73 | Returns the shared network reachability manager. 74 | */ 75 | + (instancetype)sharedManager; 76 | 77 | /** 78 | Creates and returns a network reachability manager for the specified domain. 79 | 80 | @param domain The domain used to evaluate network reachability. 81 | 82 | @return An initialized network reachability manager, actively monitoring the specified domain. 83 | */ 84 | + (instancetype)managerForDomain:(NSString *)domain; 85 | 86 | /** 87 | Creates and returns a network reachability manager for the socket address. 88 | 89 | @param address The socket address used to evaluate network reachability. 90 | 91 | @return An initialized network reachability manager, actively monitoring the specified socket address. 92 | */ 93 | + (instancetype)managerForAddress:(const struct sockaddr_in *)address; 94 | 95 | /** 96 | Initializes an instance of a network reachability manager from the specified reachability object. 97 | 98 | @param reachability The reachability object to monitor. 99 | 100 | @return An initialized network reachability manager, actively monitoring the specified reachability. 101 | */ 102 | - (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability; 103 | 104 | ///-------------------------------------------------- 105 | /// @name Starting & Stopping Reachability Monitoring 106 | ///-------------------------------------------------- 107 | 108 | /** 109 | Starts monitoring for changes in network reachability status. 110 | */ 111 | - (void)startMonitoring; 112 | 113 | /** 114 | Stops monitoring for changes in network reachability status. 115 | */ 116 | - (void)stopMonitoring; 117 | 118 | ///------------------------------------------------- 119 | /// @name Getting Localized Reachability Description 120 | ///------------------------------------------------- 121 | 122 | /** 123 | Returns a localized string representation of the current network reachability status. 124 | */ 125 | - (NSString *)localizedNetworkReachabilityStatusString; 126 | 127 | ///--------------------------------------------------- 128 | /// @name Setting Network Reachability Change Callback 129 | ///--------------------------------------------------- 130 | 131 | /** 132 | Sets a callback to be executed when the network availability of the `baseURL` host changes. 133 | 134 | @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`. 135 | */ 136 | - (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block; 137 | 138 | @end 139 | 140 | ///---------------- 141 | /// @name Constants 142 | ///---------------- 143 | 144 | /** 145 | ## Network Reachability 146 | 147 | The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses. 148 | 149 | enum { 150 | AFNetworkReachabilityStatusUnknown, 151 | AFNetworkReachabilityStatusNotReachable, 152 | AFNetworkReachabilityStatusReachableViaWWAN, 153 | AFNetworkReachabilityStatusReachableViaWiFi, 154 | } 155 | 156 | `AFNetworkReachabilityStatusUnknown` 157 | The `baseURL` host reachability is not known. 158 | 159 | `AFNetworkReachabilityStatusNotReachable` 160 | The `baseURL` host cannot be reached. 161 | 162 | `AFNetworkReachabilityStatusReachableViaWWAN` 163 | The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS. 164 | 165 | `AFNetworkReachabilityStatusReachableViaWiFi` 166 | The `baseURL` host can be reached via a Wi-Fi connection. 167 | 168 | ### Keys for Notification UserInfo Dictionary 169 | 170 | Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification. 171 | 172 | `AFNetworkingReachabilityNotificationStatusItem` 173 | A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification. 174 | The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status. 175 | */ 176 | 177 | ///-------------------- 178 | /// @name Notifications 179 | ///-------------------- 180 | 181 | /** 182 | Posted when network reachability changes. 183 | This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability. 184 | 185 | @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import ` to the header prefix of the project (`Prefix.pch`). 186 | */ 187 | extern NSString * const AFNetworkingReachabilityDidChangeNotification; 188 | extern NSString * const AFNetworkingReachabilityNotificationStatusItem; 189 | 190 | ///-------------------- 191 | /// @name Functions 192 | ///-------------------- 193 | 194 | /** 195 | Returns a localized string representation of an `AFNetworkReachabilityStatus` value. 196 | */ 197 | extern NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status); 198 | -------------------------------------------------------------------------------- /Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m: -------------------------------------------------------------------------------- 1 | // AFHTTPRequestOperation.m 2 | // 3 | // Copyright (c) 2013-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 "AFHTTPRequestOperation.h" 24 | 25 | static dispatch_queue_t http_request_operation_processing_queue() { 26 | static dispatch_queue_t af_http_request_operation_processing_queue; 27 | static dispatch_once_t onceToken; 28 | dispatch_once(&onceToken, ^{ 29 | af_http_request_operation_processing_queue = dispatch_queue_create("com.alamofire.networking.http-request.processing", DISPATCH_QUEUE_CONCURRENT); 30 | }); 31 | 32 | return af_http_request_operation_processing_queue; 33 | } 34 | 35 | static dispatch_group_t http_request_operation_completion_group() { 36 | static dispatch_group_t af_http_request_operation_completion_group; 37 | static dispatch_once_t onceToken; 38 | dispatch_once(&onceToken, ^{ 39 | af_http_request_operation_completion_group = dispatch_group_create(); 40 | }); 41 | 42 | return af_http_request_operation_completion_group; 43 | } 44 | 45 | #pragma mark - 46 | 47 | @interface AFURLConnectionOperation () 48 | @property (readwrite, nonatomic, strong) NSURLRequest *request; 49 | @property (readwrite, nonatomic, strong) NSURLResponse *response; 50 | @end 51 | 52 | @interface AFHTTPRequestOperation () 53 | @property (readwrite, nonatomic, strong) NSHTTPURLResponse *response; 54 | @property (readwrite, nonatomic, strong) id responseObject; 55 | @property (readwrite, nonatomic, strong) NSError *responseSerializationError; 56 | @property (readwrite, nonatomic, strong) NSRecursiveLock *lock; 57 | @end 58 | 59 | @implementation AFHTTPRequestOperation 60 | @dynamic lock; 61 | 62 | - (instancetype)initWithRequest:(NSURLRequest *)urlRequest { 63 | self = [super initWithRequest:urlRequest]; 64 | if (!self) { 65 | return nil; 66 | } 67 | 68 | self.responseSerializer = [AFHTTPResponseSerializer serializer]; 69 | 70 | return self; 71 | } 72 | 73 | - (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { 74 | NSParameterAssert(responseSerializer); 75 | 76 | [self.lock lock]; 77 | _responseSerializer = responseSerializer; 78 | self.responseObject = nil; 79 | self.responseSerializationError = nil; 80 | [self.lock unlock]; 81 | } 82 | 83 | - (id)responseObject { 84 | [self.lock lock]; 85 | if (!_responseObject && [self isFinished] && !self.error) { 86 | NSError *error = nil; 87 | self.responseObject = [self.responseSerializer responseObjectForResponse:self.response data:self.responseData error:&error]; 88 | if (error) { 89 | self.responseSerializationError = error; 90 | } 91 | } 92 | [self.lock unlock]; 93 | 94 | return _responseObject; 95 | } 96 | 97 | - (NSError *)error { 98 | if (_responseSerializationError) { 99 | return _responseSerializationError; 100 | } else { 101 | return [super error]; 102 | } 103 | } 104 | 105 | #pragma mark - AFHTTPRequestOperation 106 | 107 | - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success 108 | failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure 109 | { 110 | // completionBlock is manually nilled out in AFURLConnectionOperation to break the retain cycle. 111 | #pragma clang diagnostic push 112 | #pragma clang diagnostic ignored "-Warc-retain-cycles" 113 | #pragma clang diagnostic ignored "-Wgnu" 114 | self.completionBlock = ^{ 115 | if (self.completionGroup) { 116 | dispatch_group_enter(self.completionGroup); 117 | } 118 | 119 | dispatch_async(http_request_operation_processing_queue(), ^{ 120 | if (self.error) { 121 | if (failure) { 122 | dispatch_group_async(self.completionGroup ?: http_request_operation_completion_group(), self.completionQueue ?: dispatch_get_main_queue(), ^{ 123 | failure(self, self.error); 124 | }); 125 | } 126 | } else { 127 | id responseObject = self.responseObject; 128 | if (self.error) { 129 | if (failure) { 130 | dispatch_group_async(self.completionGroup ?: http_request_operation_completion_group(), self.completionQueue ?: dispatch_get_main_queue(), ^{ 131 | failure(self, self.error); 132 | }); 133 | } 134 | } else { 135 | if (success) { 136 | dispatch_group_async(self.completionGroup ?: http_request_operation_completion_group(), self.completionQueue ?: dispatch_get_main_queue(), ^{ 137 | success(self, responseObject); 138 | }); 139 | } 140 | } 141 | } 142 | 143 | if (self.completionGroup) { 144 | dispatch_group_leave(self.completionGroup); 145 | } 146 | }); 147 | }; 148 | #pragma clang diagnostic pop 149 | } 150 | 151 | #pragma mark - AFURLRequestOperation 152 | 153 | - (void)pause { 154 | u_int64_t offset = 0; 155 | if ([self.outputStream propertyForKey:NSStreamFileCurrentOffsetKey]) { 156 | offset = [(NSNumber *)[self.outputStream propertyForKey:NSStreamFileCurrentOffsetKey] unsignedLongLongValue]; 157 | } else { 158 | offset = [(NSData *)[self.outputStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey] length]; 159 | } 160 | 161 | NSMutableURLRequest *mutableURLRequest = [self.request mutableCopy]; 162 | if ([self.response respondsToSelector:@selector(allHeaderFields)] && [[self.response allHeaderFields] valueForKey:@"ETag"]) { 163 | [mutableURLRequest setValue:[[self.response allHeaderFields] valueForKey:@"ETag"] forHTTPHeaderField:@"If-Range"]; 164 | } 165 | [mutableURLRequest setValue:[NSString stringWithFormat:@"bytes=%llu-", offset] forHTTPHeaderField:@"Range"]; 166 | self.request = mutableURLRequest; 167 | 168 | [super pause]; 169 | } 170 | 171 | #pragma mark - NSecureCoding 172 | 173 | + (BOOL)supportsSecureCoding { 174 | return YES; 175 | } 176 | 177 | - (id)initWithCoder:(NSCoder *)decoder { 178 | self = [super initWithCoder:decoder]; 179 | if (!self) { 180 | return nil; 181 | } 182 | 183 | self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))]; 184 | 185 | return self; 186 | } 187 | 188 | - (void)encodeWithCoder:(NSCoder *)coder { 189 | [super encodeWithCoder:coder]; 190 | 191 | [coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))]; 192 | } 193 | 194 | #pragma mark - NSCopying 195 | 196 | - (id)copyWithZone:(NSZone *)zone { 197 | AFHTTPRequestOperation *operation = [[[self class] allocWithZone:zone] initWithRequest:self.request]; 198 | 199 | operation.responseSerializer = [self.responseSerializer copyWithZone:zone]; 200 | operation.completionQueue = self.completionQueue; 201 | operation.completionGroup = self.completionGroup; 202 | 203 | return operation; 204 | } 205 | 206 | @end 207 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIButton+AFNetworking.h 2 | // 3 | // Copyright (c) 2013-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 defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | /** 32 | This category adds methods to the UIKit framework's `UIButton` class. The methods in this category provide support for loading remote images and background images asynchronously from a URL. 33 | */ 34 | @interface UIButton (AFNetworking) 35 | 36 | ///-------------------- 37 | /// @name Setting Image 38 | ///-------------------- 39 | 40 | /** 41 | Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. 42 | 43 | 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. 44 | 45 | @param state The control state. 46 | @param url The URL used for the image request. 47 | */ 48 | - (void)setImageForState:(UIControlState)state 49 | withURL:(NSURL *)url; 50 | 51 | /** 52 | Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. 53 | 54 | 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. 55 | 56 | @param state The control state. 57 | @param url The URL used for the image request. 58 | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes. 59 | */ 60 | - (void)setImageForState:(UIControlState)state 61 | withURL:(NSURL *)url 62 | placeholderImage:(UIImage *)placeholderImage; 63 | 64 | /** 65 | Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. 66 | 67 | 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. 68 | 69 | If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setImage:forState:` is applied. 70 | 71 | @param state The control state. 72 | @param urlRequest The URL request used for the image request. 73 | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes. 74 | @param success A block to be executed when the image request operation finishes successfully. This block has no return value and takes two arguments: the server response and the image. If the image was returned from cache, the request and response parameters will be `nil`. 75 | @param failure A block object to be executed when the image request operation finishes unsuccessfully, or that finishes successfully. This block has no return value and takes a single argument: the error that occurred. 76 | */ 77 | - (void)setImageForState:(UIControlState)state 78 | withURLRequest:(NSURLRequest *)urlRequest 79 | placeholderImage:(UIImage *)placeholderImage 80 | success:(void (^)(NSHTTPURLResponse *response, UIImage *image))success 81 | failure:(void (^)(NSError *error))failure; 82 | 83 | 84 | ///------------------------------- 85 | /// @name Setting Background Image 86 | ///------------------------------- 87 | 88 | /** 89 | Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous background image request for the receiver will be cancelled. 90 | 91 | If the background image is cached locally, the background image is set immediately, otherwise the specified placeholder background image will be set immediately, and then the remote background image will be set once the request is finished. 92 | 93 | @param state The control state. 94 | @param url The URL used for the background image request. 95 | */ 96 | - (void)setBackgroundImageForState:(UIControlState)state 97 | withURL:(NSURL *)url; 98 | 99 | /** 100 | Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. 101 | 102 | 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. 103 | 104 | @param state The control state. 105 | @param url The URL used for the background image request. 106 | @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes. 107 | */ 108 | - (void)setBackgroundImageForState:(UIControlState)state 109 | withURL:(NSURL *)url 110 | placeholderImage:(UIImage *)placeholderImage; 111 | 112 | /** 113 | Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. 114 | 115 | 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. 116 | 117 | If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setBackgroundImage:forState:` is applied. 118 | 119 | @param state The control state. 120 | @param urlRequest The URL request used for the image request. 121 | @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes. 122 | */ 123 | - (void)setBackgroundImageForState:(UIControlState)state 124 | withURLRequest:(NSURLRequest *)urlRequest 125 | placeholderImage:(UIImage *)placeholderImage 126 | success:(void (^)(NSHTTPURLResponse *response, UIImage *image))success 127 | failure:(void (^)(NSError *error))failure; 128 | 129 | 130 | ///------------------------------ 131 | /// @name Canceling Image Loading 132 | ///------------------------------ 133 | 134 | /** 135 | Cancels any executing image operation for the receiver, if one exists. 136 | */ 137 | - (void)cancelImageRequestOperation; 138 | 139 | /** 140 | Cancels any executing background image operation for the receiver, if one exists. 141 | */ 142 | - (void)cancelBackgroundImageRequestOperation; 143 | 144 | @end 145 | 146 | #endif 147 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIProgressView+AFNetworking.m 2 | // 3 | // Copyright (c) 2013-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 "UIProgressView+AFNetworking.h" 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import "AFURLConnectionOperation.h" 30 | 31 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 32 | #import "AFURLSessionManager.h" 33 | #endif 34 | 35 | static void * AFTaskCountOfBytesSentContext = &AFTaskCountOfBytesSentContext; 36 | static void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedContext; 37 | 38 | @interface AFURLConnectionOperation (_UIProgressView) 39 | @property (readwrite, nonatomic, copy) void (^uploadProgress)(NSUInteger bytes, long long totalBytes, long long totalBytesExpected); 40 | @property (readwrite, nonatomic, assign, setter = af_setUploadProgressAnimated:) BOOL af_uploadProgressAnimated; 41 | 42 | @property (readwrite, nonatomic, copy) void (^downloadProgress)(NSUInteger bytes, long long totalBytes, long long totalBytesExpected); 43 | @property (readwrite, nonatomic, assign, setter = af_setDownloadProgressAnimated:) BOOL af_downloadProgressAnimated; 44 | @end 45 | 46 | @implementation AFURLConnectionOperation (_UIProgressView) 47 | @dynamic uploadProgress; // Implemented in AFURLConnectionOperation 48 | @dynamic af_uploadProgressAnimated; 49 | 50 | @dynamic downloadProgress; // Implemented in AFURLConnectionOperation 51 | @dynamic af_downloadProgressAnimated; 52 | @end 53 | 54 | #pragma mark - 55 | 56 | @implementation UIProgressView (AFNetworking) 57 | 58 | - (BOOL)af_uploadProgressAnimated { 59 | return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_uploadProgressAnimated)) boolValue]; 60 | } 61 | 62 | - (void)af_setUploadProgressAnimated:(BOOL)animated { 63 | objc_setAssociatedObject(self, @selector(af_uploadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 64 | } 65 | 66 | - (BOOL)af_downloadProgressAnimated { 67 | return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_downloadProgressAnimated)) boolValue]; 68 | } 69 | 70 | - (void)af_setDownloadProgressAnimated:(BOOL)animated { 71 | objc_setAssociatedObject(self, @selector(af_downloadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 72 | } 73 | 74 | #pragma mark - 75 | 76 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 77 | - (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task 78 | animated:(BOOL)animated 79 | { 80 | [task addObserver:self forKeyPath:@"state" options:0 context:AFTaskCountOfBytesSentContext]; 81 | [task addObserver:self forKeyPath:@"countOfBytesSent" options:0 context:AFTaskCountOfBytesSentContext]; 82 | 83 | [self af_setUploadProgressAnimated:animated]; 84 | } 85 | 86 | - (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task 87 | animated:(BOOL)animated 88 | { 89 | [task addObserver:self forKeyPath:@"state" options:0 context:AFTaskCountOfBytesReceivedContext]; 90 | [task addObserver:self forKeyPath:@"countOfBytesReceived" options:0 context:AFTaskCountOfBytesReceivedContext]; 91 | 92 | [self af_setDownloadProgressAnimated:animated]; 93 | } 94 | #endif 95 | 96 | #pragma mark - 97 | 98 | - (void)setProgressWithUploadProgressOfOperation:(AFURLConnectionOperation *)operation 99 | animated:(BOOL)animated 100 | { 101 | __weak __typeof(self)weakSelf = self; 102 | void (^original)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) = [operation.uploadProgress copy]; 103 | [operation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) { 104 | if (original) { 105 | original(bytesWritten, totalBytesWritten, totalBytesExpectedToWrite); 106 | } 107 | 108 | dispatch_async(dispatch_get_main_queue(), ^{ 109 | if (totalBytesExpectedToWrite > 0) { 110 | __strong __typeof(weakSelf)strongSelf = weakSelf; 111 | [strongSelf setProgress:(totalBytesWritten / (totalBytesExpectedToWrite * 1.0f)) animated:animated]; 112 | } 113 | }); 114 | }]; 115 | } 116 | 117 | - (void)setProgressWithDownloadProgressOfOperation:(AFURLConnectionOperation *)operation 118 | animated:(BOOL)animated 119 | { 120 | __weak __typeof(self)weakSelf = self; 121 | void (^original)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) = [operation.downloadProgress copy]; 122 | [operation setDownloadProgressBlock:^(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) { 123 | if (original) { 124 | original(bytesRead, totalBytesRead, totalBytesExpectedToRead); 125 | } 126 | 127 | dispatch_async(dispatch_get_main_queue(), ^{ 128 | if (totalBytesExpectedToRead > 0) { 129 | __strong __typeof(weakSelf)strongSelf = weakSelf; 130 | [strongSelf setProgress:(totalBytesRead / (totalBytesExpectedToRead * 1.0f)) animated:animated]; 131 | } 132 | }); 133 | }]; 134 | } 135 | 136 | #pragma mark - NSKeyValueObserving 137 | 138 | - (void)observeValueForKeyPath:(NSString *)keyPath 139 | ofObject:(id)object 140 | change:(__unused NSDictionary *)change 141 | context:(void *)context 142 | { 143 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 144 | if (context == AFTaskCountOfBytesSentContext || context == AFTaskCountOfBytesReceivedContext) { 145 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) { 146 | if ([object countOfBytesExpectedToSend] > 0) { 147 | dispatch_async(dispatch_get_main_queue(), ^{ 148 | [self setProgress:[object countOfBytesSent] / ([object countOfBytesExpectedToSend] * 1.0f) animated:self.af_uploadProgressAnimated]; 149 | }); 150 | } 151 | } 152 | 153 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) { 154 | if ([object countOfBytesExpectedToReceive] > 0) { 155 | dispatch_async(dispatch_get_main_queue(), ^{ 156 | [self setProgress:[object countOfBytesReceived] / ([object countOfBytesExpectedToReceive] * 1.0f) animated:self.af_downloadProgressAnimated]; 157 | }); 158 | } 159 | } 160 | 161 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(state))]) { 162 | if ([(NSURLSessionTask *)object state] == NSURLSessionTaskStateCompleted) { 163 | @try { 164 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(state))]; 165 | 166 | if (context == AFTaskCountOfBytesSentContext) { 167 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))]; 168 | } 169 | 170 | if (context == AFTaskCountOfBytesReceivedContext) { 171 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))]; 172 | } 173 | } 174 | @catch (NSException * __unused exception) {} 175 | } 176 | } 177 | } 178 | #endif 179 | } 180 | 181 | @end 182 | 183 | #endif 184 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIImageView+AFNetworking.m 2 | // 3 | // Copyright (c) 2013-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 "UIImageView+AFNetworking.h" 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import "AFHTTPRequestOperation.h" 30 | 31 | @interface AFImageCache : NSCache 32 | @end 33 | 34 | #pragma mark - 35 | 36 | @interface UIImageView (_AFNetworking) 37 | @property (readwrite, nonatomic, strong, setter = af_setImageRequestOperation:) AFHTTPRequestOperation *af_imageRequestOperation; 38 | @end 39 | 40 | @implementation UIImageView (_AFNetworking) 41 | 42 | + (NSOperationQueue *)af_sharedImageRequestOperationQueue { 43 | static NSOperationQueue *_af_sharedImageRequestOperationQueue = nil; 44 | static dispatch_once_t onceToken; 45 | dispatch_once(&onceToken, ^{ 46 | _af_sharedImageRequestOperationQueue = [[NSOperationQueue alloc] init]; 47 | _af_sharedImageRequestOperationQueue.maxConcurrentOperationCount = NSOperationQueueDefaultMaxConcurrentOperationCount; 48 | }); 49 | 50 | return _af_sharedImageRequestOperationQueue; 51 | } 52 | 53 | - (AFHTTPRequestOperation *)af_imageRequestOperation { 54 | return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, @selector(af_imageRequestOperation)); 55 | } 56 | 57 | - (void)af_setImageRequestOperation:(AFHTTPRequestOperation *)imageRequestOperation { 58 | objc_setAssociatedObject(self, @selector(af_imageRequestOperation), imageRequestOperation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 59 | } 60 | 61 | @end 62 | 63 | #pragma mark - 64 | 65 | @implementation UIImageView (AFNetworking) 66 | @dynamic imageResponseSerializer; 67 | 68 | + (id )sharedImageCache { 69 | static AFImageCache *_af_defaultImageCache = nil; 70 | static dispatch_once_t oncePredicate; 71 | dispatch_once(&oncePredicate, ^{ 72 | _af_defaultImageCache = [[AFImageCache alloc] init]; 73 | 74 | [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidReceiveMemoryWarningNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * __unused notification) { 75 | [_af_defaultImageCache removeAllObjects]; 76 | }]; 77 | }); 78 | 79 | #pragma clang diagnostic push 80 | #pragma clang diagnostic ignored "-Wgnu" 81 | return objc_getAssociatedObject(self, @selector(sharedImageCache)) ?: _af_defaultImageCache; 82 | #pragma clang diagnostic pop 83 | } 84 | 85 | + (void)setSharedImageCache:(id)imageCache { 86 | objc_setAssociatedObject(self, @selector(sharedImageCache), imageCache, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 87 | } 88 | 89 | - (id )imageResponseSerializer { 90 | static id _af_defaultImageResponseSerializer = nil; 91 | static dispatch_once_t onceToken; 92 | dispatch_once(&onceToken, ^{ 93 | _af_defaultImageResponseSerializer = [AFImageResponseSerializer serializer]; 94 | }); 95 | 96 | #pragma clang diagnostic push 97 | #pragma clang diagnostic ignored "-Wgnu" 98 | return objc_getAssociatedObject(self, @selector(imageResponseSerializer)) ?: _af_defaultImageResponseSerializer; 99 | #pragma clang diagnostic pop 100 | } 101 | 102 | - (void)setImageResponseSerializer:(id )serializer { 103 | objc_setAssociatedObject(self, @selector(imageResponseSerializer), serializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 104 | } 105 | 106 | #pragma mark - 107 | 108 | - (void)setImageWithURL:(NSURL *)url { 109 | [self setImageWithURL:url placeholderImage:nil]; 110 | } 111 | 112 | - (void)setImageWithURL:(NSURL *)url 113 | placeholderImage:(UIImage *)placeholderImage 114 | { 115 | NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; 116 | [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; 117 | 118 | [self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; 119 | } 120 | 121 | - (void)setImageWithURLRequest:(NSURLRequest *)urlRequest 122 | placeholderImage:(UIImage *)placeholderImage 123 | success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success 124 | failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure 125 | { 126 | [self cancelImageRequestOperation]; 127 | 128 | UIImage *cachedImage = [[[self class] sharedImageCache] cachedImageForRequest:urlRequest]; 129 | if (cachedImage) { 130 | if (success) { 131 | success(nil, nil, cachedImage); 132 | } else { 133 | self.image = cachedImage; 134 | } 135 | 136 | self.af_imageRequestOperation = nil; 137 | } else { 138 | if (placeholderImage) { 139 | self.image = placeholderImage; 140 | } 141 | 142 | __weak __typeof(self)weakSelf = self; 143 | self.af_imageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; 144 | self.af_imageRequestOperation.responseSerializer = self.imageResponseSerializer; 145 | [self.af_imageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { 146 | __strong __typeof(weakSelf)strongSelf = weakSelf; 147 | if ([[urlRequest URL] isEqual:[strongSelf.af_imageRequestOperation.request URL]]) { 148 | if (success) { 149 | success(urlRequest, operation.response, responseObject); 150 | } else if (responseObject) { 151 | strongSelf.image = responseObject; 152 | } 153 | 154 | if (operation == strongSelf.af_imageRequestOperation){ 155 | strongSelf.af_imageRequestOperation = nil; 156 | } 157 | } 158 | 159 | [[[strongSelf class] sharedImageCache] cacheImage:responseObject forRequest:urlRequest]; 160 | } failure:^(AFHTTPRequestOperation *operation, NSError *error) { 161 | __strong __typeof(weakSelf)strongSelf = weakSelf; 162 | if ([[urlRequest URL] isEqual:[operation.request URL]]) { 163 | if (failure) { 164 | failure(urlRequest, operation.response, error); 165 | } 166 | 167 | if (operation == strongSelf.af_imageRequestOperation){ 168 | strongSelf.af_imageRequestOperation = nil; 169 | } 170 | } 171 | }]; 172 | 173 | [[[self class] af_sharedImageRequestOperationQueue] addOperation:self.af_imageRequestOperation]; 174 | } 175 | } 176 | 177 | - (void)cancelImageRequestOperation { 178 | [self.af_imageRequestOperation cancel]; 179 | self.af_imageRequestOperation = nil; 180 | } 181 | 182 | @end 183 | 184 | #pragma mark - 185 | 186 | static inline NSString * AFImageCacheKeyFromURLRequest(NSURLRequest *request) { 187 | return [[request URL] absoluteString]; 188 | } 189 | 190 | @implementation AFImageCache 191 | 192 | - (UIImage *)cachedImageForRequest:(NSURLRequest *)request { 193 | switch ([request cachePolicy]) { 194 | case NSURLRequestReloadIgnoringCacheData: 195 | case NSURLRequestReloadIgnoringLocalAndRemoteCacheData: 196 | return nil; 197 | default: 198 | break; 199 | } 200 | 201 | return [self objectForKey:AFImageCacheKeyFromURLRequest(request)]; 202 | } 203 | 204 | - (void)cacheImage:(UIImage *)image 205 | forRequest:(NSURLRequest *)request 206 | { 207 | if (image && request) { 208 | [self setObject:image forKey:AFImageCacheKeyFromURLRequest(request)]; 209 | } 210 | } 211 | 212 | @end 213 | 214 | #endif 215 | -------------------------------------------------------------------------------- /Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m: -------------------------------------------------------------------------------- 1 | // AFNetworkReachabilityManager.m 2 | // 3 | // Copyright (c) 2013-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 "AFNetworkReachabilityManager.h" 24 | 25 | NSString * const AFNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change"; 26 | NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworkingReachabilityNotificationStatusItem"; 27 | 28 | typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status); 29 | 30 | typedef NS_ENUM(NSUInteger, AFNetworkReachabilityAssociation) { 31 | AFNetworkReachabilityForAddress = 1, 32 | AFNetworkReachabilityForAddressPair = 2, 33 | AFNetworkReachabilityForName = 3, 34 | }; 35 | 36 | NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status) { 37 | switch (status) { 38 | case AFNetworkReachabilityStatusNotReachable: 39 | return NSLocalizedStringFromTable(@"Not Reachable", @"AFNetworking", nil); 40 | case AFNetworkReachabilityStatusReachableViaWWAN: 41 | return NSLocalizedStringFromTable(@"Reachable via WWAN", @"AFNetworking", nil); 42 | case AFNetworkReachabilityStatusReachableViaWiFi: 43 | return NSLocalizedStringFromTable(@"Reachable via WiFi", @"AFNetworking", nil); 44 | case AFNetworkReachabilityStatusUnknown: 45 | default: 46 | return NSLocalizedStringFromTable(@"Unknown", @"AFNetworking", nil); 47 | } 48 | } 49 | 50 | static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetworkReachabilityFlags flags) { 51 | BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0); 52 | BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0); 53 | BOOL canConnectionAutomatically = (((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0)); 54 | BOOL canConnectWithoutUserInteraction = (canConnectionAutomatically && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0); 55 | BOOL isNetworkReachable = (isReachable && (!needsConnection || canConnectWithoutUserInteraction)); 56 | 57 | AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusUnknown; 58 | if (isNetworkReachable == NO) { 59 | status = AFNetworkReachabilityStatusNotReachable; 60 | } 61 | #if TARGET_OS_IPHONE 62 | else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) { 63 | status = AFNetworkReachabilityStatusReachableViaWWAN; 64 | } 65 | #endif 66 | else { 67 | status = AFNetworkReachabilityStatusReachableViaWiFi; 68 | } 69 | 70 | return status; 71 | } 72 | 73 | static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) { 74 | AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags); 75 | AFNetworkReachabilityStatusBlock block = (__bridge AFNetworkReachabilityStatusBlock)info; 76 | if (block) { 77 | block(status); 78 | } 79 | 80 | 81 | dispatch_async(dispatch_get_main_queue(), ^{ 82 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 83 | [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:@{ AFNetworkingReachabilityNotificationStatusItem: @(status) }]; 84 | }); 85 | } 86 | 87 | static const void * AFNetworkReachabilityRetainCallback(const void *info) { 88 | return Block_copy(info); 89 | } 90 | 91 | static void AFNetworkReachabilityReleaseCallback(const void *info) { 92 | if (info) { 93 | Block_release(info); 94 | } 95 | } 96 | 97 | @interface AFNetworkReachabilityManager () 98 | @property (readwrite, nonatomic, assign) SCNetworkReachabilityRef networkReachability; 99 | @property (readwrite, nonatomic, assign) AFNetworkReachabilityAssociation networkReachabilityAssociation; 100 | @property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; 101 | @property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock; 102 | @end 103 | 104 | @implementation AFNetworkReachabilityManager 105 | 106 | + (instancetype)sharedManager { 107 | static AFNetworkReachabilityManager *_sharedManager = nil; 108 | static dispatch_once_t onceToken; 109 | dispatch_once(&onceToken, ^{ 110 | struct sockaddr_in address; 111 | bzero(&address, sizeof(address)); 112 | address.sin_len = sizeof(address); 113 | address.sin_family = AF_INET; 114 | 115 | _sharedManager = [self managerForAddress:&address]; 116 | }); 117 | 118 | return _sharedManager; 119 | } 120 | 121 | + (instancetype)managerForDomain:(NSString *)domain { 122 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]); 123 | 124 | AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability]; 125 | manager.networkReachabilityAssociation = AFNetworkReachabilityForName; 126 | 127 | return manager; 128 | } 129 | 130 | + (instancetype)managerForAddress:(const struct sockaddr_in *)address { 131 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address); 132 | 133 | AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability]; 134 | manager.networkReachabilityAssociation = AFNetworkReachabilityForAddress; 135 | 136 | return manager; 137 | } 138 | 139 | - (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability { 140 | self = [super init]; 141 | if (!self) { 142 | return nil; 143 | } 144 | 145 | self.networkReachability = reachability; 146 | self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown; 147 | 148 | return self; 149 | } 150 | 151 | - (void)dealloc { 152 | [self stopMonitoring]; 153 | 154 | if (_networkReachability) { 155 | CFRelease(_networkReachability); 156 | _networkReachability = NULL; 157 | } 158 | } 159 | 160 | #pragma mark - 161 | 162 | - (BOOL)isReachable { 163 | return [self isReachableViaWWAN] || [self isReachableViaWiFi]; 164 | } 165 | 166 | - (BOOL)isReachableViaWWAN { 167 | return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN; 168 | } 169 | 170 | - (BOOL)isReachableViaWiFi { 171 | return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWiFi; 172 | } 173 | 174 | #pragma mark - 175 | 176 | - (void)startMonitoring { 177 | [self stopMonitoring]; 178 | 179 | if (!self.networkReachability) { 180 | return; 181 | } 182 | 183 | __weak __typeof(self)weakSelf = self; 184 | AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) { 185 | __strong __typeof(weakSelf)strongSelf = weakSelf; 186 | 187 | strongSelf.networkReachabilityStatus = status; 188 | if (strongSelf.networkReachabilityStatusBlock) { 189 | strongSelf.networkReachabilityStatusBlock(status); 190 | } 191 | }; 192 | 193 | SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL}; 194 | SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context); 195 | SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); 196 | 197 | switch (self.networkReachabilityAssociation) { 198 | case AFNetworkReachabilityForName: 199 | break; 200 | case AFNetworkReachabilityForAddress: 201 | case AFNetworkReachabilityForAddressPair: 202 | default: { 203 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{ 204 | SCNetworkReachabilityFlags flags; 205 | SCNetworkReachabilityGetFlags(self.networkReachability, &flags); 206 | AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags); 207 | dispatch_async(dispatch_get_main_queue(), ^{ 208 | callback(status); 209 | }); 210 | }); 211 | } 212 | break; 213 | } 214 | } 215 | 216 | - (void)stopMonitoring { 217 | if (!self.networkReachability) { 218 | return; 219 | } 220 | 221 | SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); 222 | } 223 | 224 | #pragma mark - 225 | 226 | - (NSString *)localizedNetworkReachabilityStatusString { 227 | return AFStringFromNetworkReachabilityStatus(self.networkReachabilityStatus); 228 | } 229 | 230 | #pragma mark - 231 | 232 | - (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block { 233 | self.networkReachabilityStatusBlock = block; 234 | } 235 | 236 | #pragma mark - NSKeyValueObserving 237 | 238 | + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { 239 | if ([key isEqualToString:@"reachable"] || [key isEqualToString:@"reachableViaWWAN"] || [key isEqualToString:@"reachableViaWiFi"]) { 240 | return [NSSet setWithObject:@"networkReachabilityStatus"]; 241 | } 242 | 243 | return [super keyPathsForValuesAffectingValueForKey:key]; 244 | } 245 | 246 | @end 247 | -------------------------------------------------------------------------------- /Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.h: -------------------------------------------------------------------------------- 1 | // AFSerialization.h 2 | // 3 | // Copyright (c) 2013-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 | #import 25 | 26 | /** 27 | The `AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data. 28 | 29 | For example, a JSON response serializer may check for an acceptable status code (`2XX` range) and content type (`application/json`), decoding a valid JSON response into an object. 30 | */ 31 | @protocol AFURLResponseSerialization 32 | 33 | /** 34 | The response object decoded from the data associated with a specified response. 35 | 36 | @param response The response to be processed. 37 | @param data The response data to be decoded. 38 | @param error The error that occurred while attempting to decode the response data. 39 | 40 | @return The object decoded from the specified response data. 41 | */ 42 | - (id)responseObjectForResponse:(NSURLResponse *)response 43 | data:(NSData *)data 44 | error:(NSError *__autoreleasing *)error; 45 | 46 | @end 47 | 48 | #pragma mark - 49 | 50 | /** 51 | `AFHTTPResponseSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation. 52 | 53 | Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPResponseSerializer` in order to ensure consistent default behavior. 54 | */ 55 | @interface AFHTTPResponseSerializer : NSObject 56 | 57 | /** 58 | The string encoding used to serialize parameters. 59 | */ 60 | @property (nonatomic, assign) NSStringEncoding stringEncoding; 61 | 62 | /** 63 | Creates and returns a serializer with default configuration. 64 | */ 65 | + (instancetype)serializer; 66 | 67 | ///----------------------------------------- 68 | /// @name Configuring Response Serialization 69 | ///----------------------------------------- 70 | 71 | /** 72 | The acceptable HTTP status codes for responses. When non-`nil`, responses with status codes not contained by the set will result in an error during validation. 73 | 74 | See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 75 | */ 76 | @property (nonatomic, copy) NSIndexSet *acceptableStatusCodes; 77 | 78 | /** 79 | The acceptable MIME types for responses. When non-`nil`, responses with a `Content-Type` with MIME types that do not intersect with the set will result in an error during validation. 80 | */ 81 | @property (nonatomic, copy) NSSet *acceptableContentTypes; 82 | 83 | /** 84 | Validates the specified response and data. 85 | 86 | In its base implementation, this method checks for an acceptable status code and content type. Subclasses may wish to add other domain-specific checks. 87 | 88 | @param response The response to be validated. 89 | @param data The data associated with the response. 90 | @param error The error that occurred while attempting to validate the response. 91 | 92 | @return `YES` if the response is valid, otherwise `NO`. 93 | */ 94 | - (BOOL)validateResponse:(NSHTTPURLResponse *)response 95 | data:(NSData *)data 96 | error:(NSError *__autoreleasing *)error; 97 | 98 | @end 99 | 100 | #pragma mark - 101 | 102 | 103 | /** 104 | `AFJSONResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes JSON responses. 105 | 106 | By default, `AFJSONResponseSerializer` accepts the following MIME types, which includes the official standard, `application/json`, as well as other commonly-used types: 107 | 108 | - `application/json` 109 | - `text/json` 110 | - `text/javascript` 111 | */ 112 | @interface AFJSONResponseSerializer : AFHTTPResponseSerializer 113 | 114 | /** 115 | Options for reading the response JSON data and creating the Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. 116 | */ 117 | @property (nonatomic, assign) NSJSONReadingOptions readingOptions; 118 | 119 | /** 120 | Whether to remove keys with `NSNull` values from response JSON. Defaults to `NO`. 121 | */ 122 | @property (nonatomic, assign) BOOL removesKeysWithNullValues; 123 | 124 | /** 125 | Creates and returns a JSON serializer with specified reading and writing options. 126 | 127 | @param readingOptions The specified JSON reading options. 128 | */ 129 | + (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions; 130 | 131 | @end 132 | 133 | #pragma mark - 134 | 135 | /** 136 | `AFXMLParserSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLParser` objects. 137 | 138 | By default, `AFXMLParserSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types: 139 | 140 | - `application/xml` 141 | - `text/xml` 142 | */ 143 | @interface AFXMLParserResponseSerializer : AFHTTPResponseSerializer 144 | 145 | @end 146 | 147 | #pragma mark - 148 | 149 | #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED 150 | 151 | /** 152 | `AFXMLDocumentSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects. 153 | 154 | By default, `AFXMLDocumentSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types: 155 | 156 | - `application/xml` 157 | - `text/xml` 158 | */ 159 | @interface AFXMLDocumentResponseSerializer : AFHTTPResponseSerializer 160 | 161 | /** 162 | Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. 163 | */ 164 | @property (nonatomic, assign) NSUInteger options; 165 | 166 | /** 167 | Creates and returns an XML document serializer with the specified options. 168 | 169 | @param mask The XML document options. 170 | */ 171 | + (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask; 172 | 173 | @end 174 | 175 | #endif 176 | 177 | #pragma mark - 178 | 179 | /** 180 | `AFPropertyListSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects. 181 | 182 | By default, `AFPropertyListSerializer` accepts the following MIME types: 183 | 184 | - `application/x-plist` 185 | */ 186 | @interface AFPropertyListResponseSerializer : AFHTTPResponseSerializer 187 | 188 | /** 189 | The property list format. Possible values are described in "NSPropertyListFormat". 190 | */ 191 | @property (nonatomic, assign) NSPropertyListFormat format; 192 | 193 | /** 194 | The property list reading options. Possible values are described in "NSPropertyListMutabilityOptions." 195 | */ 196 | @property (nonatomic, assign) NSPropertyListReadOptions readOptions; 197 | 198 | /** 199 | Creates and returns a property list serializer with a specified format, read options, and write options. 200 | 201 | @param format The property list format. 202 | @param readOptions The property list reading options. 203 | */ 204 | + (instancetype)serializerWithFormat:(NSPropertyListFormat)format 205 | readOptions:(NSPropertyListReadOptions)readOptions; 206 | 207 | @end 208 | 209 | #pragma mark - 210 | 211 | /** 212 | `AFImageSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes image responses. 213 | 214 | By default, `AFImageSerializer` accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage: 215 | 216 | - `image/tiff` 217 | - `image/jpeg` 218 | - `image/gif` 219 | - `image/png` 220 | - `image/ico` 221 | - `image/x-icon` 222 | - `image/bmp` 223 | - `image/x-bmp` 224 | - `image/x-xbitmap` 225 | - `image/x-win-bitmap` 226 | */ 227 | @interface AFImageResponseSerializer : AFHTTPResponseSerializer 228 | 229 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 230 | /** 231 | The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance. 232 | */ 233 | @property (nonatomic, assign) CGFloat imageScale; 234 | 235 | /** 236 | Whether to automatically inflate response image data for compressed formats (such as PNG or JPEG). Enabling this can significantly improve drawing performance on iOS when used with `setCompletionBlockWithSuccess:failure:`, as it allows a bitmap representation to be constructed in the background rather than on the main thread. `YES` by default. 237 | */ 238 | @property (nonatomic, assign) BOOL automaticallyInflatesResponseImage; 239 | #endif 240 | 241 | @end 242 | 243 | #pragma mark - 244 | 245 | /** 246 | `AFCompoundSerializer` is a subclass of `AFHTTPResponseSerializer` that delegates the response serialization to the first `AFHTTPResponseSerializer` object that returns an object for `responseObjectForResponse:data:error:`, falling back on the default behavior of `AFHTTPResponseSerializer`. This is useful for supporting multiple potential types and structures of server responses with a single serializer. 247 | */ 248 | @interface AFCompoundResponseSerializer : AFHTTPResponseSerializer 249 | 250 | /** 251 | The component response serializers. 252 | */ 253 | @property (readonly, nonatomic, copy) NSArray *responseSerializers; 254 | 255 | /** 256 | Creates and returns a compound serializer comprised of the specified response serializers. 257 | 258 | @warning Each response serializer specified must be a subclass of `AFHTTPResponseSerializer`, and response to `-validateResponse:data:error:`. 259 | */ 260 | + (instancetype)compoundSerializerWithResponseSerializers:(NSArray *)responseSerializers; 261 | 262 | @end 263 | --------------------------------------------------------------------------------