- aggiornamento libreria per supportare diversi client id e client secret
This commit is contained in:
parent
1f625585b9
commit
6c8cf96e65
@ -351,7 +351,7 @@
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}",
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FacebookSDKStrings.bundle",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
|
||||
@ -34,12 +34,12 @@
|
||||
// Override point for customization after application launch.
|
||||
|
||||
[PNObjectConfig initSharedInstanceForEnvironments:@{EnvironmentDevelopment : @{BaseUrl:@"http://pnobject.local/",EndpointPath:@"api/v1/"},
|
||||
EnvironmentStage : @{BaseUrl:@"http://pnobject.stage.it/",EndpointPath:@"api/v1/"},
|
||||
EnvironmentStage : @{BaseUrl:@"https://idd.ppreview.it/",EndpointPath:@"wp-json/v1/"},
|
||||
EnvironmentProduction : @{BaseUrl:@"http://pnobject.prod.it/",EndpointPath:@"api/v1/"},
|
||||
} userSubclass:[PNUser class] withOauthMode:OAuthModeClientCredential];
|
||||
|
||||
[[PNObjectConfig sharedInstance] setClientID:@"xxxxxxxxx" clientSecret:@"xxxxxxxxxxxx" forEnv:EnvironmentStage];
|
||||
[[PNObjectConfig sharedInstance] setClientID:@"xxxxxxxxx" clientSecret:@"xxxxxxxxxxxx" forEnv:EnvironmentProduction];
|
||||
[[PNObjectConfig sharedInstance] setClientID:@"xVdEbNLLierj9CJoLNo5lsbg7VFs8UikqADbcwKA" clientSecret:@"2WWSJrDNbZhbUUCXIOTBiYIJv9muiRGK68f2B2Eb" oAuthEndpointAction:@"oauth/token" forEnv:EnvironmentStage];
|
||||
[[PNObjectConfig sharedInstance] setOauthClientID:@"tXYhKtcvfYdCM4tNor6WfbclEWYkoGWqBimUBzqZ" oauthClientSecret:@"3UMEQthBHp1oEo0pjFmgkifhig689ZL5L9DsSETd" oAuthEndpointAction:@"oauth/token" forEnv:EnvironmentStage];
|
||||
|
||||
[[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage];
|
||||
//[[PNObjectConfig sharedInstance] setHTTPHeaderValue:@"XMLHttpRequest" forKey:@"X-Request-With"];
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
PODS:
|
||||
- AFNetworking (3.1.0):
|
||||
- AFNetworking/NSURLSession (= 3.1.0)
|
||||
- AFNetworking/Reachability (= 3.1.0)
|
||||
- AFNetworking/Security (= 3.1.0)
|
||||
- AFNetworking/Serialization (= 3.1.0)
|
||||
- AFNetworking/UIKit (= 3.1.0)
|
||||
- AFNetworking/NSURLSession (3.1.0):
|
||||
- AFNetworking (3.2.0):
|
||||
- AFNetworking/NSURLSession (= 3.2.0)
|
||||
- AFNetworking/Reachability (= 3.2.0)
|
||||
- AFNetworking/Security (= 3.2.0)
|
||||
- AFNetworking/Serialization (= 3.2.0)
|
||||
- AFNetworking/UIKit (= 3.2.0)
|
||||
- AFNetworking/NSURLSession (3.2.0):
|
||||
- AFNetworking/Reachability
|
||||
- AFNetworking/Security
|
||||
- AFNetworking/Serialization
|
||||
- AFNetworking/Reachability (3.1.0)
|
||||
- AFNetworking/Security (3.1.0)
|
||||
- AFNetworking/Serialization (3.1.0)
|
||||
- AFNetworking/UIKit (3.1.0):
|
||||
- AFNetworking/Reachability (3.2.0)
|
||||
- AFNetworking/Security (3.2.0)
|
||||
- AFNetworking/Serialization (3.2.0)
|
||||
- AFNetworking/UIKit (3.2.0):
|
||||
- AFNetworking/NSURLSession
|
||||
- Bolts (1.9.0):
|
||||
- Bolts/AppLinks (= 1.9.0)
|
||||
@ -26,19 +26,19 @@ PODS:
|
||||
- DJLocalization/Core (= 1.2.2)
|
||||
- DJLocalization/Core (1.2.2)
|
||||
- Expecta (1.0.6)
|
||||
- FBSDKCoreKit (4.29.0):
|
||||
- FBSDKCoreKit (4.31.1):
|
||||
- Bolts (~> 1.7)
|
||||
- FBSDKLoginKit (4.29.0):
|
||||
- FBSDKCoreKit
|
||||
- FBSDKShareKit (4.29.0):
|
||||
- FBSDKLoginKit (4.31.1):
|
||||
- FBSDKCoreKit
|
||||
- FBSDKShareKit (4.31.1):
|
||||
- FBSDKCoreKit (~> 4.31.1)
|
||||
- NSDataAES (0.2.2)
|
||||
- NSDate_Utils (1.1.0):
|
||||
- DJLocalization
|
||||
- NSString-Helper (1.0.5)
|
||||
- NSString-Helper (1.0.6)
|
||||
- nv-ios-http-status (0.0.1)
|
||||
- PEAR-FileManager-iOS (1.3.1)
|
||||
- PNObject (1.3.4):
|
||||
- PNObject (1.5):
|
||||
- AFNetworking
|
||||
- CodFis-Helper
|
||||
- DDDKeychainWrapper
|
||||
@ -58,7 +58,7 @@ PODS:
|
||||
- RZDataBinding (2.1.0)
|
||||
- Specta (1.0.7)
|
||||
- StrongestPasswordValidator (0.1.2)
|
||||
- UIDevice-Utils (1.0.0)
|
||||
- UIDevice-Utils (1.0.7)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Expecta
|
||||
@ -71,27 +71,27 @@ EXTERNAL SOURCES:
|
||||
:path: ../
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
|
||||
AFNetworking: 8ac6017b94ea105479f7776e5288e48ae9c59bb4
|
||||
Bolts: ac6567323eac61e203f6a9763667d0f711be34c8
|
||||
CodFis-Helper: 28be4c74d7202542459d72354f59b1215871de87
|
||||
DDDKeychainWrapper: e681a4daba6448786fa83b4941f58102a33b1897
|
||||
DJLocalization: 0c84029af375647d4104a42ae36be87194c46c47
|
||||
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
|
||||
FBSDKCoreKit: 6f139173dc63a1deaff4430a55f2fe5bb222d2af
|
||||
FBSDKLoginKit: 56a057ca6822535ea0faa25f57a7c41edb697fd4
|
||||
FBSDKShareKit: 18a2cd118aef11dd657fe7e8b64bae5c719088b2
|
||||
FBSDKCoreKit: e08ccfcefa7bc1347a07c276dac9bf6c7fe57024
|
||||
FBSDKLoginKit: 99797ac39252fef6f72600b886f6ee60b4b29cab
|
||||
FBSDKShareKit: e640c41c9fcd61929eeb3d0c21ad335103e7cb62
|
||||
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
|
||||
NSDate_Utils: c858a89da6e204ecf53aca48dbccb4da4d25bc9e
|
||||
NSString-Helper: 459e1b6a62b3bf7db10f01b0d102548608e945c4
|
||||
NSString-Helper: 389265918b2a4c5b0d09f0e03c607e8e5e254dd7
|
||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||
PNObject: 8dc560680a7a48060ed309b019ca4fc41505cc07
|
||||
PNObject: 75d5a262457e538027c6f7b9cbd4f8ee5700f21f
|
||||
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
|
||||
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
|
||||
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66
|
||||
StrongestPasswordValidator: 921e42615bdf353513c6f925bffd4fc29865dbd7
|
||||
UIDevice-Utils: ff37bd042127117572d6ce4c5ff074f4f54ab5ed
|
||||
UIDevice-Utils: 8ff812220ce91e97a2cea243bd4160e7b958ec76
|
||||
|
||||
PODFILE CHECKSUM: fcd5d1cf3426c7c9c5b3e5edcd4b8e5402ee7f2e
|
||||
|
||||
COCOAPODS: 1.3.1
|
||||
COCOAPODS: 1.4.0
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
## Methods to Override
|
||||
|
||||
To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:completionHandler:`.
|
||||
To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:`.
|
||||
|
||||
## Serialization
|
||||
|
||||
@ -94,6 +94,15 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
@property (nonatomic, strong) AFHTTPResponseSerializer <AFURLResponseSerialization> * responseSerializer;
|
||||
|
||||
///-------------------------------
|
||||
/// @name Managing Security Policy
|
||||
///-------------------------------
|
||||
|
||||
/**
|
||||
The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified. A security policy configured with `AFSSLPinningModePublicKey` or `AFSSLPinningModeCertificate` can only be applied on a session manager initialized with a secure base URL (i.e. https). Applying a security policy with pinning enabled on an insecure session manager throws an `Invalid Security Policy` exception.
|
||||
*/
|
||||
@property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
|
||||
|
||||
///---------------------
|
||||
/// @name Initialization
|
||||
///---------------------
|
||||
|
||||
@ -98,6 +98,23 @@
|
||||
[super setResponseSerializer:responseSerializer];
|
||||
}
|
||||
|
||||
@dynamic securityPolicy;
|
||||
|
||||
- (void)setSecurityPolicy:(AFSecurityPolicy *)securityPolicy {
|
||||
if (securityPolicy.SSLPinningMode != AFSSLPinningModeNone && ![self.baseURL.scheme isEqualToString:@"https"]) {
|
||||
NSString *pinningMode = @"Unknown Pinning Mode";
|
||||
switch (securityPolicy.SSLPinningMode) {
|
||||
case AFSSLPinningModeNone: pinningMode = @"AFSSLPinningModeNone"; break;
|
||||
case AFSSLPinningModeCertificate: pinningMode = @"AFSSLPinningModeCertificate"; break;
|
||||
case AFSSLPinningModePublicKey: pinningMode = @"AFSSLPinningModePublicKey"; break;
|
||||
}
|
||||
NSString *reason = [NSString stringWithFormat:@"A security policy configured with `%@` can only be applied on a manager with a secure base URL (i.e. https)", pinningMode];
|
||||
@throw [NSException exceptionWithName:@"Invalid Security Policy" reason:reason userInfo:nil];
|
||||
}
|
||||
|
||||
[super setSecurityPolicy:securityPolicy];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (NSURLSessionDataTask *)GET:(NSString *)URLString
|
||||
@ -186,12 +203,9 @@
|
||||
NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block error:&serializationError];
|
||||
if (serializationError) {
|
||||
if (failure) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu"
|
||||
dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
|
||||
failure(nil, serializationError);
|
||||
});
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
return nil;
|
||||
@ -262,12 +276,9 @@
|
||||
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters error:&serializationError];
|
||||
if (serializationError) {
|
||||
if (failure) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu"
|
||||
dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
|
||||
failure(nil, serializationError);
|
||||
});
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
||||
@ -107,6 +107,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Initializes an instance of a network reachability manager
|
||||
*
|
||||
* @return nil as this method is unavailable
|
||||
*/
|
||||
- (nullable instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
///--------------------------------------------------
|
||||
/// @name Starting & Stopping Reachability Monitoring
|
||||
///--------------------------------------------------
|
||||
|
||||
@ -51,8 +51,6 @@ static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) {
|
||||
static id AFPublicKeyForCertificate(NSData *certificate) {
|
||||
id allowedPublicKey = nil;
|
||||
SecCertificateRef allowedCertificate;
|
||||
SecCertificateRef allowedCertificates[1];
|
||||
CFArrayRef tempCertificates = nil;
|
||||
SecPolicyRef policy = nil;
|
||||
SecTrustRef allowedTrust = nil;
|
||||
SecTrustResultType result;
|
||||
@ -60,11 +58,8 @@ static id AFPublicKeyForCertificate(NSData *certificate) {
|
||||
allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificate);
|
||||
__Require_Quiet(allowedCertificate != NULL, _out);
|
||||
|
||||
allowedCertificates[0] = allowedCertificate;
|
||||
tempCertificates = CFArrayCreate(NULL, (const void **)allowedCertificates, 1, NULL);
|
||||
|
||||
policy = SecPolicyCreateBasicX509();
|
||||
__Require_noErr_Quiet(SecTrustCreateWithCertificates(tempCertificates, policy, &allowedTrust), _out);
|
||||
__Require_noErr_Quiet(SecTrustCreateWithCertificates(allowedCertificate, policy, &allowedTrust), _out);
|
||||
__Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out);
|
||||
|
||||
allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust);
|
||||
@ -78,10 +73,6 @@ _out:
|
||||
CFRelease(policy);
|
||||
}
|
||||
|
||||
if (tempCertificates) {
|
||||
CFRelease(tempCertificates);
|
||||
}
|
||||
|
||||
if (allowedCertificate) {
|
||||
CFRelease(allowedCertificate);
|
||||
}
|
||||
|
||||
@ -60,10 +60,7 @@ NSString * AFPercentEscapedStringFromString(NSString *string) {
|
||||
NSMutableString *escaped = @"".mutableCopy;
|
||||
|
||||
while (index < string.length) {
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wgnu"
|
||||
NSUInteger length = MIN(string.length - index, batchSize);
|
||||
#pragma GCC diagnostic pop
|
||||
NSRange range = NSMakeRange(index, length);
|
||||
|
||||
// To avoid breaking up character sequences such as 👴🏻👮🏽
|
||||
@ -189,6 +186,7 @@ static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerOb
|
||||
@interface AFHTTPRequestSerializer ()
|
||||
@property (readwrite, nonatomic, strong) NSMutableSet *mutableObservedChangedKeyPaths;
|
||||
@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableHTTPRequestHeaders;
|
||||
@property (readwrite, nonatomic, strong) dispatch_queue_t requestHeaderModificationQueue;
|
||||
@property (readwrite, nonatomic, assign) AFHTTPRequestQueryStringSerializationStyle queryStringSerializationStyle;
|
||||
@property (readwrite, nonatomic, copy) AFQueryStringSerializationBlock queryStringSerialization;
|
||||
@end
|
||||
@ -208,6 +206,7 @@ static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerOb
|
||||
self.stringEncoding = NSUTF8StringEncoding;
|
||||
|
||||
self.mutableHTTPRequestHeaders = [NSMutableDictionary dictionary];
|
||||
self.requestHeaderModificationQueue = dispatch_queue_create("requestHeaderModificationQueue", DISPATCH_QUEUE_CONCURRENT);
|
||||
|
||||
// Accept-Language HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
|
||||
NSMutableArray *acceptLanguagesComponents = [NSMutableArray array];
|
||||
@ -219,8 +218,6 @@ static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerOb
|
||||
[self setValue:[acceptLanguagesComponents componentsJoinedByString:@", "] forHTTPHeaderField:@"Accept-Language"];
|
||||
|
||||
NSString *userAgent = nil;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu"
|
||||
#if TARGET_OS_IOS
|
||||
// User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
|
||||
userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]];
|
||||
@ -230,7 +227,6 @@ static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerOb
|
||||
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||
userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]];
|
||||
#endif
|
||||
#pragma clang diagnostic pop
|
||||
if (userAgent) {
|
||||
if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) {
|
||||
NSMutableString *mutableUserAgent = [userAgent mutableCopy];
|
||||
@ -306,17 +302,27 @@ static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerOb
|
||||
#pragma mark -
|
||||
|
||||
- (NSDictionary *)HTTPRequestHeaders {
|
||||
return [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders];
|
||||
NSDictionary __block *value;
|
||||
dispatch_sync(self.requestHeaderModificationQueue, ^{
|
||||
value = [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders];
|
||||
});
|
||||
return value;
|
||||
}
|
||||
|
||||
- (void)setValue:(NSString *)value
|
||||
forHTTPHeaderField:(NSString *)field
|
||||
{
|
||||
[self.mutableHTTPRequestHeaders setValue:value forKey:field];
|
||||
dispatch_barrier_async(self.requestHeaderModificationQueue, ^{
|
||||
[self.mutableHTTPRequestHeaders setValue:value forKey:field];
|
||||
});
|
||||
}
|
||||
|
||||
- (NSString *)valueForHTTPHeaderField:(NSString *)field {
|
||||
return [self.mutableHTTPRequestHeaders valueForKey:field];
|
||||
NSString __block *value;
|
||||
dispatch_sync(self.requestHeaderModificationQueue, ^{
|
||||
value = [self.mutableHTTPRequestHeaders valueForKey:field];
|
||||
});
|
||||
return value;
|
||||
}
|
||||
|
||||
- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username
|
||||
@ -328,7 +334,9 @@ forHTTPHeaderField:(NSString *)field
|
||||
}
|
||||
|
||||
- (void)clearAuthorizationHeader {
|
||||
[self.mutableHTTPRequestHeaders removeObjectForKey:@"Authorization"];
|
||||
dispatch_barrier_async(self.requestHeaderModificationQueue, ^{
|
||||
[self.mutableHTTPRequestHeaders removeObjectForKey:@"Authorization"];
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@ -560,7 +568,9 @@ forHTTPHeaderField:(NSString *)field
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)coder {
|
||||
[coder encodeObject:self.mutableHTTPRequestHeaders forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))];
|
||||
dispatch_sync(self.requestHeaderModificationQueue, ^{
|
||||
[coder encodeObject:self.mutableHTTPRequestHeaders forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))];
|
||||
});
|
||||
[coder encodeInteger:self.queryStringSerializationStyle forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))];
|
||||
}
|
||||
|
||||
@ -568,7 +578,9 @@ forHTTPHeaderField:(NSString *)field
|
||||
|
||||
- (instancetype)copyWithZone:(NSZone *)zone {
|
||||
AFHTTPRequestSerializer *serializer = [[[self class] allocWithZone:zone] init];
|
||||
serializer.mutableHTTPRequestHeaders = [self.mutableHTTPRequestHeaders mutableCopyWithZone:zone];
|
||||
dispatch_sync(self.requestHeaderModificationQueue, ^{
|
||||
serializer.mutableHTTPRequestHeaders = [self.mutableHTTPRequestHeaders mutableCopyWithZone:zone];
|
||||
});
|
||||
serializer.queryStringSerializationStyle = self.queryStringSerializationStyle;
|
||||
serializer.queryStringSerialization = self.queryStringSerialization;
|
||||
|
||||
@ -667,6 +679,11 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setRequest:(NSMutableURLRequest *)request
|
||||
{
|
||||
_request = [request mutableCopy];
|
||||
}
|
||||
|
||||
- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
|
||||
name:(NSString *)name
|
||||
error:(NSError * __autoreleasing *)error
|
||||
@ -835,14 +852,11 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
||||
@end
|
||||
|
||||
@implementation AFMultipartBodyStream
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wimplicit-atomic-properties"
|
||||
#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1100)
|
||||
@synthesize delegate;
|
||||
#endif
|
||||
@synthesize streamStatus;
|
||||
@synthesize streamError;
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
- (instancetype)initWithStringEncoding:(NSStringEncoding)encoding {
|
||||
self = [super init];
|
||||
@ -888,8 +902,6 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
||||
|
||||
NSInteger totalNumberOfBytesRead = 0;
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu"
|
||||
while ((NSUInteger)totalNumberOfBytesRead < MIN(length, self.numberOfBytesInPacket)) {
|
||||
if (!self.currentHTTPBodyPart || ![self.currentHTTPBodyPart hasBytesAvailable]) {
|
||||
if (!(self.currentHTTPBodyPart = [self.HTTPBodyPartEnumerator nextObject])) {
|
||||
@ -910,7 +922,6 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
return totalNumberOfBytesRead;
|
||||
}
|
||||
@ -1091,8 +1102,6 @@ typedef enum {
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcovered-switch-default"
|
||||
switch (self.inputStream.streamStatus) {
|
||||
case NSStreamStatusNotOpen:
|
||||
case NSStreamStatusOpening:
|
||||
@ -1106,7 +1115,6 @@ typedef enum {
|
||||
default:
|
||||
return NO;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
- (NSInteger)read:(uint8_t *)buffer
|
||||
@ -1151,11 +1159,8 @@ typedef enum {
|
||||
intoBuffer:(uint8_t *)buffer
|
||||
maxLength:(NSUInteger)length
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu"
|
||||
NSRange range = NSMakeRange((NSUInteger)_phaseReadOffset, MIN([data length] - ((NSUInteger)_phaseReadOffset), length));
|
||||
[data getBytes:buffer range:range];
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
_phaseReadOffset += range.length;
|
||||
|
||||
@ -1174,8 +1179,6 @@ typedef enum {
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcovered-switch-default"
|
||||
switch (_phase) {
|
||||
case AFEncapsulationBoundaryPhase:
|
||||
_phase = AFHeaderPhase;
|
||||
@ -1195,7 +1198,6 @@ typedef enum {
|
||||
break;
|
||||
}
|
||||
_phaseReadOffset = 0;
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
return YES;
|
||||
}
|
||||
@ -1257,7 +1259,21 @@ typedef enum {
|
||||
[mutableRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
||||
}
|
||||
|
||||
[mutableRequest setHTTPBody:[NSJSONSerialization dataWithJSONObject:parameters options:self.writingOptions error:error]];
|
||||
if (![NSJSONSerialization isValidJSONObject:parameters]) {
|
||||
if (error) {
|
||||
NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"The `parameters` argument is not valid JSON.", @"AFNetworking", nil)};
|
||||
*error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:userInfo];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parameters options:self.writingOptions error:error];
|
||||
|
||||
if (!jsonData) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
[mutableRequest setHTTPBody:jsonData];
|
||||
}
|
||||
|
||||
return mutableRequest;
|
||||
@ -1336,7 +1352,13 @@ typedef enum {
|
||||
[mutableRequest setValue:@"application/x-plist" forHTTPHeaderField:@"Content-Type"];
|
||||
}
|
||||
|
||||
[mutableRequest setHTTPBody:[NSPropertyListSerialization dataWithPropertyList:parameters format:self.format options:self.writeOptions error:error]];
|
||||
NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:parameters format:self.format options:self.writeOptions error:error];
|
||||
|
||||
if (!plistData) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
[mutableRequest setHTTPBody:plistData];
|
||||
}
|
||||
|
||||
return mutableRequest;
|
||||
|
||||
@ -57,10 +57,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (instancetype)init;
|
||||
|
||||
/**
|
||||
The string encoding used to serialize data received from the server, when no string encoding is specified by the response. `NSUTF8StringEncoding` by default.
|
||||
*/
|
||||
@property (nonatomic, assign) NSStringEncoding stringEncoding;
|
||||
@property (nonatomic, assign) NSStringEncoding stringEncoding DEPRECATED_MSG_ATTRIBUTE("The string encoding is never used. AFHTTPResponseSerializer only validates status codes and content types but does not try to decode the received data in any way.");
|
||||
|
||||
/**
|
||||
Creates and returns a serializer with default configuration.
|
||||
@ -111,6 +108,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- `application/json`
|
||||
- `text/json`
|
||||
- `text/javascript`
|
||||
|
||||
In RFC 7159 - Section 8.1, it states that JSON text is required to be encoded in UTF-8, UTF-16, or UTF-32, and the default encoding is UTF-8. NSJSONSerialization provides support for all the encodings listed in the specification, and recommends UTF-8 for efficiency. Using an unsupported encoding will result in serialization error. See the `NSJSONSerialization` documentation for more details.
|
||||
*/
|
||||
@interface AFJSONResponseSerializer : AFHTTPResponseSerializer
|
||||
|
||||
@ -166,7 +165,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (instancetype)init;
|
||||
|
||||
/**
|
||||
Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default.
|
||||
Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSXMLDocument` documentation section "Input and Output Options". `0` by default.
|
||||
*/
|
||||
@property (nonatomic, assign) NSUInteger options;
|
||||
|
||||
|
||||
@ -97,8 +97,6 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
|
||||
return nil;
|
||||
}
|
||||
|
||||
self.stringEncoding = NSUTF8StringEncoding;
|
||||
|
||||
self.acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)];
|
||||
self.acceptableContentTypes = nil;
|
||||
|
||||
@ -242,23 +240,28 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
|
||||
}
|
||||
}
|
||||
|
||||
id responseObject = nil;
|
||||
NSError *serializationError = nil;
|
||||
// Workaround for behavior of Rails to return a single space for `head :ok` (a workaround for a bug in Safari), which is not interpreted as valid input by NSJSONSerialization.
|
||||
// See https://github.com/rails/rails/issues/1742
|
||||
BOOL isSpace = [data isEqualToData:[NSData dataWithBytes:" " length:1]];
|
||||
if (data.length > 0 && !isSpace) {
|
||||
responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError];
|
||||
} else {
|
||||
|
||||
if (data.length == 0 || isSpace) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSError *serializationError = nil;
|
||||
|
||||
id responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError];
|
||||
|
||||
if (self.removesKeysWithNullValues && responseObject) {
|
||||
responseObject = AFJSONObjectByRemovingKeysWithNullValues(responseObject, self.readingOptions);
|
||||
if (!responseObject)
|
||||
{
|
||||
if (error) {
|
||||
*error = AFErrorWithUnderlyingError(serializationError, *error);
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
*error = AFErrorWithUnderlyingError(serializationError, *error);
|
||||
|
||||
if (self.removesKeysWithNullValues) {
|
||||
return AFJSONObjectByRemovingKeysWithNullValues(responseObject, self.readingOptions);
|
||||
}
|
||||
|
||||
return responseObject;
|
||||
@ -288,7 +291,7 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (instancetype)copyWithZone:(NSZone *)zone {
|
||||
AFJSONResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
|
||||
AFJSONResponseSerializer *serializer = [super copyWithZone:zone];
|
||||
serializer.readingOptions = self.readingOptions;
|
||||
serializer.removesKeysWithNullValues = self.removesKeysWithNullValues;
|
||||
|
||||
@ -378,10 +381,14 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
|
||||
NSError *serializationError = nil;
|
||||
NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:data options:self.options error:&serializationError];
|
||||
|
||||
if (error) {
|
||||
*error = AFErrorWithUnderlyingError(serializationError, *error);
|
||||
if (!document)
|
||||
{
|
||||
if (error) {
|
||||
*error = AFErrorWithUnderlyingError(serializationError, *error);
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
return document;
|
||||
}
|
||||
|
||||
@ -407,7 +414,7 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (instancetype)copyWithZone:(NSZone *)zone {
|
||||
AFXMLDocumentResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
|
||||
AFXMLDocumentResponseSerializer *serializer = [super copyWithZone:zone];
|
||||
serializer.options = self.options;
|
||||
|
||||
return serializer;
|
||||
@ -458,15 +465,20 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
|
||||
}
|
||||
}
|
||||
|
||||
id responseObject;
|
||||
NSError *serializationError = nil;
|
||||
|
||||
if (data) {
|
||||
responseObject = [NSPropertyListSerialization propertyListWithData:data options:self.readOptions format:NULL error:&serializationError];
|
||||
if (!data) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
*error = AFErrorWithUnderlyingError(serializationError, *error);
|
||||
|
||||
NSError *serializationError = nil;
|
||||
|
||||
id responseObject = [NSPropertyListSerialization propertyListWithData:data options:self.readOptions format:NULL error:&serializationError];
|
||||
|
||||
if (!responseObject)
|
||||
{
|
||||
if (error) {
|
||||
*error = AFErrorWithUnderlyingError(serializationError, *error);
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
return responseObject;
|
||||
@ -496,7 +508,7 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (instancetype)copyWithZone:(NSZone *)zone {
|
||||
AFPropertyListResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
|
||||
AFPropertyListResponseSerializer *serializer = [super copyWithZone:zone];
|
||||
serializer.format = self.format;
|
||||
serializer.readOptions = self.readOptions;
|
||||
|
||||
@ -722,7 +734,7 @@ static UIImage * AFInflatedImageFromResponseWithDataAtScale(NSHTTPURLResponse *r
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (instancetype)copyWithZone:(NSZone *)zone {
|
||||
AFImageResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
|
||||
AFImageResponseSerializer *serializer = [super copyWithZone:zone];
|
||||
|
||||
#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
|
||||
serializer.imageScale = self.imageScale;
|
||||
@ -796,7 +808,7 @@ static UIImage * AFInflatedImageFromResponseWithDataAtScale(NSHTTPURLResponse *r
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (instancetype)copyWithZone:(NSZone *)zone {
|
||||
AFCompoundResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
|
||||
AFCompoundResponseSerializer *serializer = [super copyWithZone:zone];
|
||||
serializer.responseSerializers = self.responseSerializers;
|
||||
|
||||
return serializer;
|
||||
|
||||
@ -208,7 +208,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.
|
||||
*/
|
||||
- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
|
||||
completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;
|
||||
completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler DEPRECATED_ATTRIBUTE;
|
||||
|
||||
/**
|
||||
Creates an `NSURLSessionDataTask` with the specified request.
|
||||
@ -354,7 +354,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@param block A block object to be executed when an HTTP request is attempting to perform a redirection to a different URL. The block returns the request to be made for the redirection, and takes four arguments: the session, the task, the redirection response, and the request corresponding to the redirection response.
|
||||
*/
|
||||
- (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block;
|
||||
- (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * _Nullable (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block;
|
||||
|
||||
/**
|
||||
Sets a block to be executed when a session task has received a request specific authentication challenge, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didReceiveChallenge:completionHandler:`.
|
||||
|
||||
@ -85,8 +85,6 @@ static NSString * const AFURLSessionManagerLockName = @"com.alamofire.networking
|
||||
|
||||
static NSUInteger const AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask = 3;
|
||||
|
||||
static void * AFTaskStateChangedContext = &AFTaskStateChangedContext;
|
||||
|
||||
typedef void (^AFURLSessionDidBecomeInvalidBlock)(NSURLSession *session, NSError *error);
|
||||
typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential);
|
||||
|
||||
@ -114,6 +112,7 @@ typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id re
|
||||
#pragma mark -
|
||||
|
||||
@interface AFURLSessionManagerTaskDelegate : NSObject <NSURLSessionTaskDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate>
|
||||
- (instancetype)initWithTask:(NSURLSessionTask *)task;
|
||||
@property (nonatomic, weak) AFURLSessionManager *manager;
|
||||
@property (nonatomic, strong) NSMutableData *mutableData;
|
||||
@property (nonatomic, strong) NSProgress *uploadProgress;
|
||||
@ -127,113 +126,54 @@ typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id re
|
||||
|
||||
@implementation AFURLSessionManagerTaskDelegate
|
||||
|
||||
- (instancetype)init {
|
||||
- (instancetype)initWithTask:(NSURLSessionTask *)task {
|
||||
self = [super init];
|
||||
if (!self) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
self.mutableData = [NSMutableData data];
|
||||
self.uploadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil];
|
||||
self.uploadProgress.totalUnitCount = NSURLSessionTransferSizeUnknown;
|
||||
|
||||
self.downloadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil];
|
||||
self.downloadProgress.totalUnitCount = NSURLSessionTransferSizeUnknown;
|
||||
|
||||
_mutableData = [NSMutableData data];
|
||||
_uploadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil];
|
||||
_downloadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil];
|
||||
|
||||
__weak __typeof__(task) weakTask = task;
|
||||
for (NSProgress *progress in @[ _uploadProgress, _downloadProgress ])
|
||||
{
|
||||
progress.totalUnitCount = NSURLSessionTransferSizeUnknown;
|
||||
progress.cancellable = YES;
|
||||
progress.cancellationHandler = ^{
|
||||
[weakTask cancel];
|
||||
};
|
||||
progress.pausable = YES;
|
||||
progress.pausingHandler = ^{
|
||||
[weakTask suspend];
|
||||
};
|
||||
#if __has_warning("-Wunguarded-availability-new")
|
||||
if (@available(iOS 9, macOS 10.11, *)) {
|
||||
#else
|
||||
if ([progress respondsToSelector:@selector(setResumingHandler:)]) {
|
||||
#endif
|
||||
progress.resumingHandler = ^{
|
||||
[weakTask resume];
|
||||
};
|
||||
}
|
||||
[progress addObserver:self
|
||||
forKeyPath:NSStringFromSelector(@selector(fractionCompleted))
|
||||
options:NSKeyValueObservingOptionNew
|
||||
context:NULL];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - NSProgress Tracking
|
||||
|
||||
- (void)setupProgressForTask:(NSURLSessionTask *)task {
|
||||
__weak __typeof__(task) weakTask = task;
|
||||
|
||||
self.uploadProgress.totalUnitCount = task.countOfBytesExpectedToSend;
|
||||
self.downloadProgress.totalUnitCount = task.countOfBytesExpectedToReceive;
|
||||
[self.uploadProgress setCancellable:YES];
|
||||
[self.uploadProgress setCancellationHandler:^{
|
||||
__typeof__(weakTask) strongTask = weakTask;
|
||||
[strongTask cancel];
|
||||
}];
|
||||
[self.uploadProgress setPausable:YES];
|
||||
[self.uploadProgress setPausingHandler:^{
|
||||
__typeof__(weakTask) strongTask = weakTask;
|
||||
[strongTask suspend];
|
||||
}];
|
||||
if ([self.uploadProgress respondsToSelector:@selector(setResumingHandler:)]) {
|
||||
[self.uploadProgress setResumingHandler:^{
|
||||
__typeof__(weakTask) strongTask = weakTask;
|
||||
[strongTask resume];
|
||||
}];
|
||||
}
|
||||
|
||||
[self.downloadProgress setCancellable:YES];
|
||||
[self.downloadProgress setCancellationHandler:^{
|
||||
__typeof__(weakTask) strongTask = weakTask;
|
||||
[strongTask cancel];
|
||||
}];
|
||||
[self.downloadProgress setPausable:YES];
|
||||
[self.downloadProgress setPausingHandler:^{
|
||||
__typeof__(weakTask) strongTask = weakTask;
|
||||
[strongTask suspend];
|
||||
}];
|
||||
|
||||
if ([self.downloadProgress respondsToSelector:@selector(setResumingHandler:)]) {
|
||||
[self.downloadProgress setResumingHandler:^{
|
||||
__typeof__(weakTask) strongTask = weakTask;
|
||||
[strongTask resume];
|
||||
}];
|
||||
}
|
||||
|
||||
[task addObserver:self
|
||||
forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))
|
||||
options:NSKeyValueObservingOptionNew
|
||||
context:NULL];
|
||||
[task addObserver:self
|
||||
forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))
|
||||
options:NSKeyValueObservingOptionNew
|
||||
context:NULL];
|
||||
|
||||
[task addObserver:self
|
||||
forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))
|
||||
options:NSKeyValueObservingOptionNew
|
||||
context:NULL];
|
||||
[task addObserver:self
|
||||
forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToSend))
|
||||
options:NSKeyValueObservingOptionNew
|
||||
context:NULL];
|
||||
|
||||
[self.downloadProgress addObserver:self
|
||||
forKeyPath:NSStringFromSelector(@selector(fractionCompleted))
|
||||
options:NSKeyValueObservingOptionNew
|
||||
context:NULL];
|
||||
[self.uploadProgress addObserver:self
|
||||
forKeyPath:NSStringFromSelector(@selector(fractionCompleted))
|
||||
options:NSKeyValueObservingOptionNew
|
||||
context:NULL];
|
||||
}
|
||||
|
||||
- (void)cleanUpProgressForTask:(NSURLSessionTask *)task {
|
||||
[task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))];
|
||||
[task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))];
|
||||
[task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))];
|
||||
[task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToSend))];
|
||||
- (void)dealloc {
|
||||
[self.downloadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))];
|
||||
[self.uploadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))];
|
||||
}
|
||||
|
||||
#pragma mark - NSProgress Tracking
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {
|
||||
if ([object isKindOfClass:[NSURLSessionTask class]] || [object isKindOfClass:[NSURLSessionDownloadTask class]]) {
|
||||
if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) {
|
||||
self.downloadProgress.completedUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];
|
||||
} else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))]) {
|
||||
self.downloadProgress.totalUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];
|
||||
} else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) {
|
||||
self.uploadProgress.completedUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];
|
||||
} else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToSend))]) {
|
||||
self.uploadProgress.totalUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];
|
||||
}
|
||||
}
|
||||
else if ([object isEqual:self.downloadProgress]) {
|
||||
if ([object isEqual:self.downloadProgress]) {
|
||||
if (self.downloadProgressBlock) {
|
||||
self.downloadProgressBlock(object);
|
||||
}
|
||||
@ -251,8 +191,6 @@ typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id re
|
||||
task:(NSURLSessionTask *)task
|
||||
didCompleteWithError:(NSError *)error
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu"
|
||||
__strong AFURLSessionManager *manager = self.manager;
|
||||
|
||||
__block id responseObject = nil;
|
||||
@ -314,33 +252,60 @@ didCompleteWithError:(NSError *)error
|
||||
});
|
||||
});
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
#pragma mark - NSURLSessionDataTaskDelegate
|
||||
#pragma mark - NSURLSessionDataDelegate
|
||||
|
||||
- (void)URLSession:(__unused NSURLSession *)session
|
||||
dataTask:(__unused NSURLSessionDataTask *)dataTask
|
||||
didReceiveData:(NSData *)data
|
||||
{
|
||||
self.downloadProgress.totalUnitCount = dataTask.countOfBytesExpectedToReceive;
|
||||
self.downloadProgress.completedUnitCount = dataTask.countOfBytesReceived;
|
||||
|
||||
[self.mutableData appendData:data];
|
||||
}
|
||||
|
||||
#pragma mark - NSURLSessionDownloadTaskDelegate
|
||||
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task
|
||||
didSendBodyData:(int64_t)bytesSent
|
||||
totalBytesSent:(int64_t)totalBytesSent
|
||||
totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend{
|
||||
|
||||
self.uploadProgress.totalUnitCount = task.countOfBytesExpectedToSend;
|
||||
self.uploadProgress.completedUnitCount = task.countOfBytesSent;
|
||||
}
|
||||
|
||||
#pragma mark - NSURLSessionDownloadDelegate
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask
|
||||
didWriteData:(int64_t)bytesWritten
|
||||
totalBytesWritten:(int64_t)totalBytesWritten
|
||||
totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite{
|
||||
|
||||
self.downloadProgress.totalUnitCount = totalBytesExpectedToWrite;
|
||||
self.downloadProgress.completedUnitCount = totalBytesWritten;
|
||||
}
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask
|
||||
didResumeAtOffset:(int64_t)fileOffset
|
||||
expectedTotalBytes:(int64_t)expectedTotalBytes{
|
||||
|
||||
self.downloadProgress.totalUnitCount = expectedTotalBytes;
|
||||
self.downloadProgress.completedUnitCount = fileOffset;
|
||||
}
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session
|
||||
downloadTask:(NSURLSessionDownloadTask *)downloadTask
|
||||
didFinishDownloadingToURL:(NSURL *)location
|
||||
{
|
||||
NSError *fileManagerError = nil;
|
||||
self.downloadFileURL = nil;
|
||||
|
||||
if (self.downloadTaskDidFinishDownloading) {
|
||||
self.downloadFileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location);
|
||||
if (self.downloadFileURL) {
|
||||
[[NSFileManager defaultManager] moveItemAtURL:location toURL:self.downloadFileURL error:&fileManagerError];
|
||||
NSError *fileManagerError = nil;
|
||||
|
||||
if (fileManagerError) {
|
||||
if (![[NSFileManager defaultManager] moveItemAtURL:location toURL:self.downloadFileURL error:&fileManagerError]) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:fileManagerError.userInfo];
|
||||
}
|
||||
}
|
||||
@ -608,7 +573,6 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
|
||||
|
||||
[self.lock lock];
|
||||
self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)] = delegate;
|
||||
[delegate setupProgressForTask:task];
|
||||
[self addNotificationObserverForTask:task];
|
||||
[self.lock unlock];
|
||||
}
|
||||
@ -618,7 +582,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
|
||||
downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock
|
||||
completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
|
||||
{
|
||||
AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init];
|
||||
AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] initWithTask:dataTask];
|
||||
delegate.manager = self;
|
||||
delegate.completionHandler = completionHandler;
|
||||
|
||||
@ -633,7 +597,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
|
||||
progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock
|
||||
completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
|
||||
{
|
||||
AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init];
|
||||
AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] initWithTask:uploadTask];
|
||||
delegate.manager = self;
|
||||
delegate.completionHandler = completionHandler;
|
||||
|
||||
@ -649,7 +613,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
|
||||
destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
|
||||
completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler
|
||||
{
|
||||
AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init];
|
||||
AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] initWithTask:downloadTask];
|
||||
delegate.manager = self;
|
||||
delegate.completionHandler = completionHandler;
|
||||
|
||||
@ -669,9 +633,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
|
||||
- (void)removeDelegateForTask:(NSURLSessionTask *)task {
|
||||
NSParameterAssert(task);
|
||||
|
||||
AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task];
|
||||
[self.lock lock];
|
||||
[delegate cleanUpProgressForTask:task];
|
||||
[self removeNotificationObserverForTask:task];
|
||||
[self.mutableTaskDelegatesKeyedByTaskIdentifier removeObjectForKey:@(task.taskIdentifier)];
|
||||
[self.lock unlock];
|
||||
@ -720,13 +682,11 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
|
||||
#pragma mark -
|
||||
|
||||
- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (cancelPendingTasks) {
|
||||
[self.session invalidateAndCancel];
|
||||
} else {
|
||||
[self.session finishTasksAndInvalidate];
|
||||
}
|
||||
});
|
||||
if (cancelPendingTasks) {
|
||||
[self.session invalidateAndCancel];
|
||||
} else {
|
||||
[self.session finishTasksAndInvalidate];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@ -781,16 +741,21 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
|
||||
__block NSURLSessionUploadTask *uploadTask = nil;
|
||||
url_session_manager_create_task_safely(^{
|
||||
uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];
|
||||
});
|
||||
|
||||
if (!uploadTask && self.attemptsToRecreateUploadTasksForBackgroundSessions && self.session.configuration.identifier) {
|
||||
for (NSUInteger attempts = 0; !uploadTask && attempts < AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask; attempts++) {
|
||||
uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];
|
||||
|
||||
// uploadTask may be nil on iOS7 because uploadTaskWithRequest:fromFile: may return nil despite being documented as nonnull (https://devforums.apple.com/message/926113#926113)
|
||||
if (!uploadTask && self.attemptsToRecreateUploadTasksForBackgroundSessions && self.session.configuration.identifier) {
|
||||
for (NSUInteger attempts = 0; !uploadTask && attempts < AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask; attempts++) {
|
||||
uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (uploadTask) {
|
||||
[self addDelegateForUploadTask:uploadTask
|
||||
progress:uploadProgressBlock
|
||||
completionHandler:completionHandler];
|
||||
}
|
||||
|
||||
[self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler];
|
||||
|
||||
return uploadTask;
|
||||
}
|
||||
|
||||
@ -1073,6 +1038,12 @@ totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
|
||||
totalUnitCount = (int64_t) [contentLength longLongValue];
|
||||
}
|
||||
}
|
||||
|
||||
AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task];
|
||||
|
||||
if (delegate) {
|
||||
[delegate URLSession:session task:task didSendBodyData:bytesSent totalBytesSent:totalBytesSent totalBytesExpectedToSend:totalBytesExpectedToSend];
|
||||
}
|
||||
|
||||
if (self.taskDidSendBodyData) {
|
||||
self.taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalUnitCount);
|
||||
@ -1179,8 +1150,8 @@ didFinishDownloadingToURL:(NSURL *)location
|
||||
if (fileURL) {
|
||||
delegate.downloadFileURL = fileURL;
|
||||
NSError *error = nil;
|
||||
[[NSFileManager defaultManager] moveItemAtURL:location toURL:fileURL error:&error];
|
||||
if (error) {
|
||||
|
||||
if (![[NSFileManager defaultManager] moveItemAtURL:location toURL:fileURL error:&error]) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:error.userInfo];
|
||||
}
|
||||
|
||||
@ -1199,6 +1170,13 @@ didFinishDownloadingToURL:(NSURL *)location
|
||||
totalBytesWritten:(int64_t)totalBytesWritten
|
||||
totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
|
||||
{
|
||||
|
||||
AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask];
|
||||
|
||||
if (delegate) {
|
||||
[delegate URLSession:session downloadTask:downloadTask didWriteData:bytesWritten totalBytesWritten:totalBytesWritten totalBytesExpectedToWrite:totalBytesExpectedToWrite];
|
||||
}
|
||||
|
||||
if (self.downloadTaskDidWriteData) {
|
||||
self.downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite);
|
||||
}
|
||||
@ -1209,6 +1187,13 @@ totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
|
||||
didResumeAtOffset:(int64_t)fileOffset
|
||||
expectedTotalBytes:(int64_t)expectedTotalBytes
|
||||
{
|
||||
|
||||
AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask];
|
||||
|
||||
if (delegate) {
|
||||
[delegate URLSession:session downloadTask:downloadTask didResumeAtOffset:fileOffset expectedTotalBytes:expectedTotalBytes];
|
||||
}
|
||||
|
||||
if (self.downloadTaskDidResume) {
|
||||
self.downloadTaskDidResume(session, downloadTask, fileOffset, expectedTotalBytes);
|
||||
}
|
||||
|
||||
2
Example/Pods/AFNetworking/LICENSE
generated
2
Example/Pods/AFNetworking/LICENSE
generated
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/)
|
||||
Copyright (c) 2011-2016 Alamofire Software Foundation (http://alamofire.org/)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
12
Example/Pods/AFNetworking/README.md
generated
12
Example/Pods/AFNetworking/README.md
generated
@ -9,7 +9,7 @@
|
||||
[](http://cocoadocs.org/docsets/AFNetworking)
|
||||
[](http://twitter.com/AFNetworking)
|
||||
|
||||
AFNetworking is a delightful networking library for iOS and Mac OS X. It's built on top of the [Foundation URL Loading System](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html), extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.
|
||||
AFNetworking is a delightful networking library for iOS, macOS, watchOS, and tvOS. It's built on top of the [Foundation URL Loading System](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html), extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.
|
||||
|
||||
Perhaps the most important feature of all, however, is the amazing community of developers who use and contribute to AFNetworking every day. AFNetworking powers some of the most popular and critically-acclaimed apps on the iPhone, iPad, and Mac.
|
||||
|
||||
@ -51,7 +51,9 @@ To integrate AFNetworking into your Xcode project using CocoaPods, specify it in
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
platform :ios, '8.0'
|
||||
|
||||
target 'TargetName' do
|
||||
pod 'AFNetworking', '~> 3.0'
|
||||
end
|
||||
```
|
||||
|
||||
Then, run the following command:
|
||||
@ -81,7 +83,7 @@ Run `carthage` to build the framework and drag the built `AFNetworking.framework
|
||||
|
||||
## Requirements
|
||||
|
||||
| AFNetworking Version | Minimum iOS Target | Minimum OS X Target | Minimum watchOS Target | Minimum tvOS Target | Notes |
|
||||
| AFNetworking Version | Minimum iOS Target | Minimum macOS Target | Minimum watchOS Target | Minimum tvOS Target | Notes |
|
||||
|:--------------------:|:---------------------------:|:----------------------------:|:----------------------------:|:----------------------------:|:-------------------------------------------------------------------------:|
|
||||
| 3.x | iOS 7 | OS X 10.9 | watchOS 2.0 | tvOS 9.0 | Xcode 7+ is required. `NSURLConnectionOperation` support has been removed. |
|
||||
| 2.6 -> 2.6.3 | iOS 7 | OS X 10.9 | watchOS 2.0 | n/a | Xcode 7+ is required. |
|
||||
@ -89,7 +91,7 @@ Run `carthage` to build the framework and drag the built `AFNetworking.framework
|
||||
| 1.x | iOS 5 | Mac OS X 10.7 | n/a | n/a |
|
||||
| 0.10.x | iOS 4 | Mac OS X 10.6 | n/a | n/a |
|
||||
|
||||
(OS X projects must support [64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)).
|
||||
(macOS projects must support [64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)).
|
||||
|
||||
> Programming in Swift? Try [Alamofire](https://github.com/Alamofire/Alamofire) for a more conventional set of APIs.
|
||||
|
||||
@ -110,7 +112,7 @@ Run `carthage` to build the framework and drag the built `AFNetworking.framework
|
||||
- `AFHTTPResponseSerializer`
|
||||
- `AFJSONResponseSerializer`
|
||||
- `AFXMLParserResponseSerializer`
|
||||
- `AFXMLDocumentResponseSerializer` _(Mac OS X)_
|
||||
- `AFXMLDocumentResponseSerializer` _(macOS)_
|
||||
- `AFPropertyListResponseSerializer`
|
||||
- `AFImageResponseSerializer`
|
||||
- `AFCompoundResponseSerializer`
|
||||
@ -317,4 +319,4 @@ If you believe you have identified a security vulnerability with AFNetworking, y
|
||||
|
||||
## License
|
||||
|
||||
AFNetworking is released under the MIT license. See LICENSE for details.
|
||||
AFNetworking is released under the MIT license. See [LICENSE](https://github.com/AFNetworking/AFNetworking/blob/master/LICENSE) for details.
|
||||
|
||||
@ -72,6 +72,17 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
@protocol AFImageRequestCache <AFImageCache>
|
||||
|
||||
/**
|
||||
Asks if the image should be cached using an identifier created from the request and additional identifier.
|
||||
|
||||
@param image The image to be cached.
|
||||
@param request The unique URL request identifing the image asset.
|
||||
@param identifier The additional identifier to apply to the URL request to identify the image.
|
||||
|
||||
@return A BOOL indicating whether or not the image should be added to the cache. YES will cache, NO will prevent caching.
|
||||
*/
|
||||
- (BOOL)shouldCacheImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
|
||||
|
||||
/**
|
||||
Adds the image to the cache using an identifier created from the request and additional identifier.
|
||||
|
||||
|
||||
@ -196,6 +196,10 @@
|
||||
return key;
|
||||
}
|
||||
|
||||
- (BOOL)shouldCacheImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier {
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
@ -81,6 +81,11 @@ typedef NS_ENUM(NSInteger, AFImageDownloadPrioritization) {
|
||||
*/
|
||||
+ (NSURLCache *)defaultURLCache;
|
||||
|
||||
/**
|
||||
The default `NSURLSessionConfiguration` with common usage parameter values.
|
||||
*/
|
||||
+ (NSURLSessionConfiguration *)defaultURLSessionConfiguration;
|
||||
|
||||
/**
|
||||
Default initializer
|
||||
|
||||
@ -88,6 +93,15 @@ typedef NS_ENUM(NSInteger, AFImageDownloadPrioritization) {
|
||||
*/
|
||||
- (instancetype)init;
|
||||
|
||||
/**
|
||||
Initializer with specific `URLSessionConfiguration`
|
||||
|
||||
@param configuration The `NSURLSessionConfiguration` to be be used
|
||||
|
||||
@return An instance of `AFImageDownloader` initialized with default values and custom `NSURLSessionConfiguration`
|
||||
*/
|
||||
- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration;
|
||||
|
||||
/**
|
||||
Initializes the `AFImageDownloader` instance with the given session manager, download prioritization, maximum active download count and image cache.
|
||||
|
||||
|
||||
@ -106,10 +106,20 @@
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation AFImageDownloader
|
||||
|
||||
+ (NSURLCache *)defaultURLCache {
|
||||
|
||||
// It's been discovered that a crash will occur on certain versions
|
||||
// of iOS if you customize the cache.
|
||||
//
|
||||
// More info can be found here: https://devforums.apple.com/message/1102182#1102182
|
||||
//
|
||||
// When iOS 7 support is dropped, this should be modified to use
|
||||
// NSProcessInfo methods instead.
|
||||
if ([[[UIDevice currentDevice] systemVersion] compare:@"8.2" options:NSNumericSearch] == NSOrderedAscending) {
|
||||
return [NSURLCache sharedURLCache];
|
||||
}
|
||||
return [[NSURLCache alloc] initWithMemoryCapacity:20 * 1024 * 1024
|
||||
diskCapacity:150 * 1024 * 1024
|
||||
diskPath:@"com.alamofire.imagedownloader"];
|
||||
@ -133,7 +143,11 @@
|
||||
|
||||
- (instancetype)init {
|
||||
NSURLSessionConfiguration *defaultConfiguration = [self.class defaultURLSessionConfiguration];
|
||||
AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:defaultConfiguration];
|
||||
return [self initWithSessionConfiguration:defaultConfiguration];
|
||||
}
|
||||
|
||||
- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration {
|
||||
AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration];
|
||||
sessionManager.responseSerializer = [AFImageResponseSerializer serializer];
|
||||
|
||||
return [self initWithSessionManager:sessionManager
|
||||
@ -235,10 +249,12 @@
|
||||
|
||||
createdTask = [self.sessionManager
|
||||
dataTaskWithRequest:request
|
||||
uploadProgress:nil
|
||||
downloadProgress:nil
|
||||
completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
|
||||
dispatch_async(self.responseQueue, ^{
|
||||
__strong __typeof__(weakSelf) strongSelf = weakSelf;
|
||||
AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier];
|
||||
AFImageDownloaderMergedTask *mergedTask = strongSelf.mergedTasks[URLIdentifier];
|
||||
if ([mergedTask.identifier isEqual:mergedTaskIdentifier]) {
|
||||
mergedTask = [strongSelf safelyRemoveMergedTaskWithURLIdentifier:URLIdentifier];
|
||||
if (error) {
|
||||
@ -250,7 +266,9 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
[strongSelf.imageCache addImage:responseObject forRequest:request withAdditionalIdentifier:nil];
|
||||
if ([strongSelf.imageCache shouldCacheImage:responseObject forRequest:request withAdditionalIdentifier:nil]) {
|
||||
[strongSelf.imageCache addImage:responseObject forRequest:request withAdditionalIdentifier:nil];
|
||||
}
|
||||
|
||||
for (AFImageDownloaderResponseHandler *handler in mergedTask.responseHandlers) {
|
||||
if (handler.successBlock) {
|
||||
|
||||
@ -147,10 +147,7 @@ typedef void (^AFNetworkActivityActionBlock)(BOOL networkActivityIndicatorVisibl
|
||||
- (void)decrementActivityCount {
|
||||
[self willChangeValueForKey:@"activityCount"];
|
||||
@synchronized(self) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu"
|
||||
_activityCount = MAX(_activityCount - 1, 0);
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
[self didChangeValueForKey:@"activityCount"];
|
||||
|
||||
@ -194,8 +191,9 @@ typedef void (^AFNetworkActivityActionBlock)(BOOL networkActivityIndicatorVisibl
|
||||
[self startCompletionDelayTimer];
|
||||
break;
|
||||
}
|
||||
[self didChangeValueForKey:@"currentState"];
|
||||
}
|
||||
[self didChangeValueForKey:@"currentState"];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -71,16 +71,12 @@
|
||||
|
||||
if (task) {
|
||||
if (task.state != NSURLSessionTaskStateCompleted) {
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
|
||||
#pragma clang diagnostic ignored "-Warc-repeated-use-of-weak"
|
||||
UIActivityIndicatorView *activityIndicatorView = self.activityIndicatorView;
|
||||
if (task.state == NSURLSessionTaskStateRunning) {
|
||||
[self.activityIndicatorView startAnimating];
|
||||
[activityIndicatorView startAnimating];
|
||||
} else {
|
||||
[self.activityIndicatorView stopAnimating];
|
||||
[activityIndicatorView stopAnimating];
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
[notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingTaskDidResumeNotification object:task];
|
||||
[notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidCompleteNotification object:task];
|
||||
@ -93,19 +89,13 @@
|
||||
|
||||
- (void)af_startAnimating {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
|
||||
[self.activityIndicatorView startAnimating];
|
||||
#pragma clang diagnostic pop
|
||||
});
|
||||
}
|
||||
|
||||
- (void)af_stopAnimating {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
|
||||
[self.activityIndicatorView stopAnimating];
|
||||
#pragma clang diagnostic pop
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -103,10 +103,7 @@ static const char * af_backgroundImageDownloadReceiptKeyForState(UIControlState
|
||||
|
||||
+ (AFImageDownloader *)sharedImageDownloader {
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu"
|
||||
return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader {
|
||||
|
||||
@ -48,11 +48,7 @@
|
||||
@implementation UIImageView (AFNetworking)
|
||||
|
||||
+ (AFImageDownloader *)sharedImageDownloader {
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu"
|
||||
return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader {
|
||||
|
||||
@ -55,6 +55,10 @@ static void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedCon
|
||||
- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task
|
||||
animated:(BOOL)animated
|
||||
{
|
||||
if (task.state == NSURLSessionTaskStateCompleted) {
|
||||
return;
|
||||
}
|
||||
|
||||
[task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];
|
||||
[task addObserver:self forKeyPath:@"countOfBytesSent" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];
|
||||
|
||||
@ -64,6 +68,10 @@ static void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedCon
|
||||
- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task
|
||||
animated:(BOOL)animated
|
||||
{
|
||||
if (task.state == NSURLSessionTaskStateCompleted) {
|
||||
return;
|
||||
}
|
||||
|
||||
[task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];
|
||||
[task addObserver:self forKeyPath:@"countOfBytesReceived" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];
|
||||
|
||||
|
||||
@ -71,19 +71,16 @@
|
||||
[notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
|
||||
|
||||
if (task) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
|
||||
#pragma clang diagnostic ignored "-Warc-repeated-use-of-weak"
|
||||
UIRefreshControl *refreshControl = self.refreshControl;
|
||||
if (task.state == NSURLSessionTaskStateRunning) {
|
||||
[self.refreshControl beginRefreshing];
|
||||
[refreshControl beginRefreshing];
|
||||
|
||||
[notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingTaskDidResumeNotification object:task];
|
||||
[notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidCompleteNotification object:task];
|
||||
[notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidSuspendNotification object:task];
|
||||
} else {
|
||||
[self.refreshControl endRefreshing];
|
||||
[refreshControl endRefreshing];
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,19 +88,13 @@
|
||||
|
||||
- (void)af_beginRefreshing {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
|
||||
[self.refreshControl beginRefreshing];
|
||||
#pragma clang diagnostic pop
|
||||
});
|
||||
}
|
||||
|
||||
- (void)af_endRefreshing {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wreceiver-is-weak"
|
||||
[self.refreshControl endRefreshing];
|
||||
#pragma clang diagnostic pop
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -58,10 +58,7 @@
|
||||
_af_defaultHTTPSessionManager.responseSerializer = [AFHTTPResponseSerializer serializer];
|
||||
});
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu"
|
||||
return objc_getAssociatedObject(self, @selector(sessionManager)) ?: _af_defaultHTTPSessionManager;
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
- (void)setSessionManager:(AFHTTPSessionManager *)sessionManager {
|
||||
@ -75,10 +72,7 @@
|
||||
_af_defaultResponseSerializer = [AFHTTPResponseSerializer serializer];
|
||||
});
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu"
|
||||
return objc_getAssociatedObject(self, @selector(responseSerializer)) ?: _af_defaultResponseSerializer;
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
- (void)setResponseSerializer:(AFHTTPResponseSerializer<AFURLResponseSerialization> *)responseSerializer {
|
||||
@ -125,27 +119,28 @@
|
||||
self.af_URLSessionTask = nil;
|
||||
|
||||
__weak __typeof(self)weakSelf = self;
|
||||
NSURLSessionDataTask *dataTask;
|
||||
__block NSURLSessionDataTask *dataTask;
|
||||
dataTask = [self.sessionManager
|
||||
GET:request.URL.absoluteString
|
||||
parameters:nil
|
||||
progress:nil
|
||||
success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
|
||||
__strong __typeof(weakSelf) strongSelf = weakSelf;
|
||||
if (success) {
|
||||
success((NSHTTPURLResponse *)task.response, responseObject);
|
||||
}
|
||||
[strongSelf loadData:responseObject MIMEType:MIMEType textEncodingName:textEncodingName baseURL:[task.currentRequest URL]];
|
||||
dataTaskWithRequest:request
|
||||
uploadProgress:nil
|
||||
downloadProgress:nil
|
||||
completionHandler:^(NSURLResponse * _Nonnull response, id _Nonnull responseObject, NSError * _Nullable error) {
|
||||
__strong __typeof(weakSelf) strongSelf = weakSelf;
|
||||
if (error) {
|
||||
if (failure) {
|
||||
failure(error);
|
||||
}
|
||||
} else {
|
||||
if (success) {
|
||||
success((NSHTTPURLResponse *)response, responseObject);
|
||||
}
|
||||
[strongSelf loadData:responseObject MIMEType:MIMEType textEncodingName:textEncodingName baseURL:[dataTask.currentRequest URL]];
|
||||
|
||||
if ([strongSelf.delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
|
||||
[strongSelf.delegate webViewDidFinishLoad:strongSelf];
|
||||
}
|
||||
}
|
||||
failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
|
||||
if (failure) {
|
||||
failure(error);
|
||||
}
|
||||
}];
|
||||
if ([strongSelf.delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
|
||||
[strongSelf.delegate webViewDidFinishLoad:strongSelf];
|
||||
}
|
||||
}
|
||||
}];
|
||||
self.af_URLSessionTask = dataTask;
|
||||
if (progress != nil) {
|
||||
*progress = [self.sessionManager downloadProgressForTask:dataTask];
|
||||
@ -159,4 +154,4 @@
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -220,13 +220,14 @@ static NSString *g_overrideAppID = nil;
|
||||
|
||||
@property (nonatomic, copy) NSString *pushNotificationsDeviceTokenString;
|
||||
|
||||
@property (nonatomic, strong) dispatch_source_t flushTimer;
|
||||
@property (nonatomic, strong) dispatch_source_t attributionIDRecheckTimer;
|
||||
|
||||
@end
|
||||
|
||||
@implementation FBSDKAppEvents
|
||||
{
|
||||
BOOL _explicitEventsLoggedYet;
|
||||
NSTimer *_flushTimer;
|
||||
NSTimer *_attributionIDRecheckTimer;
|
||||
FBSDKServerConfiguration *_serverConfiguration;
|
||||
FBSDKAppEventsState *_appEventsState;
|
||||
NSString *_userID;
|
||||
@ -246,18 +247,18 @@ static NSString *g_overrideAppID = nil;
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_flushBehavior = FBSDKAppEventsFlushBehaviorAuto;
|
||||
_flushTimer = [NSTimer timerWithTimeInterval:FLUSH_PERIOD_IN_SECONDS
|
||||
target:self
|
||||
selector:@selector(flushTimerFired:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
_attributionIDRecheckTimer = [NSTimer timerWithTimeInterval:APP_SUPPORTS_ATTRIBUTION_ID_RECHECK_PERIOD
|
||||
target:self
|
||||
selector:@selector(appSettingsFetchStateResetTimerFired:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
[[NSRunLoop mainRunLoop] addTimer:_flushTimer forMode:NSDefaultRunLoopMode];
|
||||
[[NSRunLoop mainRunLoop] addTimer:_attributionIDRecheckTimer forMode:NSDefaultRunLoopMode];
|
||||
|
||||
typeof(self) __weak weakSelf = self;
|
||||
self.flushTimer = [FBSDKUtility startGCDTimerWithInterval:FLUSH_PERIOD_IN_SECONDS
|
||||
block:^{
|
||||
[weakSelf flushTimerFired:nil];
|
||||
}];
|
||||
|
||||
self.attributionIDRecheckTimer = [FBSDKUtility startGCDTimerWithInterval:APP_SUPPORTS_ATTRIBUTION_ID_RECHECK_PERIOD
|
||||
block:^{
|
||||
[weakSelf appSettingsFetchStateResetTimerFired:nil];
|
||||
}];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(applicationMovingFromActiveStateOrTerminating)
|
||||
@ -286,10 +287,8 @@ static NSString *g_overrideAppID = nil;
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
// technically these timers retain self so there's a cycle but
|
||||
// we're a singleton anyway.
|
||||
[_flushTimer invalidate];
|
||||
[_attributionIDRecheckTimer invalidate];
|
||||
[FBSDKUtility stopGCDTimer:self.flushTimer];
|
||||
[FBSDKUtility stopGCDTimer:self.attributionIDRecheckTimer];
|
||||
}
|
||||
|
||||
#pragma mark - Public Methods
|
||||
@ -790,8 +789,7 @@ static NSString *g_overrideAppID = nil;
|
||||
|
||||
[self fetchServerConfiguration:^(void) {
|
||||
NSString *receipt_data = [appEventsState extractReceiptData];
|
||||
NSString *JSONString = [appEventsState JSONStringForEvents:_serverConfiguration.implicitLoggingEnabled];
|
||||
NSData *encodedEvents = [JSONString dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSString *encodedEvents = [appEventsState JSONStringForEvents:_serverConfiguration.implicitLoggingEnabled];
|
||||
if (!encodedEvents) {
|
||||
[FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorAppEvents
|
||||
logEntry:@"FBSDKAppEvents: Flushing skipped - no events after removing implicitly logged ones.\n"];
|
||||
@ -806,7 +804,7 @@ static NSString *g_overrideAppID = nil;
|
||||
postParameters[@"receipt_data"] = receipt_data;
|
||||
}
|
||||
|
||||
postParameters[@"custom_events_file"] = encodedEvents;
|
||||
postParameters[@"custom_events"] = encodedEvents;
|
||||
if (appEventsState.numSkipped > 0) {
|
||||
postParameters[@"num_skipped_events"] = [NSString stringWithFormat:@"%lu", (unsigned long)appEventsState.numSkipped];
|
||||
}
|
||||
|
||||
@ -55,9 +55,7 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
FBSDKBridgeAPIRequest *_pendingRequest;
|
||||
FBSDKBridgeAPICallbackBlock _pendingRequestCompletionBlock;
|
||||
id<FBSDKURLOpening> _pendingURLOpen;
|
||||
#ifdef __IPHONE_11_0
|
||||
SFAuthenticationSession *_authenticationSession NS_AVAILABLE_IOS(11_0);
|
||||
#endif
|
||||
#endif
|
||||
BOOL _expectingBackground;
|
||||
UIViewController *_safariViewController;
|
||||
@ -172,12 +170,12 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
completion:completePendingOpenURLBlock];
|
||||
_safariViewController = nil;
|
||||
} else {
|
||||
#ifdef __IPHONE_11_0
|
||||
if (_authenticationSession != nil) {
|
||||
[_authenticationSession cancel];
|
||||
_authenticationSession = nil;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
if (_authenticationSession != nil) {
|
||||
[_authenticationSession cancel];
|
||||
_authenticationSession = nil;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
completePendingOpenURLBlock();
|
||||
}
|
||||
if ([pendingURLOpen canOpenURL:url
|
||||
@ -243,9 +241,9 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
// might have been a "didBecomeActive" event pending that we want to ignore.
|
||||
BOOL notExpectingBackground = !_expectingBackground && !_safariViewController && !_isDismissingSafariViewController;
|
||||
#if !TARGET_OS_TV
|
||||
#ifdef __IPHONE_11_0
|
||||
notExpectingBackground = notExpectingBackground && !_authenticationSession;
|
||||
#endif
|
||||
if (@available(iOS 11.0, *)) {
|
||||
notExpectingBackground = notExpectingBackground && !_authenticationSession;
|
||||
}
|
||||
#endif
|
||||
if (notExpectingBackground) {
|
||||
_active = YES;
|
||||
@ -347,22 +345,22 @@ static NSString *const FBSDKAppLinkInboundEvent = @"fb_al_inbound";
|
||||
_expectingBackground = NO;
|
||||
_pendingURLOpen = sender;
|
||||
|
||||
#ifdef __IPHONE_11_0
|
||||
if ([sender isAuthenticationURL:url]) {
|
||||
Class SFAuthenticationSessionClass = fbsdkdfl_SFAuthenticationSessionClass();
|
||||
if (SFAuthenticationSessionClass != nil) {
|
||||
_authenticationSession = [[SFAuthenticationSessionClass alloc] initWithURL:url callbackURLScheme:[FBSDKInternalUtility appURLScheme] completionHandler:^ (NSURL *aURL, NSError *error) {
|
||||
handler(error == nil, error);
|
||||
if (error == nil) {
|
||||
[self application:[UIApplication sharedApplication] openURL:aURL sourceApplication:@"com.apple" annotation:nil];
|
||||
}
|
||||
_authenticationSession = nil;
|
||||
}];
|
||||
[_authenticationSession start];
|
||||
return;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
if ([sender isAuthenticationURL:url]) {
|
||||
Class SFAuthenticationSessionClass = fbsdkdfl_SFAuthenticationSessionClass();
|
||||
if (SFAuthenticationSessionClass != nil) {
|
||||
_authenticationSession = [[SFAuthenticationSessionClass alloc] initWithURL:url callbackURLScheme:[FBSDKInternalUtility appURLScheme] completionHandler:^ (NSURL *aURL, NSError *error) {
|
||||
handler(error == nil, error);
|
||||
if (error == nil) {
|
||||
[self application:[UIApplication sharedApplication] openURL:aURL sourceApplication:@"com.apple" annotation:nil];
|
||||
}
|
||||
_authenticationSession = nil;
|
||||
}];
|
||||
[_authenticationSession start];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// trying to dynamically load SFSafariViewController class
|
||||
// so for the cases when it is available we can send users through Safari View Controller flow
|
||||
|
||||
@ -44,5 +44,5 @@
|
||||
#import <FBSDKCoreKit/FBSDKDeviceViewControllerBase.h>
|
||||
#endif
|
||||
|
||||
#define FBSDK_VERSION_STRING @"4.29.0"
|
||||
#define FBSDK_VERSION_STRING @"4.31.1"
|
||||
#define FBSDK_TARGET_PLATFORM_VERSION @"v2.11"
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
|
||||
// constants
|
||||
static NSString *const kGetHTTPMethod = @"GET";
|
||||
static NSString *const kPostHTTPMethod = @"POST";
|
||||
|
||||
@interface FBSDKGraphRequest()
|
||||
@property (nonatomic, assign) FBSDKGraphRequestFlags flags;
|
||||
@ -144,12 +145,23 @@ static NSString *const kGetHTTPMethod = @"GET";
|
||||
+ (NSString *)serializeURL:(NSString *)baseUrl
|
||||
params:(NSDictionary *)params
|
||||
httpMethod:(NSString *)httpMethod {
|
||||
return [self serializeURL:baseUrl params:params httpMethod:httpMethod forBatch:NO];
|
||||
}
|
||||
|
||||
+ (NSString *)serializeURL:(NSString *)baseUrl
|
||||
params:(NSDictionary *)params
|
||||
httpMethod:(NSString *)httpMethod
|
||||
forBatch:(BOOL)forBatch {
|
||||
params = [self preprocessParams: params];
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
NSURL *parsedURL = [NSURL URLWithString:[baseUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
#pragma clang pop
|
||||
if ([httpMethod isEqualToString:kPostHTTPMethod] && !forBatch) {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
NSString *queryPrefix = parsedURL.query ? @"&" : @"?";
|
||||
|
||||
NSString *query = [FBSDKInternalUtility queryStringWithDictionary:params error:NULL invalidObjectHandler:^id(id object, BOOL *stop) {
|
||||
|
||||
@ -443,7 +443,7 @@ NSURLSessionDataDelegate
|
||||
NSUInteger bodyLength = [[body data] length] / 1024;
|
||||
|
||||
[request setValue:[FBSDKGraphRequestConnection userAgent] forHTTPHeaderField:@"User-Agent"];
|
||||
[request setValue:[FBSDKGraphRequestBody mimeContentType] forHTTPHeaderField:@"Content-Type"];
|
||||
[request setValue:[body mimeContentType] forHTTPHeaderField:@"Content-Type"];
|
||||
[request setHTTPShouldHandleCookies:NO];
|
||||
|
||||
[self logRequest:request bodyLength:bodyLength bodyLogger:bodyLogger attachmentLogger:attachmentLogger];
|
||||
@ -495,7 +495,8 @@ NSURLSessionDataDelegate
|
||||
|
||||
NSString *url = [FBSDKGraphRequest serializeURL:baseURL
|
||||
params:request.parameters
|
||||
httpMethod:request.HTTPMethod];
|
||||
httpMethod:request.HTTPMethod
|
||||
forBatch:forBatch];
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
@ -52,4 +52,18 @@
|
||||
*/
|
||||
+ (NSString *)URLEncode:(NSString *)value;
|
||||
|
||||
/**
|
||||
Creates a timer using Grand Central Dispatch.
|
||||
- Parameter interval: The interval to fire the timer, in seconds.
|
||||
- Parameter block: The code block to execute when timer is fired.
|
||||
- Returns: The dispatch handle.
|
||||
*/
|
||||
+ (dispatch_source_t)startGCDTimerWithInterval:(double)interval block:(dispatch_block_t)block;
|
||||
|
||||
/**
|
||||
Stop a timer that was started by startGCDTimerWithInterval.
|
||||
- Parameter timer: The dispatch handle received from startGCDTimerWithInterval.
|
||||
*/
|
||||
+ (void)stopGCDTimer:(dispatch_source_t)timer;
|
||||
|
||||
@end
|
||||
|
||||
@ -81,6 +81,32 @@
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
+ (dispatch_source_t)startGCDTimerWithInterval:(double)interval block:(dispatch_block_t)block
|
||||
{
|
||||
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, // source type
|
||||
0, // handle
|
||||
0, // mask
|
||||
dispatch_get_main_queue()); // queue
|
||||
|
||||
dispatch_source_set_timer(timer, // dispatch source
|
||||
dispatch_time(DISPATCH_TIME_NOW, interval * NSEC_PER_SEC), // start
|
||||
interval * NSEC_PER_SEC, // interval
|
||||
0 * NSEC_PER_SEC); // leeway
|
||||
|
||||
dispatch_source_set_event_handler(timer, block);
|
||||
|
||||
dispatch_resume(timer);
|
||||
|
||||
return timer;
|
||||
}
|
||||
|
||||
+ (void)stopGCDTimer:(dispatch_source_t)timer
|
||||
{
|
||||
if (timer) {
|
||||
dispatch_source_cancel(timer);
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
FBSDK_NO_DESIGNATED_INITIALIZER();
|
||||
|
||||
@ -714,11 +714,7 @@ static NSMapTable *_transientObjects;
|
||||
|
||||
if (![self isRegisteredCanOpenURLScheme:urlScheme]){
|
||||
NSString *reason = [NSString stringWithFormat:@"%@ is missing from your Info.plist under LSApplicationQueriesSchemes and is required for iOS 9.0", urlScheme];
|
||||
#ifdef __IPHONE_9_0
|
||||
@throw [NSException exceptionWithName:@"InvalidOperationException" reason:reason userInfo:nil];
|
||||
#else
|
||||
[FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors logEntry:reason];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@ typedef NS_OPTIONS(NSUInteger, FBSDKGraphRequestFlags)
|
||||
+ (BOOL)isAttachment:(id)item;
|
||||
+ (NSString *)serializeURL:(NSString *)baseUrl
|
||||
params:(NSDictionary *)params
|
||||
httpMethod:(NSString *)httpMethod;
|
||||
httpMethod:(NSString *)httpMethod
|
||||
forBatch:(BOOL)forBatch;
|
||||
|
||||
@end
|
||||
|
||||
@ -42,6 +42,6 @@
|
||||
dataAttachmentValue:(FBSDKGraphRequestDataAttachment *)dataAttachment
|
||||
logger:(FBSDKLogger *)logger;
|
||||
|
||||
+ (NSString *)mimeContentType;
|
||||
- (NSString *)mimeContentType;
|
||||
|
||||
@end
|
||||
|
||||
@ -28,20 +28,26 @@
|
||||
@implementation FBSDKGraphRequestBody
|
||||
{
|
||||
NSMutableData *_data;
|
||||
NSMutableDictionary *_json;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_data = [[NSMutableData alloc] init];
|
||||
_json = [NSMutableDictionary dictionary];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (NSString *)mimeContentType
|
||||
- (NSString *)mimeContentType
|
||||
{
|
||||
return [NSString stringWithFormat:@"multipart/form-data; boundary=%@", kStringBoundary];
|
||||
if (_json) {
|
||||
return @"application/json";
|
||||
} else {
|
||||
return [NSString stringWithFormat:@"multipart/form-data; boundary=%@",kStringBoundary];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)appendUTF8:(NSString *)utf8
|
||||
@ -62,6 +68,9 @@
|
||||
[self _appendWithKey:key filename:nil contentType:nil contentBlock:^{
|
||||
[self appendUTF8:value];
|
||||
}];
|
||||
if (key && value) {
|
||||
[_json setObject:value forKey:key];
|
||||
}
|
||||
[logger appendFormat:@"\n %@:\t%@", key, (NSString *)value];
|
||||
}
|
||||
|
||||
@ -73,6 +82,7 @@
|
||||
[self _appendWithKey:key filename:key contentType:@"image/jpeg" contentBlock:^{
|
||||
[_data appendData:data];
|
||||
}];
|
||||
_json = nil;
|
||||
[logger appendFormat:@"\n %@:\t<Image - %lu kB>", key, (unsigned long)([data length] / 1024)];
|
||||
}
|
||||
|
||||
@ -83,6 +93,7 @@
|
||||
[self _appendWithKey:key filename:key contentType:@"content/unknown" contentBlock:^{
|
||||
[_data appendData:data];
|
||||
}];
|
||||
_json = nil;
|
||||
[logger appendFormat:@"\n %@:\t<Data - %lu kB>", key, (unsigned long)([data length] / 1024)];
|
||||
}
|
||||
|
||||
@ -96,11 +107,22 @@
|
||||
[self _appendWithKey:key filename:filename contentType:contentType contentBlock:^{
|
||||
[_data appendData:data];
|
||||
}];
|
||||
_json = nil;
|
||||
[logger appendFormat:@"\n %@:\t<Data - %lu kB>", key, (unsigned long)([data length] / 1024)];
|
||||
}
|
||||
|
||||
- (NSData *)data
|
||||
{
|
||||
if (_json) {
|
||||
NSData *jsonData;
|
||||
if (_json.allKeys.count > 0) {
|
||||
jsonData = [NSJSONSerialization dataWithJSONObject:_json options:0 error:nil];
|
||||
} else {
|
||||
jsonData = [NSData data];
|
||||
}
|
||||
|
||||
return jsonData;
|
||||
}
|
||||
return [_data copy];
|
||||
}
|
||||
|
||||
|
||||
@ -53,6 +53,7 @@ typedef NS_OPTIONS(NSUInteger, FBSDKServerConfigurationSmartLoginOptions)
|
||||
advertisingIDEnabled:(BOOL)advertisingIDEnabled
|
||||
implicitLoggingEnabled:(BOOL)implicitLoggingEnabled
|
||||
implicitPurchaseLoggingEnabled:(BOOL)implicitPurchaseLoggingEnabled
|
||||
appIndexingTriggerEnabled:(BOOL)appIndexingTriggerEnabled
|
||||
systemAuthenticationEnabled:(BOOL)systemAuthenticationEnabled
|
||||
nativeAuthFlowEnabled:(BOOL)nativeAuthFlowEnabled
|
||||
dialogConfigurations:(NSDictionary *)dialogConfigurations
|
||||
@ -75,6 +76,7 @@ NS_DESIGNATED_INITIALIZER;
|
||||
@property (nonatomic, strong, readonly) FBSDKErrorConfiguration *errorConfiguration;
|
||||
@property (nonatomic, assign, readonly, getter=isImplicitLoggingSupported) BOOL implicitLoggingEnabled;
|
||||
@property (nonatomic, assign, readonly, getter=isImplicitPurchaseLoggingSupported) BOOL implicitPurchaseLoggingEnabled;
|
||||
@property (nonatomic, assign, readonly, getter=isAppIndexingTriggerEnabled) BOOL appIndexingTriggerEnabled;
|
||||
@property (nonatomic, assign, readonly, getter=isLoginTooltipEnabled) BOOL loginTooltipEnabled;
|
||||
@property (nonatomic, assign, readonly, getter=isNativeAuthFlowEnabled) BOOL nativeAuthFlowEnabled;
|
||||
@property (nonatomic, assign, readonly, getter=isSystemAuthenticationEnabled) BOOL systemAuthenticationEnabled;
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
#define FBSDK_SERVER_CONFIGURATION_IMPLICIT_LOGGING_ENABLED_KEY @"implicitLoggingEnabled"
|
||||
#define FBSDK_SERVER_CONFIGURATION_DEFAULT_SHARE_MODE_KEY @"defaultShareMode"
|
||||
#define FBSDK_SERVER_CONFIGURATION_IMPLICIT_PURCHASE_LOGGING_ENABLED_KEY @"implicitPurchaseLoggingEnabled"
|
||||
#define FBSDK_SERVER_CONFIGURATION_APP_INDEXING_TRIGGER_ENABLED_KEY @"appIndexingTriggerEnabled"
|
||||
#define FBSDK_SERVER_CONFIGURATION_LOGIN_TOOLTIP_ENABLED_KEY @"loginTooltipEnabled"
|
||||
#define FBSDK_SERVER_CONFIGURATION_LOGIN_TOOLTIP_TEXT_KEY @"loginTooltipText"
|
||||
#define FBSDK_SERVER_CONFIGURATION_SYSTEM_AUTHENTICATION_ENABLED_KEY @"systemAuthenticationEnabled"
|
||||
@ -87,6 +88,7 @@ const NSInteger FBSDKServerConfigurationVersion = 2;
|
||||
advertisingIDEnabled:(BOOL)advertisingIDEnabled
|
||||
implicitLoggingEnabled:(BOOL)implicitLoggingEnabled
|
||||
implicitPurchaseLoggingEnabled:(BOOL)implicitPurchaseLoggingEnabled
|
||||
appIndexingTriggerEnabled:(BOOL)appIndexingTriggerEnabled
|
||||
systemAuthenticationEnabled:(BOOL)systemAuthenticationEnabled
|
||||
nativeAuthFlowEnabled:(BOOL)nativeAuthFlowEnabled
|
||||
dialogConfigurations:(NSDictionary *)dialogConfigurations
|
||||
@ -109,6 +111,7 @@ implicitPurchaseLoggingEnabled:(BOOL)implicitPurchaseLoggingEnabled
|
||||
_advertisingIDEnabled = advertisingIDEnabled;
|
||||
_implicitLoggingEnabled = implicitLoggingEnabled;
|
||||
_implicitPurchaseLoggingEnabled = implicitPurchaseLoggingEnabled;
|
||||
_appIndexingTriggerEnabled = appIndexingTriggerEnabled;
|
||||
_systemAuthenticationEnabled = systemAuthenticationEnabled;
|
||||
_nativeAuthFlowEnabled = nativeAuthFlowEnabled;
|
||||
_dialogConfigurations = [dialogConfigurations copy];
|
||||
@ -177,6 +180,8 @@ implicitPurchaseLoggingEnabled:(BOOL)implicitPurchaseLoggingEnabled
|
||||
BOOL implicitLoggingEnabled = [decoder decodeBoolForKey:FBSDK_SERVER_CONFIGURATION_IMPLICIT_LOGGING_ENABLED_KEY];
|
||||
BOOL implicitPurchaseLoggingEnabled =
|
||||
[decoder decodeBoolForKey:FBSDK_SERVER_CONFIGURATION_IMPLICIT_PURCHASE_LOGGING_ENABLED_KEY];
|
||||
BOOL appIndexingTriggerEnabled =
|
||||
[decoder decodeBoolForKey:FBSDK_SERVER_CONFIGURATION_APP_INDEXING_TRIGGER_ENABLED_KEY];
|
||||
BOOL systemAuthenticationEnabled =
|
||||
[decoder decodeBoolForKey:FBSDK_SERVER_CONFIGURATION_SYSTEM_AUTHENTICATION_ENABLED_KEY];
|
||||
FBSDKServerConfigurationSmartLoginOptions smartLoginOptions = [decoder decodeIntegerForKey:FBSDK_SERVER_CONFIGURATION_SMART_LOGIN_OPTIONS_KEY];
|
||||
@ -209,6 +214,7 @@ implicitPurchaseLoggingEnabled:(BOOL)implicitPurchaseLoggingEnabled
|
||||
advertisingIDEnabled:advertisingIDEnabled
|
||||
implicitLoggingEnabled:implicitLoggingEnabled
|
||||
implicitPurchaseLoggingEnabled:implicitPurchaseLoggingEnabled
|
||||
appIndexingTriggerEnabled:appIndexingTriggerEnabled
|
||||
systemAuthenticationEnabled:systemAuthenticationEnabled
|
||||
nativeAuthFlowEnabled:nativeAuthFlowEnabled
|
||||
dialogConfigurations:dialogConfigurations
|
||||
@ -238,6 +244,8 @@ implicitPurchaseLoggingEnabled:(BOOL)implicitPurchaseLoggingEnabled
|
||||
[encoder encodeBool:_implicitLoggingEnabled forKey:FBSDK_SERVER_CONFIGURATION_IMPLICIT_LOGGING_ENABLED_KEY];
|
||||
[encoder encodeBool:_implicitPurchaseLoggingEnabled
|
||||
forKey:FBSDK_SERVER_CONFIGURATION_IMPLICIT_PURCHASE_LOGGING_ENABLED_KEY];
|
||||
[encoder encodeBool:_appIndexingTriggerEnabled
|
||||
forKey:FBSDK_SERVER_CONFIGURATION_APP_INDEXING_TRIGGER_ENABLED_KEY];
|
||||
[encoder encodeBool:_loginTooltipEnabled forKey:FBSDK_SERVER_CONFIGURATION_LOGIN_TOOLTIP_ENABLED_KEY];
|
||||
[encoder encodeObject:_loginTooltipText forKey:FBSDK_SERVER_CONFIGURATION_LOGIN_TOOLTIP_TEXT_KEY];
|
||||
[encoder encodeBool:_nativeAuthFlowEnabled forKey:FBSDK_SERVER_CONFIGURATION_NATIVE_AUTH_FLOW_ENABLED_KEY];
|
||||
|
||||
@ -65,6 +65,7 @@ typedef NS_OPTIONS(NSUInteger, FBSDKServerConfigurationManagerAppEventsFeatures)
|
||||
FBSDKServerConfigurationManagerAppEventsFeaturesNone = 0,
|
||||
FBSDKServerConfigurationManagerAppEventsFeaturesAdvertisingIDEnabled = 1 << 0,
|
||||
FBSDKServerConfigurationManagerAppEventsFeaturesImplicitPurchaseLoggingEnabled = 1 << 1,
|
||||
FBSDKServerConfigurationManagerAppEventsFeaturesAppIndexingTriggerEnabled = 1 << 6,
|
||||
};
|
||||
|
||||
#pragma mark - Public Class Methods
|
||||
@ -172,7 +173,7 @@ typedef NS_OPTIONS(NSUInteger, FBSDKServerConfigurationManagerAppEventsFeatures)
|
||||
NSUInteger appEventsFeatures = [FBSDKTypeUtility unsignedIntegerValue:resultDictionary[FBSDK_SERVER_CONFIGURATION_APP_EVENTS_FEATURES_FIELD]];
|
||||
BOOL advertisingIDEnabled = (appEventsFeatures & FBSDKServerConfigurationManagerAppEventsFeaturesAdvertisingIDEnabled);
|
||||
BOOL implicitPurchaseLoggingEnabled = (appEventsFeatures & FBSDKServerConfigurationManagerAppEventsFeaturesImplicitPurchaseLoggingEnabled);
|
||||
|
||||
BOOL appIndexingTriggerEnabled = (appEventsFeatures & FBSDKServerConfigurationManagerAppEventsFeaturesAppIndexingTriggerEnabled);
|
||||
NSString *appName = [FBSDKTypeUtility stringValue:resultDictionary[FBSDK_SERVER_CONFIGURATION_APP_NAME_FIELD]];
|
||||
BOOL loginTooltipEnabled = [FBSDKTypeUtility boolValue:resultDictionary[FBSDK_SERVER_CONFIGURATION_LOGIN_TOOLTIP_ENABLED_FIELD]];
|
||||
NSString *loginTooltipText = [FBSDKTypeUtility stringValue:resultDictionary[FBSDK_SERVER_CONFIGURATION_LOGIN_TOOLTIP_TEXT_FIELD]];
|
||||
@ -198,6 +199,7 @@ typedef NS_OPTIONS(NSUInteger, FBSDKServerConfigurationManagerAppEventsFeatures)
|
||||
advertisingIDEnabled:advertisingIDEnabled
|
||||
implicitLoggingEnabled:implicitLoggingEnabled
|
||||
implicitPurchaseLoggingEnabled:implicitPurchaseLoggingEnabled
|
||||
appIndexingTriggerEnabled:appIndexingTriggerEnabled
|
||||
systemAuthenticationEnabled:systemAuthenticationEnabled
|
||||
nativeAuthFlowEnabled:nativeAuthFlowEnabled
|
||||
dialogConfigurations:dialogConfigurations
|
||||
@ -298,6 +300,7 @@ typedef NS_OPTIONS(NSUInteger, FBSDKServerConfigurationManagerAppEventsFeatures)
|
||||
advertisingIDEnabled:NO
|
||||
implicitLoggingEnabled:NO
|
||||
implicitPurchaseLoggingEnabled:NO
|
||||
appIndexingTriggerEnabled:NO
|
||||
systemAuthenticationEnabled:NO
|
||||
nativeAuthFlowEnabled:NO
|
||||
dialogConfigurations:nil
|
||||
|
||||
@ -49,6 +49,7 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
FBSDKLoginManagerLogger *_logger;
|
||||
FBSDKLoginManagerState _state;
|
||||
FBSDKKeychainStore *_keychainStore;
|
||||
BOOL _usedSFAuthSession;
|
||||
}
|
||||
|
||||
+ (void)initialize
|
||||
@ -159,6 +160,14 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
{
|
||||
switch (_state) {
|
||||
case FBSDKLoginManagerStateStart: {
|
||||
if (self->_usedSFAuthSession) {
|
||||
// Using SFAuthenticationSession makes an interestitial dialog that blocks the app, but in certain situations such as
|
||||
// screen lock it can be dismissed and have the control returned to the app without invoking the completionHandler.
|
||||
// In this case, the viewcontroller has the control back and tried to reinvoke the login. This is acceptable behavior
|
||||
// and we should pop up the dialog again
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSString *errorStr = @"** WARNING: You are trying to start a login while a previous login has not finished yet."
|
||||
"This is unsupported behavior. You should wait until the previous login handler gets called to start a new login.";
|
||||
[FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors
|
||||
@ -198,6 +207,8 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
|
||||
- (void)completeAuthentication:(FBSDKLoginCompletionParameters *)parameters expectChallenge:(BOOL)expectChallenge
|
||||
{
|
||||
NSSet *recentlyGrantedPermissions = nil;
|
||||
NSSet *recentlyDeclinedPermissions = nil;
|
||||
FBSDKLoginManagerLoginResult *result = nil;
|
||||
NSError *error = parameters.error;
|
||||
|
||||
@ -226,9 +237,6 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
NSSet *grantedPermissions = parameters.permissions;
|
||||
NSSet *declinedPermissions = parameters.declinedPermissions;
|
||||
|
||||
NSSet *recentlyGrantedPermissions = nil;
|
||||
NSSet *recentlyDeclinedPermissions = nil;
|
||||
|
||||
[self determineRecentlyGrantedPermissions:&recentlyGrantedPermissions
|
||||
recentlyDeclinedPermissions:&recentlyDeclinedPermissions
|
||||
forGrantedPermission:grantedPermissions
|
||||
@ -259,13 +267,18 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
|
||||
if (cancelled) {
|
||||
NSSet *declinedPermissions = nil;
|
||||
|
||||
// If a System Account reauthorization was cancelled by the user tapping Don't Allow
|
||||
// then add the declined permissions to the login result. The Accounts framework
|
||||
// doesn't register the decline with Facebook, which is why we don't update the
|
||||
// access token.
|
||||
if ([FBSDKAccessToken currentAccessToken] != nil && parameters.isSystemAccount) {
|
||||
declinedPermissions = parameters.declinedPermissions;
|
||||
if ([FBSDKAccessToken currentAccessToken] != nil) {
|
||||
if (parameters.isSystemAccount) {
|
||||
// If a System Account reauthorization was cancelled by the user tapping Don't Allow
|
||||
// then add the declined permissions to the login result. The Accounts framework
|
||||
// doesn't register the decline with Facebook, which is why we don't update the
|
||||
// access token.
|
||||
declinedPermissions = parameters.declinedPermissions;
|
||||
} else {
|
||||
// Always include the list of declined permissions from this login request
|
||||
// if an access token is already cached by the SDK
|
||||
declinedPermissions = recentlyDeclinedPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
result = [[FBSDKLoginManagerLoginResult alloc] initWithToken:nil
|
||||
@ -382,6 +395,7 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
{
|
||||
FBSDKServerConfiguration *serverConfiguration = [FBSDKServerConfigurationManager cachedServerConfiguration];
|
||||
NSDictionary *loginParams = [self logInParametersWithPermissions:_requestedPermissions serverConfiguration:serverConfiguration];
|
||||
self->_usedSFAuthSession = NO;
|
||||
|
||||
void(^completion)(BOOL, NSString *, NSError *) = ^void(BOOL didPerformLogIn, NSString *authMethod, NSError *error) {
|
||||
if (didPerformLogIn) {
|
||||
@ -418,7 +432,7 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
// intentional fall through.
|
||||
// Intentional fall through. Switching to browser login instead.
|
||||
}
|
||||
case FBSDKLoginBehaviorBrowser: {
|
||||
[self performBrowserLogInWithParameters:loginParams handler:^(BOOL openedURL,
|
||||
@ -548,8 +562,10 @@ typedef NS_ENUM(NSInteger, FBSDKLoginManagerState) {
|
||||
handler(didOpen, authMethod, anError);
|
||||
}
|
||||
};
|
||||
|
||||
if (useSafariViewController) {
|
||||
// Note based on above, authURL must be a http scheme. If that changes, add a guard, otherwise SFVC can throw
|
||||
// Note based on above, authURL must be a http scheme. If that changes, add a guard, otherwise SFVC can throw
|
||||
self->_usedSFAuthSession = YES;
|
||||
[[FBSDKApplicationDelegate sharedInstance] openURLWithSafariViewController:authURL
|
||||
sender:self
|
||||
fromViewController:self.fromViewController
|
||||
|
||||
@ -35,6 +35,22 @@ static NSString *const kButtonsKey = @"buttons";
|
||||
|
||||
@implementation FBSDKShareMessengerContentUtility
|
||||
|
||||
static BOOL _URLHasFacebookDomain(NSURL *URL)
|
||||
{
|
||||
NSString *urlHost = [URL.host lowercaseString];
|
||||
NSArray<NSString *> *pathComponents = [URL pathComponents];
|
||||
|
||||
/**
|
||||
Check the following three different cases...
|
||||
1. Check if host is facebook.com, such as in 'https://facebok.com/test'
|
||||
2. Check if host is someprefix.facebook.com, such as in 'https://www.facebook.com/test'
|
||||
3. Check if host is null, but the first path component is facebook.com
|
||||
*/
|
||||
return [urlHost isEqualToString:@"facebook.com"] ||
|
||||
[urlHost hasSuffix:@".facebook.com"] ||
|
||||
([[[pathComponents firstObject] lowercaseString] hasSuffix:@"facebook.com"]);
|
||||
}
|
||||
|
||||
static void _AddToContentPreviewDictionaryForURLButton(NSMutableDictionary *dictionary,
|
||||
FBSDKShareMessengerURLActionButton *urlButton)
|
||||
{
|
||||
@ -168,6 +184,15 @@ static NSArray *_SerializableOpenGraphMusicTemplateContentFromContent(FBSDKShare
|
||||
return serializableOpenGraphMusicTemplateContent;
|
||||
}
|
||||
|
||||
static NSString *_MediaTemplateURLSerializationKey(NSURL *mediaURL)
|
||||
{
|
||||
if (_URLHasFacebookDomain(mediaURL)) {
|
||||
return @"facebook_media_url";
|
||||
} else {
|
||||
return @"image_url";
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)_addToParameters:(NSMutableDictionary *)parameters
|
||||
contentForShare:(NSMutableDictionary *)contentForShare
|
||||
contentForPreview:(NSMutableDictionary *)contentForPreview
|
||||
@ -232,7 +257,9 @@ forShareMessengerMediaTemplateContent:(FBSDKShareMessengerMediaTemplateContent *
|
||||
NSMutableDictionary *contentForPreview = [NSMutableDictionary dictionary];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:@"DEFAULT" forKey:@"preview_type"];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:mediaTemplateContent.attachmentID forKey:@"attachment_id"];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:mediaTemplateContent.mediaURL.absoluteString forKey:@"facebook_media_url"];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview
|
||||
setObject:mediaTemplateContent.mediaURL.absoluteString
|
||||
forKey:_MediaTemplateURLSerializationKey(mediaTemplateContent.mediaURL)];
|
||||
[FBSDKInternalUtility dictionary:contentForPreview setObject:_MediaTypeString(mediaTemplateContent.mediaType) forKey:@"media_type"];
|
||||
_AddToContentPreviewDictionaryForButton(contentForPreview, mediaTemplateContent.button);
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "PNObject",
|
||||
"version": "1.3.4",
|
||||
"version": "1.5",
|
||||
"summary": "PNObject is a simple replica of the more complex ParseObject",
|
||||
"homepage": "https://github.com/giuseppenucifora/PNObject",
|
||||
"license": {
|
||||
@ -12,7 +12,7 @@
|
||||
},
|
||||
"source": {
|
||||
"git": "https://github.com/giuseppenucifora/PNObject.git",
|
||||
"tag": "1.3.4"
|
||||
"tag": "1.5"
|
||||
},
|
||||
"platforms": {
|
||||
"ios": "8.0"
|
||||
|
||||
52
Example/Pods/Manifest.lock
generated
52
Example/Pods/Manifest.lock
generated
@ -1,18 +1,18 @@
|
||||
PODS:
|
||||
- AFNetworking (3.1.0):
|
||||
- AFNetworking/NSURLSession (= 3.1.0)
|
||||
- AFNetworking/Reachability (= 3.1.0)
|
||||
- AFNetworking/Security (= 3.1.0)
|
||||
- AFNetworking/Serialization (= 3.1.0)
|
||||
- AFNetworking/UIKit (= 3.1.0)
|
||||
- AFNetworking/NSURLSession (3.1.0):
|
||||
- AFNetworking (3.2.0):
|
||||
- AFNetworking/NSURLSession (= 3.2.0)
|
||||
- AFNetworking/Reachability (= 3.2.0)
|
||||
- AFNetworking/Security (= 3.2.0)
|
||||
- AFNetworking/Serialization (= 3.2.0)
|
||||
- AFNetworking/UIKit (= 3.2.0)
|
||||
- AFNetworking/NSURLSession (3.2.0):
|
||||
- AFNetworking/Reachability
|
||||
- AFNetworking/Security
|
||||
- AFNetworking/Serialization
|
||||
- AFNetworking/Reachability (3.1.0)
|
||||
- AFNetworking/Security (3.1.0)
|
||||
- AFNetworking/Serialization (3.1.0)
|
||||
- AFNetworking/UIKit (3.1.0):
|
||||
- AFNetworking/Reachability (3.2.0)
|
||||
- AFNetworking/Security (3.2.0)
|
||||
- AFNetworking/Serialization (3.2.0)
|
||||
- AFNetworking/UIKit (3.2.0):
|
||||
- AFNetworking/NSURLSession
|
||||
- Bolts (1.9.0):
|
||||
- Bolts/AppLinks (= 1.9.0)
|
||||
@ -26,19 +26,19 @@ PODS:
|
||||
- DJLocalization/Core (= 1.2.2)
|
||||
- DJLocalization/Core (1.2.2)
|
||||
- Expecta (1.0.6)
|
||||
- FBSDKCoreKit (4.29.0):
|
||||
- FBSDKCoreKit (4.31.1):
|
||||
- Bolts (~> 1.7)
|
||||
- FBSDKLoginKit (4.29.0):
|
||||
- FBSDKCoreKit
|
||||
- FBSDKShareKit (4.29.0):
|
||||
- FBSDKLoginKit (4.31.1):
|
||||
- FBSDKCoreKit
|
||||
- FBSDKShareKit (4.31.1):
|
||||
- FBSDKCoreKit (~> 4.31.1)
|
||||
- NSDataAES (0.2.2)
|
||||
- NSDate_Utils (1.1.0):
|
||||
- DJLocalization
|
||||
- NSString-Helper (1.0.5)
|
||||
- NSString-Helper (1.0.6)
|
||||
- nv-ios-http-status (0.0.1)
|
||||
- PEAR-FileManager-iOS (1.3.1)
|
||||
- PNObject (1.3.4):
|
||||
- PNObject (1.5):
|
||||
- AFNetworking
|
||||
- CodFis-Helper
|
||||
- DDDKeychainWrapper
|
||||
@ -58,7 +58,7 @@ PODS:
|
||||
- RZDataBinding (2.1.0)
|
||||
- Specta (1.0.7)
|
||||
- StrongestPasswordValidator (0.1.2)
|
||||
- UIDevice-Utils (1.0.0)
|
||||
- UIDevice-Utils (1.0.7)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Expecta
|
||||
@ -71,27 +71,27 @@ EXTERNAL SOURCES:
|
||||
:path: ../
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
|
||||
AFNetworking: 8ac6017b94ea105479f7776e5288e48ae9c59bb4
|
||||
Bolts: ac6567323eac61e203f6a9763667d0f711be34c8
|
||||
CodFis-Helper: 28be4c74d7202542459d72354f59b1215871de87
|
||||
DDDKeychainWrapper: e681a4daba6448786fa83b4941f58102a33b1897
|
||||
DJLocalization: 0c84029af375647d4104a42ae36be87194c46c47
|
||||
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
|
||||
FBSDKCoreKit: 6f139173dc63a1deaff4430a55f2fe5bb222d2af
|
||||
FBSDKLoginKit: 56a057ca6822535ea0faa25f57a7c41edb697fd4
|
||||
FBSDKShareKit: 18a2cd118aef11dd657fe7e8b64bae5c719088b2
|
||||
FBSDKCoreKit: e08ccfcefa7bc1347a07c276dac9bf6c7fe57024
|
||||
FBSDKLoginKit: 99797ac39252fef6f72600b886f6ee60b4b29cab
|
||||
FBSDKShareKit: e640c41c9fcd61929eeb3d0c21ad335103e7cb62
|
||||
NSDataAES: 967ea3337476a80e9838a533c25d570a06855ed0
|
||||
NSDate_Utils: c858a89da6e204ecf53aca48dbccb4da4d25bc9e
|
||||
NSString-Helper: 459e1b6a62b3bf7db10f01b0d102548608e945c4
|
||||
NSString-Helper: 389265918b2a4c5b0d09f0e03c607e8e5e254dd7
|
||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||
PNObject: 8dc560680a7a48060ed309b019ca4fc41505cc07
|
||||
PNObject: 75d5a262457e538027c6f7b9cbd4f8ee5700f21f
|
||||
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd
|
||||
RZDataBinding: 6981e90ddaae2f5e02028323b1043f8c31013109
|
||||
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66
|
||||
StrongestPasswordValidator: 921e42615bdf353513c6f925bffd4fc29865dbd7
|
||||
UIDevice-Utils: ff37bd042127117572d6ce4c5ff074f4f54ab5ed
|
||||
UIDevice-Utils: 8ff812220ce91e97a2cea243bd4160e7b958ec76
|
||||
|
||||
PODFILE CHECKSUM: fcd5d1cf3426c7c9c5b3e5edcd4b8e5402ee7f2e
|
||||
|
||||
COCOAPODS: 1.3.1
|
||||
COCOAPODS: 1.4.0
|
||||
|
||||
@ -30,4 +30,5 @@
|
||||
|
||||
- (NSString*) sha512;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@ -46,10 +46,13 @@
|
||||
}
|
||||
|
||||
- (BOOL) isValidUrl {
|
||||
NSString *urlRegEx =
|
||||
@"(http|https)://((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+";
|
||||
NSString *urlRegEx = @"(http|https)://((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+";
|
||||
NSString *urlRegEx2 =@"((?:http|https)://)?(?:www\\.)?[\\w\\d\\-_]+\\.\\w{2,3}(\\.\\w{2})?(/(?<=/)(?:[\\w\\d\\-./_]+)?)?";
|
||||
|
||||
NSPredicate *urlTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", urlRegEx];
|
||||
return [urlTest evaluateWithObject:self];
|
||||
NSPredicate *urlTest2 = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", urlRegEx2];
|
||||
|
||||
return [urlTest evaluateWithObject:self]|| [urlTest2 evaluateWithObject:self];
|
||||
}
|
||||
|
||||
- (BOOL) isValidTaxCode {
|
||||
|
||||
1467
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
1467
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,9 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/AFNetworking
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworking" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
OTHER_LDFLAGS = -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/AFNetworking
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Bolts
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Bolts
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Bolts" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/Bolts
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/CodFis-Helper
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CodFis-Helper
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CodFis-Helper" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/CodFis-Helper
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/DDDKeychainWrapper
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/DDDKeychainWrapper
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
OTHER_LDFLAGS = -framework "Security"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/DDDKeychainWrapper
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/DJLocalization
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/DJLocalization
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/DJLocalization" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/DJLocalization
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Expecta
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Expecta
|
||||
ENABLE_BITCODE = NO
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Expecta" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
OTHER_LDFLAGS = -framework "Foundation" -framework "XCTest"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/Expecta
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/FBSDKCoreKit
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FBSDKCoreKit
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Bolts"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Bolts"
|
||||
OTHER_LDFLAGS = -weak_framework "Accounts" -weak_framework "AudioToolbox" -weak_framework "CoreGraphics" -weak_framework "CoreLocation" -weak_framework "Foundation" -weak_framework "QuartzCore" -weak_framework "Security" -weak_framework "Social" -weak_framework "UIKit"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/FBSDKCoreKit
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/FBSDKLoginKit
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FBSDKLoginKit
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Bolts" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKCoreKit"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Bolts" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKCoreKit"
|
||||
OTHER_LDFLAGS = -weak_framework "Accounts" -weak_framework "AudioToolbox" -weak_framework "CoreGraphics" -weak_framework "CoreLocation" -weak_framework "Foundation" -weak_framework "QuartzCore" -weak_framework "Security" -weak_framework "Social" -weak_framework "UIKit"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/FBSDKLoginKit
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/FBSDKShareKit
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FBSDKShareKit
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/FBSDKShareKit" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Bolts" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKCoreKit"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Bolts" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKCoreKit"
|
||||
OTHER_LDFLAGS = -weak_framework "Accounts" -weak_framework "AudioToolbox" -weak_framework "CoreGraphics" -weak_framework "CoreLocation" -weak_framework "Foundation" -weak_framework "QuartzCore" -weak_framework "Security" -weak_framework "Social" -weak_framework "UIKit"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/FBSDKShareKit
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/NSDataAES
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/NSDataAES
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/NSDataAES" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/NSDataAES
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/NSDate_Utils
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/NSDate_Utils" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DJLocalization"
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/NSDate_Utils
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/NSString-Helper
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/NSString-Helper
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/NSString-Helper" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/NSString-Helper
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PEAR-FileManager-iOS
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/PEAR-FileManager-iOS
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/PNObject
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PNObject
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/PNObject" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/AFNetworking" "$PODS_CONFIGURATION_BUILD_DIR/Bolts" "$PODS_CONFIGURATION_BUILD_DIR/CodFis-Helper" "$PODS_CONFIGURATION_BUILD_DIR/DDDKeychainWrapper" "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$PODS_CONFIGURATION_BUILD_DIR/NSDataAES" "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils" "$PODS_CONFIGURATION_BUILD_DIR/NSString-Helper" "$PODS_CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$PODS_CONFIGURATION_BUILD_DIR/RZDataBinding" "$PODS_CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$PODS_CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$PODS_CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking" "${PODS_CONFIGURATION_BUILD_DIR}/Bolts" "${PODS_CONFIGURATION_BUILD_DIR}/CodFis-Helper" "${PODS_CONFIGURATION_BUILD_DIR}/DDDKeychainWrapper" "${PODS_CONFIGURATION_BUILD_DIR}/DJLocalization" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKCoreKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKLoginKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKShareKit" "${PODS_CONFIGURATION_BUILD_DIR}/NSDataAES" "${PODS_CONFIGURATION_BUILD_DIR}/NSDate_Utils" "${PODS_CONFIGURATION_BUILD_DIR}/NSString-Helper" "${PODS_CONFIGURATION_BUILD_DIR}/PEAR-FileManager-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/RZDataBinding" "${PODS_CONFIGURATION_BUILD_DIR}/StrongestPasswordValidator" "${PODS_CONFIGURATION_BUILD_DIR}/UIDevice-Utils" "${PODS_CONFIGURATION_BUILD_DIR}/nv-ios-http-status"
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -3,7 +3,7 @@ This application makes use of the following third party libraries:
|
||||
|
||||
## AFNetworking
|
||||
|
||||
Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/)
|
||||
Copyright (c) 2011-2016 Alamofire Software Foundation (http://alamofire.org/)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/)
|
||||
<string>Copyright (c) 2011-2016 Alamofire Software Foundation (http://alamofire.org/)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@ -6,10 +6,14 @@ mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
|
||||
|
||||
# Used as a return value for each invocation of `strip_invalid_archs` function.
|
||||
STRIP_BINARY_RETVAL=0
|
||||
|
||||
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
||||
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
||||
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
||||
|
||||
# Copies and strips a vendored framework
|
||||
install_framework()
|
||||
{
|
||||
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
||||
@ -58,12 +62,31 @@ install_framework()
|
||||
fi
|
||||
}
|
||||
|
||||
# Copies the dSYM of a vendored framework
|
||||
# Copies and strips a vendored dSYM
|
||||
install_dsym() {
|
||||
local source="$1"
|
||||
if [ -r "$source" ]; then
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}"
|
||||
# Copy the dSYM into a the targets temp dir.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .framework.dSYM "$source")"
|
||||
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
|
||||
|
||||
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
||||
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
|
||||
strip_invalid_archs "$binary"
|
||||
fi
|
||||
|
||||
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
|
||||
# Move the stripped file into its final destination.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
|
||||
else
|
||||
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
|
||||
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -85,10 +108,18 @@ code_sign_if_enabled() {
|
||||
# Strip invalid architectures
|
||||
strip_invalid_archs() {
|
||||
binary="$1"
|
||||
# Get architectures for current file
|
||||
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
|
||||
# Get architectures for current target binary
|
||||
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
|
||||
# Intersect them with the architectures we are building for
|
||||
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
|
||||
# If there are no archs supported by this binary then warn the user
|
||||
if [[ -z "$intersected_archs" ]]; then
|
||||
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
|
||||
STRIP_BINARY_RETVAL=0
|
||||
return
|
||||
fi
|
||||
stripped=""
|
||||
for arch in $archs; do
|
||||
for arch in $binary_archs; do
|
||||
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
|
||||
# Strip non-valid architectures in-place
|
||||
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
|
||||
@ -98,6 +129,7 @@ strip_invalid_archs() {
|
||||
if [[ "$stripped" ]]; then
|
||||
echo "Stripped $binary of architectures:$stripped"
|
||||
fi
|
||||
STRIP_BINARY_RETVAL=1
|
||||
}
|
||||
|
||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/AFNetworking" "$PODS_CONFIGURATION_BUILD_DIR/Bolts" "$PODS_CONFIGURATION_BUILD_DIR/CodFis-Helper" "$PODS_CONFIGURATION_BUILD_DIR/DDDKeychainWrapper" "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$PODS_CONFIGURATION_BUILD_DIR/NSDataAES" "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils" "$PODS_CONFIGURATION_BUILD_DIR/NSString-Helper" "$PODS_CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$PODS_CONFIGURATION_BUILD_DIR/PNObject" "$PODS_CONFIGURATION_BUILD_DIR/PureLayout" "$PODS_CONFIGURATION_BUILD_DIR/RZDataBinding" "$PODS_CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$PODS_CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$PODS_CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking" "${PODS_CONFIGURATION_BUILD_DIR}/Bolts" "${PODS_CONFIGURATION_BUILD_DIR}/CodFis-Helper" "${PODS_CONFIGURATION_BUILD_DIR}/DDDKeychainWrapper" "${PODS_CONFIGURATION_BUILD_DIR}/DJLocalization" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKCoreKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKLoginKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKShareKit" "${PODS_CONFIGURATION_BUILD_DIR}/NSDataAES" "${PODS_CONFIGURATION_BUILD_DIR}/NSDate_Utils" "${PODS_CONFIGURATION_BUILD_DIR}/NSString-Helper" "${PODS_CONFIGURATION_BUILD_DIR}/PEAR-FileManager-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/PNObject" "${PODS_CONFIGURATION_BUILD_DIR}/PureLayout" "${PODS_CONFIGURATION_BUILD_DIR}/RZDataBinding" "${PODS_CONFIGURATION_BUILD_DIR}/StrongestPasswordValidator" "${PODS_CONFIGURATION_BUILD_DIR}/UIDevice-Utils" "${PODS_CONFIGURATION_BUILD_DIR}/nv-ios-http-status"
|
||||
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/Bolts" -isystem "${PODS_ROOT}/Headers/Public/CodFis-Helper" -isystem "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" -isystem "${PODS_ROOT}/Headers/Public/DJLocalization" -isystem "${PODS_ROOT}/Headers/Public/Expecta" -isystem "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" -isystem "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" -isystem "${PODS_ROOT}/Headers/Public/FBSDKShareKit" -isystem "${PODS_ROOT}/Headers/Public/NSDataAES" -isystem "${PODS_ROOT}/Headers/Public/NSDate_Utils" -isystem "${PODS_ROOT}/Headers/Public/NSString-Helper" -isystem "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" -isystem "${PODS_ROOT}/Headers/Public/PNObject" -isystem "${PODS_ROOT}/Headers/Public/PureLayout" -isystem "${PODS_ROOT}/Headers/Public/RZDataBinding" -isystem "${PODS_ROOT}/Headers/Public/Specta" -isystem "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" -isystem "${PODS_ROOT}/Headers/Public/UIDevice-Utils" -isystem "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -l"Bolts" -l"CodFis-Helper" -l"DDDKeychainWrapper" -l"DJLocalization" -l"FBSDKCoreKit" -l"FBSDKLoginKit" -l"FBSDKShareKit" -l"NSDataAES" -l"NSDate_Utils" -l"NSString-Helper" -l"PEAR-FileManager-iOS" -l"PNObject" -l"PureLayout" -l"RZDataBinding" -l"StrongestPasswordValidator" -l"UIDevice-Utils" -l"nv-ios-http-status" -framework "CoreGraphics" -framework "Foundation" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -weak_framework "Accounts" -weak_framework "AudioToolbox" -weak_framework "CoreGraphics" -weak_framework "CoreLocation" -weak_framework "Foundation" -weak_framework "QuartzCore" -weak_framework "Security" -weak_framework "Social" -weak_framework "UIKit"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/AFNetworking" "$PODS_CONFIGURATION_BUILD_DIR/Bolts" "$PODS_CONFIGURATION_BUILD_DIR/CodFis-Helper" "$PODS_CONFIGURATION_BUILD_DIR/DDDKeychainWrapper" "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$PODS_CONFIGURATION_BUILD_DIR/NSDataAES" "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils" "$PODS_CONFIGURATION_BUILD_DIR/NSString-Helper" "$PODS_CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$PODS_CONFIGURATION_BUILD_DIR/PNObject" "$PODS_CONFIGURATION_BUILD_DIR/PureLayout" "$PODS_CONFIGURATION_BUILD_DIR/RZDataBinding" "$PODS_CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$PODS_CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$PODS_CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking" "${PODS_CONFIGURATION_BUILD_DIR}/Bolts" "${PODS_CONFIGURATION_BUILD_DIR}/CodFis-Helper" "${PODS_CONFIGURATION_BUILD_DIR}/DDDKeychainWrapper" "${PODS_CONFIGURATION_BUILD_DIR}/DJLocalization" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKCoreKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKLoginKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKShareKit" "${PODS_CONFIGURATION_BUILD_DIR}/NSDataAES" "${PODS_CONFIGURATION_BUILD_DIR}/NSDate_Utils" "${PODS_CONFIGURATION_BUILD_DIR}/NSString-Helper" "${PODS_CONFIGURATION_BUILD_DIR}/PEAR-FileManager-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/PNObject" "${PODS_CONFIGURATION_BUILD_DIR}/PureLayout" "${PODS_CONFIGURATION_BUILD_DIR}/RZDataBinding" "${PODS_CONFIGURATION_BUILD_DIR}/StrongestPasswordValidator" "${PODS_CONFIGURATION_BUILD_DIR}/UIDevice-Utils" "${PODS_CONFIGURATION_BUILD_DIR}/nv-ios-http-status"
|
||||
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/Bolts" -isystem "${PODS_ROOT}/Headers/Public/CodFis-Helper" -isystem "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" -isystem "${PODS_ROOT}/Headers/Public/DJLocalization" -isystem "${PODS_ROOT}/Headers/Public/Expecta" -isystem "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" -isystem "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" -isystem "${PODS_ROOT}/Headers/Public/FBSDKShareKit" -isystem "${PODS_ROOT}/Headers/Public/NSDataAES" -isystem "${PODS_ROOT}/Headers/Public/NSDate_Utils" -isystem "${PODS_ROOT}/Headers/Public/NSString-Helper" -isystem "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" -isystem "${PODS_ROOT}/Headers/Public/PNObject" -isystem "${PODS_ROOT}/Headers/Public/PureLayout" -isystem "${PODS_ROOT}/Headers/Public/RZDataBinding" -isystem "${PODS_ROOT}/Headers/Public/Specta" -isystem "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" -isystem "${PODS_ROOT}/Headers/Public/UIDevice-Utils" -isystem "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -l"Bolts" -l"CodFis-Helper" -l"DDDKeychainWrapper" -l"DJLocalization" -l"FBSDKCoreKit" -l"FBSDKLoginKit" -l"FBSDKShareKit" -l"NSDataAES" -l"NSDate_Utils" -l"NSString-Helper" -l"PEAR-FileManager-iOS" -l"PNObject" -l"PureLayout" -l"RZDataBinding" -l"StrongestPasswordValidator" -l"UIDevice-Utils" -l"nv-ios-http-status" -framework "CoreGraphics" -framework "Foundation" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -weak_framework "Accounts" -weak_framework "AudioToolbox" -weak_framework "CoreGraphics" -weak_framework "CoreLocation" -weak_framework "Foundation" -weak_framework "QuartzCore" -weak_framework "Security" -weak_framework "Social" -weak_framework "UIKit"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -6,10 +6,14 @@ mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
|
||||
|
||||
# Used as a return value for each invocation of `strip_invalid_archs` function.
|
||||
STRIP_BINARY_RETVAL=0
|
||||
|
||||
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
||||
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
||||
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
||||
|
||||
# Copies and strips a vendored framework
|
||||
install_framework()
|
||||
{
|
||||
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
||||
@ -58,12 +62,31 @@ install_framework()
|
||||
fi
|
||||
}
|
||||
|
||||
# Copies the dSYM of a vendored framework
|
||||
# Copies and strips a vendored dSYM
|
||||
install_dsym() {
|
||||
local source="$1"
|
||||
if [ -r "$source" ]; then
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}"
|
||||
# Copy the dSYM into a the targets temp dir.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .framework.dSYM "$source")"
|
||||
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
|
||||
|
||||
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
||||
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
|
||||
strip_invalid_archs "$binary"
|
||||
fi
|
||||
|
||||
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
|
||||
# Move the stripped file into its final destination.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
|
||||
else
|
||||
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
|
||||
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -85,10 +108,18 @@ code_sign_if_enabled() {
|
||||
# Strip invalid architectures
|
||||
strip_invalid_archs() {
|
||||
binary="$1"
|
||||
# Get architectures for current file
|
||||
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
|
||||
# Get architectures for current target binary
|
||||
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
|
||||
# Intersect them with the architectures we are building for
|
||||
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
|
||||
# If there are no archs supported by this binary then warn the user
|
||||
if [[ -z "$intersected_archs" ]]; then
|
||||
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
|
||||
STRIP_BINARY_RETVAL=0
|
||||
return
|
||||
fi
|
||||
stripped=""
|
||||
for arch in $archs; do
|
||||
for arch in $binary_archs; do
|
||||
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
|
||||
# Strip non-valid architectures in-place
|
||||
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
|
||||
@ -98,6 +129,7 @@ strip_invalid_archs() {
|
||||
if [[ "$stripped" ]]; then
|
||||
echo "Stripped $binary of architectures:$stripped"
|
||||
fi
|
||||
STRIP_BINARY_RETVAL=1
|
||||
}
|
||||
|
||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks "$(PLATFORM_DIR)/Developer/Library/Frameworks"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Expecta" "$PODS_CONFIGURATION_BUILD_DIR/Specta" "$PODS_CONFIGURATION_BUILD_DIR/AFNetworking" "$PODS_CONFIGURATION_BUILD_DIR/Bolts" "$PODS_CONFIGURATION_BUILD_DIR/CodFis-Helper" "$PODS_CONFIGURATION_BUILD_DIR/DDDKeychainWrapper" "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$PODS_CONFIGURATION_BUILD_DIR/NSDataAES" "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils" "$PODS_CONFIGURATION_BUILD_DIR/NSString-Helper" "$PODS_CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$PODS_CONFIGURATION_BUILD_DIR/PNObject" "$PODS_CONFIGURATION_BUILD_DIR/PureLayout" "$PODS_CONFIGURATION_BUILD_DIR/RZDataBinding" "$PODS_CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$PODS_CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$PODS_CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Expecta" "${PODS_CONFIGURATION_BUILD_DIR}/Specta" "${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking" "${PODS_CONFIGURATION_BUILD_DIR}/Bolts" "${PODS_CONFIGURATION_BUILD_DIR}/CodFis-Helper" "${PODS_CONFIGURATION_BUILD_DIR}/DDDKeychainWrapper" "${PODS_CONFIGURATION_BUILD_DIR}/DJLocalization" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKCoreKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKLoginKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKShareKit" "${PODS_CONFIGURATION_BUILD_DIR}/NSDataAES" "${PODS_CONFIGURATION_BUILD_DIR}/NSDate_Utils" "${PODS_CONFIGURATION_BUILD_DIR}/NSString-Helper" "${PODS_CONFIGURATION_BUILD_DIR}/PEAR-FileManager-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/PNObject" "${PODS_CONFIGURATION_BUILD_DIR}/PureLayout" "${PODS_CONFIGURATION_BUILD_DIR}/RZDataBinding" "${PODS_CONFIGURATION_BUILD_DIR}/StrongestPasswordValidator" "${PODS_CONFIGURATION_BUILD_DIR}/UIDevice-Utils" "${PODS_CONFIGURATION_BUILD_DIR}/nv-ios-http-status"
|
||||
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/Bolts" -isystem "${PODS_ROOT}/Headers/Public/CodFis-Helper" -isystem "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" -isystem "${PODS_ROOT}/Headers/Public/DJLocalization" -isystem "${PODS_ROOT}/Headers/Public/Expecta" -isystem "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" -isystem "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" -isystem "${PODS_ROOT}/Headers/Public/FBSDKShareKit" -isystem "${PODS_ROOT}/Headers/Public/NSDataAES" -isystem "${PODS_ROOT}/Headers/Public/NSDate_Utils" -isystem "${PODS_ROOT}/Headers/Public/NSString-Helper" -isystem "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" -isystem "${PODS_ROOT}/Headers/Public/PNObject" -isystem "${PODS_ROOT}/Headers/Public/PureLayout" -isystem "${PODS_ROOT}/Headers/Public/RZDataBinding" -isystem "${PODS_ROOT}/Headers/Public/Specta" -isystem "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" -isystem "${PODS_ROOT}/Headers/Public/UIDevice-Utils" -isystem "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
OTHER_LDFLAGS = $(inherited) -ObjC -l"Expecta" -l"Specta" -framework "CoreGraphics" -framework "Foundation" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "XCTest" -weak_framework "Accounts" -weak_framework "AudioToolbox" -weak_framework "CoreGraphics" -weak_framework "CoreLocation" -weak_framework "Foundation" -weak_framework "QuartzCore" -weak_framework "Security" -weak_framework "Social" -weak_framework "UIKit"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks "$(PLATFORM_DIR)/Developer/Library/Frameworks"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Expecta" "$PODS_CONFIGURATION_BUILD_DIR/Specta" "$PODS_CONFIGURATION_BUILD_DIR/AFNetworking" "$PODS_CONFIGURATION_BUILD_DIR/Bolts" "$PODS_CONFIGURATION_BUILD_DIR/CodFis-Helper" "$PODS_CONFIGURATION_BUILD_DIR/DDDKeychainWrapper" "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$PODS_CONFIGURATION_BUILD_DIR/NSDataAES" "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils" "$PODS_CONFIGURATION_BUILD_DIR/NSString-Helper" "$PODS_CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$PODS_CONFIGURATION_BUILD_DIR/PNObject" "$PODS_CONFIGURATION_BUILD_DIR/PureLayout" "$PODS_CONFIGURATION_BUILD_DIR/RZDataBinding" "$PODS_CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$PODS_CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$PODS_CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Expecta" "${PODS_CONFIGURATION_BUILD_DIR}/Specta" "${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking" "${PODS_CONFIGURATION_BUILD_DIR}/Bolts" "${PODS_CONFIGURATION_BUILD_DIR}/CodFis-Helper" "${PODS_CONFIGURATION_BUILD_DIR}/DDDKeychainWrapper" "${PODS_CONFIGURATION_BUILD_DIR}/DJLocalization" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKCoreKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKLoginKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKShareKit" "${PODS_CONFIGURATION_BUILD_DIR}/NSDataAES" "${PODS_CONFIGURATION_BUILD_DIR}/NSDate_Utils" "${PODS_CONFIGURATION_BUILD_DIR}/NSString-Helper" "${PODS_CONFIGURATION_BUILD_DIR}/PEAR-FileManager-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/PNObject" "${PODS_CONFIGURATION_BUILD_DIR}/PureLayout" "${PODS_CONFIGURATION_BUILD_DIR}/RZDataBinding" "${PODS_CONFIGURATION_BUILD_DIR}/StrongestPasswordValidator" "${PODS_CONFIGURATION_BUILD_DIR}/UIDevice-Utils" "${PODS_CONFIGURATION_BUILD_DIR}/nv-ios-http-status"
|
||||
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/Bolts" -isystem "${PODS_ROOT}/Headers/Public/CodFis-Helper" -isystem "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" -isystem "${PODS_ROOT}/Headers/Public/DJLocalization" -isystem "${PODS_ROOT}/Headers/Public/Expecta" -isystem "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" -isystem "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" -isystem "${PODS_ROOT}/Headers/Public/FBSDKShareKit" -isystem "${PODS_ROOT}/Headers/Public/NSDataAES" -isystem "${PODS_ROOT}/Headers/Public/NSDate_Utils" -isystem "${PODS_ROOT}/Headers/Public/NSString-Helper" -isystem "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" -isystem "${PODS_ROOT}/Headers/Public/PNObject" -isystem "${PODS_ROOT}/Headers/Public/PureLayout" -isystem "${PODS_ROOT}/Headers/Public/RZDataBinding" -isystem "${PODS_ROOT}/Headers/Public/Specta" -isystem "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" -isystem "${PODS_ROOT}/Headers/Public/UIDevice-Utils" -isystem "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
OTHER_LDFLAGS = $(inherited) -ObjC -l"Expecta" -l"Specta" -framework "CoreGraphics" -framework "Foundation" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -framework "XCTest" -weak_framework "Accounts" -weak_framework "AudioToolbox" -weak_framework "CoreGraphics" -weak_framework "CoreLocation" -weak_framework "Foundation" -weak_framework "QuartzCore" -weak_framework "Security" -weak_framework "Social" -weak_framework "UIKit"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/PureLayout
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PureLayout
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/PureLayout" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/PureLayout
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/RZDataBinding
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RZDataBinding
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/RZDataBinding" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/RZDataBinding
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Specta
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Specta
|
||||
ENABLE_BITCODE = NO
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Specta" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
OTHER_LDFLAGS = -framework "Foundation" -framework "XCTest"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/Specta
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/StrongestPasswordValidator
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/StrongestPasswordValidator
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
OTHER_LDFLAGS = -framework "UIKit"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/StrongestPasswordValidator
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/UIDevice-Utils
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/UIDevice-Utils
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/UIDevice-Utils" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/UIDevice-Utils
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/nv-ios-http-status
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/nv-ios-http-status
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/nv-ios-http-status" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bolts" "${PODS_ROOT}/Headers/Public/CodFis-Helper" "${PODS_ROOT}/Headers/Public/DDDKeychainWrapper" "${PODS_ROOT}/Headers/Public/DJLocalization" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/FBSDKCoreKit" "${PODS_ROOT}/Headers/Public/FBSDKLoginKit" "${PODS_ROOT}/Headers/Public/FBSDKShareKit" "${PODS_ROOT}/Headers/Public/NSDataAES" "${PODS_ROOT}/Headers/Public/NSDate_Utils" "${PODS_ROOT}/Headers/Public/NSString-Helper" "${PODS_ROOT}/Headers/Public/PEAR-FileManager-iOS" "${PODS_ROOT}/Headers/Public/PNObject" "${PODS_ROOT}/Headers/Public/PureLayout" "${PODS_ROOT}/Headers/Public/RZDataBinding" "${PODS_ROOT}/Headers/Public/Specta" "${PODS_ROOT}/Headers/Public/StrongestPasswordValidator" "${PODS_ROOT}/Headers/Public/UIDevice-Utils" "${PODS_ROOT}/Headers/Public/nv-ios-http-status"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/nv-ios-http-status
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
@ -1,11 +1,3 @@
|
||||
/*
|
||||
Erica Sadun, http://ericasadun.com
|
||||
iPhone Developer's Cookbook, 6.x Edition
|
||||
BSD License, Use at your own risk
|
||||
|
||||
Modified by Eric Horacek for Monospace Ltd. on 2/4/13
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#define IS_IPAD (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
|
||||
@ -26,6 +18,7 @@ typedef NS_ENUM(NSUInteger, UIDeviceFamily) {
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, UIDeviceGenerationModel) {
|
||||
UIDeviceGenerationModeliPhone1G,
|
||||
UIDeviceGenerationModeliPhone3G,
|
||||
UIDeviceGenerationModeliPhone3GS,
|
||||
UIDeviceGenerationModeliPhone4,
|
||||
@ -37,18 +30,27 @@ typedef NS_ENUM(NSUInteger, UIDeviceGenerationModel) {
|
||||
UIDeviceGenerationModeliPhone6Plus,
|
||||
UIDeviceGenerationModeliPhone6S,
|
||||
UIDeviceGenerationModeliPhone6SPlus,
|
||||
UIDeviceGenerationModeliPhoneSE,
|
||||
UIDeviceGenerationModeliPhone7,
|
||||
UIDeviceGenerationModeliPhone7Plus,
|
||||
UIDeviceGenerationModeliPhone8,
|
||||
UIDeviceGenerationModeliPhone8Plus,
|
||||
UIDeviceGenerationModeliPhoneX,
|
||||
UIDeviceGenerationModeliPhoneSimulator,
|
||||
UIDeviceGenerationModeliPad1,
|
||||
UIDeviceGenerationModeliPad2,
|
||||
UIDeviceGenerationModeliPad3,
|
||||
UIDeviceGenerationModeliPad4,
|
||||
UIDeviceGenerationModeliPad5,
|
||||
UIDeviceGenerationModeliPadAir,
|
||||
UIDeviceGenerationModeliPadAir2,
|
||||
UIDeviceGenerationModeliPadMini1,
|
||||
UIDeviceGenerationModeliPadMini2,
|
||||
UIDeviceGenerationModeliPadMini3,
|
||||
UIDeviceGenerationModeliPadMini4,
|
||||
UIDeviceGenerationModeliPadPro,
|
||||
UIDeviceGenerationModeliPadPro97,
|
||||
UIDeviceGenerationModeliPadPro105,
|
||||
UIDeviceGenerationModeliPadPro12,
|
||||
UIDeviceGenerationModeliPadSimulator,
|
||||
UIDeviceGenerationModeliPod1,
|
||||
UIDeviceGenerationModeliPod2,
|
||||
@ -70,15 +72,19 @@ typedef NS_ENUM(NSUInteger, UIDeviceModelInches) {
|
||||
UIDeviceModelInches4,
|
||||
UIDeviceModelInches47,
|
||||
UIDeviceModelInches55,
|
||||
UIDeviceModelInches58,
|
||||
UIDeviceModelInches79,
|
||||
UIDeviceModelInches97,
|
||||
UIDeviceModelInches105,
|
||||
UIDeviceModelInches129,
|
||||
UIDeviceSimulatorModelInches35 = UIDeviceModelInches35,
|
||||
UIDeviceSimulatorModelInches4 = UIDeviceModelInches4,
|
||||
UIDeviceSimulatorModelInches47 = UIDeviceModelInches47,
|
||||
UIDeviceSimulatorModelInches55 = UIDeviceModelInches55,
|
||||
UIDeviceSimulatorModelInches58 = UIDeviceModelInches58,
|
||||
UIDeviceSimulatorModelInches79 = UIDeviceModelInches79,
|
||||
UIDeviceSimulatorModelInches97 = UIDeviceModelInches97,
|
||||
UIDeviceSimulatorModelInches105 = UIDeviceModelInches105,
|
||||
UIDeviceSimulatorModelInches129 = UIDeviceModelInches129,
|
||||
UIDeviceModelInchesUnKnown
|
||||
};
|
||||
@ -91,11 +97,6 @@ typedef NS_ENUM(NSUInteger, UIDeviceModelInches) {
|
||||
*/
|
||||
- (NSString *)modelIdentifier;
|
||||
|
||||
/**
|
||||
Returns a human-readable model name in the format of "iPhone 4S". Fallback of the the `modelIdentifier` value.
|
||||
*/
|
||||
- (NSString *)modelName;
|
||||
|
||||
/**
|
||||
Returns the device generation model as a `UIDeviceGenerationModel`
|
||||
*/
|
||||
|
||||
@ -1,11 +1,3 @@
|
||||
/*
|
||||
Erica Sadun, http://ericasadun.com
|
||||
iPhone Developer's Cookbook, 6.x Edition
|
||||
BSD License, Use at your own risk
|
||||
|
||||
Modified by Eric Horacek for Monospace Ltd. on 2/4/13
|
||||
*/
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
#import "UIDevice-Hardware.h"
|
||||
|
||||
@ -36,94 +28,9 @@
|
||||
return [self getSysInfoByName:"hw.machine"];
|
||||
}
|
||||
|
||||
- (NSString *)modelName
|
||||
{
|
||||
return [self modelNameForModelIdentifier:[self modelIdentifier]];
|
||||
}
|
||||
|
||||
- (NSString *)modelNameForModelIdentifier:(NSString *)modelIdentifier
|
||||
{
|
||||
// iPhone http://theiphonewiki.com/wiki/IPhone
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPhone1,1"]) return @"iPhone 1G";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone3,1"]) return @"iPhone 4 (GSM)";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone3,2"]) return @"iPhone 4 (GSM Rev A)";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone3,3"]) return @"iPhone 4 (CDMA)";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone5,1"]) return @"iPhone 5 (GSM)";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone5,2"]) return @"iPhone 5 (Global)";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone5,3"]) return @"iPhone 5c (GSM)";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone5,4"]) return @"iPhone 5c (Global)";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone6,1"]) return @"iPhone 5s (GSM)";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone6,2"]) return @"iPhone 5s (Global)";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
|
||||
|
||||
// iPad http://theiphonewiki.com/wiki/IPad
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPad1,1"]) return @"iPad 1G";
|
||||
if ([modelIdentifier isEqualToString:@"iPad2,1"]) return @"iPad 2 (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad2,2"]) return @"iPad 2 (GSM)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad2,4"]) return @"iPad 2 (Rev A)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,1"]) return @"iPad 3 (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,2"]) return @"iPad 3 (GSM)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,3"]) return @"iPad 3 (Global)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,4"]) return @"iPad 4 (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,5"]) return @"iPad 4 (GSM)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,6"]) return @"iPad 4 (Global)";
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,1"]) return @"iPad Air (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,2"]) return @"iPad Air (Cellular)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad5,3"]) return @"iPad Air 2 (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad5,4"]) return @"iPad Air 2 (Cellular)";
|
||||
|
||||
// iPad Mini http://theiphonewiki.com/wiki/IPad_mini
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPad2,5"]) return @"iPad mini 1G (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad2,6"]) return @"iPad mini 1G (GSM)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad2,7"]) return @"iPad mini 1G (Global)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,4"]) return @"iPad mini 2G (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,5"]) return @"iPad mini 2G (Cellular)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,6"]) return @"iPad mini 2G (Cellular)"; // TD-LTE model see https://support.apple.com/en-us/HT201471#iPad-mini2
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,7"]) return @"iPad mini 3G (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,8"]) return @"iPad mini 3G (Cellular)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,9"]) return @"iPad mini 3G (Cellular)";
|
||||
|
||||
// iPod http://theiphonewiki.com/wiki/IPod
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPod1,1"]) return @"iPod touch 1G";
|
||||
if ([modelIdentifier isEqualToString:@"iPod2,1"]) return @"iPod touch 2G";
|
||||
if ([modelIdentifier isEqualToString:@"iPod3,1"]) return @"iPod touch 3G";
|
||||
if ([modelIdentifier isEqualToString:@"iPod4,1"]) return @"iPod touch 4G";
|
||||
if ([modelIdentifier isEqualToString:@"iPod5,1"]) return @"iPod touch 5G";
|
||||
if ([modelIdentifier isEqualToString:@"iPod7,1"]) return @"iPod touch 6G"; // as 6,1 was never released 7,1 is actually 6th generation
|
||||
|
||||
// Apple TV https://www.theiphonewiki.com/wiki/Apple_TV
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"AppleTV1,1"]) return @"Apple TV 1G";
|
||||
if ([modelIdentifier isEqualToString:@"AppleTV2,1"]) return @"Apple TV 2G";
|
||||
if ([modelIdentifier isEqualToString:@"AppleTV3,1"]) return @"Apple TV 3G";
|
||||
if ([modelIdentifier isEqualToString:@"AppleTV3,2"]) return @"Apple TV 3G"; // small, incremental update over 3,1
|
||||
if ([modelIdentifier isEqualToString:@"AppleTV5,3"]) return @"Apple TV 4G";
|
||||
|
||||
// Simulator
|
||||
if ([modelIdentifier hasSuffix:@"86"] || [modelIdentifier isEqual:@"x86_64"])
|
||||
{
|
||||
BOOL smallerScreen = ([[UIScreen mainScreen] bounds].size.width < 768.0);
|
||||
return (smallerScreen ? @"iPhone Simulator" : @"iPad Simulator");
|
||||
}
|
||||
|
||||
return modelIdentifier;
|
||||
}
|
||||
|
||||
- (UIDeviceFamily) deviceFamily
|
||||
{
|
||||
NSString *modelIdentifier = [self modelNameForModelIdentifier:[self modelIdentifier]];
|
||||
NSString *modelIdentifier = [self deviceGenerationModelString];
|
||||
if ([modelIdentifier hasPrefix:@"iPhone"]) return UIDeviceFamilyiPhone;
|
||||
if ([modelIdentifier hasPrefix:@"iPod"]) return UIDeviceFamilyiPod;
|
||||
if ([modelIdentifier hasPrefix:@"iPad"]) return UIDeviceFamilyiPad;
|
||||
@ -135,7 +42,9 @@
|
||||
{
|
||||
NSString *modelIdentifier = [self modelIdentifier];
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPhone1,1"]) return UIDeviceGenerationModeliPhone3G;
|
||||
// iPhone https://www.theiphonewiki.com/wiki/List_of_iPhones
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPhone1,1"]) return UIDeviceGenerationModeliPhone1G;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone1,2"]) return UIDeviceGenerationModeliPhone3G;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone2,1"]) return UIDeviceGenerationModeliPhone3GS;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone3,1"]) return UIDeviceGenerationModeliPhone4;
|
||||
@ -152,6 +61,17 @@
|
||||
if ([modelIdentifier isEqualToString:@"iPhone7,2"]) return UIDeviceGenerationModeliPhone6;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone8,1"]) return UIDeviceGenerationModeliPhone6S;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone8,2"]) return UIDeviceGenerationModeliPhone6SPlus;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone8,4"]) return UIDeviceGenerationModeliPhoneSE;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone9,1"]) return UIDeviceGenerationModeliPhone7;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone9,2"]) return UIDeviceGenerationModeliPhone7Plus;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone9,3"]) return UIDeviceGenerationModeliPhone7;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone9,4"]) return UIDeviceGenerationModeliPhone7Plus;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,1"]) return UIDeviceGenerationModeliPhone8;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,2"]) return UIDeviceGenerationModeliPhone8Plus;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,3"]) return UIDeviceGenerationModeliPhoneX;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,4"]) return UIDeviceGenerationModeliPhone8;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,5"]) return UIDeviceGenerationModeliPhone8Plus;
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,6"]) return UIDeviceGenerationModeliPhoneX;
|
||||
|
||||
// iPad http://theiphonewiki.com/wiki/IPad
|
||||
|
||||
@ -166,13 +86,13 @@
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,4"]) return UIDeviceGenerationModeliPad4;
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,5"]) return UIDeviceGenerationModeliPad4;
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,6"]) return UIDeviceGenerationModeliPad4;
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,11"]) return UIDeviceGenerationModeliPad5;
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,12"]) return UIDeviceGenerationModeliPad5;
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,1"]) return UIDeviceGenerationModeliPadAir;
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,2"]) return UIDeviceGenerationModeliPadAir;
|
||||
if ([modelIdentifier isEqualToString:@"iPad5,3"]) return UIDeviceGenerationModeliPadAir2;
|
||||
if ([modelIdentifier isEqualToString:@"iPad5,4"]) return UIDeviceGenerationModeliPadAir2;
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,7"]) return UIDeviceGenerationModeliPadPro;
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,8"]) return UIDeviceGenerationModeliPadPro;
|
||||
|
||||
// iPad Mini http://theiphonewiki.com/wiki/IPad_mini
|
||||
|
||||
@ -185,6 +105,19 @@
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,7"]) return UIDeviceGenerationModeliPadMini3;
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,8"]) return UIDeviceGenerationModeliPadMini3;
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,9"]) return UIDeviceGenerationModeliPadMini3;
|
||||
if ([modelIdentifier isEqualToString:@"iPad5,1"]) return UIDeviceGenerationModeliPadMini4;
|
||||
if ([modelIdentifier isEqualToString:@"iPad5,2"]) return UIDeviceGenerationModeliPadMini4;
|
||||
|
||||
// iPad Pro https://www.theiphonewiki.com/wiki/IPad_Pro
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,3"]) return UIDeviceGenerationModeliPadPro97; // http://pdadb.net/index.php?m=specs&id=9938&c=apple_ipad_pro_9.7-inch_a1673_wifi_32gb_apple_ipad_6,3
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,4"]) return UIDeviceGenerationModeliPadPro97; // http://pdadb.net/index.php?m=specs&id=9981&c=apple_ipad_pro_9.7-inch_a1675_td-lte_32gb_apple_ipad_6,4
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,7"]) return UIDeviceGenerationModeliPadPro12; // http://pdadb.net/index.php?m=specs&id=8960&c=apple_ipad_pro_wifi_a1584_128gb
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,8"]) return UIDeviceGenerationModeliPadPro12; // http://pdadb.net/index.php?m=specs&id=8965&c=apple_ipad_pro_td-lte_a1652_32gb_apple_ipad_6,8
|
||||
if ([modelIdentifier isEqualToString:@"iPad 7,1"]) return UIDeviceGenerationModeliPadPro12;
|
||||
if ([modelIdentifier isEqualToString:@"iPad 7,2"]) return UIDeviceGenerationModeliPadPro12;
|
||||
if ([modelIdentifier isEqualToString:@"iPad 7,3"]) return UIDeviceGenerationModeliPadPro105;
|
||||
if ([modelIdentifier isEqualToString:@"iPad 7,4"]) return UIDeviceGenerationModeliPadPro105;
|
||||
|
||||
// iPod http://theiphonewiki.com/wiki/IPod
|
||||
|
||||
@ -238,6 +171,17 @@
|
||||
if ([modelIdentifier isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone8,4"]) return @"iPhone SE";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone9,1"]) return @"iPhone 7";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone9,3"]) return @"iPhone 7";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus";
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,1"]) return @"iPhone 8"; // US (Verizon), China, Japan
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,2"]) return @"iPhone 8 Plus"; // US (Verizon), China, Japan
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,3"]) return @"iPhone X"; // US (Verizon), China, Japan
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,4"]) return @"iPhone 8"; // AT&T, Global
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,5"]) return @"iPhone 8 Plus"; // AT&T, Global
|
||||
if ([modelIdentifier isEqualToString:@"iPhone10,6"]) return @"iPhone X"; // AT&T, Global
|
||||
|
||||
// iPad http://theiphonewiki.com/wiki/IPad
|
||||
|
||||
@ -252,15 +196,14 @@
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,4"]) return @"iPad 4 (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,5"]) return @"iPad 4 (GSM)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad3,6"]) return @"iPad 4 (Global)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,11"]) return @"iPad (5th gen) (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,12"]) return @"iPad (5th gen) (Cellular)";
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,1"]) return @"iPad Air (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,2"]) return @"iPad Air (Cellular)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad5,3"]) return @"iPad Air 2 (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad5,4"]) return @"iPad Air 2 (Cellular)";
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,7"]) return @"iPad Pro (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,8"]) return @"iPad Pro (Cellular)";
|
||||
|
||||
// iPad Mini http://theiphonewiki.com/wiki/IPad_mini
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPad2,5"]) return @"iPad mini 1G (Wi-Fi)";
|
||||
@ -272,6 +215,19 @@
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,7"]) return @"iPad mini 3G (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,8"]) return @"iPad mini 3G (Cellular)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad4,9"]) return @"iPad mini 3G (Cellular)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad5,1"]) return @"iPad mini 4G (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad5,2"]) return @"iPad mini 4G (Cellular)";
|
||||
|
||||
// iPad Pro https://www.theiphonewiki.com/wiki/IPad_Pro
|
||||
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,3"]) return @"iPad Pro (9.7 inch) 1G (Wi-Fi)"; // http://pdadb.net/index.php?m=specs&id=9938&c=apple_ipad_pro_9.7-inch_a1673_wifi_32gb_apple_ipad_6,3
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,4"]) return @"iPad Pro (9.7 inch) 1G (Cellular)"; // http://pdadb.net/index.php?m=specs&id=9981&c=apple_ipad_pro_9.7-inch_a1675_td-lte_32gb_apple_ipad_6,4
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,7"]) return @"iPad Pro (12.9 inch) 1G (Wi-Fi)"; // http://pdadb.net/index.php?m=specs&id=8960&c=apple_ipad_pro_wifi_a1584_128gb
|
||||
if ([modelIdentifier isEqualToString:@"iPad6,8"]) return @"iPad Pro (12.9 inch) 1G (Cellular)"; // http://pdadb.net/index.php?m=specs&id=8965&c=apple_ipad_pro_td-lte_a1652_32gb_apple_ipad_6,8
|
||||
if ([modelIdentifier isEqualToString:@"iPad 7,1"]) return @"iPad Pro (12.9 inch) 2G (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad 7,2"]) return @"iPad Pro (12.9 inch) 2G (Cellular)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad 7,3"]) return @"iPad Pro (10.5 inch) 1G (Wi-Fi)";
|
||||
if ([modelIdentifier isEqualToString:@"iPad 7,4"]) return @"iPad Pro (10.5 inch) 1G (Cellular)";
|
||||
|
||||
// iPod http://theiphonewiki.com/wiki/IPod
|
||||
|
||||
@ -311,26 +267,37 @@
|
||||
break;
|
||||
case UIDeviceGenerationModeliPhone5:
|
||||
case UIDeviceGenerationModeliPhone5C:
|
||||
case UIDeviceGenerationModeliPhone5S:{
|
||||
case UIDeviceGenerationModeliPhone5S:
|
||||
case UIDeviceGenerationModeliPhoneSE:{
|
||||
return UIDeviceModelInches4;
|
||||
}
|
||||
break;
|
||||
case UIDeviceGenerationModeliPhone6:
|
||||
case UIDeviceGenerationModeliPhone6S:{
|
||||
case UIDeviceGenerationModeliPhone6S:
|
||||
case UIDeviceGenerationModeliPhone7:
|
||||
case UIDeviceGenerationModeliPhone8:{
|
||||
return UIDeviceModelInches47;
|
||||
}
|
||||
break;
|
||||
case UIDeviceGenerationModeliPhone6Plus:
|
||||
case UIDeviceGenerationModeliPhone6SPlus:{
|
||||
case UIDeviceGenerationModeliPhone6SPlus:
|
||||
case UIDeviceGenerationModeliPhone7Plus:
|
||||
case UIDeviceGenerationModeliPhone8Plus:{
|
||||
return UIDeviceModelInches55;
|
||||
}
|
||||
break;
|
||||
case UIDeviceGenerationModeliPhoneX:{
|
||||
return UIDeviceModelInches58;
|
||||
}
|
||||
break;
|
||||
case UIDeviceGenerationModeliPad1:
|
||||
case UIDeviceGenerationModeliPad2:
|
||||
case UIDeviceGenerationModeliPad3:
|
||||
case UIDeviceGenerationModeliPad4:
|
||||
case UIDeviceGenerationModeliPad5:
|
||||
case UIDeviceGenerationModeliPadAir:
|
||||
case UIDeviceGenerationModeliPadAir2:{
|
||||
case UIDeviceGenerationModeliPadAir2:
|
||||
case UIDeviceGenerationModeliPadPro97:{
|
||||
return UIDeviceModelInches97;
|
||||
}
|
||||
break;
|
||||
@ -341,16 +308,19 @@
|
||||
return UIDeviceModelInches79;
|
||||
}
|
||||
break;
|
||||
case UIDeviceGenerationModeliPadPro:{
|
||||
return UIDeviceModelInches129;
|
||||
break;
|
||||
case UIDeviceGenerationModeliPadPro105:{
|
||||
return UIDeviceModelInches105;
|
||||
}
|
||||
break;
|
||||
case UIDeviceGenerationModeliPadPro12:{
|
||||
return UIDeviceModelInches129;
|
||||
}
|
||||
break;
|
||||
case UIDeviceGenerationModeliPadSimulator:
|
||||
case UIDeviceGenerationModeliPhoneSimulator:{
|
||||
CGRect screenRect = [[UIScreen mainScreen] bounds];
|
||||
NSInteger screenHeight = ((NSInteger)screenRect.size.height > (NSInteger)screenRect.size.width) ? (NSInteger)screenRect.size.height : (NSInteger)screenRect.size.width;
|
||||
|
||||
|
||||
switch (screenHeight) {
|
||||
case 480:{
|
||||
return UIDeviceSimulatorModelInches35;
|
||||
@ -368,6 +338,11 @@
|
||||
return UIDeviceSimulatorModelInches55;
|
||||
break;
|
||||
}
|
||||
case 812:{
|
||||
return UIDeviceSimulatorModelInches58;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1024:{
|
||||
return UIDeviceModelInches97;
|
||||
break;
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'PNObject'
|
||||
s.version = '1.3.4'
|
||||
s.version = '1.5'
|
||||
s.summary = 'PNObject is a simple replica of the more complex ParseObject'
|
||||
|
||||
|
||||
|
||||
@ -7,70 +7,14 @@
|
||||
//
|
||||
|
||||
#import "PNObject.h"
|
||||
#import "PNObjectFormData.h"
|
||||
#import "PNObject+PNObjectGETConnection.h"
|
||||
#import "PNObject+PNObjectPOSTConnection.h"
|
||||
#import "PNObject+PNObjectDELETEConnection.h"
|
||||
|
||||
#define MAX_RETRIES 3
|
||||
|
||||
@interface PNObject (PNObjectConnection)
|
||||
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nullable uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
formData:(NSArray * _Nullable) postFormData
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
formData:(NSArray * _Nullable) postFormData
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (id _Nonnull) parseObjectFromResponse:(id _Nullable) response;
|
||||
|
||||
@end
|
||||
|
||||
@ -14,249 +14,8 @@
|
||||
#import <AFNetworking/AFNetworking.h>
|
||||
#import "PNObject+Protected.h"
|
||||
|
||||
#define MAX_RETRIES 3
|
||||
|
||||
@implementation PNObject (PNObjectConnection)
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
return [self GETWithEndpointAction:endPoint parameters:nil progress:downloadProgress success:success failure:failure];
|
||||
|
||||
}
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
return [self GETWithEndpointAction:endPoint parameters:parameters retries:MAX_RETRIES progress:downloadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
if ([[PNObjectConfig sharedInstance] currentOauthCredential] && ![[[PNObjectConfig sharedInstance] currentOauthCredential] isExpired]) {
|
||||
[[[PNObjectConfig sharedInstance] manager] GET:[[[PNObjectConfig sharedInstance] endPointUrl] stringByAppendingFormat:@"%@",endPoint] parameters:parameters progress:downloadProgress success:^(NSURLSessionDataTask *task, id responseObject) {
|
||||
|
||||
if (success) {
|
||||
success(task,responseObject);
|
||||
}
|
||||
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
if (retries > 0) {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self GETWithEndpointAction:endPoint parameters:parameters retries:retries-1 progress:downloadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
return;
|
||||
}else {
|
||||
if (failure) {
|
||||
failure(task,error);
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
else {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self GETWithEndpointAction:endPoint parameters:parameters retries:retries-1 progress:downloadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
return [self POSTWithEndpointAction:endPoint parameters:parameters retries:MAX_RETRIES progress:uploadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
if ([[PNObjectConfig sharedInstance] currentOauthCredential] && ![[[PNObjectConfig sharedInstance] currentOauthCredential] isExpired]) {
|
||||
|
||||
[[[PNObjectConfig sharedInstance] manager] POST:[[[PNObjectConfig sharedInstance] endPointUrl] stringByAppendingFormat:@"%@",endPoint] parameters:parameters progress:uploadProgress success:^(NSURLSessionDataTask *task, id responseObject) {
|
||||
|
||||
if (success) {
|
||||
success(task,responseObject);
|
||||
}
|
||||
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
if (retries > 0) {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self POSTWithEndpointAction:endPoint parameters:parameters retries:retries-1 progress:uploadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
else {
|
||||
if (failure) {
|
||||
failure(task, error);
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
else {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self POSTWithEndpointAction:endPoint parameters:parameters retries:retries-1 progress:uploadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
formData:(NSArray * _Nullable) postFormData
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
return [self POSTWithEndpointAction:endPoint formData:postFormData parameters:parameters retries:MAX_RETRIES progress:uploadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
formData:(NSArray * _Nullable) postFormData
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
if ([[PNObjectConfig sharedInstance] currentOauthCredential] && ![[[PNObjectConfig sharedInstance] currentOauthCredential] isExpired]) {
|
||||
[[[PNObjectConfig sharedInstance] manager] POST:[[[PNObjectConfig sharedInstance] endPointUrl] stringByAppendingFormat:@"%@",endPoint]
|
||||
parameters:parameters
|
||||
constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
||||
if (postFormData) {
|
||||
for (PNObjectFormData *postData in postFormData) {
|
||||
|
||||
[formData appendPartWithFileData:[postData formData] name:[postData name] fileName:[postData fileName] mimeType:[postData mimeType]];
|
||||
}
|
||||
}
|
||||
}
|
||||
progress:uploadProgress
|
||||
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
||||
if (success) {
|
||||
success(task,responseObject);
|
||||
}
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
if (retries > 0) {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self POSTWithEndpointAction:endPoint formData:postFormData parameters:parameters retries:retries-1 progress:uploadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
else {
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
else {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self POSTWithEndpointAction:endPoint formData:postFormData parameters:parameters retries:retries-1 progress:uploadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
return [self DELETEWithEndpointAction:endPoint parameters:parameters retries:MAX_RETRIES progress:uploadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
if ([[PNObjectConfig sharedInstance] currentOauthCredential] && ![[[PNObjectConfig sharedInstance] currentOauthCredential] isExpired]) {
|
||||
[[[PNObjectConfig sharedInstance] manager] DELETE:[[[PNObjectConfig sharedInstance] endPointUrl] stringByAppendingFormat:@"%@",endPoint]
|
||||
parameters:parameters
|
||||
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
||||
if (success) {
|
||||
success(task,responseObject);
|
||||
}
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
if (retries > 0) {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
[self DELETEWithEndpointAction:endPoint parameters:parameters retries:retries-1 progress:uploadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
else {
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
else {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
[self DELETEWithEndpointAction:endPoint parameters:parameters retries:retries-1 progress:uploadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Private Methods
|
||||
|
||||
+ (id _Nonnull) parseObjectFromResponse:(id _Nullable) response {
|
||||
|
||||
42
PNObject/Classes/PNObject+PNObjectDELETEConnection.h
Normal file
42
PNObject/Classes/PNObject+PNObjectDELETEConnection.h
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// PNObjectConnection.h
|
||||
// Pods
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 18/01/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import "PNObject.h"
|
||||
#import "PNObjectFormData.h"
|
||||
|
||||
@interface PNObject (PNObjectDELETEConnection)
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
@end
|
||||
122
PNObject/Classes/PNObject+PNObjectDELETEConnection.m
Normal file
122
PNObject/Classes/PNObject+PNObjectDELETEConnection.m
Normal file
@ -0,0 +1,122 @@
|
||||
//
|
||||
// PNObjectConnection.m
|
||||
// Pods
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 18/01/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import "PNObject+PNObjectDELETEConnection.h"
|
||||
#import "PNObjectConstants.h"
|
||||
#import <NSDate_Utils/NSDate+NSDate_Util.h>
|
||||
#import "PNObjectConfig.h"
|
||||
#import "PNObjectModel.h"
|
||||
#import <AFNetworking/AFNetworking.h>
|
||||
#import "PNObject+Protected.h"
|
||||
#import "PNObject+PNObjectConnection.h"
|
||||
|
||||
@implementation PNObject (PNObjectDELETEConnection)
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
return [self DELETEWithEndpointAction:endPoint authMode:OAuthModeClientCredential parameters:parameters retries:MAX_RETRIES progress:uploadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
return [self DELETEWithEndpointAction:endPoint authMode:OAuthModeClientCredential parameters:parameters retries:retries progress:uploadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
return [self DELETEWithEndpointAction:endPoint authMode:authMode parameters:parameters retries:MAX_RETRIES progress:uploadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) DELETEWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
|
||||
|
||||
if ([[PNObjectConfig sharedInstance] currentOauthUserCredential] && ![[[PNObjectConfig sharedInstance] currentOauthUserCredential] isExpired]) {
|
||||
[[[PNObjectConfig sharedInstance] manager] DELETE:[[[PNObjectConfig sharedInstance] endPointUrl] stringByAppendingFormat:@"%@",endPoint]
|
||||
parameters:parameters
|
||||
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
||||
if (success) {
|
||||
success(task,responseObject);
|
||||
}
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
if (retries > 0) {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
[self DELETEWithEndpointAction:endPoint
|
||||
authMode:authMode
|
||||
parameters:parameters
|
||||
retries:retries-1
|
||||
progress:uploadProgress
|
||||
success:success
|
||||
failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
else {
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
else {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
[self DELETEWithEndpointAction:endPoint
|
||||
authMode:authMode
|
||||
parameters:parameters
|
||||
retries:retries-1
|
||||
progress:uploadProgress
|
||||
success:success
|
||||
failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
+ (BOOL) checkCredential {
|
||||
|
||||
switch ([[PNObjectConfig sharedInstance] oauthMode]) {
|
||||
case OAuthModeClientCredential:
|
||||
return NO;
|
||||
break;
|
||||
case OAuthModePassword:
|
||||
default:
|
||||
return NO;
|
||||
break;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
56
PNObject/Classes/PNObject+PNObjectGETConnection.h
Normal file
56
PNObject/Classes/PNObject+PNObjectGETConnection.h
Normal file
@ -0,0 +1,56 @@
|
||||
//
|
||||
// PNObjectConnection.h
|
||||
// Pods
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 18/01/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import "PNObject.h"
|
||||
#import "PNObjectFormData.h"
|
||||
|
||||
@interface PNObject (PNObjectGETConnection)
|
||||
|
||||
#pragma mark - GET
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
@end
|
||||
122
PNObject/Classes/PNObject+PNObjectGETConnection.m
Normal file
122
PNObject/Classes/PNObject+PNObjectGETConnection.m
Normal file
@ -0,0 +1,122 @@
|
||||
//
|
||||
// PNObjectConnection.m
|
||||
// Pods
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 18/01/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import "PNObject+PNObjectGETConnection.h"
|
||||
#import "PNObject+PNObjectConnection.h"
|
||||
#import "PNObjectConstants.h"
|
||||
#import <NSDate_Utils/NSDate+NSDate_Util.h>
|
||||
#import "PNObjectConfig.h"
|
||||
#import "PNObjectModel.h"
|
||||
#import <AFNetworking/AFNetworking.h>
|
||||
#import "PNObject+Protected.h"
|
||||
|
||||
@implementation PNObject (PNObjectGETConnection)
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
return [self GETWithEndpointAction:endPoint parameters:nil progress:downloadProgress success:success failure:failure];
|
||||
|
||||
}
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
return [self GETWithEndpointAction:endPoint authMode:OAuthModeClientCredential parameters:parameters retries:MAX_RETRIES progress:downloadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
return [self GETWithEndpointAction:endPoint authMode:OAuthModeClientCredential parameters:parameters retries:retries progress:downloadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
return [self GETWithEndpointAction:endPoint authMode:authMode parameters:nil retries:MAX_RETRIES progress:downloadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
return [self GETWithEndpointAction:endPoint authMode:authMode parameters:parameters retries:MAX_RETRIES progress:downloadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nullable downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
if ([[PNObjectConfig sharedInstance] currentOauthClientCredential] && ![[[PNObjectConfig sharedInstance] currentOauthClientCredential] isExpired]) {
|
||||
[[[PNObjectConfig sharedInstance] manager] GET:[[[PNObjectConfig sharedInstance] endPointUrl] stringByAppendingFormat:@"%@",endPoint] parameters:parameters progress:downloadProgress success:^(NSURLSessionDataTask *task, id responseObject) {
|
||||
|
||||
if (success) {
|
||||
success(task,responseObject);
|
||||
}
|
||||
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
if (retries > 0) {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self GETWithEndpointAction:endPoint
|
||||
authMode:authMode
|
||||
parameters:parameters
|
||||
retries:retries-1
|
||||
progress:downloadProgress
|
||||
success:success
|
||||
failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
return;
|
||||
}else {
|
||||
if (failure) {
|
||||
failure(task,error);
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
else {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self GETWithEndpointAction:endPoint
|
||||
authMode:authMode
|
||||
parameters:parameters
|
||||
retries:retries-1
|
||||
progress:downloadProgress
|
||||
success:success
|
||||
failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
78
PNObject/Classes/PNObject+PNObjectPOSTConnection.h
Normal file
78
PNObject/Classes/PNObject+PNObjectPOSTConnection.h
Normal file
@ -0,0 +1,78 @@
|
||||
//
|
||||
// PNObjectConnection.h
|
||||
// Pods
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 18/01/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import "PNObject.h"
|
||||
#import "PNObjectFormData.h"
|
||||
|
||||
@interface PNObject (PNObjectPOSTConnection)
|
||||
|
||||
#pragma mark - GET
|
||||
|
||||
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nullable uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
formData:(NSArray * _Nullable) postFormData
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
formData:(NSArray * _Nullable) postFormData
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nullable uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
formData:(NSArray * _Nullable) postFormData
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
formData:(NSArray * _Nullable) postFormData
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
@end
|
||||
145
PNObject/Classes/PNObject+PNObjectPOSTConnection.m
Normal file
145
PNObject/Classes/PNObject+PNObjectPOSTConnection.m
Normal file
@ -0,0 +1,145 @@
|
||||
//
|
||||
// PNObjectConnection.m
|
||||
// Pods
|
||||
//
|
||||
// Created by Giuseppe Nucifora on 18/01/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import "PNObject+PNObjectConnection.h"
|
||||
#import "PNObjectConstants.h"
|
||||
#import <NSDate_Utils/NSDate+NSDate_Util.h>
|
||||
#import "PNObjectConfig.h"
|
||||
#import "PNObjectModel.h"
|
||||
#import <AFNetworking/AFNetworking.h>
|
||||
#import "PNObject+Protected.h"
|
||||
#import "PNObject+PNObjectConnection.h"
|
||||
|
||||
@implementation PNObject (PNObjectPOSTConnection)
|
||||
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
return [self POSTWithEndpointAction:endPoint authMode:OAuthModeClientCredential parameters:parameters retries:MAX_RETRIES progress:uploadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
if ([[PNObjectConfig sharedInstance] currentOauthUserCredential] && ![[[PNObjectConfig sharedInstance] currentOauthUserCredential] isExpired]) {
|
||||
|
||||
[[[PNObjectConfig sharedInstance] manager] POST:[[[PNObjectConfig sharedInstance] endPointUrl] stringByAppendingFormat:@"%@",endPoint] parameters:parameters progress:uploadProgress success:^(NSURLSessionDataTask *task, id responseObject) {
|
||||
|
||||
if (success) {
|
||||
success(task,responseObject);
|
||||
}
|
||||
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
if (retries > 0) {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self POSTWithEndpointAction:endPoint parameters:parameters retries:retries-1 progress:uploadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
else {
|
||||
if (failure) {
|
||||
failure(task, error);
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
else {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self POSTWithEndpointAction:endPoint parameters:parameters retries:retries-1 progress:uploadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
authMode:(OAuthMode) authMode
|
||||
formData:(NSArray * _Nullable) postFormData
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
return [self POSTWithEndpointAction:endPoint authMode:OAuthModeClientCredential formData:postFormData parameters:parameters retries:MAX_RETRIES progress:uploadProgress success:success failure:failure];
|
||||
}
|
||||
|
||||
+ (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
formData:(NSArray * _Nullable) postFormData
|
||||
parameters:(NSDictionary * _Nullable) parameters
|
||||
retries:(NSInteger) retries
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
if ([[PNObjectConfig sharedInstance] currentOauthUserCredential] && ![[[PNObjectConfig sharedInstance] currentOauthUserCredential] isExpired]) {
|
||||
[[[PNObjectConfig sharedInstance] manager] POST:[[[PNObjectConfig sharedInstance] endPointUrl] stringByAppendingFormat:@"%@",endPoint]
|
||||
parameters:parameters
|
||||
constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
||||
if (postFormData) {
|
||||
for (PNObjectFormData *postData in postFormData) {
|
||||
|
||||
[formData appendPartWithFileData:[postData formData] name:[postData name] fileName:[postData fileName] mimeType:[postData mimeType]];
|
||||
}
|
||||
}
|
||||
}
|
||||
progress:uploadProgress
|
||||
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
||||
if (success) {
|
||||
success(task,responseObject);
|
||||
}
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
if (retries > 0) {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self POSTWithEndpointAction:endPoint formData:postFormData parameters:parameters retries:retries-1 progress:uploadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
else {
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
else {
|
||||
[[PNObjectConfig sharedInstance] refreshTokenWithBlockSuccess:^(BOOL refreshSuccess) {
|
||||
|
||||
return [self POSTWithEndpointAction:endPoint formData:postFormData parameters:parameters retries:retries-1 progress:uploadProgress success:success failure:failure];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
if (failure) {
|
||||
failure(nil,error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -39,6 +39,8 @@ extern NSString* _Nonnull const PNObjectLocalNotificationPNInstallationUserDelet
|
||||
|
||||
extern NSString* _Nonnull const BaseUrl;
|
||||
extern NSString* _Nonnull const EndpointPath;
|
||||
extern NSString* _Nonnull const OAuthEndpointPath;
|
||||
extern NSString* _Nonnull const OAuthEndpointAction;
|
||||
|
||||
extern NSString* _Nonnull const EnvironmentProduction;
|
||||
extern NSString* _Nonnull const EnvironmentStage;
|
||||
@ -47,6 +49,9 @@ extern NSString* _Nonnull const EnvironmentDevelopment;
|
||||
extern NSString* _Nonnull const Client_ID;
|
||||
extern NSString* _Nonnull const Client_Secret;
|
||||
|
||||
extern NSString* _Nonnull const OAuthClient_ID;
|
||||
extern NSString* _Nonnull const OAuthClient_Secret;
|
||||
|
||||
typedef NS_ENUM(NSInteger, OAuthMode) {
|
||||
OAuthModeNo = 0,
|
||||
OAuthModeClientCredential,
|
||||
@ -67,8 +72,8 @@ typedef NS_ENUM(NSInteger, OAuthMode) {
|
||||
* @param endpointUrlsForEnvironments
|
||||
* For example,
|
||||
* @{ PNObjectConfigDevelopment : @"https://development.it/api/v1",
|
||||
* PNObjectConfigEnvStage : @"ttps://stage.it/api/v1",
|
||||
* PNObjectConfigEnvProduction : @"ttps://production.it/api/v1"
|
||||
* PNObjectConfigEnvStage : @"https://stage.it/api/v1",
|
||||
* PNObjectConfigEnvProduction : @"https://production.it/api/v1"
|
||||
* }
|
||||
*
|
||||
* @return singleton
|
||||
@ -81,8 +86,8 @@ typedef NS_ENUM(NSInteger, OAuthMode) {
|
||||
* @param endpointUrlsForEnvironments
|
||||
* For example,
|
||||
* @{ PNObjectConfigDevelopment : @"https://development.it/api/v1",
|
||||
* PNObjectConfigEnvStage : @"ttps://stage.it/api/v1",
|
||||
* PNObjectConfigEnvProduction : @"ttps://production.it/api/v1"
|
||||
* PNObjectConfigEnvStage : @"https://stage.it/api/v1",
|
||||
* PNObjectConfigEnvProduction : @"https://production.it/api/v1"
|
||||
* }
|
||||
* @param userSubClass <#userSubClass description#>
|
||||
*
|
||||
@ -96,8 +101,8 @@ typedef NS_ENUM(NSInteger, OAuthMode) {
|
||||
* @param endpointUrlsForEnvironments
|
||||
* For example,
|
||||
* @{ PNObjectConfigDevelopment : @"https://development.it/api/v1",
|
||||
* PNObjectConfigEnvStage : @"ttps://stage.it/api/v1",
|
||||
* PNObjectConfigEnvProduction : @"ttps://production.it/api/v1"
|
||||
* PNObjectConfigEnvStage : @"https://stage.it/api/v1",
|
||||
* PNObjectConfigEnvProduction : @"https://production.it/api/v1"
|
||||
* }
|
||||
* @param oauthMode <#oauthEnabled description#>
|
||||
*
|
||||
@ -111,8 +116,8 @@ typedef NS_ENUM(NSInteger, OAuthMode) {
|
||||
* @param endpointUrlsForEnvironments
|
||||
* For example,
|
||||
* @{ PNObjectConfigDevelopment : @"https://development.it/api/v1",
|
||||
* PNObjectConfigEnvStage : @"ttps://stage.it/api/v1",
|
||||
* PNObjectConfigEnvProduction : @"ttps://production.it/api/v1"
|
||||
* PNObjectConfigEnvStage : @"https://stage.it/api/v1",
|
||||
* PNObjectConfigEnvProduction : @"https://production.it/api/v1"
|
||||
* }
|
||||
* @param userSubClass <#userSubClass description#>
|
||||
* @param oauthMode <#oauthEnabled description#>
|
||||
@ -147,10 +152,11 @@ typedef NS_ENUM(NSInteger, OAuthMode) {
|
||||
|
||||
|
||||
|
||||
- (void) setClientID:(NSString * _Nonnull) clientID clientSecret:(NSString* _Nonnull) clientSecret forEnv:(NSString * _Nonnull) environment;
|
||||
- (void) setClientID:(NSString * _Nonnull) clientID clientSecret:(NSString* _Nonnull) clientSecret oAuthEndpointAction:(NSString* _Nonnull) oAuthEndpointAction forEnv:(NSString * _Nonnull) environment;
|
||||
|
||||
- (void) setOauthClientID:(NSString * _Nonnull) oauthClientID oauthClientSecret:(NSString* _Nonnull) oauthClientSecret oAuthEndpointAction:(NSString* _Nonnull) oAuthEndpointAction forEnv:(NSString *) environment;
|
||||
|
||||
- (void) setOauthUserName:(NSString * _Nonnull)oauthUserName oauthPassword:(NSString* _Nonnull) oauthPassword forEnv:(NSString * _Nonnull) environment;
|
||||
- (void) setOauthUserName:(NSString * _Nonnull)oauthUserName oauthPassword:(NSString* _Nonnull) oauthPassword oAuthEndpointAction:(NSString* _Nonnull) oAuthEndpointAction forEnv:(NSString * _Nonnull) environment;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
@ -240,6 +246,8 @@ typedef NS_ENUM(NSInteger, OAuthMode) {
|
||||
#pragma mark - PNObjectConfig Properties
|
||||
///--------------------------------------
|
||||
|
||||
@property (nonatomic, readonly) OAuthMode oauthMode;
|
||||
|
||||
@property (nonatomic, readonly, nonnull) Class userSubClass;
|
||||
/**
|
||||
* <#Description#>
|
||||
@ -259,7 +267,12 @@ typedef NS_ENUM(NSInteger, OAuthMode) {
|
||||
/**
|
||||
* <#Description#>
|
||||
*/
|
||||
@property (nonatomic, strong, nullable, readonly) AFOAuthCredential *currentOauthCredential;
|
||||
@property (nonatomic, strong, nullable, readonly) AFOAuthCredential *currentOauthClientCredential;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@property (nonatomic, strong, nullable, readonly) AFOAuthCredential *currentOauthUserCredential;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
|
||||
@ -47,29 +47,43 @@ NSString* const EnvironmentDevelopment = @"PNObjectConfigDevelopment";
|
||||
|
||||
NSString* const BaseUrl = @"base_url";
|
||||
NSString* const EndpointPath = @"endpoint_path";
|
||||
NSString* const OAuthEndpointPath = @"oauth_endpoint_path";
|
||||
NSString* const OAuthEndpointAction = @"oauth_endpoint_action";
|
||||
|
||||
NSString* const Client_ID = @"client_id";
|
||||
NSString* const Client_Secret = @"client_secret";
|
||||
|
||||
NSString* const OAuthClient_ID = @"client_id";
|
||||
NSString* const OAuthClient_Secret = @"client_secret";
|
||||
|
||||
|
||||
NSString* const Client_Username = @"client_username";
|
||||
NSString* const Client_Password = @"client_password";
|
||||
|
||||
@interface PNObjectConfig()
|
||||
|
||||
@property (nonatomic) OAuthMode oauthMode;
|
||||
|
||||
@property (nonatomic, strong) NSMutableDictionary *configuration;
|
||||
@property (nonatomic, strong) NSMutableDictionary *headerFields;
|
||||
@property (nonatomic, strong) NSString *currentEnv;
|
||||
@property (nonatomic, strong) NSString *currentBaseUrl;
|
||||
|
||||
@property (nonatomic, strong) NSString *currentEndPointPath;
|
||||
@property (nonatomic, strong) NSString *currentEndPointUrl;
|
||||
@property (nonatomic, strong) NSString *currentOAuthClientID;
|
||||
@property (nonatomic, strong) NSString *currentOAuthClientSecret;
|
||||
|
||||
|
||||
@property (nonatomic, strong) NSString *currentOauthEndPointPath;
|
||||
@property (nonatomic, strong) NSString *currentOauthEndPointUrl;
|
||||
@property (nonatomic, strong) NSString *currentOauthEndPointAction;
|
||||
@property (nonatomic, strong) NSString *currentClientID;
|
||||
@property (nonatomic, strong) NSString *currentClientSecret;
|
||||
|
||||
@property (nonatomic, strong) NSString *currentOAuthUserName;
|
||||
@property (nonatomic, strong) NSString *currentOAuthPassword;
|
||||
|
||||
@property (nonatomic, strong) AFOAuth2Manager *authManager;
|
||||
|
||||
|
||||
@property (nonatomic, strong) AFOAuth2Manager *clientCredentialAuthManager;
|
||||
@property (nonatomic, strong) AFOAuth2Manager *userCredentialAuthManager;
|
||||
|
||||
@end
|
||||
|
||||
@ -201,13 +215,13 @@ static bool isFirstAccess = YES;
|
||||
AFOAuthCredential *clientCredential = [AFOAuthCredential retrieveCredentialWithIdentifier:PNObjectServiceClientCredentialIdentifier];
|
||||
|
||||
if (clientCredential) {
|
||||
_currentOauthCredential = clientCredential;
|
||||
_currentOauthClientCredential = clientCredential;
|
||||
}
|
||||
|
||||
AFOAuthCredential *userCredential = [AFOAuthCredential retrieveCredentialWithIdentifier:PNObjectServiceUserCredentialIdentifier];
|
||||
|
||||
if (userCredential) {
|
||||
_currentOauthCredential = userCredential;
|
||||
_currentOauthUserCredential = userCredential;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -220,22 +234,58 @@ static bool isFirstAccess = YES;
|
||||
|
||||
_currentEnv = environment;
|
||||
_currentBaseUrl = nil;
|
||||
_currentEndPointPath = nil;
|
||||
_currentEndPointUrl = nil;
|
||||
|
||||
|
||||
_currentOauthEndPointPath = nil;
|
||||
_currentOauthEndPointUrl = nil;
|
||||
_currentOAuthClientID = nil;
|
||||
_currentOAuthClientSecret = nil;
|
||||
|
||||
_currentEndPointPath = nil;
|
||||
_currentEndPointUrl = nil;
|
||||
_currentClientID = nil;
|
||||
_currentClientSecret = nil;
|
||||
|
||||
_currentOAuthUserName = nil;
|
||||
_currentOAuthPassword = nil;
|
||||
|
||||
if ([_configuration objectForKey:environment]) {
|
||||
_currentBaseUrl = [[_configuration objectForKey:_currentEnv] objectForKey:BaseUrl];
|
||||
_currentEndPointPath = ([[_configuration objectForKey:_currentEnv] objectForKey:EndpointPath] ? [[_configuration objectForKey:_currentEnv] objectForKey:EndpointPath] : @"");
|
||||
if ([_configuration objectForKey:_currentEnv]) {
|
||||
|
||||
NSDictionary *currentEnvConfig = [_configuration objectForKey:_currentEnv];
|
||||
|
||||
_currentBaseUrl = [currentEnvConfig objectForKey:BaseUrl];
|
||||
|
||||
|
||||
_currentEndPointPath = ([currentEnvConfig objectForKey:EndpointPath] ? [currentEnvConfig objectForKey:EndpointPath] : @"");
|
||||
_currentClientID = [currentEnvConfig objectForKey:Client_ID];
|
||||
_currentClientSecret = [currentEnvConfig objectForKey:Client_Secret];
|
||||
|
||||
_currentEndPointUrl = [_currentBaseUrl stringByAppendingString:_currentEndPointPath];
|
||||
_currentOAuthClientID = [[_configuration objectForKey:_currentEnv] objectForKey:Client_ID];
|
||||
_currentOAuthClientSecret = [[_configuration objectForKey:_currentEnv] objectForKey:Client_Secret];
|
||||
if ([[_configuration objectForKey:_currentEnv] objectForKey:Client_Username] && [[_configuration objectForKey:_currentEnv] objectForKey:Client_Password]) {
|
||||
_currentOAuthUserName = [[_configuration objectForKey:_currentEnv] objectForKey:Client_Username];
|
||||
_currentOAuthPassword = [[_configuration objectForKey:_currentEnv] objectForKey:Client_Password];
|
||||
|
||||
_currentOauthEndPointAction = [currentEnvConfig objectForKey:OAuthEndpointAction];
|
||||
|
||||
if (![currentEnvConfig objectForKey:OAuthClient_ID] || ![currentEnvConfig objectForKey:OAuthClient_Secret]) {
|
||||
_currentOAuthClientID = _currentClientID;
|
||||
_currentOAuthClientSecret = _currentClientSecret;
|
||||
}
|
||||
else {
|
||||
_currentOAuthClientID = [currentEnvConfig objectForKey:OAuthClient_ID];
|
||||
_currentOAuthClientSecret = [currentEnvConfig objectForKey:OAuthClient_Secret];
|
||||
}
|
||||
|
||||
if (![currentEnvConfig objectForKey:OAuthClient_ID] || ![currentEnvConfig objectForKey:OAuthClient_Secret]) {
|
||||
_currentOauthEndPointPath = _currentEndPointPath;
|
||||
_currentOauthEndPointUrl = _currentEndPointUrl;
|
||||
}
|
||||
else {
|
||||
_currentOauthEndPointPath = ([currentEnvConfig objectForKey:OAuthEndpointPath] ? [currentEnvConfig objectForKey:OAuthEndpointPath] : @"");
|
||||
_currentOauthEndPointUrl = [_currentBaseUrl stringByAppendingString:_currentOauthEndPointPath];
|
||||
}
|
||||
|
||||
|
||||
if ([currentEnvConfig objectForKey:Client_Username] && [currentEnvConfig objectForKey:Client_Password]) {
|
||||
_currentOAuthUserName = [currentEnvConfig objectForKey:Client_Username];
|
||||
_currentOAuthPassword = [currentEnvConfig objectForKey:Client_Password];
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,8 +294,8 @@ static bool isFirstAccess = YES;
|
||||
NSAssert(_currentEndPointUrl,@"Selected environment generate error. Please check configuration");
|
||||
|
||||
if (_currentOAuthClientID && _currentOAuthClientSecret) {
|
||||
[self authManager];
|
||||
|
||||
[self clientCredentialAuthManager];
|
||||
[self userCredentialAuthManager];
|
||||
[self manager];
|
||||
}
|
||||
}
|
||||
@ -277,11 +327,17 @@ static bool isFirstAccess = YES;
|
||||
[_jsonSerializer setValue:[_headerFields objectForKey:key] forHTTPHeaderField:key];
|
||||
}
|
||||
|
||||
if (_currentOauthCredential && ![_currentOauthCredential isExpired] && ![[_manager requestSerializer] hasAuthorizationHeaderField]) {
|
||||
if (_currentOauthUserCredential && ![_currentOauthUserCredential isExpired] && ![[_manager requestSerializer] hasAuthorizationHeaderField]) {
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
}
|
||||
else if (_currentOauthClientCredential && ![_currentOauthClientCredential isExpired] && ![[_manager requestSerializer] hasAuthorizationHeaderField]) {
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
}
|
||||
else {
|
||||
[self refreshToken];
|
||||
@ -294,41 +350,50 @@ static bool isFirstAccess = YES;
|
||||
return _manager;
|
||||
}
|
||||
|
||||
- (AFOAuth2Manager *) authManager {
|
||||
- (BOOL) setCredentialIfPossible {
|
||||
|
||||
BOOL response = NO;
|
||||
|
||||
if (_currentOauthUserCredential && ![_currentOauthUserCredential isExpired] && ![[_manager requestSerializer] hasAuthorizationHeaderField]) {
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
response = YES;
|
||||
}
|
||||
else if (_currentOauthClientCredential && ![_currentOauthClientCredential isExpired] && ![[_manager requestSerializer] hasAuthorizationHeaderField]) {
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
response = YES;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
- (AFOAuth2Manager *) clientCredentialAuthManager {
|
||||
|
||||
BOOL canTryRefreh = NO;
|
||||
|
||||
if (!_authManager) {
|
||||
_authManager = [AFOAuth2Manager manager];
|
||||
if (!_clientCredentialAuthManager) {
|
||||
_clientCredentialAuthManager = [AFOAuth2Manager manager];
|
||||
|
||||
switch (_oauthMode) {
|
||||
case OAuthModeClientCredential:{
|
||||
if (_currentOAuthClientID && _currentOAuthClientSecret) {
|
||||
|
||||
|
||||
if (![_authManager clientID]) {
|
||||
_authManager = [AFOAuth2Manager managerWithBaseURL:[NSURL URLWithString:_currentEndPointUrl] clientID:_currentOAuthClientID secret:_currentOAuthClientSecret];
|
||||
if (![_clientCredentialAuthManager clientID]) {
|
||||
_clientCredentialAuthManager = [AFOAuth2Manager managerWithBaseURL:[NSURL URLWithString:_currentOauthEndPointUrl] clientID:_currentOAuthClientID secret:_currentOAuthClientSecret];
|
||||
}
|
||||
|
||||
[_authManager setUseHTTPBasicAuthentication:NO];
|
||||
|
||||
canTryRefreh = YES;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OAuthModePassword:{
|
||||
if (_currentOAuthClientID && _currentOAuthClientSecret && _currentOAuthUserName && _currentOAuthPassword) {
|
||||
|
||||
if (![_authManager clientID]) {
|
||||
_authManager = [AFOAuth2Manager managerWithBaseURL:[NSURL URLWithString:_currentEndPointUrl] clientID:_currentOAuthClientID secret:_currentOAuthClientSecret];
|
||||
}
|
||||
|
||||
[_authManager setUseHTTPBasicAuthentication:NO];
|
||||
[_clientCredentialAuthManager setUseHTTPBasicAuthentication:NO];
|
||||
|
||||
canTryRefreh = YES;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OAuthModePassword:
|
||||
case OAuthModeNo:
|
||||
default:{
|
||||
|
||||
@ -345,26 +410,86 @@ static bool isFirstAccess = YES;
|
||||
|
||||
if (canTryRefreh) {
|
||||
|
||||
if (_currentOauthCredential && ![_currentOauthCredential isExpired] && ![[_manager requestSerializer] hasAuthorizationHeaderField]) {
|
||||
if (_currentOauthClientCredential && ![_currentOauthClientCredential isExpired] && ![[_manager requestSerializer] hasAuthorizationHeaderField]) {
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_authManager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthClientCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthClientCredential];
|
||||
[_clientCredentialAuthManager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthClientCredential];
|
||||
}
|
||||
else {
|
||||
[self refreshToken];
|
||||
}
|
||||
}
|
||||
|
||||
_authManager.responseSerializer = [AFJSONResponseSerializerWithData serializer];
|
||||
_clientCredentialAuthManager.responseSerializer = [AFJSONResponseSerializerWithData serializer];
|
||||
}
|
||||
|
||||
return _authManager;
|
||||
return _clientCredentialAuthManager;
|
||||
}
|
||||
|
||||
- (AFOAuth2Manager *) userCredentialAuthManager {
|
||||
|
||||
BOOL canTryRefreh = NO;
|
||||
|
||||
if (!_userCredentialAuthManager) {
|
||||
_userCredentialAuthManager = [AFOAuth2Manager manager];
|
||||
|
||||
switch (_oauthMode) {
|
||||
|
||||
case OAuthModePassword:{
|
||||
if (_currentClientID && _currentClientID && _currentOAuthUserName && _currentOAuthPassword) {
|
||||
|
||||
if (![_userCredentialAuthManager clientID]) {
|
||||
_userCredentialAuthManager = [AFOAuth2Manager managerWithBaseURL:[NSURL URLWithString:_currentOauthEndPointUrl] clientID:_currentClientID secret:_currentClientID];
|
||||
}
|
||||
|
||||
[_userCredentialAuthManager setUseHTTPBasicAuthentication:NO];
|
||||
|
||||
canTryRefreh = YES;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OAuthModeClientCredential:
|
||||
case OAuthModeNo:
|
||||
default:{
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (NSString *key in [_headerFields allKeys]) {
|
||||
|
||||
[_httpSerializer setValue:[_headerFields objectForKey:key] forHTTPHeaderField:key];
|
||||
[_jsonSerializer setValue:[_headerFields objectForKey:key] forHTTPHeaderField:key];
|
||||
}
|
||||
|
||||
if (canTryRefreh) {
|
||||
|
||||
if (_currentOauthUserCredential && ![_currentOauthUserCredential isExpired] && ![[_manager requestSerializer] hasAuthorizationHeaderField]) {
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
[_userCredentialAuthManager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthUserCredential];
|
||||
}
|
||||
else {
|
||||
[self refreshToken];
|
||||
}
|
||||
}
|
||||
|
||||
_userCredentialAuthManager.responseSerializer = [AFJSONResponseSerializerWithData serializer];
|
||||
}
|
||||
|
||||
return _userCredentialAuthManager;
|
||||
}
|
||||
|
||||
- (BOOL) resetToken {
|
||||
if (_currentOauthCredential) {
|
||||
_currentOauthCredential = nil;
|
||||
if (_currentOauthClientCredential) {
|
||||
_currentOauthClientCredential = nil;
|
||||
[AFOAuthCredential deleteCredentialWithIdentifier:PNObjectServiceClientCredentialIdentifier];
|
||||
return [AFOAuthCredential deleteCredentialWithIdentifier:PNObjectServiceUserCredentialIdentifier];
|
||||
}
|
||||
if (_currentOauthUserCredential) {
|
||||
_currentOauthUserCredential = nil;
|
||||
[AFOAuthCredential deleteCredentialWithIdentifier:PNObjectServiceClientCredentialIdentifier];
|
||||
return [AFOAuthCredential deleteCredentialWithIdentifier:PNObjectServiceUserCredentialIdentifier];
|
||||
}
|
||||
@ -394,18 +519,25 @@ static bool isFirstAccess = YES;
|
||||
|
||||
- (void) refreshTokenForUserWithBlockSuccess:(nullable void (^)(BOOL refreshSuccess))success
|
||||
failure:(nullable void (^)(NSError * _Nonnull error))failure {
|
||||
if (_currentOauthCredential) {
|
||||
|
||||
__block __typeof__(_currentOauthUserCredential) __weak wCurrentOauthCredential = _currentOauthUserCredential;
|
||||
|
||||
__block __typeof__(_httpSerializer) __weak wHttpSerializer = _httpSerializer;
|
||||
__block __typeof__(_jsonSerializer) __weak wJsonSerializer = _jsonSerializer;
|
||||
__block __typeof__(_manager) __weak wManager = _manager;
|
||||
__block __typeof__(_userCredentialAuthManager) __weak wUserCredentialAuthManager = _userCredentialAuthManager;
|
||||
|
||||
if (_currentOauthUserCredential) {
|
||||
|
||||
[_authManager authenticateUsingOAuthWithURLString:[_currentEndPointUrl stringByAppendingString:@"oauth-token"] refreshToken:[_currentOauthCredential refreshToken] success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
_currentOauthCredential = credential;
|
||||
[_clientCredentialAuthManager authenticateUsingOAuthWithURLString:[_currentOauthEndPointUrl stringByAppendingString:_currentOauthEndPointAction] refreshToken:[_currentOauthUserCredential refreshToken] success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
wCurrentOauthCredential = credential;
|
||||
|
||||
[AFOAuthCredential storeCredential:wCurrentOauthCredential withIdentifier:PNObjectServiceUserCredentialIdentifier];
|
||||
|
||||
[AFOAuthCredential storeCredential:_currentOauthCredential withIdentifier:PNObjectServiceUserCredentialIdentifier];
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_authManager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[wHttpSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wJsonSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wUserCredentialAuthManager.requestSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wManager.requestSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationRefreshTokenUserSuccess object:nil];
|
||||
if (success) {
|
||||
@ -469,16 +601,25 @@ static bool isFirstAccess = YES;
|
||||
return;
|
||||
}
|
||||
}
|
||||
[_authManager authenticateUsingOAuthWithURLString:[_currentEndPointUrl stringByAppendingString:@"oauth-token"] username:email password:password scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
_currentOauthCredential = credential;
|
||||
|
||||
__block __typeof__(_currentOauthUserCredential) __weak wCurrentOauthCredential = _currentOauthUserCredential;
|
||||
|
||||
__block __typeof__(_httpSerializer) __weak wHttpSerializer = _httpSerializer;
|
||||
__block __typeof__(_jsonSerializer) __weak wJsonSerializer = _jsonSerializer;
|
||||
__block __typeof__(_manager) __weak wManager = _manager;
|
||||
__block __typeof__(_userCredentialAuthManager) __weak wUserCredentialAuthManager = _userCredentialAuthManager;
|
||||
|
||||
|
||||
[_userCredentialAuthManager authenticateUsingOAuthWithURLString:[_currentOauthEndPointUrl stringByAppendingString:_currentOauthEndPointAction] username:email password:password scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
wCurrentOauthCredential = credential;
|
||||
|
||||
[AFOAuthCredential storeCredential:wCurrentOauthCredential withIdentifier:PNObjectServiceUserCredentialIdentifier];
|
||||
|
||||
[AFOAuthCredential storeCredential:_currentOauthCredential withIdentifier:PNObjectServiceUserCredentialIdentifier];
|
||||
[wHttpSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wJsonSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wUserCredentialAuthManager.requestSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wManager.requestSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_authManager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationRefreshTokenUserSuccess object:nil];
|
||||
if (success) {
|
||||
@ -512,15 +653,22 @@ static bool isFirstAccess = YES;
|
||||
}
|
||||
}
|
||||
|
||||
[_authManager authenticateUsingFacebookOAuthWithURLString:[_currentEndPointUrl stringByAppendingString:@"oauth-token"] facebookId:facebookId facebookToken:facebookToken scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
_currentOauthCredential = credential;
|
||||
__block __typeof__(_currentOauthUserCredential) __weak wCurrentOauthCredential = _currentOauthUserCredential;
|
||||
|
||||
__block __typeof__(_httpSerializer) __weak wHttpSerializer = _httpSerializer;
|
||||
__block __typeof__(_jsonSerializer) __weak wJsonSerializer = _jsonSerializer;
|
||||
__block __typeof__(_manager) __weak wManager = _manager;
|
||||
__block __typeof__(_userCredentialAuthManager) __weak wUserCredentialAuthManager = _userCredentialAuthManager;
|
||||
|
||||
[_userCredentialAuthManager authenticateUsingFacebookOAuthWithURLString:[_currentOauthEndPointUrl stringByAppendingString:_currentOauthEndPointAction] facebookId:facebookId facebookToken:facebookToken scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
wCurrentOauthCredential = credential;
|
||||
|
||||
[AFOAuthCredential storeCredential:_currentOauthCredential withIdentifier:PNObjectServiceUserCredentialIdentifier];
|
||||
[AFOAuthCredential storeCredential:wCurrentOauthCredential withIdentifier:PNObjectServiceUserCredentialIdentifier];
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_authManager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[wHttpSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wJsonSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wUserCredentialAuthManager.requestSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wManager.requestSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationRefreshTokenUserSuccess object:nil];
|
||||
if (success) {
|
||||
@ -543,17 +691,25 @@ static bool isFirstAccess = YES;
|
||||
- (void) refreshTokenForClientCredentialWithBlockSuccess:(nullable void (^)(BOOL refreshSuccess))success
|
||||
failure:(nullable void (^)(NSError * _Nonnull error))failure {
|
||||
|
||||
if (_currentOauthCredential) {
|
||||
__block __typeof__(_currentOauthClientCredential) __weak wCurrentOauthCredential = _currentOauthClientCredential;
|
||||
|
||||
__block __typeof__(_httpSerializer) __weak wHttpSerializer = _httpSerializer;
|
||||
__block __typeof__(_jsonSerializer) __weak wJsonSerializer = _jsonSerializer;
|
||||
__block __typeof__(_clientCredentialAuthManager) __weak wAuthManager = _clientCredentialAuthManager;
|
||||
__block __typeof__(_manager) __weak wManager = _manager;
|
||||
|
||||
|
||||
if (_currentOauthClientCredential) {
|
||||
|
||||
[_authManager authenticateUsingOAuthWithURLString:[_currentEndPointUrl stringByAppendingString:@"oauth-token"] refreshToken:[_currentOauthCredential refreshToken] success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
_currentOauthCredential = credential;
|
||||
[_clientCredentialAuthManager authenticateUsingOAuthWithURLString:[_currentOauthEndPointUrl stringByAppendingString:_currentOauthEndPointAction] refreshToken:[_currentOauthClientCredential refreshToken] success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
wCurrentOauthCredential = credential;
|
||||
|
||||
[AFOAuthCredential storeCredential:_currentOauthCredential withIdentifier:PNObjectServiceClientCredentialIdentifier];
|
||||
[AFOAuthCredential storeCredential:wCurrentOauthCredential withIdentifier:PNObjectServiceUserCredentialIdentifier];
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_authManager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[wHttpSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wJsonSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wAuthManager.requestSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wManager.requestSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationRefreshTokenClientCredentialSuccess object:nil];
|
||||
if (success) {
|
||||
@ -571,40 +727,15 @@ static bool isFirstAccess = YES;
|
||||
else {
|
||||
switch (_oauthMode) {
|
||||
case OAuthModeClientCredential:{
|
||||
[_authManager authenticateUsingOAuthWithURLString:[_currentEndPointUrl stringByAppendingString:@"oauth-token"] scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
_currentOauthCredential = credential;
|
||||
[_clientCredentialAuthManager authenticateUsingOAuthWithURLString:[_currentOauthEndPointUrl stringByAppendingString:_currentOauthEndPointAction] scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
wCurrentOauthCredential = credential;
|
||||
|
||||
[AFOAuthCredential storeCredential:_currentOauthCredential withIdentifier:PNObjectServiceClientCredentialIdentifier];
|
||||
[AFOAuthCredential storeCredential:wCurrentOauthCredential withIdentifier:PNObjectServiceUserCredentialIdentifier];
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_authManager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationRefreshTokenClientCredentialSuccess object:nil];
|
||||
if (success) {
|
||||
success(YES);
|
||||
}
|
||||
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationRefreshTokenClientCredentialFail object:nil];
|
||||
if (failure) {
|
||||
failure(error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
break;
|
||||
case OAuthModePassword:{
|
||||
|
||||
[_authManager authenticateUsingOAuthWithURLString:[_currentEndPointUrl stringByAppendingString:@"oauth-token"] username:_currentOAuthUserName password:_currentOAuthPassword scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
_currentOauthCredential = credential;
|
||||
|
||||
[AFOAuthCredential storeCredential:_currentOauthCredential withIdentifier:PNObjectServiceClientCredentialIdentifier];
|
||||
|
||||
[_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_authManager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
[wHttpSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wJsonSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wAuthManager.requestSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
[wManager.requestSerializer setAuthorizationHeaderFieldWithCredential:wCurrentOauthCredential];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationRefreshTokenClientCredentialSuccess object:nil];
|
||||
if (success) {
|
||||
@ -619,6 +750,7 @@ static bool isFirstAccess = YES;
|
||||
}];
|
||||
}
|
||||
break;
|
||||
case OAuthModePassword:
|
||||
case OAuthModeNo:
|
||||
default:
|
||||
|
||||
@ -642,13 +774,14 @@ static bool isFirstAccess = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setClientID:(NSString * _Nonnull) clientID clientSecret:(NSString* _Nonnull) clientSecret forEnv:(NSString *) environment {
|
||||
- (void) setClientID:(NSString * _Nonnull) clientID clientSecret:(NSString* _Nonnull) clientSecret oAuthEndpointAction:(NSString* _Nonnull) oAuthEndpointAction forEnv:(NSString *) environment {
|
||||
|
||||
if ([_configuration objectForKey:environment]) {
|
||||
|
||||
NSMutableDictionary *currentConfigurationDict = [[NSMutableDictionary alloc] initWithDictionary:[_configuration objectForKey:environment]];
|
||||
[currentConfigurationDict setObject:clientID forKey:Client_ID];
|
||||
[currentConfigurationDict setObject:clientSecret forKey:Client_Secret];
|
||||
[currentConfigurationDict setObject:oAuthEndpointAction forKey:OAuthEndpointAction];
|
||||
|
||||
[_configuration setObject:currentConfigurationDict forKey:environment];
|
||||
|
||||
@ -658,13 +791,31 @@ static bool isFirstAccess = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setOauthUserName:(NSString * _Nonnull)oauthUserName oauthPassword:(NSString* _Nonnull) oauthPassword forEnv:(NSString *) environment {
|
||||
- (void) setOauthClientID:(NSString * _Nonnull) oauthClientID oauthClientSecret:(NSString* _Nonnull) oauthClientSecret oAuthEndpointAction:(NSString* _Nonnull) oAuthEndpointAction forEnv:(NSString *) environment {
|
||||
|
||||
if ([_configuration objectForKey:environment]) {
|
||||
|
||||
NSMutableDictionary *currentConfigurationDict = [[NSMutableDictionary alloc] initWithDictionary:[_configuration objectForKey:environment]];
|
||||
[currentConfigurationDict setObject:oauthClientID forKey:OAuthClient_ID];
|
||||
[currentConfigurationDict setObject:oauthClientSecret forKey:OAuthClient_Secret];
|
||||
[currentConfigurationDict setObject:oAuthEndpointAction forKey:OAuthEndpointAction];
|
||||
|
||||
[_configuration setObject:currentConfigurationDict forKey:environment];
|
||||
|
||||
if (_currentEnv == environment) {
|
||||
[self setEnvironment:environment];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setOauthUserName:(NSString * _Nonnull)oauthUserName oauthPassword:(NSString* _Nonnull) oauthPassword oAuthEndpointAction:(NSString* _Nonnull) oAuthEndpointAction forEnv:(NSString *) environment {
|
||||
|
||||
if ([_configuration objectForKey:environment]) {
|
||||
|
||||
NSMutableDictionary *currentConfigurationDict = [[NSMutableDictionary alloc] initWithDictionary:[_configuration objectForKey:environment]];
|
||||
[currentConfigurationDict setObject:oauthUserName forKey:Client_Username];
|
||||
[currentConfigurationDict setObject:oauthPassword forKey:Client_Password];
|
||||
[currentConfigurationDict setObject:oAuthEndpointAction forKey:OAuthEndpointAction];
|
||||
|
||||
[_configuration setObject:currentConfigurationDict forKey:environment];
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user