├── .gitignore
├── .travis.yml
├── ABMSoundCloudAPI.podspec
├── Example
├── ABMSoundCloudAPI.xcodeproj
│ └── project.pbxproj
├── ABMSoundCloudAPI.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── ABMSoundCloudAPI.xcscmblueprint
├── ABMSoundCloudAPI
│ ├── ABMAppDelegate.h
│ ├── ABMAppDelegate.m
│ ├── ABMSoundCloudAPI-Info.plist
│ ├── ABMSoundCloudAPI-Prefix.pch
│ ├── API
│ │ ├── ABMSoundCloudAPISingleton.h
│ │ └── ABMSoundCloudAPISingleton.m
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Images.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── LaunchImage.launchimage
│ │ │ └── Contents.json
│ │ └── playlist_icon.imageset
│ │ │ ├── Contents.json
│ │ │ └── playlist_icon.pdf
│ ├── ViewControllers
│ │ ├── ABMConnectViewController.h
│ │ ├── ABMConnectViewController.m
│ │ ├── ABMMainTabBarViewController.h
│ │ ├── ABMMainTabBarViewController.m
│ │ ├── ABMPlayListSongsTableViewController.h
│ │ ├── ABMPlayListSongsTableViewController.m
│ │ ├── ABMPlayListsViewController.h
│ │ ├── ABMPlayListsViewController.m
│ │ ├── ABMSearchSongsViewController.h
│ │ ├── ABMSearchSongsViewController.m
│ │ ├── ABMSongDetailViewController.h
│ │ └── ABMSongDetailViewController.m
│ ├── en.lproj
│ │ └── InfoPlist.strings
│ └── main.m
├── Podfile
├── Podfile.lock
├── Pods
│ ├── AFNetworking
│ │ ├── AFNetworking
│ │ │ ├── AFHTTPSessionManager.h
│ │ │ ├── AFHTTPSessionManager.m
│ │ │ ├── AFNetworkReachabilityManager.h
│ │ │ ├── AFNetworkReachabilityManager.m
│ │ │ ├── AFNetworking.h
│ │ │ ├── AFSecurityPolicy.h
│ │ │ ├── AFSecurityPolicy.m
│ │ │ ├── AFURLRequestSerialization.h
│ │ │ ├── AFURLRequestSerialization.m
│ │ │ ├── AFURLResponseSerialization.h
│ │ │ ├── AFURLResponseSerialization.m
│ │ │ ├── AFURLSessionManager.h
│ │ │ └── AFURLSessionManager.m
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── UIKit+AFNetworking
│ │ │ ├── AFAutoPurgingImageCache.h
│ │ │ ├── AFAutoPurgingImageCache.m
│ │ │ ├── AFImageDownloader.h
│ │ │ ├── AFImageDownloader.m
│ │ │ ├── AFNetworkActivityIndicatorManager.h
│ │ │ ├── AFNetworkActivityIndicatorManager.m
│ │ │ ├── UIActivityIndicatorView+AFNetworking.h
│ │ │ ├── UIActivityIndicatorView+AFNetworking.m
│ │ │ ├── UIButton+AFNetworking.h
│ │ │ ├── UIButton+AFNetworking.m
│ │ │ ├── UIImage+AFNetworking.h
│ │ │ ├── UIImageView+AFNetworking.h
│ │ │ ├── UIImageView+AFNetworking.m
│ │ │ ├── UIKit+AFNetworking.h
│ │ │ ├── UIProgressView+AFNetworking.h
│ │ │ ├── UIProgressView+AFNetworking.m
│ │ │ ├── UIRefreshControl+AFNetworking.h
│ │ │ ├── UIRefreshControl+AFNetworking.m
│ │ │ ├── UIWebView+AFNetworking.h
│ │ │ └── UIWebView+AFNetworking.m
│ ├── AFOAuth2Manager
│ │ ├── AFOAuth2Manager
│ │ │ ├── AFHTTPRequestSerializer+OAuth2.h
│ │ │ ├── AFHTTPRequestSerializer+OAuth2.m
│ │ │ ├── AFOAuth2Manager.h
│ │ │ ├── AFOAuth2Manager.m
│ │ │ ├── AFOAuthCredential.h
│ │ │ └── AFOAuthCredential.m
│ │ ├── LICENSE
│ │ └── README.md
│ ├── Headers
│ │ ├── Private
│ │ │ ├── ABMSoundCloudAPI
│ │ │ │ ├── NSError+APISoundCloud.h
│ │ │ │ ├── NSUserDefaults+SoundCloudToken.h
│ │ │ │ ├── SoundCloudLoginWebViewController.h
│ │ │ │ └── SoundCloudPort.h
│ │ │ ├── AFNetworking
│ │ │ │ ├── AFAutoPurgingImageCache.h
│ │ │ │ ├── AFHTTPSessionManager.h
│ │ │ │ ├── AFImageDownloader.h
│ │ │ │ ├── AFNetworkActivityIndicatorManager.h
│ │ │ │ ├── AFNetworkReachabilityManager.h
│ │ │ │ ├── AFNetworking.h
│ │ │ │ ├── AFSecurityPolicy.h
│ │ │ │ ├── AFURLRequestSerialization.h
│ │ │ │ ├── AFURLResponseSerialization.h
│ │ │ │ ├── AFURLSessionManager.h
│ │ │ │ ├── UIActivityIndicatorView+AFNetworking.h
│ │ │ │ ├── UIButton+AFNetworking.h
│ │ │ │ ├── UIImage+AFNetworking.h
│ │ │ │ ├── UIImageView+AFNetworking.h
│ │ │ │ ├── UIKit+AFNetworking.h
│ │ │ │ ├── UIProgressView+AFNetworking.h
│ │ │ │ ├── UIRefreshControl+AFNetworking.h
│ │ │ │ └── UIWebView+AFNetworking.h
│ │ │ └── AFOAuth2Manager
│ │ │ │ ├── AFHTTPRequestSerializer+OAuth2.h
│ │ │ │ ├── AFOAuth2Manager.h
│ │ │ │ └── AFOAuthCredential.h
│ │ └── Public
│ │ │ ├── ABMSoundCloudAPI
│ │ │ ├── NSError+APISoundCloud.h
│ │ │ ├── NSUserDefaults+soundCloudToken.h
│ │ │ ├── SoundCloudLoginWebViewController.h
│ │ │ └── SoundCloudPort.h
│ │ │ ├── AFNetworking
│ │ │ ├── AFAutoPurgingImageCache.h
│ │ │ ├── AFHTTPSessionManager.h
│ │ │ ├── AFImageDownloader.h
│ │ │ ├── AFNetworkActivityIndicatorManager.h
│ │ │ ├── AFNetworkReachabilityManager.h
│ │ │ ├── AFNetworking.h
│ │ │ ├── AFSecurityPolicy.h
│ │ │ ├── AFURLRequestSerialization.h
│ │ │ ├── AFURLResponseSerialization.h
│ │ │ ├── AFURLSessionManager.h
│ │ │ ├── UIActivityIndicatorView+AFNetworking.h
│ │ │ ├── UIButton+AFNetworking.h
│ │ │ ├── UIImage+AFNetworking.h
│ │ │ ├── UIImageView+AFNetworking.h
│ │ │ ├── UIKit+AFNetworking.h
│ │ │ ├── UIProgressView+AFNetworking.h
│ │ │ ├── UIRefreshControl+AFNetworking.h
│ │ │ └── UIWebView+AFNetworking.h
│ │ │ └── AFOAuth2Manager
│ │ │ ├── AFHTTPRequestSerializer+OAuth2.h
│ │ │ ├── AFOAuth2Manager.h
│ │ │ └── AFOAuthCredential.h
│ ├── Local Podspecs
│ │ └── ABMSoundCloudAPI.podspec.json
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ │ └── project.pbxproj
│ └── Target Support Files
│ │ ├── ABMSoundCloudAPI
│ │ ├── ABMSoundCloudAPI-dummy.m
│ │ ├── ABMSoundCloudAPI-prefix.pch
│ │ └── ABMSoundCloudAPI.xcconfig
│ │ ├── AFNetworking
│ │ ├── AFNetworking-dummy.m
│ │ ├── AFNetworking-prefix.pch
│ │ └── AFNetworking.xcconfig
│ │ ├── AFOAuth2Manager
│ │ ├── AFOAuth2Manager-dummy.m
│ │ ├── AFOAuth2Manager-prefix.pch
│ │ └── AFOAuth2Manager.xcconfig
│ │ └── Pods-ABMSoundCloudAPI
│ │ ├── Pods-ABMSoundCloudAPI-acknowledgements.markdown
│ │ ├── Pods-ABMSoundCloudAPI-acknowledgements.plist
│ │ ├── Pods-ABMSoundCloudAPI-dummy.m
│ │ ├── Pods-ABMSoundCloudAPI-frameworks.sh
│ │ ├── Pods-ABMSoundCloudAPI-resources.sh
│ │ ├── Pods-ABMSoundCloudAPI.debug.xcconfig
│ │ └── Pods-ABMSoundCloudAPI.release.xcconfig
├── Tests
│ ├── Tests-Info.plist
│ ├── Tests-Prefix.pch
│ ├── Tests.m
│ └── en.lproj
│ │ └── InfoPlist.strings
└── screenshots
│ ├── ABMSoundCloudAPI_logo.png
│ ├── screenshot_1.png
│ ├── screenshot_2.png
│ ├── screenshot_3.png
│ └── screenshot_4.png
├── LICENSE
├── Pod
├── Assets
│ └── .gitkeep
└── Classes
│ ├── .gitkeep
│ ├── API
│ ├── SoundCloudPort.h
│ └── SoundCloudPort.m
│ ├── Categories
│ ├── NSError+APISoundCloud.h
│ ├── NSError+APISoundCloud.m
│ ├── NSUserDefaults+SoundCloudToken.h
│ └── NSUserDefaults+SoundCloudToken.m
│ ├── Controllers
│ ├── SoundCloudLoginWebViewController.h
│ ├── SoundCloudLoginWebViewController.m
│ └── SoundCloudLoginWebViewController.m.orig
│ └── Views
│ └── SoundCloudLogin.storyboard
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | #####
2 | # OS X temporary files that should never be committed
3 | #
4 | # c.f. http://www.westwind.com/reference/os-x/invisibles.html
5 |
6 | .DS_Store
7 |
8 | # c.f. http://www.westwind.com/reference/os-x/invisibles.html
9 |
10 | .Trashes
11 |
12 | # Xcode
13 | #
14 | build/
15 | *.pbxuser
16 | !default.pbxuser
17 | *.mode1v3
18 | !default.mode1v3
19 | *.mode2v3
20 | !default.mode2v3
21 | *.perspectivev3
22 | !default.perspectivev3
23 | !default.xcworkspace
24 | xcuserdata
25 | *.xccheckout
26 | *.moved-aside
27 | DerivedData
28 | *.hmap
29 | *.ipa
30 | *.xcuserstate
31 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
--------------------------------------------------------------------------------
/ABMSoundCloudAPI.podspec:
--------------------------------------------------------------------------------
1 |
2 | Pod::Spec.new do |s|
3 | s.name = "ABMSoundCloudAPI"
4 | s.version = "1.0.2"
5 | s.summary = "Own library to handle oauth2 authentication and basic operations for SoundCloud API."
6 | s.description = <<-DESC
7 | Since SoundCloud decided not to maintain any longer its library for iOS I diceded to create my own one. Right now it is supported:
8 | * Authentication usign internal webview
9 | * Searching for songs
10 | * Download a song
11 | * Get User Playlists
12 | * Get Playlists given playlist ID
13 | * Get song info given song ID
14 | * Follow user given user ID
15 | DESC
16 | s.homepage = "https://github.com/andresbrun/ABMSoundCloudAPI"
17 | s.screenshots = "https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/master/Example/screenshots/screenshot_1.png",
18 | "https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/master/Example/screenshots/screenshot_2.png",
19 | "https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/master/Example/screenshots/screenshot_3.png",
20 | "https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/master/Example/screenshots/screenshot_4.png"
21 | s.license = 'MIT'
22 | s.author = { "Andres Brun Moreno" => "andresbrunmoreno@gmail.com" }
23 | s.source = { :git => "https://github.com/andresbrun/ABMSoundCloudAPI.git", :tag => s.version.to_s }
24 | s.social_media_url = 'https://twitter.com/andrewsBrun'
25 |
26 | s.platform = :ios, '7.0'
27 | s.requires_arc = true
28 |
29 | s.source_files = 'Pod/Classes/**/*.{h,m}'
30 | s.resources = 'Pod/Classes/Views/*.storyboard'
31 |
32 | # s.public_header_files = 'Pod/Classes/**/*.h'
33 | s.dependency 'AFNetworking', '~> 3.0'
34 | s.dependency 'AFOAuth2Manager', '~> 3.0'
35 | end
36 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI.xcworkspace/xcshareddata/ABMSoundCloudAPI.xcscmblueprint:
--------------------------------------------------------------------------------
1 | {
2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "38D59B5098BBAA16B15C991E8F4AE8619C871E70",
3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
4 |
5 | },
6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
7 | "38D59B5098BBAA16B15C991E8F4AE8619C871E70" : 0,
8 | "70C09E0900E645CE2A932DB857353D11158164EF" : 0
9 | },
10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "4E06EBDF-6D68-469B-B608-0444DC475A82",
11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
12 | "38D59B5098BBAA16B15C991E8F4AE8619C871E70" : "ABMSoundCloudAP\/",
13 | "70C09E0900E645CE2A932DB857353D11158164EF" : "ABMSoundCloudAPI"
14 | },
15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "ABMSoundCloudAPI",
16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204,
17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Example\/ABMSoundCloudAPI.xcworkspace",
18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
19 | {
20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:andresbrun\/ABMSoundCloudAPI.git",
21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "38D59B5098BBAA16B15C991E8F4AE8619C871E70"
23 | },
24 | {
25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:andresbrun\/ABMSoundCloudAPI.git",
26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "70C09E0900E645CE2A932DB857353D11158164EF"
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ABMAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // ABMAppDelegate.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by CocoaPods on 03/14/2015.
6 | // Copyright (c) 2014 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ABMAppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ABMAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // ABMAppDelegate.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by CocoaPods on 03/14/2015.
6 | // Copyright (c) 2014 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import "ABMAppDelegate.h"
10 |
11 | @implementation ABMAppDelegate
12 |
13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
14 | {
15 | return YES;
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ABMSoundCloudAPI-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UIMainStoryboardFile~ipad
32 | Main_iPad
33 | UIRequiredDeviceCapabilities
34 |
35 | armv7
36 |
37 | UISupportedInterfaceOrientations
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationLandscapeLeft
41 | UIInterfaceOrientationLandscapeRight
42 |
43 | UISupportedInterfaceOrientations~ipad
44 |
45 | UIInterfaceOrientationPortrait
46 | UIInterfaceOrientationPortraitUpsideDown
47 | UIInterfaceOrientationLandscapeLeft
48 | UIInterfaceOrientationLandscapeRight
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ABMSoundCloudAPI-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 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/API/ABMSoundCloudAPISingleton.h:
--------------------------------------------------------------------------------
1 | //
2 | // ABMSoundCloudAPISingleton.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface ABMSoundCloudAPISingleton : NSObject
13 |
14 | + (instancetype)sharedManager;
15 |
16 | - (void) setClientID:(NSString *)clientID secretKey:(NSString *)secretKey;
17 |
18 | @property (nonatomic, readonly) SoundCloudPort *soundCloudPort;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/API/ABMSoundCloudAPISingleton.m:
--------------------------------------------------------------------------------
1 | //
2 | // ABMSoundCloudAPISingleton.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import "ABMSoundCloudAPISingleton.h"
10 |
11 | @interface ABMSoundCloudAPISingleton ()
12 | @property (nonatomic, strong) SoundCloudPort *soundCloudPort;
13 | @end
14 |
15 | @implementation ABMSoundCloudAPISingleton
16 |
17 | + (instancetype)sharedManager
18 | {
19 | static ABMSoundCloudAPISingleton *sharedMyManager = nil;
20 | static dispatch_once_t onceToken;
21 | dispatch_once(&onceToken, ^{
22 | sharedMyManager = [[self alloc] init];
23 | });
24 | return sharedMyManager;
25 | }
26 |
27 | - (void) setClientID:(NSString *)clientID secretKey:(NSString *)secretKey {
28 | self.soundCloudPort = [[SoundCloudPort alloc] initWithClientId:clientID clientSecret:secretKey];
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
27 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/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" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "83.5x83.5",
66 | "scale" : "2x"
67 | }
68 | ],
69 | "info" : {
70 | "version" : 1,
71 | "author" : "xcode"
72 | }
73 | }
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/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 | "orientation" : "portrait",
20 | "idiom" : "ipad",
21 | "extent" : "full-screen",
22 | "minimum-system-version" : "7.0",
23 | "scale" : "1x"
24 | },
25 | {
26 | "orientation" : "landscape",
27 | "idiom" : "ipad",
28 | "extent" : "full-screen",
29 | "minimum-system-version" : "7.0",
30 | "scale" : "1x"
31 | },
32 | {
33 | "orientation" : "portrait",
34 | "idiom" : "ipad",
35 | "extent" : "full-screen",
36 | "minimum-system-version" : "7.0",
37 | "scale" : "2x"
38 | },
39 | {
40 | "orientation" : "landscape",
41 | "idiom" : "ipad",
42 | "extent" : "full-screen",
43 | "minimum-system-version" : "7.0",
44 | "scale" : "2x"
45 | }
46 | ],
47 | "info" : {
48 | "version" : 1,
49 | "author" : "xcode"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/Images.xcassets/playlist_icon.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "playlist_icon.pdf"
6 | }
7 | ],
8 | "info" : {
9 | "version" : 1,
10 | "author" : "xcode"
11 | }
12 | }
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/Images.xcassets/playlist_icon.imageset/playlist_icon.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/2276c54a5f82116769fe1d734b1a631a16ccc4b9/Example/ABMSoundCloudAPI/Images.xcassets/playlist_icon.imageset/playlist_icon.pdf
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMConnectViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ABMConnectViewController.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ABMConnectViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMConnectViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ABMConnectViewController.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import "ABMConnectViewController.h"
10 | #import "ABMSoundCloudAPISingleton.h"
11 |
12 | @interface ABMConnectViewController ()
13 | @property (weak, nonatomic) IBOutlet UITextField *redirectURLTextField;
14 | @property (weak, nonatomic) IBOutlet UITextField *clientIDTextField;
15 | @property (weak, nonatomic) IBOutlet UITextField *secretKeyTextField;
16 | @end
17 |
18 | @implementation ABMConnectViewController
19 |
20 | - (void)viewDidAppear:(BOOL)animated {
21 | [super viewDidAppear:animated];
22 |
23 | if ([self retrieveConfigurationData]) {
24 | [self authenticate];
25 | }
26 | }
27 |
28 | - (IBAction)connectButtonPressed:(id)sender {
29 | [self authenticate];
30 | }
31 |
32 | - (void) authenticate {
33 | [[ABMSoundCloudAPISingleton sharedManager] setClientID:self.clientIDTextField.text secretKey:self.secretKeyTextField.text];
34 |
35 | __weak typeof(self) weakSelf = self;
36 | [[[ABMSoundCloudAPISingleton sharedManager] soundCloudPort] loginWithResult:^(BOOL success) {
37 | if (success) {
38 | [weakSelf saveConfigurationData];
39 | [weakSelf dismissViewControllerAnimated:YES completion:nil];
40 | } else {
41 | [weakSelf showErrorAlert];
42 | }
43 | } usingParentVC:self redirectURL:self.redirectURLTextField.text];
44 | }
45 |
46 | - (void)showErrorAlert {
47 | [[[UIAlertView alloc] initWithTitle:@"Error" message:@"Cannot authenticate with current data." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show];
48 | }
49 |
50 | - (void) saveConfigurationData {
51 | [[NSUserDefaults standardUserDefaults] setValue:self.clientIDTextField.text forKey:@"ClientID"];
52 | [[NSUserDefaults standardUserDefaults] setValue:self.secretKeyTextField.text forKey:@"SecretKey"];
53 | [[NSUserDefaults standardUserDefaults] setValue:self.redirectURLTextField.text forKey:@"RedirectURL"];
54 | [[NSUserDefaults standardUserDefaults] synchronize];
55 | }
56 |
57 | - (BOOL) retrieveConfigurationData {
58 | [self.clientIDTextField setText:[[NSUserDefaults standardUserDefaults] valueForKey:@"ClientID"]];
59 | [self.secretKeyTextField setText:[[NSUserDefaults standardUserDefaults] valueForKey:@"SecretKey"]];
60 | [self.redirectURLTextField setText:[[NSUserDefaults standardUserDefaults] valueForKey:@"RedirectURL"]];
61 |
62 | return self.clientIDTextField.text.length>0 && self.secretKeyTextField.text.length>0 && self.redirectURLTextField.text.length>0;
63 | }
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMMainTabBarViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ABMMainTabBarViewController.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ABMMainTabBarViewController : UITabBarController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMMainTabBarViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ABMMainTabBarViewController.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import "ABMMainTabBarViewController.h"
10 | #import "ABMSoundCloudAPISingleton.h"
11 |
12 | @interface ABMMainTabBarViewController ()
13 |
14 | @end
15 |
16 | @implementation ABMMainTabBarViewController
17 |
18 | - (void)viewDidAppear:(BOOL)animated {
19 | [super viewDidAppear:animated];
20 |
21 | if (![[[ABMSoundCloudAPISingleton sharedManager] soundCloudPort] isValidToken]) {
22 | [self performSegueWithIdentifier:@"presentConnectView" sender:nil];
23 | }
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMPlayListSongsTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ABMPlayListSongsTableViewController.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ABMPlayListSongsTableViewController : UITableViewController
12 |
13 | @property (nonatomic, strong) NSDictionary *playListDict;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMPlayListSongsTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ABMPlayListSongsTableViewController.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import "ABMPlayListSongsTableViewController.h"
10 | #import "ABMSongDetailViewController.h"
11 |
12 | @interface ABMPlayListSongsTableViewController ()
13 |
14 | @end
15 |
16 | @implementation ABMPlayListSongsTableViewController
17 |
18 | # pragma mark - Navigation
19 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
20 | if ([segue.destinationViewController isKindOfClass:[ABMSongDetailViewController class]]) {
21 | NSIndexPath *selectedIndexPath = [self.tableView indexPathForCell:sender];
22 | NSDictionary *songDict = self.playListDict[@"tracks"][selectedIndexPath.row];
23 | [(ABMSongDetailViewController *)segue.destinationViewController setSongDictionary:songDict];
24 | }
25 | }
26 |
27 | #pragma mark - Table view data source
28 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
29 | return 1;
30 | }
31 |
32 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
33 | return [self.playListDict[@"tracks"] count];
34 | }
35 |
36 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
37 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SongDetail_Cell"];
38 |
39 | NSDictionary *songDict = self.playListDict[@"tracks"][indexPath.row];
40 |
41 | cell.textLabel.text = songDict[@"title"];
42 | cell.detailTextLabel.text = songDict[@"user"][@"username"];
43 |
44 | return cell;
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMPlayListsViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ABMPlayListsViewController.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ABMPlayListsViewController : UITableViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMPlayListsViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ABMPlayListsViewController.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import "ABMPlayListsViewController.h"
10 |
11 | #import "ABMSoundCloudAPISingleton.h"
12 | #import "ABMPlayListSongsTableViewController.h"
13 |
14 | @interface ABMPlayListsViewController ()
15 | @property (nonatomic, strong) NSArray *playLists;
16 | @end
17 |
18 | @implementation ABMPlayListsViewController
19 |
20 | - (void)viewDidAppear:(BOOL)animated {
21 | [super viewDidAppear:animated];
22 |
23 | __weak typeof(self) weaSelf = self;
24 | [[[ABMSoundCloudAPISingleton sharedManager] soundCloudPort] requestPlaylistsWithSuccess:^(NSArray *playLists) {
25 | weaSelf.playLists = playLists;
26 | [weaSelf.tableView reloadData];
27 | } failure:^(NSError *error) {
28 | [[[UIAlertView alloc] initWithTitle:@"Error" message:error.description delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil] show];
29 | }];
30 | }
31 |
32 | #pragma mark - Navigation
33 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
34 | if ([segue.destinationViewController isKindOfClass:[ABMPlayListSongsTableViewController class]]) {
35 | NSIndexPath *selectedIndexPath = [self.tableView indexPathForCell:sender];
36 | NSDictionary *playListDict = self.playLists[selectedIndexPath.row];
37 | [(ABMPlayListSongsTableViewController *) segue.destinationViewController setPlayListDict:playListDict];
38 | }
39 | }
40 |
41 | #pragma mark - TableView
42 | -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
43 | return 1;
44 | }
45 |
46 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
47 | return [self.playLists count];
48 | }
49 |
50 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
51 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Playlist_Cell"];
52 |
53 | NSDictionary *playListDict = self.playLists[indexPath.row];
54 |
55 | cell.textLabel.text = playListDict[@"title"];
56 | cell.detailTextLabel.text = [NSString stringWithFormat:@"Tracks: %@", playListDict[@"track_count"]];
57 |
58 | return cell;
59 | }
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMSearchSongsViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ABMSearchSongsViewController.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ABMSearchSongsViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMSearchSongsViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ABMSearchSongsViewController.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import "ABMSearchSongsViewController.h"
10 | #import "ABMSoundCloudAPISingleton.h"
11 | #import "ABMSongDetailViewController.h"
12 |
13 | @interface ABMSearchSongsViewController ()
14 | @property(nonatomic, strong) NSMutableArray *songsList;
15 | @property(nonatomic, assign, getter=isSearching) BOOL searching;
16 | @end
17 |
18 | @implementation ABMSearchSongsViewController
19 |
20 | #pragma mark - Private methods
21 | - (void)searchTableList {
22 | NSString *query = self.searchDisplayController.searchBar.text;
23 | [[[ABMSoundCloudAPISingleton sharedManager] soundCloudPort] requestSongsForQuery:query limit:20 withSuccess:^(NSDictionary *songsDict) {
24 | self.songsList = songsDict[@"suggestions"];
25 | self.searching=NO;
26 | } failure:^(NSError *error) {
27 | [[[UIAlertView alloc] initWithTitle:@"Error" message:error.description delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil] show];
28 | self.searching=NO;
29 | }];
30 | }
31 |
32 | # pragma mark - Navigation
33 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
34 | if ([segue.destinationViewController isKindOfClass:[ABMSongDetailViewController class]]) {
35 | [(ABMSongDetailViewController *)segue.destinationViewController setSongDictionary:sender];
36 | }
37 | }
38 |
39 | #pragma mark - Search Bar
40 | - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
41 | }
42 |
43 | - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
44 |
45 | if([searchText length] != 0 && !self.searching) {
46 | self.searching = YES;
47 | [self searchTableList];
48 | }
49 | }
50 |
51 | - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
52 | }
53 |
54 | - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
55 | [self searchTableList];
56 | }
57 |
58 | #pragma mark - TableView
59 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
60 | return 1;
61 | }
62 |
63 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
64 | return [self.songsList count];
65 | }
66 |
67 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
68 | static NSString *CellIdentifier = @"Cell";
69 |
70 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
71 | if (cell == nil) {
72 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
73 | }
74 |
75 | NSDictionary *songDictionary = [self.songsList objectAtIndex:indexPath.row];
76 |
77 | [cell.textLabel setAttributedText:[self createAttributtedStringFromHTMLText:songDictionary[@"query"]]];
78 | [cell.detailTextLabel setText:songDictionary[@"kind"]];
79 |
80 | return cell;
81 | }
82 |
83 | -(BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath {
84 | NSDictionary *songDictionary = [self.songsList objectAtIndex:indexPath.row];
85 |
86 | NSString *type = songDictionary[@"kind"];
87 | if ([type isEqualToString:@"track"]) {
88 | [self performSegueWithIdentifier:@"presentSong" sender:songDictionary];
89 | } else {
90 | [[[UIAlertView alloc] initWithTitle:@"Limitation"
91 | message:[NSString stringWithFormat:@"Details for %@ type not supported yet", type]
92 | delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil] show];
93 | }
94 |
95 | return NO;
96 | }
97 |
98 | #pragma mark - Helpers
99 | - (NSAttributedString *) createAttributtedStringFromHTMLText:(NSString *)htmlText {
100 | NSError *error;
101 | NSAttributedString *attributtedString = [[NSAttributedString alloc] initWithData: [htmlText dataUsingEncoding:NSUTF8StringEncoding]
102 | options: @{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType }
103 | documentAttributes: nil
104 | error: &error];
105 | if(error)
106 | NSLog(@"Unable to parse label text: %@", error);
107 |
108 | return attributtedString;
109 | }
110 |
111 | @end
112 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMSongDetailViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ABMSongDetailViewController.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ABMSongDetailViewController : UIViewController
12 |
13 | @property (nonatomic, strong) NSDictionary* songDictionary;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/ViewControllers/ABMSongDetailViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ABMSongDetailViewController.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 14/03/15.
6 | // Copyright (c) 2015 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import "ABMSongDetailViewController.h"
10 | #import "ABMSoundCloudAPISingleton.h"
11 |
12 | @interface ABMSongDetailViewController ()
13 | @property (weak, nonatomic) IBOutlet UITextView *resultTextField;
14 |
15 | @end
16 |
17 | @implementation ABMSongDetailViewController
18 |
19 | - (void)viewDidAppear:(BOOL)animated {
20 | [super viewDidAppear:animated];
21 |
22 | __weak typeof(self) weakSelf = self;
23 | [[[ABMSoundCloudAPISingleton sharedManager] soundCloudPort] requestSongById:self.songDictionary[@"id"] withSuccess:^(NSDictionary *songDict) {
24 | [weakSelf.resultTextField setText:songDict.descriptionInStringsFileFormat];
25 | } failure:^(NSError *error) {
26 | [[[UIAlertView alloc] initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil] show];
27 | }];
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Example/ABMSoundCloudAPI/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun Moreno on 03/14/2015.
6 | // Copyright (c) 2014 Andres Brun Moreno. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "ABMAppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([ABMAppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Example/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 |
3 | target 'ABMSoundCloudAPI' do
4 | pod "ABMSoundCloudAPI", :path => "../"
5 | pod "AFNetworking"
6 | pod "AFOAuth2Manager"
7 | end
--------------------------------------------------------------------------------
/Example/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - ABMSoundCloudAPI (1.0.1):
3 | - AFNetworking (~> 3.0)
4 | - AFOAuth2Manager (~> 3.0)
5 | - AFNetworking (3.1.0):
6 | - AFNetworking/NSURLSession (= 3.1.0)
7 | - AFNetworking/Reachability (= 3.1.0)
8 | - AFNetworking/Security (= 3.1.0)
9 | - AFNetworking/Serialization (= 3.1.0)
10 | - AFNetworking/UIKit (= 3.1.0)
11 | - AFNetworking/NSURLSession (3.1.0):
12 | - AFNetworking/Reachability
13 | - AFNetworking/Security
14 | - AFNetworking/Serialization
15 | - AFNetworking/Reachability (3.1.0)
16 | - AFNetworking/Security (3.1.0)
17 | - AFNetworking/Serialization (3.1.0)
18 | - AFNetworking/UIKit (3.1.0):
19 | - AFNetworking/NSURLSession
20 | - AFOAuth2Manager (3.0.0):
21 | - AFNetworking/NSURLSession (~> 3.0)
22 |
23 | DEPENDENCIES:
24 | - ABMSoundCloudAPI (from `../`)
25 | - AFNetworking
26 | - AFOAuth2Manager
27 |
28 | EXTERNAL SOURCES:
29 | ABMSoundCloudAPI:
30 | :path: "../"
31 |
32 | SPEC CHECKSUMS:
33 | ABMSoundCloudAPI: 22c50b5487c9326de14bf9f057266e6dd9a27452
34 | AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
35 | AFOAuth2Manager: 0566da1be64883e339813d411229fdc9a84dab7c
36 |
37 | PODFILE CHECKSUM: a14b2086b5e07c84f3c22bc1e15a9f9ce8c1a835
38 |
39 | COCOAPODS: 1.0.1
40 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h:
--------------------------------------------------------------------------------
1 | // AFNetworkReachabilityManager.h
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import
23 |
24 | #if !TARGET_OS_WATCH
25 | #import
26 |
27 | typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) {
28 | AFNetworkReachabilityStatusUnknown = -1,
29 | AFNetworkReachabilityStatusNotReachable = 0,
30 | AFNetworkReachabilityStatusReachableViaWWAN = 1,
31 | AFNetworkReachabilityStatusReachableViaWiFi = 2,
32 | };
33 |
34 | NS_ASSUME_NONNULL_BEGIN
35 |
36 | /**
37 | `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.
38 |
39 | Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability.
40 |
41 | See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ )
42 |
43 | @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined.
44 | */
45 | @interface AFNetworkReachabilityManager : NSObject
46 |
47 | /**
48 | The current network reachability status.
49 | */
50 | @property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
51 |
52 | /**
53 | Whether or not the network is currently reachable.
54 | */
55 | @property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable;
56 |
57 | /**
58 | Whether or not the network is currently reachable via WWAN.
59 | */
60 | @property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN;
61 |
62 | /**
63 | Whether or not the network is currently reachable via WiFi.
64 | */
65 | @property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi;
66 |
67 | ///---------------------
68 | /// @name Initialization
69 | ///---------------------
70 |
71 | /**
72 | Returns the shared network reachability manager.
73 | */
74 | + (instancetype)sharedManager;
75 |
76 | /**
77 | Creates and returns a network reachability manager with the default socket address.
78 |
79 | @return An initialized network reachability manager, actively monitoring the default socket address.
80 | */
81 | + (instancetype)manager;
82 |
83 | /**
84 | Creates and returns a network reachability manager for the specified domain.
85 |
86 | @param domain The domain used to evaluate network reachability.
87 |
88 | @return An initialized network reachability manager, actively monitoring the specified domain.
89 | */
90 | + (instancetype)managerForDomain:(NSString *)domain;
91 |
92 | /**
93 | Creates and returns a network reachability manager for the socket address.
94 |
95 | @param address The socket address (`sockaddr_in6`) used to evaluate network reachability.
96 |
97 | @return An initialized network reachability manager, actively monitoring the specified socket address.
98 | */
99 | + (instancetype)managerForAddress:(const void *)address;
100 |
101 | /**
102 | Initializes an instance of a network reachability manager from the specified reachability object.
103 |
104 | @param reachability The reachability object to monitor.
105 |
106 | @return An initialized network reachability manager, actively monitoring the specified reachability.
107 | */
108 | - (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;
109 |
110 | ///--------------------------------------------------
111 | /// @name Starting & Stopping Reachability Monitoring
112 | ///--------------------------------------------------
113 |
114 | /**
115 | Starts monitoring for changes in network reachability status.
116 | */
117 | - (void)startMonitoring;
118 |
119 | /**
120 | Stops monitoring for changes in network reachability status.
121 | */
122 | - (void)stopMonitoring;
123 |
124 | ///-------------------------------------------------
125 | /// @name Getting Localized Reachability Description
126 | ///-------------------------------------------------
127 |
128 | /**
129 | Returns a localized string representation of the current network reachability status.
130 | */
131 | - (NSString *)localizedNetworkReachabilityStatusString;
132 |
133 | ///---------------------------------------------------
134 | /// @name Setting Network Reachability Change Callback
135 | ///---------------------------------------------------
136 |
137 | /**
138 | Sets a callback to be executed when the network availability of the `baseURL` host changes.
139 |
140 | @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`.
141 | */
142 | - (void)setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block;
143 |
144 | @end
145 |
146 | ///----------------
147 | /// @name Constants
148 | ///----------------
149 |
150 | /**
151 | ## Network Reachability
152 |
153 | The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses.
154 |
155 | enum {
156 | AFNetworkReachabilityStatusUnknown,
157 | AFNetworkReachabilityStatusNotReachable,
158 | AFNetworkReachabilityStatusReachableViaWWAN,
159 | AFNetworkReachabilityStatusReachableViaWiFi,
160 | }
161 |
162 | `AFNetworkReachabilityStatusUnknown`
163 | The `baseURL` host reachability is not known.
164 |
165 | `AFNetworkReachabilityStatusNotReachable`
166 | The `baseURL` host cannot be reached.
167 |
168 | `AFNetworkReachabilityStatusReachableViaWWAN`
169 | The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS.
170 |
171 | `AFNetworkReachabilityStatusReachableViaWiFi`
172 | The `baseURL` host can be reached via a Wi-Fi connection.
173 |
174 | ### Keys for Notification UserInfo Dictionary
175 |
176 | Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification.
177 |
178 | `AFNetworkingReachabilityNotificationStatusItem`
179 | A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification.
180 | The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status.
181 | */
182 |
183 | ///--------------------
184 | /// @name Notifications
185 | ///--------------------
186 |
187 | /**
188 | Posted when network reachability changes.
189 | 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.
190 |
191 | @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`).
192 | */
193 | FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification;
194 | FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem;
195 |
196 | ///--------------------
197 | /// @name Functions
198 | ///--------------------
199 |
200 | /**
201 | Returns a localized string representation of an `AFNetworkReachabilityStatus` value.
202 | */
203 | FOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status);
204 |
205 | NS_ASSUME_NONNULL_END
206 | #endif
207 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/AFNetworking/AFNetworking.h:
--------------------------------------------------------------------------------
1 | // AFNetworking.h
2 | //
3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/)
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 |
23 | #import
24 | #import
25 | #import
26 |
27 | #ifndef _AFNETWORKING_
28 | #define _AFNETWORKING_
29 |
30 | #import "AFURLRequestSerialization.h"
31 | #import "AFURLResponseSerialization.h"
32 | #import "AFSecurityPolicy.h"
33 |
34 | #if !TARGET_OS_WATCH
35 | #import "AFNetworkReachabilityManager.h"
36 | #endif
37 |
38 | #import "AFURLSessionManager.h"
39 | #import "AFHTTPSessionManager.h"
40 |
41 | #endif /* _AFNETWORKING_ */
42 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h:
--------------------------------------------------------------------------------
1 | // AFSecurityPolicy.h
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import
23 | #import
24 |
25 | typedef NS_ENUM(NSUInteger, AFSSLPinningMode) {
26 | AFSSLPinningModeNone,
27 | AFSSLPinningModePublicKey,
28 | AFSSLPinningModeCertificate,
29 | };
30 |
31 | /**
32 | `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.
33 |
34 | Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.
35 | */
36 |
37 | NS_ASSUME_NONNULL_BEGIN
38 |
39 | @interface AFSecurityPolicy : NSObject
40 |
41 | /**
42 | The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`.
43 | */
44 | @property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode;
45 |
46 | /**
47 | The certificates used to evaluate server trust according to the SSL pinning mode.
48 |
49 | By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`.
50 |
51 | Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches.
52 | */
53 | @property (nonatomic, strong, nullable) NSSet *pinnedCertificates;
54 |
55 | /**
56 | Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`.
57 | */
58 | @property (nonatomic, assign) BOOL allowInvalidCertificates;
59 |
60 | /**
61 | Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`.
62 | */
63 | @property (nonatomic, assign) BOOL validatesDomainName;
64 |
65 | ///-----------------------------------------
66 | /// @name Getting Certificates from the Bundle
67 | ///-----------------------------------------
68 |
69 | /**
70 | Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`.
71 |
72 | @return The certificates included in the given bundle.
73 | */
74 | + (NSSet *)certificatesInBundle:(NSBundle *)bundle;
75 |
76 | ///-----------------------------------------
77 | /// @name Getting Specific Security Policies
78 | ///-----------------------------------------
79 |
80 | /**
81 | Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys.
82 |
83 | @return The default security policy.
84 | */
85 | + (instancetype)defaultPolicy;
86 |
87 | ///---------------------
88 | /// @name Initialization
89 | ///---------------------
90 |
91 | /**
92 | Creates and returns a security policy with the specified pinning mode.
93 |
94 | @param pinningMode The SSL pinning mode.
95 |
96 | @return A new security policy.
97 | */
98 | + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode;
99 |
100 | /**
101 | Creates and returns a security policy with the specified pinning mode.
102 |
103 | @param pinningMode The SSL pinning mode.
104 | @param pinnedCertificates The certificates to pin against.
105 |
106 | @return A new security policy.
107 | */
108 | + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates;
109 |
110 | ///------------------------------
111 | /// @name Evaluating Server Trust
112 | ///------------------------------
113 |
114 | /**
115 | Whether or not the specified server trust should be accepted, based on the security policy.
116 |
117 | This method should be used when responding to an authentication challenge from a server.
118 |
119 | @param serverTrust The X.509 certificate trust of the server.
120 | @param domain The domain of serverTrust. If `nil`, the domain will not be validated.
121 |
122 | @return Whether or not to trust the server.
123 | */
124 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust
125 | forDomain:(nullable NSString *)domain;
126 |
127 | @end
128 |
129 | NS_ASSUME_NONNULL_END
130 |
131 | ///----------------
132 | /// @name Constants
133 | ///----------------
134 |
135 | /**
136 | ## SSL Pinning Modes
137 |
138 | The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes.
139 |
140 | enum {
141 | AFSSLPinningModeNone,
142 | AFSSLPinningModePublicKey,
143 | AFSSLPinningModeCertificate,
144 | }
145 |
146 | `AFSSLPinningModeNone`
147 | Do not used pinned certificates to validate servers.
148 |
149 | `AFSSLPinningModePublicKey`
150 | Validate host certificates against public keys of pinned certificates.
151 |
152 | `AFSSLPinningModeCertificate`
153 | Validate host certificates against pinned certificates.
154 | */
155 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h:
--------------------------------------------------------------------------------
1 | // AFAutoPurgingImageCache.h
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import
23 | #import
24 |
25 | #if TARGET_OS_IOS || TARGET_OS_TV
26 | #import
27 |
28 | NS_ASSUME_NONNULL_BEGIN
29 |
30 | /**
31 | The `AFImageCache` protocol defines a set of APIs for adding, removing and fetching images from a cache synchronously.
32 | */
33 | @protocol AFImageCache
34 |
35 | /**
36 | Adds the image to the cache with the given identifier.
37 |
38 | @param image The image to cache.
39 | @param identifier The unique identifier for the image in the cache.
40 | */
41 | - (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier;
42 |
43 | /**
44 | Removes the image from the cache matching the given identifier.
45 |
46 | @param identifier The unique identifier for the image in the cache.
47 |
48 | @return A BOOL indicating whether or not the image was removed from the cache.
49 | */
50 | - (BOOL)removeImageWithIdentifier:(NSString *)identifier;
51 |
52 | /**
53 | Removes all images from the cache.
54 |
55 | @return A BOOL indicating whether or not all images were removed from the cache.
56 | */
57 | - (BOOL)removeAllImages;
58 |
59 | /**
60 | Returns the image in the cache associated with the given identifier.
61 |
62 | @param identifier The unique identifier for the image in the cache.
63 |
64 | @return An image for the matching identifier, or nil.
65 | */
66 | - (nullable UIImage *)imageWithIdentifier:(NSString *)identifier;
67 | @end
68 |
69 |
70 | /**
71 | The `ImageRequestCache` protocol extends the `ImageCache` protocol by adding methods for adding, removing and fetching images from a cache given an `NSURLRequest` and additional identifier.
72 | */
73 | @protocol AFImageRequestCache
74 |
75 | /**
76 | Adds the image to the cache using an identifier created from the request and additional identifier.
77 |
78 | @param image The image to cache.
79 | @param request The unique URL request identifing the image asset.
80 | @param identifier The additional identifier to apply to the URL request to identify the image.
81 | */
82 | - (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
83 |
84 | /**
85 | Removes the image from the cache using an identifier created from the request and additional identifier.
86 |
87 | @param request The unique URL request identifing the image asset.
88 | @param identifier The additional identifier to apply to the URL request to identify the image.
89 |
90 | @return A BOOL indicating whether or not all images were removed from the cache.
91 | */
92 | - (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
93 |
94 | /**
95 | Returns the image from the cache associated with an identifier created from the request and additional identifier.
96 |
97 | @param request The unique URL request identifing the image asset.
98 | @param identifier The additional identifier to apply to the URL request to identify the image.
99 |
100 | @return An image for the matching request and identifier, or nil.
101 | */
102 | - (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
103 |
104 | @end
105 |
106 | /**
107 | The `AutoPurgingImageCache` in an in-memory image cache used to store images up to a given memory capacity. When the memory capacity is reached, the image cache is sorted by last access date, then the oldest image is continuously purged until the preferred memory usage after purge is met. Each time an image is accessed through the cache, the internal access date of the image is updated.
108 | */
109 | @interface AFAutoPurgingImageCache : NSObject
110 |
111 | /**
112 | The total memory capacity of the cache in bytes.
113 | */
114 | @property (nonatomic, assign) UInt64 memoryCapacity;
115 |
116 | /**
117 | The preferred memory usage after purge in bytes. During a purge, images will be purged until the memory capacity drops below this limit.
118 | */
119 | @property (nonatomic, assign) UInt64 preferredMemoryUsageAfterPurge;
120 |
121 | /**
122 | The current total memory usage in bytes of all images stored within the cache.
123 | */
124 | @property (nonatomic, assign, readonly) UInt64 memoryUsage;
125 |
126 | /**
127 | Initialies the `AutoPurgingImageCache` instance with default values for memory capacity and preferred memory usage after purge limit. `memoryCapcity` defaults to `100 MB`. `preferredMemoryUsageAfterPurge` defaults to `60 MB`.
128 |
129 | @return The new `AutoPurgingImageCache` instance.
130 | */
131 | - (instancetype)init;
132 |
133 | /**
134 | Initialies the `AutoPurgingImageCache` instance with the given memory capacity and preferred memory usage
135 | after purge limit.
136 |
137 | @param memoryCapacity The total memory capacity of the cache in bytes.
138 | @param preferredMemoryCapacity The preferred memory usage after purge in bytes.
139 |
140 | @return The new `AutoPurgingImageCache` instance.
141 | */
142 | - (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity;
143 |
144 | @end
145 |
146 | NS_ASSUME_NONNULL_END
147 |
148 | #endif
149 |
150 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.m:
--------------------------------------------------------------------------------
1 | // AFAutoPurgingImageCache.m
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import
23 |
24 | #if TARGET_OS_IOS || TARGET_OS_TV
25 |
26 | #import "AFAutoPurgingImageCache.h"
27 |
28 | @interface AFCachedImage : NSObject
29 |
30 | @property (nonatomic, strong) UIImage *image;
31 | @property (nonatomic, strong) NSString *identifier;
32 | @property (nonatomic, assign) UInt64 totalBytes;
33 | @property (nonatomic, strong) NSDate *lastAccessDate;
34 | @property (nonatomic, assign) UInt64 currentMemoryUsage;
35 |
36 | @end
37 |
38 | @implementation AFCachedImage
39 |
40 | -(instancetype)initWithImage:(UIImage *)image identifier:(NSString *)identifier {
41 | if (self = [self init]) {
42 | self.image = image;
43 | self.identifier = identifier;
44 |
45 | CGSize imageSize = CGSizeMake(image.size.width * image.scale, image.size.height * image.scale);
46 | CGFloat bytesPerPixel = 4.0;
47 | CGFloat bytesPerSize = imageSize.width * imageSize.height;
48 | self.totalBytes = (UInt64)bytesPerPixel * (UInt64)bytesPerSize;
49 | self.lastAccessDate = [NSDate date];
50 | }
51 | return self;
52 | }
53 |
54 | - (UIImage*)accessImage {
55 | self.lastAccessDate = [NSDate date];
56 | return self.image;
57 | }
58 |
59 | - (NSString *)description {
60 | NSString *descriptionString = [NSString stringWithFormat:@"Idenfitier: %@ lastAccessDate: %@ ", self.identifier, self.lastAccessDate];
61 | return descriptionString;
62 |
63 | }
64 |
65 | @end
66 |
67 | @interface AFAutoPurgingImageCache ()
68 | @property (nonatomic, strong) NSMutableDictionary *cachedImages;
69 | @property (nonatomic, assign) UInt64 currentMemoryUsage;
70 | @property (nonatomic, strong) dispatch_queue_t synchronizationQueue;
71 | @end
72 |
73 | @implementation AFAutoPurgingImageCache
74 |
75 | - (instancetype)init {
76 | return [self initWithMemoryCapacity:100 * 1024 * 1024 preferredMemoryCapacity:60 * 1024 * 1024];
77 | }
78 |
79 | - (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity {
80 | if (self = [super init]) {
81 | self.memoryCapacity = memoryCapacity;
82 | self.preferredMemoryUsageAfterPurge = preferredMemoryCapacity;
83 | self.cachedImages = [[NSMutableDictionary alloc] init];
84 |
85 | NSString *queueName = [NSString stringWithFormat:@"com.alamofire.autopurgingimagecache-%@", [[NSUUID UUID] UUIDString]];
86 | self.synchronizationQueue = dispatch_queue_create([queueName cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_CONCURRENT);
87 |
88 | [[NSNotificationCenter defaultCenter]
89 | addObserver:self
90 | selector:@selector(removeAllImages)
91 | name:UIApplicationDidReceiveMemoryWarningNotification
92 | object:nil];
93 |
94 | }
95 | return self;
96 | }
97 |
98 | - (void)dealloc {
99 | [[NSNotificationCenter defaultCenter] removeObserver:self];
100 | }
101 |
102 | - (UInt64)memoryUsage {
103 | __block UInt64 result = 0;
104 | dispatch_sync(self.synchronizationQueue, ^{
105 | result = self.currentMemoryUsage;
106 | });
107 | return result;
108 | }
109 |
110 | - (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier {
111 | dispatch_barrier_async(self.synchronizationQueue, ^{
112 | AFCachedImage *cacheImage = [[AFCachedImage alloc] initWithImage:image identifier:identifier];
113 |
114 | AFCachedImage *previousCachedImage = self.cachedImages[identifier];
115 | if (previousCachedImage != nil) {
116 | self.currentMemoryUsage -= previousCachedImage.totalBytes;
117 | }
118 |
119 | self.cachedImages[identifier] = cacheImage;
120 | self.currentMemoryUsage += cacheImage.totalBytes;
121 | });
122 |
123 | dispatch_barrier_async(self.synchronizationQueue, ^{
124 | if (self.currentMemoryUsage > self.memoryCapacity) {
125 | UInt64 bytesToPurge = self.currentMemoryUsage - self.preferredMemoryUsageAfterPurge;
126 | NSMutableArray *sortedImages = [NSMutableArray arrayWithArray:self.cachedImages.allValues];
127 | NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lastAccessDate"
128 | ascending:YES];
129 | [sortedImages sortUsingDescriptors:@[sortDescriptor]];
130 |
131 | UInt64 bytesPurged = 0;
132 |
133 | for (AFCachedImage *cachedImage in sortedImages) {
134 | [self.cachedImages removeObjectForKey:cachedImage.identifier];
135 | bytesPurged += cachedImage.totalBytes;
136 | if (bytesPurged >= bytesToPurge) {
137 | break ;
138 | }
139 | }
140 | self.currentMemoryUsage -= bytesPurged;
141 | }
142 | });
143 | }
144 |
145 | - (BOOL)removeImageWithIdentifier:(NSString *)identifier {
146 | __block BOOL removed = NO;
147 | dispatch_barrier_sync(self.synchronizationQueue, ^{
148 | AFCachedImage *cachedImage = self.cachedImages[identifier];
149 | if (cachedImage != nil) {
150 | [self.cachedImages removeObjectForKey:identifier];
151 | self.currentMemoryUsage -= cachedImage.totalBytes;
152 | removed = YES;
153 | }
154 | });
155 | return removed;
156 | }
157 |
158 | - (BOOL)removeAllImages {
159 | __block BOOL removed = NO;
160 | dispatch_barrier_sync(self.synchronizationQueue, ^{
161 | if (self.cachedImages.count > 0) {
162 | [self.cachedImages removeAllObjects];
163 | self.currentMemoryUsage = 0;
164 | removed = YES;
165 | }
166 | });
167 | return removed;
168 | }
169 |
170 | - (nullable UIImage *)imageWithIdentifier:(NSString *)identifier {
171 | __block UIImage *image = nil;
172 | dispatch_sync(self.synchronizationQueue, ^{
173 | AFCachedImage *cachedImage = self.cachedImages[identifier];
174 | image = [cachedImage accessImage];
175 | });
176 | return image;
177 | }
178 |
179 | - (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {
180 | [self addImage:image withIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];
181 | }
182 |
183 | - (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {
184 | return [self removeImageWithIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];
185 | }
186 |
187 | - (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {
188 | return [self imageWithIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];
189 | }
190 |
191 | - (NSString *)imageCacheKeyFromURLRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)additionalIdentifier {
192 | NSString *key = request.URL.absoluteString;
193 | if (additionalIdentifier != nil) {
194 | key = [key stringByAppendingString:additionalIdentifier];
195 | }
196 | return key;
197 | }
198 |
199 | @end
200 |
201 | #endif
202 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h:
--------------------------------------------------------------------------------
1 | // AFNetworkActivityIndicatorManager.h
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import
23 |
24 | #import
25 |
26 | #if TARGET_OS_IOS
27 |
28 | #import
29 |
30 | NS_ASSUME_NONNULL_BEGIN
31 |
32 | /**
33 | `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a session task has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero.
34 |
35 | You should enable the shared instance of `AFNetworkActivityIndicatorManager` when your application finishes launching. In `AppDelegate application:didFinishLaunchingWithOptions:` you can do so with the following code:
36 |
37 | [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
38 |
39 | By setting `enabled` to `YES` for `sharedManager`, the network activity indicator will show and hide automatically as requests start and finish. You should not ever need to call `incrementActivityCount` or `decrementActivityCount` yourself.
40 |
41 | See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information:
42 | http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44
43 | */
44 | NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.")
45 | @interface AFNetworkActivityIndicatorManager : NSObject
46 |
47 | /**
48 | A Boolean value indicating whether the manager is enabled.
49 |
50 | If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO.
51 | */
52 | @property (nonatomic, assign, getter = isEnabled) BOOL enabled;
53 |
54 | /**
55 | A Boolean value indicating whether the network activity indicator manager is currently active.
56 | */
57 | @property (readonly, nonatomic, assign, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible;
58 |
59 | /**
60 | A time interval indicating the minimum duration of networking activity that should occur before the activity indicator is displayed. The default value 1 second. If the network activity indicator should be displayed immediately when network activity occurs, this value should be set to 0 seconds.
61 |
62 | Apple's HIG describes the following:
63 |
64 | > Display the network activity indicator to provide feedback when your app accesses the network for more than a couple of seconds. If the operation finishes sooner than that, you don’t have to show the network activity indicator, because the indicator is likely to disappear before users notice its presence.
65 |
66 | */
67 | @property (nonatomic, assign) NSTimeInterval activationDelay;
68 |
69 | /**
70 | A time interval indicating the duration of time of no networking activity required before the activity indicator is disabled. This allows for continuous display of the network activity indicator across multiple requests. The default value is 0.17 seconds.
71 | */
72 |
73 | @property (nonatomic, assign) NSTimeInterval completionDelay;
74 |
75 | /**
76 | Returns the shared network activity indicator manager object for the system.
77 |
78 | @return The systemwide network activity indicator manager.
79 | */
80 | + (instancetype)sharedManager;
81 |
82 | /**
83 | Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator.
84 | */
85 | - (void)incrementActivityCount;
86 |
87 | /**
88 | Decrements the number of active network requests. If this number becomes zero after decrementing, this will stop animating the status bar network activity indicator.
89 | */
90 | - (void)decrementActivityCount;
91 |
92 | /**
93 | Set the a custom method to be executed when the network activity indicator manager should be hidden/shown. By default, this is null, and the UIApplication Network Activity Indicator will be managed automatically. If this block is set, it is the responsiblity of the caller to manager the network activity indicator going forward.
94 |
95 | @param block A block to be executed when the network activity indicator status changes.
96 | */
97 | - (void)setNetworkingActivityActionWithBlock:(nullable void (^)(BOOL networkActivityIndicatorVisible))block;
98 |
99 | @end
100 |
101 | NS_ASSUME_NONNULL_END
102 |
103 | #endif
104 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | // UIActivityIndicatorView+AFNetworking.h
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import
23 |
24 | #import
25 |
26 | #if TARGET_OS_IOS || TARGET_OS_TV
27 |
28 | #import
29 |
30 | /**
31 | This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a session task.
32 | */
33 | @interface UIActivityIndicatorView (AFNetworking)
34 |
35 | ///----------------------------------
36 | /// @name Animating for Session Tasks
37 | ///----------------------------------
38 |
39 | /**
40 | Binds the animating state to the state of the specified task.
41 |
42 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled.
43 | */
44 | - (void)setAnimatingWithStateOfTask:(nullable NSURLSessionTask *)task;
45 |
46 | @end
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m:
--------------------------------------------------------------------------------
1 | // UIActivityIndicatorView+AFNetworking.m
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import "UIActivityIndicatorView+AFNetworking.h"
23 | #import
24 |
25 | #if TARGET_OS_IOS || TARGET_OS_TV
26 |
27 | #import "AFURLSessionManager.h"
28 |
29 | @interface AFActivityIndicatorViewNotificationObserver : NSObject
30 | @property (readonly, nonatomic, weak) UIActivityIndicatorView *activityIndicatorView;
31 | - (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView;
32 |
33 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task;
34 |
35 | @end
36 |
37 | @implementation UIActivityIndicatorView (AFNetworking)
38 |
39 | - (AFActivityIndicatorViewNotificationObserver *)af_notificationObserver {
40 | AFActivityIndicatorViewNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver));
41 | if (notificationObserver == nil) {
42 | notificationObserver = [[AFActivityIndicatorViewNotificationObserver alloc] initWithActivityIndicatorView:self];
43 | objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
44 | }
45 | return notificationObserver;
46 | }
47 |
48 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task {
49 | [[self af_notificationObserver] setAnimatingWithStateOfTask:task];
50 | }
51 |
52 | @end
53 |
54 | @implementation AFActivityIndicatorViewNotificationObserver
55 |
56 | - (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView
57 | {
58 | self = [super init];
59 | if (self) {
60 | _activityIndicatorView = activityIndicatorView;
61 | }
62 | return self;
63 | }
64 |
65 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task {
66 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
67 |
68 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
69 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
70 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
71 |
72 | if (task) {
73 | if (task.state != NSURLSessionTaskStateCompleted) {
74 |
75 | #pragma clang diagnostic push
76 | #pragma clang diagnostic ignored "-Wreceiver-is-weak"
77 | #pragma clang diagnostic ignored "-Warc-repeated-use-of-weak"
78 | if (task.state == NSURLSessionTaskStateRunning) {
79 | [self.activityIndicatorView startAnimating];
80 | } else {
81 | [self.activityIndicatorView stopAnimating];
82 | }
83 | #pragma clang diagnostic pop
84 |
85 | [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingTaskDidResumeNotification object:task];
86 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidCompleteNotification object:task];
87 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidSuspendNotification object:task];
88 | }
89 | }
90 | }
91 |
92 | #pragma mark -
93 |
94 | - (void)af_startAnimating {
95 | dispatch_async(dispatch_get_main_queue(), ^{
96 | #pragma clang diagnostic push
97 | #pragma clang diagnostic ignored "-Wreceiver-is-weak"
98 | [self.activityIndicatorView startAnimating];
99 | #pragma clang diagnostic pop
100 | });
101 | }
102 |
103 | - (void)af_stopAnimating {
104 | dispatch_async(dispatch_get_main_queue(), ^{
105 | #pragma clang diagnostic push
106 | #pragma clang diagnostic ignored "-Wreceiver-is-weak"
107 | [self.activityIndicatorView stopAnimating];
108 | #pragma clang diagnostic pop
109 | });
110 | }
111 |
112 | #pragma mark -
113 |
114 | - (void)dealloc {
115 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
116 |
117 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
118 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
119 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
120 | }
121 |
122 | @end
123 |
124 | #endif
125 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+AFNetworking.h
3 | //
4 | //
5 | // Created by Paulo Ferreira on 08/07/15.
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 |
25 | #if TARGET_OS_IOS || TARGET_OS_TV
26 |
27 | #import
28 |
29 | @interface UIImage (AFNetworking)
30 |
31 | + (UIImage*) safeImageWithData:(NSData*)data;
32 |
33 | @end
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | // UIImageView+AFNetworking.h
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import
23 |
24 | #import
25 |
26 | #if TARGET_OS_IOS || TARGET_OS_TV
27 |
28 | #import
29 |
30 | NS_ASSUME_NONNULL_BEGIN
31 |
32 | @class AFImageDownloader;
33 |
34 | /**
35 | This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL.
36 | */
37 | @interface UIImageView (AFNetworking)
38 |
39 | ///------------------------------------
40 | /// @name Accessing the Image Downloader
41 | ///------------------------------------
42 |
43 | /**
44 | Set the shared image downloader used to download images.
45 |
46 | @param imageDownloader The shared image downloader used to download images.
47 | */
48 | + (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader;
49 |
50 | /**
51 | The shared image downloader used to download images.
52 | */
53 | + (AFImageDownloader *)sharedImageDownloader;
54 |
55 | ///--------------------
56 | /// @name Setting Image
57 | ///--------------------
58 |
59 | /**
60 | Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.
61 |
62 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
63 |
64 | By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`
65 |
66 | @param url The URL used for the image request.
67 | */
68 | - (void)setImageWithURL:(NSURL *)url;
69 |
70 | /**
71 | Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.
72 |
73 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
74 |
75 | By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`
76 |
77 | @param url The URL used for the image request.
78 | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.
79 | */
80 | - (void)setImageWithURL:(NSURL *)url
81 | placeholderImage:(nullable UIImage *)placeholderImage;
82 |
83 | /**
84 | Asynchronously downloads an image from the specified URL request, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.
85 |
86 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
87 |
88 | If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is applied.
89 |
90 | @param urlRequest The URL request used for the image request.
91 | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.
92 | @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
93 | @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
94 | */
95 | - (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
96 | placeholderImage:(nullable UIImage *)placeholderImage
97 | success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
98 | failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
99 |
100 | /**
101 | Cancels any executing image operation for the receiver, if one exists.
102 | */
103 | - (void)cancelImageDownloadTask;
104 |
105 | @end
106 |
107 | NS_ASSUME_NONNULL_END
108 |
109 | #endif
110 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m:
--------------------------------------------------------------------------------
1 | // UIImageView+AFNetworking.m
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import "UIImageView+AFNetworking.h"
23 |
24 | #import
25 |
26 | #if TARGET_OS_IOS || TARGET_OS_TV
27 |
28 | #import "AFImageDownloader.h"
29 |
30 | @interface UIImageView (_AFNetworking)
31 | @property (readwrite, nonatomic, strong, setter = af_setActiveImageDownloadReceipt:) AFImageDownloadReceipt *af_activeImageDownloadReceipt;
32 | @end
33 |
34 | @implementation UIImageView (_AFNetworking)
35 |
36 | - (AFImageDownloadReceipt *)af_activeImageDownloadReceipt {
37 | return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, @selector(af_activeImageDownloadReceipt));
38 | }
39 |
40 | - (void)af_setActiveImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt {
41 | objc_setAssociatedObject(self, @selector(af_activeImageDownloadReceipt), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
42 | }
43 |
44 | @end
45 |
46 | #pragma mark -
47 |
48 | @implementation UIImageView (AFNetworking)
49 |
50 | + (AFImageDownloader *)sharedImageDownloader {
51 |
52 | #pragma clang diagnostic push
53 | #pragma clang diagnostic ignored "-Wgnu"
54 | return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];
55 | #pragma clang diagnostic pop
56 | }
57 |
58 | + (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader {
59 | objc_setAssociatedObject(self, @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
60 | }
61 |
62 | #pragma mark -
63 |
64 | - (void)setImageWithURL:(NSURL *)url {
65 | [self setImageWithURL:url placeholderImage:nil];
66 | }
67 |
68 | - (void)setImageWithURL:(NSURL *)url
69 | placeholderImage:(UIImage *)placeholderImage
70 | {
71 | NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
72 | [request addValue:@"image/*" forHTTPHeaderField:@"Accept"];
73 |
74 | [self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];
75 | }
76 |
77 | - (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
78 | placeholderImage:(UIImage *)placeholderImage
79 | success:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
80 | failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure
81 | {
82 |
83 | if ([urlRequest URL] == nil) {
84 | [self cancelImageDownloadTask];
85 | self.image = placeholderImage;
86 | return;
87 | }
88 |
89 | if ([self isActiveTaskURLEqualToURLRequest:urlRequest]){
90 | return;
91 | }
92 |
93 | [self cancelImageDownloadTask];
94 |
95 | AFImageDownloader *downloader = [[self class] sharedImageDownloader];
96 | id imageCache = downloader.imageCache;
97 |
98 | //Use the image from the image cache if it exists
99 | UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil];
100 | if (cachedImage) {
101 | if (success) {
102 | success(urlRequest, nil, cachedImage);
103 | } else {
104 | self.image = cachedImage;
105 | }
106 | [self clearActiveDownloadInformation];
107 | } else {
108 | if (placeholderImage) {
109 | self.image = placeholderImage;
110 | }
111 |
112 | __weak __typeof(self)weakSelf = self;
113 | NSUUID *downloadID = [NSUUID UUID];
114 | AFImageDownloadReceipt *receipt;
115 | receipt = [downloader
116 | downloadImageForURLRequest:urlRequest
117 | withReceiptID:downloadID
118 | success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {
119 | __strong __typeof(weakSelf)strongSelf = weakSelf;
120 | if ([strongSelf.af_activeImageDownloadReceipt.receiptID isEqual:downloadID]) {
121 | if (success) {
122 | success(request, response, responseObject);
123 | } else if(responseObject) {
124 | strongSelf.image = responseObject;
125 | }
126 | [strongSelf clearActiveDownloadInformation];
127 | }
128 |
129 | }
130 | failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {
131 | __strong __typeof(weakSelf)strongSelf = weakSelf;
132 | if ([strongSelf.af_activeImageDownloadReceipt.receiptID isEqual:downloadID]) {
133 | if (failure) {
134 | failure(request, response, error);
135 | }
136 | [strongSelf clearActiveDownloadInformation];
137 | }
138 | }];
139 |
140 | self.af_activeImageDownloadReceipt = receipt;
141 | }
142 | }
143 |
144 | - (void)cancelImageDownloadTask {
145 | if (self.af_activeImageDownloadReceipt != nil) {
146 | [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:self.af_activeImageDownloadReceipt];
147 | [self clearActiveDownloadInformation];
148 | }
149 | }
150 |
151 | - (void)clearActiveDownloadInformation {
152 | self.af_activeImageDownloadReceipt = nil;
153 | }
154 |
155 | - (BOOL)isActiveTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest {
156 | return [self.af_activeImageDownloadReceipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString];
157 | }
158 |
159 | @end
160 |
161 | #endif
162 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h:
--------------------------------------------------------------------------------
1 | // UIKit+AFNetworking.h
2 | //
3 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 |
23 | #if TARGET_OS_IOS || TARGET_OS_TV
24 | #import
25 |
26 | #ifndef _UIKIT_AFNETWORKING_
27 | #define _UIKIT_AFNETWORKING_
28 |
29 | #if TARGET_OS_IOS
30 | #import "AFAutoPurgingImageCache.h"
31 | #import "AFImageDownloader.h"
32 | #import "AFNetworkActivityIndicatorManager.h"
33 | #import "UIRefreshControl+AFNetworking.h"
34 | #import "UIWebView+AFNetworking.h"
35 | #endif
36 |
37 | #import "UIActivityIndicatorView+AFNetworking.h"
38 | #import "UIButton+AFNetworking.h"
39 | #import "UIImageView+AFNetworking.h"
40 | #import "UIProgressView+AFNetworking.h"
41 | #endif /* _UIKIT_AFNETWORKING_ */
42 | #endif
43 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | // UIProgressView+AFNetworking.h
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import
23 |
24 | #import
25 |
26 | #if TARGET_OS_IOS || TARGET_OS_TV
27 |
28 | #import
29 |
30 | NS_ASSUME_NONNULL_BEGIN
31 |
32 |
33 | /**
34 | This category adds methods to the UIKit framework's `UIProgressView` class. The methods in this category provide support for binding the progress to the upload and download progress of a session task.
35 | */
36 | @interface UIProgressView (AFNetworking)
37 |
38 | ///------------------------------------
39 | /// @name Setting Session Task Progress
40 | ///------------------------------------
41 |
42 | /**
43 | Binds the progress to the upload progress of the specified session task.
44 |
45 | @param task The session task.
46 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately.
47 | */
48 | - (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task
49 | animated:(BOOL)animated;
50 |
51 | /**
52 | Binds the progress to the download progress of the specified session task.
53 |
54 | @param task The session task.
55 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately.
56 | */
57 | - (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task
58 | animated:(BOOL)animated;
59 |
60 | @end
61 |
62 | NS_ASSUME_NONNULL_END
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m:
--------------------------------------------------------------------------------
1 | // UIProgressView+AFNetworking.m
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import "UIProgressView+AFNetworking.h"
23 |
24 | #import
25 |
26 | #if TARGET_OS_IOS || TARGET_OS_TV
27 |
28 | #import "AFURLSessionManager.h"
29 |
30 | static void * AFTaskCountOfBytesSentContext = &AFTaskCountOfBytesSentContext;
31 | static void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedContext;
32 |
33 | #pragma mark -
34 |
35 | @implementation UIProgressView (AFNetworking)
36 |
37 | - (BOOL)af_uploadProgressAnimated {
38 | return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_uploadProgressAnimated)) boolValue];
39 | }
40 |
41 | - (void)af_setUploadProgressAnimated:(BOOL)animated {
42 | objc_setAssociatedObject(self, @selector(af_uploadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
43 | }
44 |
45 | - (BOOL)af_downloadProgressAnimated {
46 | return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_downloadProgressAnimated)) boolValue];
47 | }
48 |
49 | - (void)af_setDownloadProgressAnimated:(BOOL)animated {
50 | objc_setAssociatedObject(self, @selector(af_downloadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
51 | }
52 |
53 | #pragma mark -
54 |
55 | - (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task
56 | animated:(BOOL)animated
57 | {
58 | [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];
59 | [task addObserver:self forKeyPath:@"countOfBytesSent" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];
60 |
61 | [self af_setUploadProgressAnimated:animated];
62 | }
63 |
64 | - (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task
65 | animated:(BOOL)animated
66 | {
67 | [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];
68 | [task addObserver:self forKeyPath:@"countOfBytesReceived" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];
69 |
70 | [self af_setDownloadProgressAnimated:animated];
71 | }
72 |
73 | #pragma mark - NSKeyValueObserving
74 |
75 | - (void)observeValueForKeyPath:(NSString *)keyPath
76 | ofObject:(id)object
77 | change:(__unused NSDictionary *)change
78 | context:(void *)context
79 | {
80 | if (context == AFTaskCountOfBytesSentContext || context == AFTaskCountOfBytesReceivedContext) {
81 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) {
82 | if ([object countOfBytesExpectedToSend] > 0) {
83 | dispatch_async(dispatch_get_main_queue(), ^{
84 | [self setProgress:[object countOfBytesSent] / ([object countOfBytesExpectedToSend] * 1.0f) animated:self.af_uploadProgressAnimated];
85 | });
86 | }
87 | }
88 |
89 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) {
90 | if ([object countOfBytesExpectedToReceive] > 0) {
91 | dispatch_async(dispatch_get_main_queue(), ^{
92 | [self setProgress:[object countOfBytesReceived] / ([object countOfBytesExpectedToReceive] * 1.0f) animated:self.af_downloadProgressAnimated];
93 | });
94 | }
95 | }
96 |
97 | if ([keyPath isEqualToString:NSStringFromSelector(@selector(state))]) {
98 | if ([(NSURLSessionTask *)object state] == NSURLSessionTaskStateCompleted) {
99 | @try {
100 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(state))];
101 |
102 | if (context == AFTaskCountOfBytesSentContext) {
103 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))];
104 | }
105 |
106 | if (context == AFTaskCountOfBytesReceivedContext) {
107 | [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))];
108 | }
109 | }
110 | @catch (NSException * __unused exception) {}
111 | }
112 | }
113 | }
114 | }
115 |
116 | @end
117 |
118 | #endif
119 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h:
--------------------------------------------------------------------------------
1 | // UIRefreshControl+AFNetworking.m
2 | //
3 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 |
23 | #import
24 |
25 | #import
26 |
27 | #if TARGET_OS_IOS
28 |
29 | #import
30 |
31 | NS_ASSUME_NONNULL_BEGIN
32 |
33 | /**
34 | This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically beginning and ending refreshing depending on the loading state of a session task.
35 | */
36 | @interface UIRefreshControl (AFNetworking)
37 |
38 | ///-----------------------------------
39 | /// @name Refreshing for Session Tasks
40 | ///-----------------------------------
41 |
42 | /**
43 | Binds the refreshing state to the state of the specified task.
44 |
45 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled.
46 | */
47 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task;
48 |
49 | @end
50 |
51 | NS_ASSUME_NONNULL_END
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m:
--------------------------------------------------------------------------------
1 | // UIRefreshControl+AFNetworking.m
2 | //
3 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 |
23 | #import "UIRefreshControl+AFNetworking.h"
24 | #import
25 |
26 | #if TARGET_OS_IOS
27 |
28 | #import "AFURLSessionManager.h"
29 |
30 | @interface AFRefreshControlNotificationObserver : NSObject
31 | @property (readonly, nonatomic, weak) UIRefreshControl *refreshControl;
32 | - (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl;
33 |
34 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task;
35 |
36 | @end
37 |
38 | @implementation UIRefreshControl (AFNetworking)
39 |
40 | - (AFRefreshControlNotificationObserver *)af_notificationObserver {
41 | AFRefreshControlNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver));
42 | if (notificationObserver == nil) {
43 | notificationObserver = [[AFRefreshControlNotificationObserver alloc] initWithActivityRefreshControl:self];
44 | objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
45 | }
46 | return notificationObserver;
47 | }
48 |
49 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task {
50 | [[self af_notificationObserver] setRefreshingWithStateOfTask:task];
51 | }
52 |
53 | @end
54 |
55 | @implementation AFRefreshControlNotificationObserver
56 |
57 | - (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl
58 | {
59 | self = [super init];
60 | if (self) {
61 | _refreshControl = refreshControl;
62 | }
63 | return self;
64 | }
65 |
66 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task {
67 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
68 |
69 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
70 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
71 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
72 |
73 | if (task) {
74 | #pragma clang diagnostic push
75 | #pragma clang diagnostic ignored "-Wreceiver-is-weak"
76 | #pragma clang diagnostic ignored "-Warc-repeated-use-of-weak"
77 | if (task.state == NSURLSessionTaskStateRunning) {
78 | [self.refreshControl beginRefreshing];
79 |
80 | [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingTaskDidResumeNotification object:task];
81 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidCompleteNotification object:task];
82 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidSuspendNotification object:task];
83 | } else {
84 | [self.refreshControl endRefreshing];
85 | }
86 | #pragma clang diagnostic pop
87 | }
88 | }
89 |
90 | #pragma mark -
91 |
92 | - (void)af_beginRefreshing {
93 | dispatch_async(dispatch_get_main_queue(), ^{
94 | #pragma clang diagnostic push
95 | #pragma clang diagnostic ignored "-Wreceiver-is-weak"
96 | [self.refreshControl beginRefreshing];
97 | #pragma clang diagnostic pop
98 | });
99 | }
100 |
101 | - (void)af_endRefreshing {
102 | dispatch_async(dispatch_get_main_queue(), ^{
103 | #pragma clang diagnostic push
104 | #pragma clang diagnostic ignored "-Wreceiver-is-weak"
105 | [self.refreshControl endRefreshing];
106 | #pragma clang diagnostic pop
107 | });
108 | }
109 |
110 | #pragma mark -
111 |
112 | - (void)dealloc {
113 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
114 |
115 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
116 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
117 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
118 | }
119 |
120 | @end
121 |
122 | #endif
123 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | // UIWebView+AFNetworking.h
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import
23 |
24 | #import
25 |
26 | #if TARGET_OS_IOS
27 |
28 | #import
29 |
30 | NS_ASSUME_NONNULL_BEGIN
31 |
32 | @class AFHTTPSessionManager;
33 |
34 | /**
35 | This category adds methods to the UIKit framework's `UIWebView` class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling.
36 |
37 | @discussion When using these category methods, make sure to assign `delegate` for the web view, which implements `–webView:shouldStartLoadWithRequest:navigationType:` appropriately. This allows for tapped links to be loaded through AFNetworking, and can ensure that `canGoBack` & `canGoForward` update their values correctly.
38 | */
39 | @interface UIWebView (AFNetworking)
40 |
41 | /**
42 | The session manager used to download all requests.
43 | */
44 | @property (nonatomic, strong) AFHTTPSessionManager *sessionManager;
45 |
46 | /**
47 | Asynchronously loads the specified request.
48 |
49 | @param request A URL request identifying the location of the content to load. This must not be `nil`.
50 | @param progress A progress object monitoring the current download progress.
51 | @param success A block object to be executed when the request finishes loading successfully. This block returns the HTML string to be loaded by the web view, and takes two arguments: the response, and the response string.
52 | @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred.
53 | */
54 | - (void)loadRequest:(NSURLRequest *)request
55 | progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
56 | success:(nullable NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success
57 | failure:(nullable void (^)(NSError *error))failure;
58 |
59 | /**
60 | Asynchronously loads the data associated with a particular request with a specified MIME type and text encoding.
61 |
62 | @param request A URL request identifying the location of the content to load. This must not be `nil`.
63 | @param MIMEType The MIME type of the content. Defaults to the content type of the response if not specified.
64 | @param textEncodingName The IANA encoding name, as in `utf-8` or `utf-16`. Defaults to the response text encoding if not specified.
65 | @param progress A progress object monitoring the current download progress.
66 | @param success A block object to be executed when the request finishes loading successfully. This block returns the data to be loaded by the web view and takes two arguments: the response, and the downloaded data.
67 | @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred.
68 | */
69 | - (void)loadRequest:(NSURLRequest *)request
70 | MIMEType:(nullable NSString *)MIMEType
71 | textEncodingName:(nullable NSString *)textEncodingName
72 | progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
73 | success:(nullable NSData * (^)(NSHTTPURLResponse *response, NSData *data))success
74 | failure:(nullable void (^)(NSError *error))failure;
75 |
76 | @end
77 |
78 | NS_ASSUME_NONNULL_END
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/Example/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m:
--------------------------------------------------------------------------------
1 | // UIWebView+AFNetworking.m
2 | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | #import "UIWebView+AFNetworking.h"
23 |
24 | #import
25 |
26 | #if TARGET_OS_IOS
27 |
28 | #import "AFHTTPSessionManager.h"
29 | #import "AFURLResponseSerialization.h"
30 | #import "AFURLRequestSerialization.h"
31 |
32 | @interface UIWebView (_AFNetworking)
33 | @property (readwrite, nonatomic, strong, setter = af_setURLSessionTask:) NSURLSessionDataTask *af_URLSessionTask;
34 | @end
35 |
36 | @implementation UIWebView (_AFNetworking)
37 |
38 | - (NSURLSessionDataTask *)af_URLSessionTask {
39 | return (NSURLSessionDataTask *)objc_getAssociatedObject(self, @selector(af_URLSessionTask));
40 | }
41 |
42 | - (void)af_setURLSessionTask:(NSURLSessionDataTask *)af_URLSessionTask {
43 | objc_setAssociatedObject(self, @selector(af_URLSessionTask), af_URLSessionTask, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
44 | }
45 |
46 | @end
47 |
48 | #pragma mark -
49 |
50 | @implementation UIWebView (AFNetworking)
51 |
52 | - (AFHTTPSessionManager *)sessionManager {
53 | static AFHTTPSessionManager *_af_defaultHTTPSessionManager = nil;
54 | static dispatch_once_t onceToken;
55 | dispatch_once(&onceToken, ^{
56 | _af_defaultHTTPSessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
57 | _af_defaultHTTPSessionManager.requestSerializer = [AFHTTPRequestSerializer serializer];
58 | _af_defaultHTTPSessionManager.responseSerializer = [AFHTTPResponseSerializer serializer];
59 | });
60 |
61 | #pragma clang diagnostic push
62 | #pragma clang diagnostic ignored "-Wgnu"
63 | return objc_getAssociatedObject(self, @selector(sessionManager)) ?: _af_defaultHTTPSessionManager;
64 | #pragma clang diagnostic pop
65 | }
66 |
67 | - (void)setSessionManager:(AFHTTPSessionManager *)sessionManager {
68 | objc_setAssociatedObject(self, @selector(sessionManager), sessionManager, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
69 | }
70 |
71 | - (AFHTTPResponseSerializer *)responseSerializer {
72 | static AFHTTPResponseSerializer *_af_defaultResponseSerializer = nil;
73 | static dispatch_once_t onceToken;
74 | dispatch_once(&onceToken, ^{
75 | _af_defaultResponseSerializer = [AFHTTPResponseSerializer serializer];
76 | });
77 |
78 | #pragma clang diagnostic push
79 | #pragma clang diagnostic ignored "-Wgnu"
80 | return objc_getAssociatedObject(self, @selector(responseSerializer)) ?: _af_defaultResponseSerializer;
81 | #pragma clang diagnostic pop
82 | }
83 |
84 | - (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer {
85 | objc_setAssociatedObject(self, @selector(responseSerializer), responseSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
86 | }
87 |
88 | #pragma mark -
89 |
90 | - (void)loadRequest:(NSURLRequest *)request
91 | progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
92 | success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success
93 | failure:(void (^)(NSError *error))failure
94 | {
95 | [self loadRequest:request MIMEType:nil textEncodingName:nil progress:progress success:^NSData *(NSHTTPURLResponse *response, NSData *data) {
96 | NSStringEncoding stringEncoding = NSUTF8StringEncoding;
97 | if (response.textEncodingName) {
98 | CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName);
99 | if (encoding != kCFStringEncodingInvalidId) {
100 | stringEncoding = CFStringConvertEncodingToNSStringEncoding(encoding);
101 | }
102 | }
103 |
104 | NSString *string = [[NSString alloc] initWithData:data encoding:stringEncoding];
105 | if (success) {
106 | string = success(response, string);
107 | }
108 |
109 | return [string dataUsingEncoding:stringEncoding];
110 | } failure:failure];
111 | }
112 |
113 | - (void)loadRequest:(NSURLRequest *)request
114 | MIMEType:(NSString *)MIMEType
115 | textEncodingName:(NSString *)textEncodingName
116 | progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
117 | success:(NSData * (^)(NSHTTPURLResponse *response, NSData *data))success
118 | failure:(void (^)(NSError *error))failure
119 | {
120 | NSParameterAssert(request);
121 |
122 | if (self.af_URLSessionTask.state == NSURLSessionTaskStateRunning || self.af_URLSessionTask.state == NSURLSessionTaskStateSuspended) {
123 | [self.af_URLSessionTask cancel];
124 | }
125 | self.af_URLSessionTask = nil;
126 |
127 | __weak __typeof(self)weakSelf = self;
128 | NSURLSessionDataTask *dataTask;
129 | dataTask = [self.sessionManager
130 | GET:request.URL.absoluteString
131 | parameters:nil
132 | progress:nil
133 | success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
134 | __strong __typeof(weakSelf) strongSelf = weakSelf;
135 | if (success) {
136 | success((NSHTTPURLResponse *)task.response, responseObject);
137 | }
138 | [strongSelf loadData:responseObject MIMEType:MIMEType textEncodingName:textEncodingName baseURL:[task.currentRequest URL]];
139 |
140 | if ([strongSelf.delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
141 | [strongSelf.delegate webViewDidFinishLoad:strongSelf];
142 | }
143 | }
144 | failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
145 | if (failure) {
146 | failure(error);
147 | }
148 | }];
149 | self.af_URLSessionTask = dataTask;
150 | if (progress != nil) {
151 | *progress = [self.sessionManager downloadProgressForTask:dataTask];
152 | }
153 | [self.af_URLSessionTask resume];
154 |
155 | if ([self.delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
156 | [self.delegate webViewDidStartLoad:self];
157 | }
158 | }
159 |
160 | @end
161 |
162 | #endif
--------------------------------------------------------------------------------
/Example/Pods/AFOAuth2Manager/AFOAuth2Manager/AFHTTPRequestSerializer+OAuth2.h:
--------------------------------------------------------------------------------
1 | // AFHTTPRequestSerializer+OAuth2.h
2 | //
3 | // Copyright (c) 2012-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 | @class AFOAuthCredential;
26 |
27 | @interface AFHTTPRequestSerializer (OAuth2)
28 |
29 | /**
30 | Sets the "Authorization" HTTP header set in request objects made by the HTTP client to contain the access token within the OAuth credential. This overwrites any existing value for this header.
31 |
32 | @param credential The OAuth2 credential
33 | */
34 | - (void)setAuthorizationHeaderFieldWithCredential:(AFOAuthCredential *)credential;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/Example/Pods/AFOAuth2Manager/AFOAuth2Manager/AFHTTPRequestSerializer+OAuth2.m:
--------------------------------------------------------------------------------
1 | // AFHTTPRequestSerializer+OAuth2.m
2 | //
3 | // Copyright (c) 2012-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 "AFHTTPRequestSerializer+OAuth2.h"
24 | #import "AFOAuth2Manager.h"
25 | #import "AFOAuthCredential.h"
26 |
27 | @implementation AFHTTPRequestSerializer (OAuth2)
28 |
29 | - (void)setAuthorizationHeaderFieldWithCredential:(AFOAuthCredential *)credential {
30 | if ([credential.tokenType compare:@"Bearer" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
31 | [self setValue:[NSString stringWithFormat:@"Bearer %@", credential.accessToken] forHTTPHeaderField:@"Authorization"];
32 | }
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Example/Pods/AFOAuth2Manager/AFOAuth2Manager/AFOAuthCredential.h:
--------------------------------------------------------------------------------
1 | // AFOAuthCredential.h
2 | //
3 | // Copyright (c) 2012-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 | NS_ASSUME_NONNULL_BEGIN
26 |
27 | /**
28 | `AFOAuthCredential` models the credentials returned from an OAuth server, storing the token type, access & refresh tokens, and whether the token is expired.
29 |
30 | OAuth credentials can be stored in the user's keychain, and retrieved on subsequent launches.
31 | */
32 | @interface AFOAuthCredential : NSObject
33 |
34 | ///--------------------------------------
35 | /// @name Accessing Credential Properties
36 | ///--------------------------------------
37 |
38 | /**
39 | The OAuth access token.
40 | */
41 | @property (readonly, nonatomic, copy) NSString *accessToken;
42 |
43 | /**
44 | The OAuth token type (e.g. "bearer").
45 | */
46 | @property (readonly, nonatomic, copy) NSString *tokenType;
47 |
48 | /**
49 | The OAuth refresh token.
50 | */
51 | @property (readonly, nonatomic, copy) NSString *refreshToken;
52 |
53 | /**
54 | Whether the OAuth credentials are expired.
55 | */
56 | @property (readonly, nonatomic, assign, getter = isExpired) BOOL expired;
57 |
58 | ///--------------------------------------------
59 | /// @name Creating and Initializing Credentials
60 | ///--------------------------------------------
61 |
62 | /**
63 | Create an OAuth credential from a token string, with a specified type.
64 |
65 | @param token The OAuth token string.
66 | @param type The OAuth token type.
67 | */
68 | + (instancetype)credentialWithOAuthToken:(NSString *)token
69 | tokenType:(NSString *)type;
70 |
71 | /**
72 | Initialize an OAuth credential from a token string, with a specified type.
73 |
74 | @param token The OAuth token string.
75 | @param type The OAuth token type.
76 | */
77 | - (id)initWithOAuthToken:(NSString *)token
78 | tokenType:(NSString *)type;
79 |
80 | ///----------------------------
81 | /// @name Setting Refresh Token
82 | ///----------------------------
83 |
84 | /**
85 | Set the credential refresh token, without a specific expiration
86 |
87 | @param refreshToken The OAuth refresh token.
88 | */
89 | - (void)setRefreshToken:(NSString *)refreshToken;
90 |
91 |
92 | /**
93 | Set the expiration on the access token. If no expiration is given by the OAuth2 provider,
94 | you may pass in [NSDate distantFuture]
95 |
96 | @param expiration The expiration of the access token. This must not be `nil`.
97 | */
98 | - (void)setExpiration:(NSDate *)expiration;
99 |
100 | /**
101 | Set the credential refresh token, with a specified expiration.
102 |
103 | @param refreshToken The OAuth refresh token.
104 | @param expiration The expiration of the access token. This must not be `nil`.
105 | */
106 | - (void)setRefreshToken:(NSString *)refreshToken
107 | expiration:(NSDate *)expiration;
108 |
109 | ///-----------------------------------------
110 | /// @name Storing and Retrieving Credentials
111 | ///-----------------------------------------
112 |
113 | /**
114 | Stores the specified OAuth credential for a given web service identifier in the Keychain.
115 | with the default Keychain Accessibilty of kSecAttrAccessibleWhenUnlocked.
116 |
117 | @param credential The OAuth credential to be stored.
118 | @param identifier The service identifier associated with the specified credential.
119 |
120 | @return Whether or not the credential was stored in the keychain.
121 | */
122 | + (BOOL)storeCredential:(AFOAuthCredential *)credential
123 | withIdentifier:(NSString *)identifier;
124 |
125 | /**
126 | Stores the specified OAuth token for a given web service identifier in the Keychain.
127 |
128 | @param credential The OAuth credential to be stored.
129 | @param identifier The service identifier associated with the specified token.
130 | @param securityAccessibility The Keychain security accessibility to store the credential with.
131 |
132 | @return Whether or not the credential was stored in the keychain.
133 | */
134 | + (BOOL)storeCredential:(AFOAuthCredential *)credential
135 | withIdentifier:(NSString *)identifier
136 | withAccessibility:(id)securityAccessibility;
137 |
138 | /**
139 | Retrieves the OAuth credential stored with the specified service identifier from the Keychain.
140 |
141 | @param identifier The service identifier associated with the specified credential.
142 |
143 | @return The retrieved OAuth credential.
144 | */
145 | + (nullable AFOAuthCredential *)retrieveCredentialWithIdentifier:(NSString *)identifier;
146 |
147 | /**
148 | Deletes the OAuth credential stored with the specified service identifier from the Keychain.
149 |
150 | @param identifier The service identifier associated with the specified credential.
151 |
152 | @return Whether or not the credential was deleted from the keychain.
153 | */
154 | + (BOOL)deleteCredentialWithIdentifier:(NSString *)identifier;
155 |
156 | @end
157 |
158 | NS_ASSUME_NONNULL_END
159 |
--------------------------------------------------------------------------------
/Example/Pods/AFOAuth2Manager/AFOAuth2Manager/AFOAuthCredential.m:
--------------------------------------------------------------------------------
1 | // AFOAuthCredential.m
2 | //
3 | // Copyright (c) 2012-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 "AFOAuthCredential.h"
24 |
25 | NSString * const kAFOAuth2CredentialServiceName = @"AFOAuthCredentialService";
26 |
27 | static NSDictionary * AFKeychainQueryDictionaryWithIdentifier(NSString *identifier) {
28 | NSCParameterAssert(identifier);
29 |
30 | return @{
31 | (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,
32 | (__bridge id)kSecAttrService: kAFOAuth2CredentialServiceName,
33 | (__bridge id)kSecAttrAccount: identifier
34 | };
35 | }
36 |
37 | @interface AFOAuthCredential()
38 | @property (readwrite, nonatomic, copy) NSString *accessToken;
39 | @property (readwrite, nonatomic, copy) NSString *tokenType;
40 | @property (readwrite, nonatomic, copy) NSString *refreshToken;
41 | @property (readwrite, nonatomic, copy) NSDate *expiration;
42 | @end
43 |
44 |
45 | @implementation AFOAuthCredential
46 | //@dynamic expired;
47 |
48 | #pragma mark -
49 |
50 | + (instancetype)credentialWithOAuthToken:(NSString *)token
51 | tokenType:(NSString *)type
52 | {
53 | return [[self alloc] initWithOAuthToken:token tokenType:type];
54 | }
55 |
56 | - (id)initWithOAuthToken:(NSString *)token
57 | tokenType:(NSString *)type
58 | {
59 | self = [super init];
60 | if (!self) {
61 | return nil;
62 | }
63 |
64 | self.accessToken = token;
65 | self.tokenType = type;
66 |
67 | return self;
68 | }
69 |
70 | - (NSString *)description {
71 | return [NSString stringWithFormat:@"<%@ accessToken:\"%@\" tokenType:\"%@\" refreshToken:\"%@\" expiration:\"%@\">", [self class], self.accessToken, self.tokenType, self.refreshToken, self.expiration];
72 | }
73 |
74 | - (void)setRefreshToken:(NSString *)refreshToken
75 | {
76 | _refreshToken = refreshToken;
77 | }
78 |
79 | - (void)setExpiration:(NSDate *)expiration
80 | {
81 | _expiration = expiration;
82 | }
83 |
84 | - (void)setRefreshToken:(NSString *)refreshToken
85 | expiration:(NSDate *)expiration
86 | {
87 | NSParameterAssert(refreshToken);
88 | NSParameterAssert(expiration);
89 |
90 | self.refreshToken = refreshToken;
91 | self.expiration = expiration;
92 | }
93 |
94 | - (BOOL)isExpired {
95 | return [self.expiration compare:[NSDate date]] == NSOrderedAscending;
96 | }
97 |
98 | #pragma mark Keychain
99 |
100 | + (BOOL)storeCredential:(AFOAuthCredential *)credential
101 | withIdentifier:(NSString *)identifier
102 | {
103 | id securityAccessibility = nil;
104 | #if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 43000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090)
105 | #pragma clang diagnostic push
106 | #pragma clang diagnostic ignored "-Wtautological-compare"
107 | if (&kSecAttrAccessibleWhenUnlocked != NULL) {
108 | securityAccessibility = (__bridge id)kSecAttrAccessibleWhenUnlocked;
109 | }
110 | #pragma clang diagnostic pop
111 | #endif
112 |
113 | return [[self class] storeCredential:credential withIdentifier:identifier withAccessibility:securityAccessibility];
114 | }
115 |
116 | + (BOOL)storeCredential:(AFOAuthCredential *)credential
117 | withIdentifier:(NSString *)identifier
118 | withAccessibility:(id)securityAccessibility
119 | {
120 | NSMutableDictionary *queryDictionary = [AFKeychainQueryDictionaryWithIdentifier(identifier) mutableCopy];
121 |
122 | NSMutableDictionary *updateDictionary = [NSMutableDictionary dictionary];
123 | updateDictionary[(__bridge id)kSecValueData] = [NSKeyedArchiver archivedDataWithRootObject:credential];
124 |
125 | if (securityAccessibility) {
126 | updateDictionary[(__bridge id)kSecAttrAccessible] = securityAccessibility;
127 | }
128 |
129 | OSStatus status;
130 | BOOL exists = ([self retrieveCredentialWithIdentifier:identifier] != nil);
131 |
132 | if (exists) {
133 | status = SecItemUpdate((__bridge CFDictionaryRef)queryDictionary, (__bridge CFDictionaryRef)updateDictionary);
134 | } else {
135 | [queryDictionary addEntriesFromDictionary:updateDictionary];
136 | status = SecItemAdd((__bridge CFDictionaryRef)queryDictionary, NULL);
137 | }
138 |
139 | return (status == errSecSuccess);
140 | }
141 |
142 | + (BOOL)deleteCredentialWithIdentifier:(NSString *)identifier {
143 | NSMutableDictionary *queryDictionary = [AFKeychainQueryDictionaryWithIdentifier(identifier) mutableCopy];
144 |
145 | OSStatus status = SecItemDelete((__bridge CFDictionaryRef)queryDictionary);
146 |
147 | return (status == errSecSuccess);
148 | }
149 |
150 | + (AFOAuthCredential *)retrieveCredentialWithIdentifier:(NSString *)identifier {
151 | NSMutableDictionary *queryDictionary = [AFKeychainQueryDictionaryWithIdentifier(identifier) mutableCopy];
152 | queryDictionary[(__bridge id)kSecReturnData] = (__bridge id)kCFBooleanTrue;
153 | queryDictionary[(__bridge id)kSecMatchLimit] = (__bridge id)kSecMatchLimitOne;
154 |
155 | CFDataRef result = nil;
156 | OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)queryDictionary, (CFTypeRef *)&result);
157 |
158 | if (status != errSecSuccess) {
159 | return nil;
160 | }
161 |
162 | return [NSKeyedUnarchiver unarchiveObjectWithData:(__bridge_transfer NSData *)result];
163 | }
164 |
165 | #pragma mark - NSCoding
166 |
167 | - (id)initWithCoder:(NSCoder *)decoder {
168 | self = [super init];
169 | self.accessToken = [decoder decodeObjectForKey:NSStringFromSelector(@selector(accessToken))];
170 | self.tokenType = [decoder decodeObjectForKey:NSStringFromSelector(@selector(tokenType))];
171 | self.refreshToken = [decoder decodeObjectForKey:NSStringFromSelector(@selector(refreshToken))];
172 | self.expiration = [decoder decodeObjectForKey:NSStringFromSelector(@selector(expiration))];
173 |
174 | return self;
175 | }
176 |
177 | - (void)encodeWithCoder:(NSCoder *)encoder {
178 | [encoder encodeObject:self.accessToken forKey:NSStringFromSelector(@selector(accessToken))];
179 | [encoder encodeObject:self.tokenType forKey:NSStringFromSelector(@selector(tokenType))];
180 | [encoder encodeObject:self.refreshToken forKey:NSStringFromSelector(@selector(refreshToken))];
181 | [encoder encodeObject:self.expiration forKey:NSStringFromSelector(@selector(expiration))];
182 | }
183 |
184 | @end
185 |
--------------------------------------------------------------------------------
/Example/Pods/AFOAuth2Manager/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011-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 |
--------------------------------------------------------------------------------
/Example/Pods/AFOAuth2Manager/README.md:
--------------------------------------------------------------------------------
1 | # AFOAuth2Manager
2 |
3 | AFOAuth2Manager is an extension for [AFNetworking](http://github.com/AFNetworking/AFNetworking/) that simplifies the process of authenticating against an [OAuth 2](https://tools.ietf.org/html/rfc6749) provider.
4 |
5 | ## Example Usage
6 |
7 | ### Authentication
8 |
9 | ```objective-c
10 | NSURL *baseURL = [NSURL URLWithString:@"http://example.com/"];
11 | AFOAuth2Manager *OAuth2Manager =
12 | [[AFOAuth2Manager alloc] initWithBaseURL:baseURL
13 | clientID:kClientID
14 | secret:kClientSecret];
15 |
16 | [OAuth2Manager authenticateUsingOAuthWithURLString:@"/oauth/token"
17 | username:@"username"
18 | password:@"password"
19 | scope:@"email"
20 | success:^(AFOAuthCredential *credential) {
21 | NSLog(@"Token: %@", credential.accessToken);
22 | }
23 | failure:^(NSError *error) {
24 | NSLog(@"Error: %@", error);
25 | }];
26 | ```
27 |
28 | ### Authorizing Requests
29 |
30 | ```objective-c
31 | AFHTTPSessionManager *manager =
32 | [[AFHTTPSessionManager alloc] initWithBaseURL:baseURL];
33 |
34 | [manager.requestSerializer setAuthorizationHeaderFieldWithCredential:credential];
35 |
36 | [manager GET:@"/path/to/protected/resource"
37 | parameters:nil
38 | progress:nil
39 | success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
40 | NSLog(@"Success: %@", responseObject);
41 | }
42 | failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
43 | NSLog(@"Failure: %@", error);
44 | }];
45 | ```
46 |
47 | ### Storing Credentials
48 |
49 | ```objective-c
50 | [AFOAuthCredential storeCredential:credential
51 | withIdentifier:serviceProviderIdentifier];
52 | ```
53 |
54 | ### Retrieving Credentials
55 |
56 | ```objective-c
57 | AFOAuthCredential *credential =
58 | [AFOAuthCredential retrieveCredentialWithIdentifier:serviceProviderIdentifier];
59 | ```
60 |
61 | ## Documentation
62 |
63 | Documentation for all releases of AFOAuth2Manager are [available on CocoaDocs](http://cocoadocs.org/docsets/AFOAuth2Manager/).
64 |
65 |
66 | ## License
67 |
68 | AFOAuth2Manager is available under the MIT license. See the LICENSE file for more info.
69 |
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/ABMSoundCloudAPI/NSError+APISoundCloud.h:
--------------------------------------------------------------------------------
1 | ../../../../../Pod/Classes/Categories/NSError+APISoundCloud.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/ABMSoundCloudAPI/NSUserDefaults+SoundCloudToken.h:
--------------------------------------------------------------------------------
1 | ../../../../../Pod/Classes/Categories/NSUserDefaults+SoundCloudToken.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/ABMSoundCloudAPI/SoundCloudLoginWebViewController.h:
--------------------------------------------------------------------------------
1 | ../../../../../Pod/Classes/Controllers/SoundCloudLoginWebViewController.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/ABMSoundCloudAPI/SoundCloudPort.h:
--------------------------------------------------------------------------------
1 | ../../../../../Pod/Classes/API/SoundCloudPort.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/AFAutoPurgingImageCache.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/AFHTTPSessionManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFHTTPSessionManager.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/AFImageDownloader.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFImageDownloader.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/AFNetworkActivityIndicatorManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/AFNetworkReachabilityManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/AFSecurityPolicy.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFSecurityPolicy.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/AFURLRequestSerialization.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLRequestSerialization.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/AFURLResponseSerialization.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLResponseSerialization.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/AFURLSessionManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLSessionManager.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/UIActivityIndicatorView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/UIButton+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/UIImage+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/UIImageView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/UIKit+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/UIProgressView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/UIRefreshControl+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFNetworking/UIWebView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFOAuth2Manager/AFHTTPRequestSerializer+OAuth2.h:
--------------------------------------------------------------------------------
1 | ../../../AFOAuth2Manager/AFOAuth2Manager/AFHTTPRequestSerializer+OAuth2.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFOAuth2Manager/AFOAuth2Manager.h:
--------------------------------------------------------------------------------
1 | ../../../AFOAuth2Manager/AFOAuth2Manager/AFOAuth2Manager.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Private/AFOAuth2Manager/AFOAuthCredential.h:
--------------------------------------------------------------------------------
1 | ../../../AFOAuth2Manager/AFOAuth2Manager/AFOAuthCredential.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/ABMSoundCloudAPI/NSError+APISoundCloud.h:
--------------------------------------------------------------------------------
1 | ../../../../../Pod/Classes/Categories/NSError+APISoundCloud.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/ABMSoundCloudAPI/NSUserDefaults+soundCloudToken.h:
--------------------------------------------------------------------------------
1 | ../../../../../Pod/Classes/Categories/NSUserDefaults+SoundCloudToken.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/ABMSoundCloudAPI/SoundCloudLoginWebViewController.h:
--------------------------------------------------------------------------------
1 | ../../../../../Pod/Classes/Controllers/SoundCloudLoginWebViewController.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/ABMSoundCloudAPI/SoundCloudPort.h:
--------------------------------------------------------------------------------
1 | ../../../../../Pod/Classes/API/SoundCloudPort.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/AFAutoPurgingImageCache.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/AFHTTPSessionManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFHTTPSessionManager.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/AFImageDownloader.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFImageDownloader.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/AFNetworkActivityIndicatorManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/AFNetworkReachabilityManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/AFSecurityPolicy.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFSecurityPolicy.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/AFURLRequestSerialization.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLRequestSerialization.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/AFURLResponseSerialization.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLResponseSerialization.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/AFURLSessionManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLSessionManager.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/UIActivityIndicatorView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/UIButton+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/UIImage+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/UIImageView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/UIKit+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/UIProgressView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/UIRefreshControl+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFNetworking/UIWebView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFOAuth2Manager/AFHTTPRequestSerializer+OAuth2.h:
--------------------------------------------------------------------------------
1 | ../../../AFOAuth2Manager/AFOAuth2Manager/AFHTTPRequestSerializer+OAuth2.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFOAuth2Manager/AFOAuth2Manager.h:
--------------------------------------------------------------------------------
1 | ../../../AFOAuth2Manager/AFOAuth2Manager/AFOAuth2Manager.h
--------------------------------------------------------------------------------
/Example/Pods/Headers/Public/AFOAuth2Manager/AFOAuthCredential.h:
--------------------------------------------------------------------------------
1 | ../../../AFOAuth2Manager/AFOAuth2Manager/AFOAuthCredential.h
--------------------------------------------------------------------------------
/Example/Pods/Local Podspecs/ABMSoundCloudAPI.podspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ABMSoundCloudAPI",
3 | "version": "1.0.1",
4 | "summary": "Own library to handle oauth2 authentication and basic operations for SoundCloud API.",
5 | "description": "Since SoundCloud decided not to maintain any longer its library for iOS I diceded to create my own one. Right now it is supported:\n* Authentication usign internal webview\n* Searching for songs\n* Download a song\n* Get User Playlists\n* Get Playlists given playlist ID\n* Get song info given song ID\n* Follow user given user ID",
6 | "homepage": "https://github.com/andresbrun/ABMSoundCloudAPI",
7 | "screenshots": [
8 | "https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/master/Example/screenshots/screenshot_1.png",
9 | "https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/master/Example/screenshots/screenshot_2.png",
10 | "https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/master/Example/screenshots/screenshot_3.png",
11 | "https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/master/Example/screenshots/screenshot_4.png"
12 | ],
13 | "license": "MIT",
14 | "authors": {
15 | "Andres Brun Moreno": "andresbrunmoreno@gmail.com"
16 | },
17 | "source": {
18 | "git": "https://github.com/andresbrun/ABMSoundCloudAPI.git",
19 | "tag": "1.0.1"
20 | },
21 | "social_media_url": "https://twitter.com/andrewsBrun",
22 | "platforms": {
23 | "ios": "7.0"
24 | },
25 | "requires_arc": true,
26 | "source_files": "Pod/Classes/**/*.{h,m}",
27 | "resources": "Pod/Classes/Views/*.storyboard",
28 | "dependencies": {
29 | "AFNetworking": [
30 | "~> 3.0"
31 | ],
32 | "AFOAuth2Manager": [
33 | "~> 3.0"
34 | ]
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Example/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - ABMSoundCloudAPI (1.0.1):
3 | - AFNetworking (~> 3.0)
4 | - AFOAuth2Manager (~> 3.0)
5 | - AFNetworking (3.1.0):
6 | - AFNetworking/NSURLSession (= 3.1.0)
7 | - AFNetworking/Reachability (= 3.1.0)
8 | - AFNetworking/Security (= 3.1.0)
9 | - AFNetworking/Serialization (= 3.1.0)
10 | - AFNetworking/UIKit (= 3.1.0)
11 | - AFNetworking/NSURLSession (3.1.0):
12 | - AFNetworking/Reachability
13 | - AFNetworking/Security
14 | - AFNetworking/Serialization
15 | - AFNetworking/Reachability (3.1.0)
16 | - AFNetworking/Security (3.1.0)
17 | - AFNetworking/Serialization (3.1.0)
18 | - AFNetworking/UIKit (3.1.0):
19 | - AFNetworking/NSURLSession
20 | - AFOAuth2Manager (3.0.0):
21 | - AFNetworking/NSURLSession (~> 3.0)
22 |
23 | DEPENDENCIES:
24 | - ABMSoundCloudAPI (from `../`)
25 | - AFNetworking
26 | - AFOAuth2Manager
27 |
28 | EXTERNAL SOURCES:
29 | ABMSoundCloudAPI:
30 | :path: "../"
31 |
32 | SPEC CHECKSUMS:
33 | ABMSoundCloudAPI: 22c50b5487c9326de14bf9f057266e6dd9a27452
34 | AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
35 | AFOAuth2Manager: 0566da1be64883e339813d411229fdc9a84dab7c
36 |
37 | PODFILE CHECKSUM: a14b2086b5e07c84f3c22bc1e15a9f9ce8c1a835
38 |
39 | COCOAPODS: 1.0.1
40 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/ABMSoundCloudAPI/ABMSoundCloudAPI-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_ABMSoundCloudAPI : NSObject
3 | @end
4 | @implementation PodsDummy_ABMSoundCloudAPI
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/ABMSoundCloudAPI/ABMSoundCloudAPI-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/ABMSoundCloudAPI/ABMSoundCloudAPI.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/ABMSoundCloudAPI
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/ABMSoundCloudAPI" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/ABMSoundCloudAPI" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/AFOAuth2Manager"
4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/AFNetworking" "$PODS_CONFIGURATION_BUILD_DIR/AFOAuth2Manager"
5 | PODS_BUILD_DIR = $BUILD_DIR
6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_ROOT = ${SRCROOT}
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AFNetworking/AFNetworking-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_AFNetworking : NSObject
3 | @end
4 | @implementation PodsDummy_AFNetworking
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AFNetworking/AFNetworking-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 | #ifndef TARGET_OS_IOS
6 | #define TARGET_OS_IOS TARGET_OS_IPHONE
7 | #endif
8 |
9 | #ifndef TARGET_OS_WATCH
10 | #define TARGET_OS_WATCH 0
11 | #endif
12 |
13 | #ifndef TARGET_OS_TV
14 | #define TARGET_OS_TV 0
15 | #endif
16 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AFNetworking/AFNetworking.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/AFNetworking
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworking" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/ABMSoundCloudAPI" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/AFOAuth2Manager"
4 | OTHER_LDFLAGS = -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
5 | PODS_BUILD_DIR = $BUILD_DIR
6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_ROOT = ${SRCROOT}
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AFOAuth2Manager/AFOAuth2Manager-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_AFOAuth2Manager : NSObject
3 | @end
4 | @implementation PodsDummy_AFOAuth2Manager
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AFOAuth2Manager/AFOAuth2Manager-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AFOAuth2Manager/AFOAuth2Manager.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/AFOAuth2Manager
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFOAuth2Manager" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/ABMSoundCloudAPI" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/AFOAuth2Manager"
4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/AFNetworking"
5 | OTHER_LDFLAGS = -framework "Security"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_ROOT = ${SRCROOT}
9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
10 | SKIP_INSTALL = YES
11 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-ABMSoundCloudAPI/Pods-ABMSoundCloudAPI-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## ABMSoundCloudAPI
5 |
6 | Copyright (c) 2015 Andres Brun Moreno
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 |
27 | ## AFNetworking
28 |
29 | Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/)
30 |
31 | Permission is hereby granted, free of charge, to any person obtaining a copy
32 | of this software and associated documentation files (the "Software"), to deal
33 | in the Software without restriction, including without limitation the rights
34 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35 | copies of the Software, and to permit persons to whom the Software is
36 | furnished to do so, subject to the following conditions:
37 |
38 | The above copyright notice and this permission notice shall be included in
39 | all copies or substantial portions of the Software.
40 |
41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
47 | THE SOFTWARE.
48 |
49 |
50 | ## AFOAuth2Manager
51 |
52 | Copyright (c) 2011-2014 AFNetworking (http://afnetworking.com)
53 |
54 | Permission is hereby granted, free of charge, to any person obtaining a copy
55 | of this software and associated documentation files (the "Software"), to deal
56 | in the Software without restriction, including without limitation the rights
57 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
58 | copies of the Software, and to permit persons to whom the Software is
59 | furnished to do so, subject to the following conditions:
60 |
61 | The above copyright notice and this permission notice shall be included in
62 | all copies or substantial portions of the Software.
63 |
64 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
65 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
66 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
67 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
68 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
69 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
70 | THE SOFTWARE.
71 |
72 | Generated by CocoaPods - https://cocoapods.org
73 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-ABMSoundCloudAPI/Pods-ABMSoundCloudAPI-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) 2015 Andres Brun Moreno <andresbrunmoreno@gmail.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 | ABMSoundCloudAPI
39 | Type
40 | PSGroupSpecifier
41 |
42 |
43 | FooterText
44 | Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/)
45 |
46 | Permission is hereby granted, free of charge, to any person obtaining a copy
47 | of this software and associated documentation files (the "Software"), to deal
48 | in the Software without restriction, including without limitation the rights
49 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
50 | copies of the Software, and to permit persons to whom the Software is
51 | furnished to do so, subject to the following conditions:
52 |
53 | The above copyright notice and this permission notice shall be included in
54 | all copies or substantial portions of the Software.
55 |
56 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
57 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
58 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
59 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
60 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
61 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
62 | THE SOFTWARE.
63 |
64 | Title
65 | AFNetworking
66 | Type
67 | PSGroupSpecifier
68 |
69 |
70 | FooterText
71 | Copyright (c) 2011-2014 AFNetworking (http://afnetworking.com)
72 |
73 | Permission is hereby granted, free of charge, to any person obtaining a copy
74 | of this software and associated documentation files (the "Software"), to deal
75 | in the Software without restriction, including without limitation the rights
76 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
77 | copies of the Software, and to permit persons to whom the Software is
78 | furnished to do so, subject to the following conditions:
79 |
80 | The above copyright notice and this permission notice shall be included in
81 | all copies or substantial portions of the Software.
82 |
83 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
84 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
85 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
86 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
87 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
88 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
89 | THE SOFTWARE.
90 |
91 | Title
92 | AFOAuth2Manager
93 | Type
94 | PSGroupSpecifier
95 |
96 |
97 | FooterText
98 | Generated by CocoaPods - https://cocoapods.org
99 | Title
100 |
101 | Type
102 | PSGroupSpecifier
103 |
104 |
105 | StringsTable
106 | Acknowledgements
107 | Title
108 | Acknowledgements
109 |
110 |
111 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-ABMSoundCloudAPI/Pods-ABMSoundCloudAPI-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_ABMSoundCloudAPI : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_ABMSoundCloudAPI
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-ABMSoundCloudAPI/Pods-ABMSoundCloudAPI-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
6 |
7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
8 |
9 | install_framework()
10 | {
11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
12 | local source="${BUILT_PRODUCTS_DIR}/$1"
13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
15 | elif [ -r "$1" ]; then
16 | local source="$1"
17 | fi
18 |
19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20 |
21 | if [ -L "${source}" ]; then
22 | echo "Symlinked..."
23 | source="$(readlink "${source}")"
24 | fi
25 |
26 | # use filter instead of exclude so missing patterns dont' throw errors
27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
29 |
30 | local basename
31 | basename="$(basename -s .framework "$1")"
32 | binary="${destination}/${basename}.framework/${basename}"
33 | if ! [ -r "$binary" ]; then
34 | binary="${destination}/${basename}"
35 | fi
36 |
37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
39 | strip_invalid_archs "$binary"
40 | fi
41 |
42 | # Resign the code if required by the build settings to avoid unstable apps
43 | code_sign_if_enabled "${destination}/$(basename "$1")"
44 |
45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
47 | local swift_runtime_libs
48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
49 | for lib in $swift_runtime_libs; do
50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
52 | code_sign_if_enabled "${destination}/${lib}"
53 | done
54 | fi
55 | }
56 |
57 | # Signs a framework with the provided identity
58 | code_sign_if_enabled() {
59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
60 | # Use the current code_sign_identitiy
61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\""
63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1"
64 | fi
65 | }
66 |
67 | # Strip invalid architectures
68 | strip_invalid_archs() {
69 | binary="$1"
70 | # Get architectures for current file
71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
72 | stripped=""
73 | for arch in $archs; do
74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
75 | # Strip non-valid architectures in-place
76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1
77 | stripped="$stripped $arch"
78 | fi
79 | done
80 | if [[ "$stripped" ]]; then
81 | echo "Stripped $binary of architectures:$stripped"
82 | fi
83 | }
84 |
85 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-ABMSoundCloudAPI/Pods-ABMSoundCloudAPI-resources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
5 |
6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
7 | > "$RESOURCES_TO_COPY"
8 |
9 | XCASSET_FILES=()
10 |
11 | case "${TARGETED_DEVICE_FAMILY}" in
12 | 1,2)
13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
14 | ;;
15 | 1)
16 | TARGET_DEVICE_ARGS="--target-device iphone"
17 | ;;
18 | 2)
19 | TARGET_DEVICE_ARGS="--target-device ipad"
20 | ;;
21 | *)
22 | TARGET_DEVICE_ARGS="--target-device mac"
23 | ;;
24 | esac
25 |
26 | realpath() {
27 | DIRECTORY="$(cd "${1%/*}" && pwd)"
28 | FILENAME="${1##*/}"
29 | echo "$DIRECTORY/$FILENAME"
30 | }
31 |
32 | install_resource()
33 | {
34 | if [[ "$1" = /* ]] ; then
35 | RESOURCE_PATH="$1"
36 | else
37 | RESOURCE_PATH="${PODS_ROOT}/$1"
38 | fi
39 | if [[ ! -e "$RESOURCE_PATH" ]] ; then
40 | cat << EOM
41 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
42 | EOM
43 | exit 1
44 | fi
45 | case $RESOURCE_PATH in
46 | *.storyboard)
47 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
48 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
49 | ;;
50 | *.xib)
51 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
52 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
53 | ;;
54 | *.framework)
55 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
56 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
57 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
58 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
59 | ;;
60 | *.xcdatamodel)
61 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
62 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
63 | ;;
64 | *.xcdatamodeld)
65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
67 | ;;
68 | *.xcmappingmodel)
69 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
70 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
71 | ;;
72 | *.xcassets)
73 | ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH")
74 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
75 | ;;
76 | *)
77 | echo "$RESOURCE_PATH"
78 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
79 | ;;
80 | esac
81 | }
82 | if [[ "$CONFIGURATION" == "Debug" ]]; then
83 | install_resource "../../Pod/Classes/Views/SoundCloudLogin.storyboard"
84 | fi
85 | if [[ "$CONFIGURATION" == "Release" ]]; then
86 | install_resource "../../Pod/Classes/Views/SoundCloudLogin.storyboard"
87 | fi
88 |
89 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
90 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
91 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
92 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
93 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
94 | fi
95 | rm -f "$RESOURCES_TO_COPY"
96 |
97 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
98 | then
99 | # Find all other xcassets (this unfortunately includes those of path pods and other targets).
100 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
101 | while read line; do
102 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
103 | XCASSET_FILES+=("$line")
104 | fi
105 | done <<<"$OTHER_XCASSETS"
106 |
107 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
108 | fi
109 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-ABMSoundCloudAPI/Pods-ABMSoundCloudAPI.debug.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/ABMSoundCloudAPI" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/AFOAuth2Manager"
3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/ABMSoundCloudAPI" "$PODS_CONFIGURATION_BUILD_DIR/AFNetworking" "$PODS_CONFIGURATION_BUILD_DIR/AFOAuth2Manager"
4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/ABMSoundCloudAPI" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/AFOAuth2Manager"
5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"ABMSoundCloudAPI" -l"AFNetworking" -l"AFOAuth2Manager" -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_ROOT = ${SRCROOT}/Pods
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-ABMSoundCloudAPI/Pods-ABMSoundCloudAPI.release.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/ABMSoundCloudAPI" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/AFOAuth2Manager"
3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/ABMSoundCloudAPI" "$PODS_CONFIGURATION_BUILD_DIR/AFNetworking" "$PODS_CONFIGURATION_BUILD_DIR/AFOAuth2Manager"
4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/ABMSoundCloudAPI" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/AFOAuth2Manager"
5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"ABMSoundCloudAPI" -l"AFNetworking" -l"AFOAuth2Manager" -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_ROOT = ${SRCROOT}/Pods
9 |
--------------------------------------------------------------------------------
/Example/Tests/Tests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Example/Tests/Tests-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every test case source file.
5 | //
6 |
7 | #ifdef __OBJC__
8 |
9 |
10 |
11 | #endif
12 |
--------------------------------------------------------------------------------
/Example/Tests/Tests.m:
--------------------------------------------------------------------------------
1 | //
2 | // ABMSoundCloudAPITests.m
3 | // ABMSoundCloudAPITests
4 | //
5 | // Created by Andres Brun Moreno on 03/14/2015.
6 | // Copyright (c) 2014 Andres Brun Moreno. All rights reserved.
7 | //
8 |
--------------------------------------------------------------------------------
/Example/Tests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Example/screenshots/ABMSoundCloudAPI_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/2276c54a5f82116769fe1d734b1a631a16ccc4b9/Example/screenshots/ABMSoundCloudAPI_logo.png
--------------------------------------------------------------------------------
/Example/screenshots/screenshot_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/2276c54a5f82116769fe1d734b1a631a16ccc4b9/Example/screenshots/screenshot_1.png
--------------------------------------------------------------------------------
/Example/screenshots/screenshot_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/2276c54a5f82116769fe1d734b1a631a16ccc4b9/Example/screenshots/screenshot_2.png
--------------------------------------------------------------------------------
/Example/screenshots/screenshot_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/2276c54a5f82116769fe1d734b1a631a16ccc4b9/Example/screenshots/screenshot_3.png
--------------------------------------------------------------------------------
/Example/screenshots/screenshot_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/2276c54a5f82116769fe1d734b1a631a16ccc4b9/Example/screenshots/screenshot_4.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015 Andres Brun Moreno
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 |
--------------------------------------------------------------------------------
/Pod/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/2276c54a5f82116769fe1d734b1a631a16ccc4b9/Pod/Assets/.gitkeep
--------------------------------------------------------------------------------
/Pod/Classes/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andresbrun/ABMSoundCloudAPI/2276c54a5f82116769fe1d734b1a631a16ccc4b9/Pod/Classes/.gitkeep
--------------------------------------------------------------------------------
/Pod/Classes/API/SoundCloudPort.h:
--------------------------------------------------------------------------------
1 | //
2 | // SoundCloudPort.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by AndresBrun on 01/10/14.
6 | // Copyright (c) 2014 Brun's Software. All rights reserved.
7 | //
8 |
9 | @interface SoundCloudPort : NSObject
10 |
11 | - (instancetype)initWithClientId:(nonnull NSString *)clientID
12 | clientSecret:(nonnull NSString *)clientSecret;
13 |
14 | - (BOOL)isValidToken;
15 |
16 | - (void)loginWithResult:(nullable void (^)(BOOL success))resultBlock
17 | usingParentVC:(nonnull UIViewController *)parentVC
18 | redirectURL:(nonnull NSString *)redirectURL;
19 |
20 | - (void)requestPlaylistsWithSuccess:(nullable void (^)(NSArray *_Nonnull playlists))successBlock
21 | failure:(nullable void (^)(NSError *_Nonnull error))failureBlock;
22 |
23 | - (void)requestPlaylistWithID:(nonnull NSString *) playlistID
24 | withSuccess:(nullable void (^)(NSDictionary *_Nonnull songsDict))successBlock
25 | failure:(nullable void (^)(NSError *_Nonnull error))failureBlock;
26 |
27 | - (void)requestSongsForQuery:(nonnull NSString *)query
28 | limit:(NSUInteger)limit
29 | withSuccess:(nullable void (^)(NSDictionary *_Nonnull songsDict))successBlock
30 | failure:(nullable void (^)(NSError *_Nonnull error))failureBlock;
31 |
32 | - (void)requestSongById:(nonnull NSString *)songID
33 | withSuccess:(nullable void (^)(NSDictionary *_Nonnull songDict))successBlock
34 | failure:(nullable void (^)(NSError *_Nonnull error))failureBlock;
35 |
36 | - (void)followUserId:(nonnull NSString *)userID
37 | withSuccess:(nullable void (^)(NSDictionary *_Nonnull songDict))successBlock
38 | failure:(nullable void (^)(NSError *_Nonnull error))failureBlock;
39 |
40 | - (void)downloadDataForSongURL:(nonnull NSString *)songStream
41 | inPath:(nonnull NSString *)pathToSave
42 | withSuccess:(nullable void (^)(NSURL *_Nonnull path))successBlock
43 | failure:(nullable void (^)(NSError *_Nonnull error))failureBlock
44 | progress:(nullable void (^)(CGFloat progress))progressBlock;
45 |
46 | - (void)uploadAudioFile:(nonnull NSData *)fileData
47 | mimeType:(nonnull NSString*)mimeType
48 | meta:(nonnull NSDictionary*)params
49 | withSuccess:(nullable void (^)(NSDictionary *_Nonnull songDict))successBlock
50 | progress:(nullable void (^)(NSProgress *_Nonnull progress))progressBlock
51 | failure:(nullable void (^)(NSError *_Nonnull error))failureBlock;
52 |
53 | - (void)cancelLastOperation;
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/Pod/Classes/Categories/NSError+APISoundCloud.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSError+APISoundCloud.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun on 08/03/15.
6 | // Copyright (c) 2015 Brun's Software. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSError (APISoundCloud)
12 |
13 | + (nonnull NSError *)createParsingError;
14 | + (nonnull NSError *)createNonStreamableSongError;
15 | + (nonnull NSError *)createConnexionError;
16 | + (nonnull NSError *)createSessionError;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Pod/Classes/Categories/NSError+APISoundCloud.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSError+APISoundCloud.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun on 08/03/15.
6 | // Copyright (c) 2015 Brun's Software. All rights reserved.
7 | //
8 |
9 | #import "NSError+APISoundCloud.h"
10 |
11 | @implementation NSError (APISoundCloud)
12 |
13 | + (NSError *)createParsingError {
14 | return [NSError errorWithDomain:@"APIManager" code:490 userInfo:@{@"Info":@"Parse error."}];
15 | }
16 |
17 | + (NSError *)createNonStreamableSongError {
18 | return [NSError errorWithDomain:@"APIManager" code:480 userInfo:@{@"Info":@"The song is not streamable."}];
19 | }
20 |
21 | + (NSError *)createConnexionError {
22 | return [NSError errorWithDomain:@"APIManager" code:600 userInfo:@{@"Info":@"No connection."}];
23 | }
24 |
25 | + (NSError *)createSessionError {
26 | return [NSError errorWithDomain:@"APIManager" code:401 userInfo:@{@"Info":@"No Session."}];
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/Pod/Classes/Categories/NSUserDefaults+SoundCloudToken.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSUserDefaults+soundCloudToken.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun on 05/03/15.
6 | // Copyright (c) 2015 Brun's Software. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSUserDefaults (SoundCloudToken)
12 |
13 | + (void)saveSoundCloudToken:(nonnull NSString *)token;
14 | + (nullable NSString *)getSoundCloudCode;
15 | + (void)removeSoundCloudCode;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Pod/Classes/Categories/NSUserDefaults+SoundCloudToken.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSUserDefaults+soundCloudToken.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun on 05/03/15.
6 | // Copyright (c) 2015 Brun's Software. All rights reserved.
7 | //
8 |
9 | #import "NSUserDefaults+SoundCloudToken.h"
10 |
11 | NSString *kSCTokenKey = @"sc_key_token";
12 |
13 | @implementation NSUserDefaults (SoundCloudToken)
14 |
15 | + (void)saveSoundCloudToken:(NSString *)token {
16 | [[self standardUserDefaults] setObject:token forKey:kSCTokenKey];
17 | [[self standardUserDefaults] synchronize];
18 | }
19 |
20 | + (NSString *)getSoundCloudCode {
21 | return [[self standardUserDefaults] objectForKey:kSCTokenKey];
22 | }
23 |
24 | + (void)removeSoundCloudCode {
25 | [[self standardUserDefaults] removeObjectForKey:kSCTokenKey];
26 | [[self standardUserDefaults] synchronize];
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/Pod/Classes/Controllers/SoundCloudLoginWebViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SoundCloudLoginWebViewController.h
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun on 08/03/15.
6 | // Copyright (c) 2015 Brun's Software. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SoundCloudLoginWebViewController: UIViewController
12 |
13 | + (nonnull UINavigationController *)instantiateWithLoginURL:(nonnull NSString *)loginURL
14 | redirectURL:(nonnull NSString *)redirectURL
15 | resultBlock:(void (^)(BOOL result, NSString *code))resultBlock;
16 |
17 | @property (strong, nonatomic, nonnull) NSString *scLoginURL;
18 | @property (strong, nonatomic, nonnull) NSString *redirectURL;
19 | @property (copy, nonatomic) void (^resultBlock)(BOOL success, NSString * _Nullable code);
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/Pod/Classes/Controllers/SoundCloudLoginWebViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SoundCloudLoginWebViewController.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun on 08/03/15.
6 | // Copyright (c) 2015 Brun's Software. All rights reserved.
7 | //
8 |
9 | #import "SoundCloudLoginWebViewController.h"
10 |
11 | @interface SoundCloudLoginWebViewController ()
12 | @property (weak, nonatomic) IBOutlet UIWebView *webViewContainer;
13 | @end
14 |
15 | // Shows scLoginURL related screen. Checking URL response wait for a success or failure login to call resultBlock
16 | @implementation SoundCloudLoginWebViewController
17 |
18 | + (UINavigationController *)instantiateWithLoginURL:(NSString *)loginURL
19 | redirectURL:(NSString *)redirectURL
20 | resultBlock:(void (^)(BOOL result, NSString *code))resultBlock {
21 | UINavigationController *navController = [[UIStoryboard storyboardWithName:@"SoundCloudLogin" bundle:[NSBundle bundleForClass:self]] instantiateInitialViewController];
22 | SoundCloudLoginWebViewController *loginVC = [navController.viewControllers firstObject];
23 | if (loginVC) {
24 | loginVC.scLoginURL = [loginURL stringByAppendingFormat:@"&redirect_uri=%@",redirectURL];
25 | loginVC.redirectURL = redirectURL;
26 | loginVC.resultBlock = resultBlock;
27 | }
28 | return navController;
29 | }
30 |
31 | - (void)viewWillAppear:(BOOL)animated {
32 | [super viewWillAppear:animated];
33 |
34 | [self.webViewContainer loadRequest:[self webURLForLogin]];
35 | }
36 |
37 | - (IBAction)closeButtonPressed:(id)sender {
38 | [self dismissViewControllerAnimated:YES completion:^{
39 | self.resultBlock(NO, nil);
40 | }];
41 | }
42 |
43 | - (NSURLRequest *)webURLForLogin {
44 | NSAssert(self.scLoginURL!=nil, @"Login url has to be set before load the view.");
45 |
46 | NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:self.scLoginURL]];
47 | return request;
48 | }
49 |
50 | - (NSString *)extractCodeFromRequest:(NSURLRequest *)request {
51 | NSArray *codeArray =[request.URL.absoluteString componentsSeparatedByString:@"code="];
52 | if(codeArray.count>1) {
53 | NSString *code = codeArray[1];
54 | if([code hasSuffix:@"#"]) {
55 | code = [code substringToIndex:code.length-1];
56 | return code;
57 | }
58 | }
59 | return nil;
60 | }
61 |
62 | - (BOOL)isFlowFinishWithRequest:(NSURLRequest *)request {
63 | NSString *baseURL = [@[request.URL.scheme, request.URL.host] componentsJoinedByString:@"://"];
64 | return [baseURL rangeOfString:self.redirectURL].location!=NSNotFound;
65 | }
66 |
67 | - (void)finishFlowWithRequest:(NSURLRequest *)request {
68 | [self dismissViewControllerAnimated:YES completion:^{
69 | NSString *code = [self extractCodeFromRequest:request];
70 | self.resultBlock(code!=nil, code);
71 | }];
72 | }
73 |
74 | #pragma mark - WebView delegate
75 | - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
76 |
77 | if ([self isFlowFinishWithRequest:request]) {
78 | [self finishFlowWithRequest:request];
79 | return NO;
80 | }
81 |
82 | return YES;
83 | }
84 |
85 | @end
86 |
--------------------------------------------------------------------------------
/Pod/Classes/Controllers/SoundCloudLoginWebViewController.m.orig:
--------------------------------------------------------------------------------
1 | //
2 | // SoundCloudLoginWebViewController.m
3 | // ABMSoundCloudAPI
4 | //
5 | // Created by Andres Brun on 08/03/15.
6 | // Copyright (c) 2015 Brun's Software. All rights reserved.
7 | //
8 |
9 | #import "SoundCloudLoginWebViewController.h"
10 |
11 | @interface SoundCloudLoginWebViewController ()
12 | @property (weak, nonatomic) IBOutlet UIWebView *webViewContainer;
13 | @end
14 |
15 | // Shows scLoginURL related screen. Checking URL response wait for a success or failure login to call resultBlock
16 | @implementation SoundCloudLoginWebViewController
17 |
18 | + (UINavigationController *)instantiateWithLoginURL:(NSString *)loginURL redirectURL:(NSString *)redirectURL resultBlock:(void (^)(BOOL result, NSString *code))resultBlock {
19 | <<<<<<< HEAD
20 | UINavigationController *navController = [[UIStoryboard storyboardWithName:@"SoundCloudLogin" bundle:[NSBundle bundleForClass:self.class]] instantiateInitialViewController];
21 | =======
22 | UINavigationController *navController = [[UIStoryboard storyboardWithName:@"SoundCloudLogin" bundle:[NSBundle bundleForClass:self]] instantiateInitialViewController];
23 | >>>>>>> 0949102311bb4382fe86cdea743992f6ea3fc685
24 | SoundCloudLoginWebViewController *loginVC = [navController.viewControllers firstObject];
25 | if (loginVC) {
26 | loginVC.scLoginURL = [loginURL stringByAppendingFormat:@"&redirect_uri=%@",redirectURL];
27 | loginVC.redirectURL = redirectURL;
28 | loginVC.resultBlock = resultBlock;
29 | }
30 | return navController;
31 | }
32 |
33 | - (void)viewWillAppear:(BOOL)animated {
34 | [super viewWillAppear:animated];
35 |
36 | [self.webViewContainer loadRequest:[self webURLForLogin]];
37 | }
38 |
39 | - (IBAction)closeButtonPressed:(id)sender {
40 | [self dismissViewControllerAnimated:YES completion:^{
41 | self.resultBlock(NO, nil);
42 | }];
43 | }
44 |
45 | - (NSURLRequest *)webURLForLogin {
46 | NSAssert(self.scLoginURL!=nil, @"Login url has to be set before load the view.");
47 |
48 | NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:self.scLoginURL]];
49 | return request;
50 | }
51 |
52 | - (NSString *)extractCodeFromRequest:(NSURLRequest *)request {
53 | NSArray *codeArray =[request.URL.absoluteString componentsSeparatedByString:@"code="];
54 | if(codeArray.count>1) {
55 | NSString *code = codeArray[1];
56 | if([code hasSuffix:@"#"]) {
57 | code = [code substringToIndex:code.length-1];
58 | return code;
59 | }
60 | }
61 | return nil;
62 | }
63 |
64 | - (BOOL)isFlowFinishWithRequest:(NSURLRequest *)request {
65 | NSString *baseURL = [@[request.URL.scheme, request.URL.host] componentsJoinedByString:@"://"];
66 | return [baseURL rangeOfString:self.redirectURL].location!=NSNotFound;
67 | }
68 |
69 | - (void)finishFlowWithRequest:(NSURLRequest *)request {
70 | [self dismissViewControllerAnimated:YES completion:^{
71 | NSString *code = [self extractCodeFromRequest:request];
72 | self.resultBlock(code!=nil, code);
73 | }];
74 | }
75 |
76 | #pragma mark - WebView delegate
77 | - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
78 |
79 | if ([self isFlowFinishWithRequest:request]) {
80 | [self finishFlowWithRequest:request];
81 | return NO;
82 | }
83 |
84 | return YES;
85 | }
86 |
87 | @end
88 |
--------------------------------------------------------------------------------
/Pod/Classes/Views/SoundCloudLogin.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | 
3 |
4 | [](https://travis-ci.org/andresbrun/ABMSoundCloudAPI)
5 | [](http://cocoadocs.org/docsets/ABMSoundCloudAPI)
6 | [](http://cocoadocs.org/docsets/ABMSoundCloudAPI)
7 | [](http://cocoadocs.org/docsets/ABMSoundCloudAPI)
8 |
9 | ## Motivation
10 |
11 | Since SoundCloud decided not to maintain anymore its API iOS library I decided to create my own one. Right now just support some of the API's endpoints such as:
12 | * Authentication usign internal webview.
13 | * Searching for songs given a query string.
14 | * Download a song given the stream URL.
15 | * Get User Playlists.
16 | * Get Playlists given playlist ID.
17 | * Get song info given song ID.
18 | * Follow user given user ID.
19 | * Upload an audio file.
20 |
21 | ## Usage
22 |
23 | * To run the example project, clone the repo, and run `pod install` from the Example directory first.
24 | * How to upload audio file to soundcloud (this is basic example with basic meta information)
25 |
26 | In Objective-C
27 | ```objective-c
28 | NSDictionary *params = @{
29 | @"track[title]": @"title",
30 | @"track[permalink]": @"permalink", //must be lowercase
31 | @"track[tag_list]": @"tag", //must be lowercaset
32 | @"triack[sharing]": @"public",
33 | @"track[downloadable]": @YES
34 | };
35 |
36 |
37 | [[ABMSoundCloudAPISingleton sharedManager].soundCloudPort uploadAudioFile:fileData mimeType:@"audio/mp4" meta:params withSuccess:^(NSDictionary *songDict) {
38 |
39 | NSLog(@"success");
40 |
41 | } failure:^(NSError *error) {
42 |
43 | NSLog(@"error");
44 |
45 | }];
46 | ```
47 | In Swift 3.0
48 |
49 | ```swift
50 | let params = ["track[title]": "title", "track[permalink]": "permalink"...]
51 |
52 | ABMSoundCloudAPISingleton.sharedManager.uploadAudioFile(fileData, mimeType: "audio/mp4", meta: params, withSuccess: { (songDict) in
53 | print("Success")
54 | }, progress: { (progress) in
55 | print("Progress \(progress.fractionCompleted)")
56 | }) { (error) in
57 | print("Error")
58 | }
59 | ```
60 |
61 | ## Dependencies
62 |
63 | * `AFNetworking`, '~> 3.0'
64 | * `AFOAuth2Manager`, '~> 3.0'
65 |
66 | ## Requirements
67 |
68 | This library needs to connect succesfully with SoundCloud API an account from where get:
69 | * `Client_id`
70 | * `Secret_key`
71 | * `Redirect_url`
72 |
73 | ## Installation
74 |
75 | ABMSoundCloudAPI is available through [CocoaPods](http://cocoapods.org). To install
76 | it, simply add the following line to your Podfile:
77 |
78 | pod "ABMSoundCloudAPI"
79 |
80 | ## Author
81 |
82 | Andres Brun Moreno, andresbrunmoreno@gmail.com
83 |
84 | ## License
85 |
86 | ABMSoundCloudAPI is available under the MIT license. See the LICENSE file for more info.
87 |
88 | ## Contributing
89 |
90 | 1. Fork it (https://github.com/andresbrun/ABMSoundCloudAPI/fork)
91 | 2. Create your feature branch (`git checkout -b my-new-feature`)
92 | 3. Commit your changes (`git commit -am 'Add some feature'`)
93 | 4. Push to the branch (`git push origin my-new-feature`)
94 | 5. Create a new Pull Request
95 |
96 | And I will review it as soon as I can :)
97 |
--------------------------------------------------------------------------------