diff --git a/plugin.xml b/plugin.xml
index 776ce44d..b5914ad5 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -36,25 +36,25 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/ios/BinaryRequestSerializer.h b/src/ios/BinaryRequestSerializer.h
index b9930a8b..066eb824 100644
--- a/src/ios/BinaryRequestSerializer.h
+++ b/src/ios/BinaryRequestSerializer.h
@@ -1,5 +1,5 @@
#import
-#import "AFURLRequestSerialization.h"
+#import "SM_AFURLRequestSerialization.h"
@interface BinaryRequestSerializer : AFHTTPRequestSerializer
diff --git a/src/ios/BinaryRequestSerializer.m b/src/ios/BinaryRequestSerializer.m
index ada4df8b..823c93ea 100644
--- a/src/ios/BinaryRequestSerializer.m
+++ b/src/ios/BinaryRequestSerializer.m
@@ -8,7 +8,7 @@ + (instancetype)serializer
return serializer;
}
-#pragma mark - AFURLRequestSerialization
+#pragma mark - SM_AFURLRequestSerialization
- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
withParameters:(id)parameters
diff --git a/src/ios/BinaryResponseSerializer.h b/src/ios/BinaryResponseSerializer.h
index 92af2662..35d79714 100644
--- a/src/ios/BinaryResponseSerializer.h
+++ b/src/ios/BinaryResponseSerializer.h
@@ -1,5 +1,5 @@
#import
-#import "AFURLResponseSerialization.h"
+#import "SM_AFURLResponseSerialization.h"
@interface BinaryResponseSerializer : AFHTTPResponseSerializer
diff --git a/src/ios/BinaryResponseSerializer.m b/src/ios/BinaryResponseSerializer.m
index a891f8fd..45bbcc8f 100644
--- a/src/ios/BinaryResponseSerializer.m
+++ b/src/ios/BinaryResponseSerializer.m
@@ -85,20 +85,20 @@ - (BOOL)validateResponse:(NSHTTPURLResponse *)response
if (response && [response isKindOfClass:[NSHTTPURLResponse class]]) {
if (self.acceptableStatusCodes && ![self.acceptableStatusCodes containsIndex:(NSUInteger)response.statusCode] && [response URL]) {
NSMutableDictionary *mutableUserInfo = [@{
- NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%ld)", @"AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode],
+ NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%ld)", @"SM_AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode],
NSURLErrorFailingURLErrorKey: [response URL],
- AFNetworkingOperationFailingURLResponseErrorKey: response,
+ SM_AFNetworkingOperationFailingURLResponseErrorKey: response,
} mutableCopy];
if (data) {
- mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
+ mutableUserInfo[SM_AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
// trying to decode error message in body
- mutableUserInfo[AFNetworkingOperationFailingURLResponseBodyErrorKey] = [self decodeResponseData:data withEncoding:[self getEncoding:response]];
+ mutableUserInfo[SM_AFNetworkingOperationFailingURLResponseBodyErrorKey] = [self decodeResponseData:data withEncoding:[self getEncoding:response]];
}
if (error) {
- *error = [NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo];
+ *error = [NSError errorWithDomain:SM_AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo];
}
return NO;
@@ -108,14 +108,14 @@ - (BOOL)validateResponse:(NSHTTPURLResponse *)response
return YES;
}
-#pragma mark - AFURLResponseSerialization
+#pragma mark - SM_AFURLResponseSerialization
- (id)responseObjectForResponse:(NSURLResponse *)response
data:(NSData *)data
error:(NSError *__autoreleasing *)error
{
if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+ if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, SM_AFURLResponseSerializationErrorDomain)) {
return nil;
}
}
diff --git a/src/ios/CordovaHttpPlugin.m b/src/ios/CordovaHttpPlugin.m
index 240a7a7f..5d265675 100644
--- a/src/ios/CordovaHttpPlugin.m
+++ b/src/ios/CordovaHttpPlugin.m
@@ -4,31 +4,31 @@
#import "BinaryResponseSerializer.h"
#import "TextResponseSerializer.h"
#import "TextRequestSerializer.h"
-#import "AFHTTPSessionManager.h"
+#import "SM_AFHTTPSessionManager.h"
#import "SDNetworkActivityIndicator.h"
@interface CordovaHttpPlugin()
- (void)addRequest:(NSNumber*)reqId forTask:(NSURLSessionDataTask*)task;
- (void)removeRequest:(NSNumber*)reqId;
-- (void)setRequestHeaders:(NSDictionary*)headers forManager:(AFHTTPSessionManager*)manager;
+- (void)setRequestHeaders:(NSDictionary*)headers forManager:(SM_AFHTTPSessionManager*)manager;
- (void)handleSuccess:(NSMutableDictionary*)dictionary withResponse:(NSHTTPURLResponse*)response andData:(id)data;
- (void)handleError:(NSMutableDictionary*)dictionary withResponse:(NSHTTPURLResponse*)response error:(NSError*)error;
- (NSNumber*)getStatusCode:(NSError*) error;
- (NSMutableDictionary*)copyHeaderFields:(NSDictionary*)headerFields;
-- (void)setTimeout:(NSTimeInterval)timeout forManager:(AFHTTPSessionManager*)manager;
-- (void)setRedirect:(bool)redirect forManager:(AFHTTPSessionManager*)manager;
+- (void)setTimeout:(NSTimeInterval)timeout forManager:(SM_AFHTTPSessionManager*)manager;
+- (void)setRedirect:(bool)redirect forManager:(SM_AFHTTPSessionManager*)manager;
@end
@implementation CordovaHttpPlugin {
- AFSecurityPolicy *securityPolicy;
+ SM_AFSecurityPolicy *securityPolicy;
NSURLCredential *x509Credential;
NSMutableDictionary *reqDict;
}
- (void)pluginInitialize {
- securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
+ securityPolicy = [SM_AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
reqDict = [NSMutableDictionary dictionary];
}
@@ -40,7 +40,7 @@ - (void)removeRequest:(NSNumber*)reqId {
[reqDict removeObjectForKey:reqId];
}
-- (void)setRequestSerializer:(NSString*)serializerName forManager:(AFHTTPSessionManager*)manager {
+- (void)setRequestSerializer:(NSString*)serializerName forManager:(SM_AFHTTPSessionManager*)manager {
if ([serializerName isEqualToString:@"json"]) {
manager.requestSerializer = [AFJSONRequestSerializer serializer];
} else if ([serializerName isEqualToString:@"utf8"]) {
@@ -52,7 +52,7 @@ - (void)setRequestSerializer:(NSString*)serializerName forManager:(AFHTTPSession
}
}
-- (void)setupAuthChallengeBlock:(AFHTTPSessionManager*)manager {
+- (void)setupAuthChallengeBlock:(SM_AFHTTPSessionManager*)manager {
[manager setSessionDidReceiveAuthenticationChallengeBlock:^NSURLSessionAuthChallengeDisposition(
NSURLSession * _Nonnull session,
NSURLAuthenticationChallenge * _Nonnull challenge,
@@ -79,13 +79,13 @@ - (void)setupAuthChallengeBlock:(AFHTTPSessionManager*)manager {
}];
}
-- (void)setRequestHeaders:(NSDictionary*)headers forManager:(AFHTTPSessionManager*)manager {
+- (void)setRequestHeaders:(NSDictionary*)headers forManager:(SM_AFHTTPSessionManager*)manager {
[headers enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
[manager.requestSerializer setValue:obj forHTTPHeaderField:key];
}];
}
-- (void)setRedirect:(bool)followRedirect forManager:(AFHTTPSessionManager*)manager {
+- (void)setRedirect:(bool)followRedirect forManager:(SM_AFHTTPSessionManager*)manager {
[manager setTaskWillPerformHTTPRedirectionBlock:^NSURLRequest * _Nonnull(NSURLSession * _Nonnull session,
NSURLSessionTask * _Nonnull task, NSURLResponse * _Nonnull response, NSURLRequest * _Nonnull request) {
@@ -97,11 +97,11 @@ - (void)setRedirect:(bool)followRedirect forManager:(AFHTTPSessionManager*)manag
}];
}
-- (void)setTimeout:(NSTimeInterval)timeout forManager:(AFHTTPSessionManager*)manager {
+- (void)setTimeout:(NSTimeInterval)timeout forManager:(SM_AFHTTPSessionManager*)manager {
[manager.requestSerializer setTimeoutInterval:timeout];
}
-- (void)setResponseSerializer:(NSString*)responseType forManager:(AFHTTPSessionManager*)manager {
+- (void)setResponseSerializer:(NSString*)responseType forManager:(SM_AFHTTPSessionManager*)manager {
if ([responseType isEqualToString: @"text"] || [responseType isEqualToString: @"json"]) {
manager.responseSerializer = [TextResponseSerializer serializer];
} else {
@@ -133,8 +133,8 @@ - (void)handleError:(NSMutableDictionary*)dictionary withResponse:(NSHTTPURLResp
[dictionary setObject:[self copyHeaderFields:response.allHeaderFields] forKey:@"headers"];
if(!aborted){
[dictionary setObject:[NSNumber numberWithInt:(int)response.statusCode] forKey:@"status"];
- if (error.userInfo[AFNetworkingOperationFailingURLResponseBodyErrorKey]) {
- [dictionary setObject:error.userInfo[AFNetworkingOperationFailingURLResponseBodyErrorKey] forKey:@"error"];
+ if (error.userInfo[SM_AFNetworkingOperationFailingURLResponseBodyErrorKey]) {
+ [dictionary setObject:error.userInfo[SM_AFNetworkingOperationFailingURLResponseBodyErrorKey] forKey:@"error"];
}
}
} else if(!aborted) {
@@ -193,7 +193,7 @@ - (NSMutableDictionary*)copyHeaderFields:(NSDictionary *)headerFields {
}
- (void)executeRequestWithoutData:(CDVInvokedUrlCommand*)command withMethod:(NSString*) method {
- AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
+ SM_AFHTTPSessionManager *manager = [SM_AFHTTPSessionManager manager];
NSString *url = [command.arguments objectAtIndex:0];
NSDictionary *headers = [command.arguments objectAtIndex:1];
@@ -253,7 +253,7 @@ - (void)executeRequestWithoutData:(CDVInvokedUrlCommand*)command withMethod:(NSS
}
- (void)executeRequestWithData:(CDVInvokedUrlCommand*)command withMethod:(NSString*)method {
- AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
+ SM_AFHTTPSessionManager *manager = [SM_AFHTTPSessionManager manager];
NSString *url = [command.arguments objectAtIndex:0];
NSDictionary *data = [command.arguments objectAtIndex:1];
@@ -351,15 +351,15 @@ - (void)setServerTrustMode:(CDVInvokedUrlCommand*)command {
NSString *certMode = [command.arguments objectAtIndex:0];
if ([certMode isEqualToString: @"default"] || [certMode isEqualToString: @"legacy"]) {
- securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
+ securityPolicy = [SM_AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
securityPolicy.allowInvalidCertificates = NO;
securityPolicy.validatesDomainName = YES;
} else if ([certMode isEqualToString: @"nocheck"]) {
- securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
+ securityPolicy = [SM_AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
securityPolicy.allowInvalidCertificates = YES;
securityPolicy.validatesDomainName = NO;
} else if ([certMode isEqualToString: @"pinned"]) {
- securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
+ securityPolicy = [SM_AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
securityPolicy.allowInvalidCertificates = NO;
securityPolicy.validatesDomainName = YES;
}
@@ -442,7 +442,7 @@ - (void)options:(CDVInvokedUrlCommand*)command {
}
- (void)uploadFiles:(CDVInvokedUrlCommand*)command {
- AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
+ SM_AFHTTPSessionManager *manager = [SM_AFHTTPSessionManager manager];
NSString *url = [command.arguments objectAtIndex:0];
NSDictionary *headers = [command.arguments objectAtIndex:1];
@@ -510,7 +510,7 @@ - (void)uploadFiles:(CDVInvokedUrlCommand*)command {
}
- (void)downloadFile:(CDVInvokedUrlCommand*)command {
- AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
+ SM_AFHTTPSessionManager *manager = [SM_AFHTTPSessionManager manager];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
NSString *url = [command.arguments objectAtIndex:0];
diff --git a/src/ios/AFNetworking/AFHTTPSessionManager.h b/src/ios/SM_AFNetworking/SM_AFHTTPSessionManager.h
similarity index 95%
rename from src/ios/AFNetworking/AFHTTPSessionManager.h
rename to src/ios/SM_AFNetworking/SM_AFHTTPSessionManager.h
index d7e1de45..0bb47f8c 100644
--- a/src/ios/AFNetworking/AFHTTPSessionManager.h
+++ b/src/ios/SM_AFNetworking/SM_AFHTTPSessionManager.h
@@ -1,4 +1,4 @@
-// AFHTTPSessionManager.h
+// SM_AFHTTPSessionManager.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -31,14 +31,14 @@
#import
#endif
-#import "AFURLSessionManager.h"
+#import "SM_AFURLSessionManager.h"
/**
- `AFHTTPSessionManager` is a subclass of `AFURLSessionManager` with convenience methods for making HTTP requests. When a `baseURL` is provided, requests made with the `GET` / `POST` / et al. convenience methods can be made with relative paths.
+ `SM_AFHTTPSessionManager` is a subclass of `SM_AFURLSessionManager` with convenience methods for making HTTP requests. When a `baseURL` is provided, requests made with the `GET` / `POST` / et al. convenience methods can be made with relative paths.
## Subclassing Notes
- Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application.
+ Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `SM_AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application.
For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `AFHTTPRequestOperationManager` may be used to similar effect.
@@ -48,9 +48,9 @@
## Serialization
- Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to ``.
+ Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to ``.
- Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to ``
+ Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to ``
## URL Construction Using Relative Paths
@@ -73,7 +73,7 @@
NS_ASSUME_NONNULL_BEGIN
-@interface AFHTTPSessionManager : AFURLSessionManager
+@interface SM_AFHTTPSessionManager : SM_AFURLSessionManager
/**
The URL used to construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods.
@@ -85,26 +85,26 @@ NS_ASSUME_NONNULL_BEGIN
@warning `requestSerializer` must not be `nil`.
*/
-@property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer;
+@property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer;
/**
Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`.
@warning `responseSerializer` must not be `nil`.
*/
-@property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer;
+@property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer;
///---------------------
/// @name Initialization
///---------------------
/**
- Creates and returns an `AFHTTPSessionManager` object.
+ Creates and returns an `SM_AFHTTPSessionManager` object.
*/
+ (instancetype)manager;
/**
- Initializes an `AFHTTPSessionManager` object with the specified base URL.
+ Initializes an `SM_AFHTTPSessionManager` object with the specified base URL.
@param url The base URL for the HTTP client.
@@ -113,7 +113,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithBaseURL:(nullable NSURL *)url;
/**
- Initializes an `AFHTTPSessionManager` object with the specified base URL.
+ Initializes an `SM_AFHTTPSessionManager` object with the specified base URL.
This is the designated initializer.
diff --git a/src/ios/AFNetworking/AFHTTPSessionManager.m b/src/ios/SM_AFNetworking/SM_AFHTTPSessionManager.m
similarity index 96%
rename from src/ios/AFNetworking/AFHTTPSessionManager.m
rename to src/ios/SM_AFNetworking/SM_AFHTTPSessionManager.m
index 11467e38..01b72ca0 100644
--- a/src/ios/AFNetworking/AFHTTPSessionManager.m
+++ b/src/ios/SM_AFNetworking/SM_AFHTTPSessionManager.m
@@ -1,4 +1,4 @@
-// AFHTTPSessionManager.m
+// SM_AFHTTPSessionManager.m
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,10 +19,10 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#import "AFHTTPSessionManager.h"
+#import "SM_AFHTTPSessionManager.h"
-#import "AFURLRequestSerialization.h"
-#import "AFURLResponseSerialization.h"
+#import "SM_AFURLRequestSerialization.h"
+#import "SM_AFURLResponseSerialization.h"
#import
#import
@@ -40,11 +40,11 @@
#import
#endif
-@interface AFHTTPSessionManager ()
+@interface SM_AFHTTPSessionManager ()
@property (readwrite, nonatomic, strong) NSURL *baseURL;
@end
-@implementation AFHTTPSessionManager
+@implementation SM_AFHTTPSessionManager
@dynamic responseSerializer;
+ (instancetype)manager {
@@ -86,13 +86,13 @@ - (instancetype)initWithBaseURL:(NSURL *)url
#pragma mark -
-- (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer {
+- (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer {
NSParameterAssert(requestSerializer);
_requestSerializer = requestSerializer;
}
-- (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer {
+- (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer {
NSParameterAssert(responseSerializer);
[super setResponseSerializer:responseSerializer];
@@ -428,7 +428,7 @@ - (instancetype)initWithCoder:(NSCoder *)decoder {
self.requestSerializer = [decoder decodeObjectOfClass:[AFHTTPRequestSerializer class] forKey:NSStringFromSelector(@selector(requestSerializer))];
self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))];
- AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))];
+ SM_AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[SM_AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))];
if (decodedPolicy) {
self.securityPolicy = decodedPolicy;
}
@@ -453,7 +453,7 @@ - (void)encodeWithCoder:(NSCoder *)coder {
#pragma mark - NSCopying
- (instancetype)copyWithZone:(NSZone *)zone {
- AFHTTPSessionManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL sessionConfiguration:self.session.configuration];
+ SM_AFHTTPSessionManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL sessionConfiguration:self.session.configuration];
HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone];
HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone];
diff --git a/src/ios/AFNetworking/AFNetworkReachabilityManager.h b/src/ios/SM_AFNetworking/SM_AFNetworkReachabilityManager.h
similarity index 87%
rename from src/ios/AFNetworking/AFNetworkReachabilityManager.h
rename to src/ios/SM_AFNetworking/SM_AFNetworkReachabilityManager.h
index 0feb18d3..5cb34d4e 100644
--- a/src/ios/AFNetworking/AFNetworkReachabilityManager.h
+++ b/src/ios/SM_AFNetworking/SM_AFNetworkReachabilityManager.h
@@ -1,4 +1,4 @@
-// AFNetworkReachabilityManager.h
+// SM_AFNetworkReachabilityManager.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -34,15 +34,15 @@ typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) {
NS_ASSUME_NONNULL_BEGIN
/**
- `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.
+ `SM_AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.
Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability.
See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ )
- @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined.
+ @warning Instances of `SM_AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined.
*/
-@interface AFNetworkReachabilityManager : NSObject
+@interface SM_AFNetworkReachabilityManager : NSObject
/**
The current network reachability status.
@@ -150,7 +150,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
## Network Reachability
- The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses.
+ The following constants are provided by `SM_AFNetworkReachabilityManager` as possible network reachability statuses.
enum {
AFNetworkReachabilityStatusUnknown,
@@ -175,8 +175,8 @@ NS_ASSUME_NONNULL_BEGIN
Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification.
- `AFNetworkingReachabilityNotificationStatusItem`
- A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification.
+ `SM_AFNetworkingReachabilityNotificationStatusItem`
+ A key in the userInfo dictionary in a `SM_AFNetworkingReachabilityDidChangeNotification` notification.
The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status.
*/
@@ -186,12 +186,12 @@ NS_ASSUME_NONNULL_BEGIN
/**
Posted when network reachability changes.
- This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability.
+ This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `SM_AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability.
@warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import ` to the header prefix of the project (`Prefix.pch`).
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification;
-FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingReachabilityDidChangeNotification;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingReachabilityNotificationStatusItem;
///--------------------
/// @name Functions
diff --git a/src/ios/AFNetworking/AFNetworkReachabilityManager.m b/src/ios/SM_AFNetworking/SM_AFNetworkReachabilityManager.m
similarity index 89%
rename from src/ios/AFNetworking/AFNetworkReachabilityManager.m
rename to src/ios/SM_AFNetworking/SM_AFNetworkReachabilityManager.m
index d4583648..611c1f2d 100644
--- a/src/ios/AFNetworking/AFNetworkReachabilityManager.m
+++ b/src/ios/SM_AFNetworking/SM_AFNetworkReachabilityManager.m
@@ -1,4 +1,4 @@
-// AFNetworkReachabilityManager.m
+// SM_AFNetworkReachabilityManager.m
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,7 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#import "AFNetworkReachabilityManager.h"
+#import "SM_AFNetworkReachabilityManager.h"
#if !TARGET_OS_WATCH
#import
@@ -28,22 +28,22 @@
#import
#import
-NSString * const AFNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change";
-NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworkingReachabilityNotificationStatusItem";
+NSString * const SM_AFNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change";
+NSString * const SM_AFNetworkingReachabilityNotificationStatusItem = @"SM_AFNetworkingReachabilityNotificationStatusItem";
typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status);
NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status) {
switch (status) {
case AFNetworkReachabilityStatusNotReachable:
- return NSLocalizedStringFromTable(@"Not Reachable", @"AFNetworking", nil);
+ return NSLocalizedStringFromTable(@"Not Reachable", @"SM_AFNetworking", nil);
case AFNetworkReachabilityStatusReachableViaWWAN:
- return NSLocalizedStringFromTable(@"Reachable via WWAN", @"AFNetworking", nil);
+ return NSLocalizedStringFromTable(@"Reachable via WWAN", @"SM_AFNetworking", nil);
case AFNetworkReachabilityStatusReachableViaWiFi:
- return NSLocalizedStringFromTable(@"Reachable via WiFi", @"AFNetworking", nil);
+ return NSLocalizedStringFromTable(@"Reachable via WiFi", @"SM_AFNetworking", nil);
case AFNetworkReachabilityStatusUnknown:
default:
- return NSLocalizedStringFromTable(@"Unknown", @"AFNetworking", nil);
+ return NSLocalizedStringFromTable(@"Unknown", @"SM_AFNetworking", nil);
}
}
@@ -85,8 +85,8 @@ static void AFPostReachabilityStatusChange(SCNetworkReachabilityFlags flags, AFN
block(status);
}
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
- NSDictionary *userInfo = @{ AFNetworkingReachabilityNotificationStatusItem: @(status) };
- [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:userInfo];
+ NSDictionary *userInfo = @{ SM_AFNetworkingReachabilityNotificationStatusItem: @(status) };
+ [notificationCenter postNotificationName:SM_AFNetworkingReachabilityDidChangeNotification object:nil userInfo:userInfo];
});
}
@@ -105,16 +105,16 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
}
}
-@interface AFNetworkReachabilityManager ()
+@interface SM_AFNetworkReachabilityManager ()
@property (readonly, nonatomic, assign) SCNetworkReachabilityRef networkReachability;
@property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
@property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock;
@end
-@implementation AFNetworkReachabilityManager
+@implementation SM_AFNetworkReachabilityManager
+ (instancetype)sharedManager {
- static AFNetworkReachabilityManager *_sharedManager = nil;
+ static SM_AFNetworkReachabilityManager *_sharedManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedManager = [self manager];
@@ -126,7 +126,7 @@ + (instancetype)sharedManager {
+ (instancetype)managerForDomain:(NSString *)domain {
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]);
- AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
+ SM_AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
CFRelease(reachability);
@@ -135,7 +135,7 @@ + (instancetype)managerForDomain:(NSString *)domain {
+ (instancetype)managerForAddress:(const void *)address {
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address);
- AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
+ SM_AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
CFRelease(reachability);
diff --git a/src/ios/AFNetworking/AFNetworking.h b/src/ios/SM_AFNetworking/SM_AFNetworking.h
similarity index 79%
rename from src/ios/AFNetworking/AFNetworking.h
rename to src/ios/SM_AFNetworking/SM_AFNetworking.h
index e2fb2f44..a3d2a633 100644
--- a/src/ios/AFNetworking/AFNetworking.h
+++ b/src/ios/SM_AFNetworking/SM_AFNetworking.h
@@ -1,6 +1,6 @@
-// AFNetworking.h
+// SM_AFNetworking.h
//
-// Copyright (c) 2013 AFNetworking (http://afnetworking.com/)
+// Copyright (c) 2013 SM_AFNetworking (http://afnetworking.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -27,15 +27,15 @@
#ifndef _AFNETWORKING_
#define _AFNETWORKING_
- #import "AFURLRequestSerialization.h"
- #import "AFURLResponseSerialization.h"
- #import "AFSecurityPolicy.h"
+ #import "SM_AFURLRequestSerialization.h"
+ #import "SM_AFURLResponseSerialization.h"
+ #import "SM_AFSecurityPolicy.h"
#if !TARGET_OS_WATCH
- #import "AFNetworkReachabilityManager.h"
+ #import "SM_AFNetworkReachabilityManager.h"
#endif
- #import "AFURLSessionManager.h"
- #import "AFHTTPSessionManager.h"
+ #import "SM_AFURLSessionManager.h"
+ #import "SM_AFHTTPSessionManager.h"
#endif /* _AFNETWORKING_ */
diff --git a/src/ios/AFNetworking/AFSecurityPolicy.h b/src/ios/SM_AFNetworking/SM_AFSecurityPolicy.h
similarity index 87%
rename from src/ios/AFNetworking/AFSecurityPolicy.h
rename to src/ios/SM_AFNetworking/SM_AFSecurityPolicy.h
index c005efa8..005ae24d 100644
--- a/src/ios/AFNetworking/AFSecurityPolicy.h
+++ b/src/ios/SM_AFNetworking/SM_AFSecurityPolicy.h
@@ -1,4 +1,4 @@
-// AFSecurityPolicy.h
+// SM_AFSecurityPolicy.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -29,14 +29,14 @@ typedef NS_ENUM(NSUInteger, AFSSLPinningMode) {
};
/**
- `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.
+ `SM_AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.
Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.
*/
NS_ASSUME_NONNULL_BEGIN
-@interface AFSecurityPolicy : NSObject
+@interface SM_AFSecurityPolicy : NSObject
/**
The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`.
@@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
The certificates used to evaluate server trust according to the SSL pinning mode.
- By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`.
+ By default, this property is set to any (`.cer`) certificates included in the target compiling SM_AFNetworking. Note that if you are using SM_AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`.
Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches.
*/
@@ -67,7 +67,7 @@ NS_ASSUME_NONNULL_BEGIN
///-----------------------------------------
/**
- Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`.
+ Returns any certificates included in the bundle. If you are using SM_AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`.
@return The certificates included in the given bundle.
*/
diff --git a/src/ios/AFNetworking/AFSecurityPolicy.m b/src/ios/SM_AFNetworking/SM_AFSecurityPolicy.m
similarity index 97%
rename from src/ios/AFNetworking/AFSecurityPolicy.m
rename to src/ios/SM_AFNetworking/SM_AFSecurityPolicy.m
index 4c04e228..c15efb9d 100644
--- a/src/ios/AFNetworking/AFSecurityPolicy.m
+++ b/src/ios/SM_AFNetworking/SM_AFSecurityPolicy.m
@@ -1,4 +1,4 @@
-// AFSecurityPolicy.m
+// SM_AFSecurityPolicy.m
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,7 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#import "AFSecurityPolicy.h"
+#import "SM_AFSecurityPolicy.h"
#import
@@ -148,12 +148,12 @@ static BOOL AFServerTrustIsValid(SecTrustRef serverTrust) {
#pragma mark -
-@interface AFSecurityPolicy()
+@interface SM_AFSecurityPolicy()
@property (readwrite, nonatomic, assign) AFSSLPinningMode SSLPinningMode;
@property (readwrite, nonatomic, strong) NSSet *pinnedPublicKeys;
@end
-@implementation AFSecurityPolicy
+@implementation SM_AFSecurityPolicy
+ (NSSet *)certificatesInBundle:(NSBundle *)bundle {
NSArray *paths = [bundle pathsForResourcesOfType:@"cer" inDirectory:@"www/certificates"];
@@ -179,7 +179,7 @@ + (NSSet *)defaultPinnedCertificates {
}
+ (instancetype)defaultPolicy {
- AFSecurityPolicy *securityPolicy = [[self alloc] init];
+ SM_AFSecurityPolicy *securityPolicy = [[self alloc] init];
securityPolicy.SSLPinningMode = AFSSLPinningModeNone;
return securityPolicy;
@@ -190,7 +190,7 @@ + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode {
}
+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates {
- AFSecurityPolicy *securityPolicy = [[self alloc] init];
+ SM_AFSecurityPolicy *securityPolicy = [[self alloc] init];
securityPolicy.SSLPinningMode = pinningMode;
[securityPolicy setPinnedCertificates:pinnedCertificates];
@@ -341,7 +341,7 @@ - (void)encodeWithCoder:(NSCoder *)coder {
#pragma mark - NSCopying
- (instancetype)copyWithZone:(NSZone *)zone {
- AFSecurityPolicy *securityPolicy = [[[self class] allocWithZone:zone] init];
+ SM_AFSecurityPolicy *securityPolicy = [[[self class] allocWithZone:zone] init];
securityPolicy.SSLPinningMode = self.SSLPinningMode;
securityPolicy.allowInvalidCertificates = self.allowInvalidCertificates;
securityPolicy.validatesDomainName = self.validatesDomainName;
diff --git a/src/ios/AFNetworking/AFURLRequestSerialization.h b/src/ios/SM_AFNetworking/SM_AFURLRequestSerialization.h
similarity index 93%
rename from src/ios/AFNetworking/AFURLRequestSerialization.h
rename to src/ios/SM_AFNetworking/SM_AFURLRequestSerialization.h
index 694696b9..431d3240 100644
--- a/src/ios/AFNetworking/AFURLRequestSerialization.h
+++ b/src/ios/SM_AFNetworking/SM_AFURLRequestSerialization.h
@@ -1,4 +1,4 @@
-// AFURLRequestSerialization.h
+// SM_AFURLRequestSerialization.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -56,11 +56,11 @@ FOUNDATION_EXPORT NSString * AFPercentEscapedStringFromString(NSString *string);
FOUNDATION_EXPORT NSString * AFQueryStringFromParameters(NSDictionary *parameters);
/**
- The `AFURLRequestSerialization` protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary.
+ The `SM_AFURLRequestSerialization` protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary.
For example, a JSON request serializer may set the HTTP body of the request to a JSON representation, and set the `Content-Type` HTTP header field value to `application/json`.
*/
-@protocol AFURLRequestSerialization
+@protocol SM_AFURLRequestSerialization
/**
Returns a request with the specified parameters encoded into a copy of the original request.
@@ -89,11 +89,11 @@ typedef NS_ENUM(NSUInteger, AFHTTPRequestQueryStringSerializationStyle) {
@protocol AFMultipartFormData;
/**
- `AFHTTPRequestSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.
+ `AFHTTPRequestSerializer` conforms to the `SM_AFURLRequestSerialization` & `SM_AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.
Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPRequestSerializer` in order to ensure consistent default behavior.
*/
-@interface AFHTTPRequestSerializer : NSObject
+@interface AFHTTPRequestSerializer : NSObject
/**
The string encoding used to serialize parameters. `NSUTF8StringEncoding` by default.
@@ -265,7 +265,7 @@ forHTTPHeaderField:(NSString *)field;
@param fileURL The file URL to write multipart form contents to.
@param handler A handler block to execute.
- @discussion There is a bug in `NSURLSessionTask` that causes requests to not send a `Content-Length` header when streaming contents from an HTTP body, which is notably problematic when interacting with the Amazon S3 webservice. As a workaround, this method takes a request constructed with `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error:`, or any other request with an `HTTPBodyStream`, writes the contents to the specified file and returns a copy of the original request with the `HTTPBodyStream` property set to `nil`. From here, the file can either be passed to `AFURLSessionManager -uploadTaskWithRequest:fromFile:progress:completionHandler:`, or have its contents read into an `NSData` that's assigned to the `HTTPBody` property of the request.
+ @discussion There is a bug in `NSURLSessionTask` that causes requests to not send a `Content-Length` header when streaming contents from an HTTP body, which is notably problematic when interacting with the Amazon S3 webservice. As a workaround, this method takes a request constructed with `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error:`, or any other request with an `HTTPBodyStream`, writes the contents to the specified file and returns a copy of the original request with the `HTTPBodyStream` property set to `nil`. From here, the file can either be passed to `SM_AFURLSessionManager -uploadTaskWithRequest:fromFile:progress:completionHandler:`, or have its contents read into an `NSData` that's assigned to the `HTTPBody` property of the request.
@see https://github.com/AFNetworking/AFNetworking/issues/1398
*/
@@ -437,28 +437,28 @@ forHTTPHeaderField:(NSString *)field;
The following error domain is predefined.
- - `NSString * const AFURLRequestSerializationErrorDomain`
+ - `NSString * const SM_AFURLRequestSerializationErrorDomain`
### Constants
- `AFURLRequestSerializationErrorDomain`
- AFURLRequestSerializer errors. Error codes for `AFURLRequestSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.
+ `SM_AFURLRequestSerializationErrorDomain`
+ AFURLRequestSerializer errors. Error codes for `SM_AFURLRequestSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.
*/
-FOUNDATION_EXPORT NSString * const AFURLRequestSerializationErrorDomain;
+FOUNDATION_EXPORT NSString * const SM_AFURLRequestSerializationErrorDomain;
/**
## User info dictionary keys
These keys may exist in the user info dictionary, in addition to those defined for NSError.
- - `NSString * const AFNetworkingOperationFailingURLRequestErrorKey`
+ - `NSString * const SM_AFNetworkingOperationFailingURLRequestErrorKey`
### Constants
- `AFNetworkingOperationFailingURLRequestErrorKey`
- The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `AFURLRequestSerializationErrorDomain`.
+ `SM_AFNetworkingOperationFailingURLRequestErrorKey`
+ The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `SM_AFURLRequestSerializationErrorDomain`.
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLRequestErrorKey;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingOperationFailingURLRequestErrorKey;
/**
## Throttling Bandwidth for HTTP Request Input Streams
diff --git a/src/ios/AFNetworking/AFURLRequestSerialization.m b/src/ios/SM_AFNetworking/SM_AFURLRequestSerialization.m
similarity index 98%
rename from src/ios/AFNetworking/AFURLRequestSerialization.m
rename to src/ios/SM_AFNetworking/SM_AFURLRequestSerialization.m
index a47e2e6e..ec7adf43 100644
--- a/src/ios/AFNetworking/AFURLRequestSerialization.m
+++ b/src/ios/SM_AFNetworking/SM_AFURLRequestSerialization.m
@@ -1,4 +1,4 @@
-// AFURLRequestSerialization.m
+// SM_AFURLRequestSerialization.m
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,7 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#import "AFURLRequestSerialization.h"
+#import "SM_AFURLRequestSerialization.h"
#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
#import
@@ -27,8 +27,8 @@
#import
#endif
-NSString * const AFURLRequestSerializationErrorDomain = @"com.alamofire.error.serialization.request";
-NSString * const AFNetworkingOperationFailingURLRequestErrorKey = @"com.alamofire.serialization.request.error.response";
+NSString * const SM_AFURLRequestSerializationErrorDomain = @"com.alamofire.error.serialization.request";
+NSString * const SM_AFNetworkingOperationFailingURLRequestErrorKey = @"com.alamofire.serialization.request.error.response";
typedef NSString * (^AFQueryStringSerializationBlock)(NSURLRequest *request, id parameters, NSError *__autoreleasing *error);
@@ -455,7 +455,7 @@ - (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request
return mutableRequest;
}
-#pragma mark - AFURLRequestSerialization
+#pragma mark - SM_AFURLRequestSerialization
- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
withParameters:(id)parameters
@@ -686,16 +686,16 @@ - (BOOL)appendPartWithFileURL:(NSURL *)fileURL
NSParameterAssert(mimeType);
if (![fileURL isFileURL]) {
- NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"Expected URL to be a file URL", @"AFNetworking", nil)};
+ NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"Expected URL to be a file URL", @"SM_AFNetworking", nil)};
if (error) {
- *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];
+ *error = [[NSError alloc] initWithDomain:SM_AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];
}
return NO;
} else if ([fileURL checkResourceIsReachableAndReturnError:error] == NO) {
- NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"File URL not reachable.", @"AFNetworking", nil)};
+ NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"File URL not reachable.", @"SM_AFNetworking", nil)};
if (error) {
- *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];
+ *error = [[NSError alloc] initWithDomain:SM_AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];
}
return NO;
@@ -1211,7 +1211,7 @@ + (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOption
return serializer;
}
-#pragma mark - AFURLRequestSerialization
+#pragma mark - SM_AFURLRequestSerialization
- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
withParameters:(id)parameters
diff --git a/src/ios/AFNetworking/AFURLResponseSerialization.h b/src/ios/SM_AFNetworking/SM_AFURLResponseSerialization.h
similarity index 84%
rename from src/ios/AFNetworking/AFURLResponseSerialization.h
rename to src/ios/SM_AFNetworking/SM_AFURLResponseSerialization.h
index 10e0fef3..6ca4d33c 100644
--- a/src/ios/AFNetworking/AFURLResponseSerialization.h
+++ b/src/ios/SM_AFNetworking/SM_AFURLResponseSerialization.h
@@ -1,4 +1,4 @@
-// AFURLResponseSerialization.h
+// SM_AFURLResponseSerialization.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -25,11 +25,11 @@
NS_ASSUME_NONNULL_BEGIN
/**
- The `AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data.
+ The `SM_AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data.
For example, a JSON response serializer may check for an acceptable status code (`2XX` range) and content type (`application/json`), decoding a valid JSON response into an object.
*/
-@protocol AFURLResponseSerialization
+@protocol SM_AFURLResponseSerialization
/**
The response object decoded from the data associated with a specified response.
@@ -49,11 +49,11 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark -
/**
- `AFHTTPResponseSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.
+ `AFHTTPResponseSerializer` conforms to the `SM_AFURLRequestSerialization` & `SM_AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.
Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPResponseSerializer` in order to ensure consistent default behavior.
*/
-@interface AFHTTPResponseSerializer : NSObject
+@interface AFHTTPResponseSerializer : NSObject
- (instancetype)init;
@@ -259,14 +259,14 @@ NS_ASSUME_NONNULL_BEGIN
/**
The component response serializers.
*/
-@property (readonly, nonatomic, copy) NSArray > *responseSerializers;
+@property (readonly, nonatomic, copy) NSArray > *responseSerializers;
/**
Creates and returns a compound serializer comprised of the specified response serializers.
@warning Each response serializer specified must be a subclass of `AFHTTPResponseSerializer`, and response to `-validateResponse:data:error:`.
*/
-+ (instancetype)compoundSerializerWithResponseSerializers:(NSArray > *)responseSerializers;
++ (instancetype)compoundSerializerWithResponseSerializers:(NSArray > *)responseSerializers;
@end
@@ -279,40 +279,40 @@ NS_ASSUME_NONNULL_BEGIN
The following error domain is predefined.
- - `NSString * const AFURLResponseSerializationErrorDomain`
+ - `NSString * const SM_AFURLResponseSerializationErrorDomain`
### Constants
- `AFURLResponseSerializationErrorDomain`
- AFURLResponseSerializer errors. Error codes for `AFURLResponseSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.
+ `SM_AFURLResponseSerializationErrorDomain`
+ AFURLResponseSerializer errors. Error codes for `SM_AFURLResponseSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.
*/
-FOUNDATION_EXPORT NSString * const AFURLResponseSerializationErrorDomain;
+FOUNDATION_EXPORT NSString * const SM_AFURLResponseSerializationErrorDomain;
/**
## User info dictionary keys
These keys may exist in the user info dictionary, in addition to those defined for NSError.
- - `NSString * const AFNetworkingOperationFailingURLResponseErrorKey`
- - `NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey`
+ - `NSString * const SM_AFNetworkingOperationFailingURLResponseErrorKey`
+ - `NSString * const SM_AFNetworkingOperationFailingURLResponseDataErrorKey`
### Constants
- `AFNetworkingOperationFailingURLResponseErrorKey`
- The corresponding value is an `NSURLResponse` containing the response of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`.
+ `SM_AFNetworkingOperationFailingURLResponseErrorKey`
+ The corresponding value is an `NSURLResponse` containing the response of the operation associated with an error. This key is only present in the `SM_AFURLResponseSerializationErrorDomain`.
- `AFNetworkingOperationFailingURLResponseDataErrorKey`
- The corresponding value is an `NSData` containing the original data of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`.
+ `SM_AFNetworkingOperationFailingURLResponseDataErrorKey`
+ The corresponding value is an `NSData` containing the original data of the operation associated with an error. This key is only present in the `SM_AFURLResponseSerializationErrorDomain`.
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseErrorKey;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingOperationFailingURLResponseErrorKey;
-FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingOperationFailingURLResponseDataErrorKey;
/**
-`AFNetworkingOperationFailingURLResponseBodyErrorKey`
+`SM_AFNetworkingOperationFailingURLResponseBodyErrorKey`
The corresponding value is an `NSString` containing the decoded error message.
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseBodyErrorKey;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingOperationFailingURLResponseBodyErrorKey;
NS_ASSUME_NONNULL_END
diff --git a/src/ios/AFNetworking/AFURLResponseSerialization.m b/src/ios/SM_AFNetworking/SM_AFURLResponseSerialization.m
similarity index 91%
rename from src/ios/AFNetworking/AFURLResponseSerialization.m
rename to src/ios/SM_AFNetworking/SM_AFURLResponseSerialization.m
index f88d938d..4c408391 100755
--- a/src/ios/AFNetworking/AFURLResponseSerialization.m
+++ b/src/ios/SM_AFNetworking/SM_AFURLResponseSerialization.m
@@ -1,4 +1,4 @@
-// AFURLResponseSerialization.m
+// SM_AFURLResponseSerialization.m
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,7 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#import "AFURLResponseSerialization.h"
+#import "SM_AFURLResponseSerialization.h"
#import
@@ -31,10 +31,10 @@
#import
#endif
-NSString * const AFURLResponseSerializationErrorDomain = @"com.alamofire.error.serialization.response";
-NSString * const AFNetworkingOperationFailingURLResponseErrorKey = @"com.alamofire.serialization.response.error.response";
-NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey = @"com.alamofire.serialization.response.error.data";
-NSString * const AFNetworkingOperationFailingURLResponseBodyErrorKey = @"com.alamofire.serialization.response.error.body";
+NSString * const SM_AFURLResponseSerializationErrorDomain = @"com.alamofire.error.serialization.response";
+NSString * const SM_AFNetworkingOperationFailingURLResponseErrorKey = @"com.alamofire.serialization.response.error.response";
+NSString * const SM_AFNetworkingOperationFailingURLResponseDataErrorKey = @"com.alamofire.serialization.response.error.data";
+NSString * const SM_AFNetworkingOperationFailingURLResponseBodyErrorKey = @"com.alamofire.serialization.response.error.body";
static NSError * AFErrorWithUnderlyingError(NSError *error, NSError *underlyingError) {
if (!error) {
@@ -121,15 +121,15 @@ - (BOOL)validateResponse:(NSHTTPURLResponse *)response
if ([data length] > 0 && [response URL]) {
NSMutableDictionary *mutableUserInfo = [@{
- NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: unacceptable content-type: %@", @"AFNetworking", nil), [response MIMEType]],
+ NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: unacceptable content-type: %@", @"SM_AFNetworking", nil), [response MIMEType]],
NSURLErrorFailingURLErrorKey:[response URL],
- AFNetworkingOperationFailingURLResponseErrorKey: response,
+ SM_AFNetworkingOperationFailingURLResponseErrorKey: response,
} mutableCopy];
if (data) {
- mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
+ mutableUserInfo[SM_AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
}
- validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:mutableUserInfo], validationError);
+ validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:SM_AFURLResponseSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:mutableUserInfo], validationError);
}
responseIsValid = NO;
@@ -137,16 +137,16 @@ - (BOOL)validateResponse:(NSHTTPURLResponse *)response
if (self.acceptableStatusCodes && ![self.acceptableStatusCodes containsIndex:(NSUInteger)response.statusCode] && [response URL]) {
NSMutableDictionary *mutableUserInfo = [@{
- NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%ld)", @"AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode],
+ NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%ld)", @"SM_AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode],
NSURLErrorFailingURLErrorKey:[response URL],
- AFNetworkingOperationFailingURLResponseErrorKey: response,
+ SM_AFNetworkingOperationFailingURLResponseErrorKey: response,
} mutableCopy];
if (data) {
- mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
+ mutableUserInfo[SM_AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
}
- validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo], validationError);
+ validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:SM_AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo], validationError);
responseIsValid = NO;
}
@@ -159,7 +159,7 @@ - (BOOL)validateResponse:(NSHTTPURLResponse *)response
return responseIsValid;
}
-#pragma mark - AFURLResponseSerialization
+#pragma mark - SM_AFURLResponseSerialization
- (id)responseObjectForResponse:(NSURLResponse *)response
data:(NSData *)data
@@ -231,14 +231,14 @@ - (instancetype)init {
return self;
}
-#pragma mark - AFURLResponseSerialization
+#pragma mark - SM_AFURLResponseSerialization
- (id)responseObjectForResponse:(NSURLResponse *)response
data:(NSData *)data
error:(NSError *__autoreleasing *)error
{
if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+ if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, SM_AFURLResponseSerializationErrorDomain)) {
return nil;
}
}
@@ -319,14 +319,14 @@ - (instancetype)init {
return self;
}
-#pragma mark - AFURLResponseSerialization
+#pragma mark - SM_AFURLResponseSerialization
- (id)responseObjectForResponse:(NSHTTPURLResponse *)response
data:(NSData *)data
error:(NSError *__autoreleasing *)error
{
if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+ if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, SM_AFURLResponseSerializationErrorDomain)) {
return nil;
}
}
@@ -364,14 +364,14 @@ - (instancetype)init {
return self;
}
-#pragma mark - AFURLResponseSerialization
+#pragma mark - SM_AFURLResponseSerialization
- (id)responseObjectForResponse:(NSURLResponse *)response
data:(NSData *)data
error:(NSError *__autoreleasing *)error
{
if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+ if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, SM_AFURLResponseSerializationErrorDomain)) {
return nil;
}
}
@@ -447,14 +447,14 @@ - (instancetype)init {
return self;
}
-#pragma mark - AFURLResponseSerialization
+#pragma mark - SM_AFURLResponseSerialization
- (id)responseObjectForResponse:(NSURLResponse *)response
data:(NSData *)data
error:(NSError *__autoreleasing *)error
{
if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+ if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, SM_AFURLResponseSerializationErrorDomain)) {
return nil;
}
}
@@ -512,13 +512,13 @@ - (instancetype)copyWithZone:(NSZone *)zone {
#import
#import
-@interface UIImage (AFNetworkingSafeImageLoading)
+@interface UIImage (SM_AFNetworkingSafeImageLoading)
+ (UIImage *)af_safeImageWithData:(NSData *)data;
@end
static NSLock* imageLock = nil;
-@implementation UIImage (AFNetworkingSafeImageLoading)
+@implementation UIImage (SM_AFNetworkingSafeImageLoading)
+ (UIImage *)af_safeImageWithData:(NSData *)data {
UIImage* image = nil;
@@ -666,7 +666,7 @@ - (id)responseObjectForResponse:(NSURLResponse *)response
error:(NSError *__autoreleasing *)error
{
if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+ if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, SM_AFURLResponseSerializationErrorDomain)) {
return nil;
}
}
@@ -750,13 +750,13 @@ + (instancetype)compoundSerializerWithResponseSerializers:(NSArray *)responseSer
return serializer;
}
-#pragma mark - AFURLResponseSerialization
+#pragma mark - SM_AFURLResponseSerialization
- (id)responseObjectForResponse:(NSURLResponse *)response
data:(NSData *)data
error:(NSError *__autoreleasing *)error
{
- for (id serializer in self.responseSerializers) {
+ for (id serializer in self.responseSerializers) {
if (![serializer isKindOfClass:[AFHTTPResponseSerializer class]]) {
continue;
}
diff --git a/src/ios/AFNetworking/AFURLSessionManager.h b/src/ios/SM_AFNetworking/SM_AFURLSessionManager.h
similarity index 90%
rename from src/ios/AFNetworking/AFURLSessionManager.h
rename to src/ios/SM_AFNetworking/SM_AFURLSessionManager.h
index 89909fe4..d3fc5285 100644
--- a/src/ios/AFNetworking/AFURLSessionManager.h
+++ b/src/ios/SM_AFNetworking/SM_AFURLSessionManager.h
@@ -1,4 +1,4 @@
-// AFURLSessionManager.h
+// SM_AFURLSessionManager.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -22,23 +22,23 @@
#import
-#import "AFURLResponseSerialization.h"
-#import "AFURLRequestSerialization.h"
-#import "AFSecurityPolicy.h"
+#import "SM_AFURLResponseSerialization.h"
+#import "SM_AFURLRequestSerialization.h"
+#import "SM_AFSecurityPolicy.h"
#if !TARGET_OS_WATCH
-#import "AFNetworkReachabilityManager.h"
+#import "SM_AFNetworkReachabilityManager.h"
#endif
/**
- `AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to ``, ``, ``, and ``.
+ `SM_AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to ``, ``, ``, and ``.
## Subclassing Notes
- This is the base class for `AFHTTPSessionManager`, which adds functionality specific to making HTTP requests. If you are looking to extend `AFURLSessionManager` specifically for HTTP, consider subclassing `AFHTTPSessionManager` instead.
+ This is the base class for `SM_AFHTTPSessionManager`, which adds functionality specific to making HTTP requests. If you are looking to extend `SM_AFURLSessionManager` specifically for HTTP, consider subclassing `SM_AFHTTPSessionManager` instead.
## NSURLSession & NSURLSessionTask Delegate Methods
- `AFURLSessionManager` implements the following delegate methods:
+ `SM_AFURLSessionManager` implements the following delegate methods:
### `NSURLSessionDelegate`
@@ -71,7 +71,7 @@
## Network Reachability Monitoring
- Network reachability status and change monitoring is available through the `reachabilityManager` property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See `AFNetworkReachabilityManager` for more details.
+ Network reachability status and change monitoring is available through the `reachabilityManager` property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See `SM_AFNetworkReachabilityManager` for more details.
## NSCoding Caveats
@@ -87,7 +87,7 @@
NS_ASSUME_NONNULL_BEGIN
-@interface AFURLSessionManager : NSObject
+@interface SM_AFURLSessionManager : NSObject
/**
The managed session.
@@ -104,16 +104,16 @@ NS_ASSUME_NONNULL_BEGIN
@warning `responseSerializer` must not be `nil`.
*/
-@property (nonatomic, strong) id responseSerializer;
+@property (nonatomic, strong) id 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.
+ The security policy used by created session to evaluate server trust for secure connections. `SM_AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified.
*/
-@property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
+@property (nonatomic, strong) SM_AFSecurityPolicy *securityPolicy;
#if !TARGET_OS_WATCH
///--------------------------------------
@@ -121,9 +121,9 @@ NS_ASSUME_NONNULL_BEGIN
///--------------------------------------
/**
- The network reachability manager. `AFURLSessionManager` uses the `sharedManager` by default.
+ The network reachability manager. `SM_AFURLSessionManager` uses the `sharedManager` by default.
*/
-@property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager;
+@property (readwrite, nonatomic, strong) SM_AFNetworkReachabilityManager *reachabilityManager;
#endif
///----------------------------
@@ -450,17 +450,17 @@ NS_ASSUME_NONNULL_BEGIN
/**
Posted when a task resumes.
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidResumeNotification;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingTaskDidResumeNotification;
/**
Posted when a task finishes executing. Includes a userInfo dictionary with additional information about the task.
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteNotification;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingTaskDidCompleteNotification;
/**
Posted when a task suspends its execution.
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidSuspendNotification;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingTaskDidSuspendNotification;
/**
Posted when a session is invalidated.
@@ -473,28 +473,28 @@ FOUNDATION_EXPORT NSString * const AFURLSessionDidInvalidateNotification;
FOUNDATION_EXPORT NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification;
/**
- The raw response data of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if response data exists for the task.
+ The raw response data of the task. Included in the userInfo dictionary of the `SM_AFNetworkingTaskDidCompleteNotification` if response data exists for the task.
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseDataKey;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingTaskDidCompleteResponseDataKey;
/**
- The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the response was serialized.
+ The serialized response object of the task. Included in the userInfo dictionary of the `SM_AFNetworkingTaskDidCompleteNotification` if the response was serialized.
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingTaskDidCompleteSerializedResponseKey;
/**
- The response serializer used to serialize the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the task has an associated response serializer.
+ The response serializer used to serialize the response. Included in the userInfo dictionary of the `SM_AFNetworkingTaskDidCompleteNotification` if the task has an associated response serializer.
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingTaskDidCompleteResponseSerializerKey;
/**
- The file path associated with the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an the response data has been stored directly to disk.
+ The file path associated with the download task. Included in the userInfo dictionary of the `SM_AFNetworkingTaskDidCompleteNotification` if an the response data has been stored directly to disk.
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteAssetPathKey;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingTaskDidCompleteAssetPathKey;
/**
- Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an error exists.
+ Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `SM_AFNetworkingTaskDidCompleteNotification` if an error exists.
*/
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteErrorKey;
+FOUNDATION_EXPORT NSString * const SM_AFNetworkingTaskDidCompleteErrorKey;
NS_ASSUME_NONNULL_END
diff --git a/src/ios/AFNetworking/AFURLSessionManager.m b/src/ios/SM_AFNetworking/SM_AFURLSessionManager.m
similarity index 93%
rename from src/ios/AFNetworking/AFURLSessionManager.m
rename to src/ios/SM_AFNetworking/SM_AFURLSessionManager.m
index af01bda2..6d922ed4 100644
--- a/src/ios/AFNetworking/AFURLSessionManager.m
+++ b/src/ios/SM_AFNetworking/SM_AFURLSessionManager.m
@@ -1,4 +1,4 @@
-// AFURLSessionManager.m
+// SM_AFURLSessionManager.m
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,7 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#import "AFURLSessionManager.h"
+#import "SM_AFURLSessionManager.h"
#import
#ifndef NSFoundationVersionNumber_iOS_8_0
@@ -69,19 +69,19 @@ static dispatch_group_t url_session_manager_completion_group() {
return af_url_session_manager_completion_group;
}
-NSString * const AFNetworkingTaskDidResumeNotification = @"com.alamofire.networking.task.resume";
-NSString * const AFNetworkingTaskDidCompleteNotification = @"com.alamofire.networking.task.complete";
-NSString * const AFNetworkingTaskDidSuspendNotification = @"com.alamofire.networking.task.suspend";
+NSString * const SM_AFNetworkingTaskDidResumeNotification = @"com.alamofire.networking.task.resume";
+NSString * const SM_AFNetworkingTaskDidCompleteNotification = @"com.alamofire.networking.task.complete";
+NSString * const SM_AFNetworkingTaskDidSuspendNotification = @"com.alamofire.networking.task.suspend";
NSString * const AFURLSessionDidInvalidateNotification = @"com.alamofire.networking.session.invalidate";
NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification = @"com.alamofire.networking.session.download.file-manager-error";
-NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey = @"com.alamofire.networking.task.complete.serializedresponse";
-NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey = @"com.alamofire.networking.task.complete.responseserializer";
-NSString * const AFNetworkingTaskDidCompleteResponseDataKey = @"com.alamofire.networking.complete.finish.responsedata";
-NSString * const AFNetworkingTaskDidCompleteErrorKey = @"com.alamofire.networking.task.complete.error";
-NSString * const AFNetworkingTaskDidCompleteAssetPathKey = @"com.alamofire.networking.task.complete.assetpath";
+NSString * const SM_AFNetworkingTaskDidCompleteSerializedResponseKey = @"com.alamofire.networking.task.complete.serializedresponse";
+NSString * const SM_AFNetworkingTaskDidCompleteResponseSerializerKey = @"com.alamofire.networking.task.complete.responseserializer";
+NSString * const SM_AFNetworkingTaskDidCompleteResponseDataKey = @"com.alamofire.networking.complete.finish.responsedata";
+NSString * const SM_AFNetworkingTaskDidCompleteErrorKey = @"com.alamofire.networking.task.complete.error";
+NSString * const SM_AFNetworkingTaskDidCompleteAssetPathKey = @"com.alamofire.networking.task.complete.assetpath";
-static NSString * const AFURLSessionManagerLockName = @"com.alamofire.networking.session.manager.lock";
+static NSString * const SM_AFURLSessionManagerLockName = @"com.alamofire.networking.session.manager.lock";
static NSUInteger const AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask = 3;
@@ -111,8 +111,8 @@ static dispatch_group_t url_session_manager_completion_group() {
#pragma mark -
-@interface AFURLSessionManagerTaskDelegate : NSObject
-@property (nonatomic, weak) AFURLSessionManager *manager;
+@interface SM_AFURLSessionManagerTaskDelegate : NSObject
+@property (nonatomic, weak) SM_AFURLSessionManager *manager;
@property (nonatomic, strong) NSMutableData *mutableData;
@property (nonatomic, strong) NSProgress *uploadProgress;
@property (nonatomic, strong) NSProgress *downloadProgress;
@@ -123,7 +123,7 @@ @interface AFURLSessionManagerTaskDelegate : NSObject )responseSerializer {
+- (void)setResponseSerializer:(id )responseSerializer {
NSParameterAssert(responseSerializer);
_responseSerializer = responseSerializer;
@@ -1078,7 +1078,7 @@ - (void)URLSession:(NSURLSession *)session
task:(NSURLSessionTask *)task
didCompleteWithError:(NSError *)error
{
- AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task];
+ SM_AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task];
// delegate may be nil when completing a task in the background
if (delegate) {
@@ -1114,7 +1114,7 @@ - (void)URLSession:(NSURLSession *)session
dataTask:(NSURLSessionDataTask *)dataTask
didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask
{
- AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask];
+ SM_AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask];
if (delegate) {
[self removeDelegateForTask:dataTask];
[self setDelegate:delegate forTask:downloadTask];
@@ -1130,7 +1130,7 @@ - (void)URLSession:(NSURLSession *)session
didReceiveData:(NSData *)data
{
- AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask];
+ SM_AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask];
[delegate URLSession:session dataTask:dataTask didReceiveData:data];
if (self.dataTaskDidReceiveData) {
@@ -1168,7 +1168,7 @@ - (void)URLSession:(NSURLSession *)session
downloadTask:(NSURLSessionDownloadTask *)downloadTask
didFinishDownloadingToURL:(NSURL *)location
{
- AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask];
+ SM_AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask];
if (self.downloadTaskDidFinishDownloading) {
NSURL *fileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location);
if (fileURL) {
diff --git a/src/ios/TextRequestSerializer.h b/src/ios/TextRequestSerializer.h
index 56ddad45..4a75aa04 100644
--- a/src/ios/TextRequestSerializer.h
+++ b/src/ios/TextRequestSerializer.h
@@ -1,5 +1,5 @@
#import
-#import "AFURLRequestSerialization.h"
+#import "SM_AFURLRequestSerialization.h"
@interface TextRequestSerializer : AFHTTPRequestSerializer
diff --git a/src/ios/TextRequestSerializer.m b/src/ios/TextRequestSerializer.m
index 31c1c2ed..0ccddb27 100644
--- a/src/ios/TextRequestSerializer.m
+++ b/src/ios/TextRequestSerializer.m
@@ -8,7 +8,7 @@ + (instancetype)serializer
return serializer;
}
-#pragma mark - AFURLRequestSerialization
+#pragma mark - SM_AFURLRequestSerialization
- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
withParameters:(id)parameters
diff --git a/src/ios/TextResponseSerializer.h b/src/ios/TextResponseSerializer.h
index d086a8ce..09301685 100644
--- a/src/ios/TextResponseSerializer.h
+++ b/src/ios/TextResponseSerializer.h
@@ -1,5 +1,5 @@
#import
-#import "AFURLResponseSerialization.h"
+#import "SM_AFURLResponseSerialization.h"
@interface TextResponseSerializer : AFHTTPResponseSerializer
diff --git a/src/ios/TextResponseSerializer.m b/src/ios/TextResponseSerializer.m
index 76b6530b..57a190a5 100644
--- a/src/ios/TextResponseSerializer.m
+++ b/src/ios/TextResponseSerializer.m
@@ -94,26 +94,26 @@ - (BOOL)validateResponse:(NSHTTPURLResponse *)response
if (data && !*decoded) {
NSMutableDictionary *mutableUserInfo = [@{
NSURLErrorFailingURLErrorKey:[response URL],
- AFNetworkingOperationFailingURLResponseErrorKey: response,
- AFNetworkingOperationFailingURLResponseDataErrorKey: data,
- AFNetworkingOperationFailingURLResponseBodyErrorKey: @"Could not decode response data due to invalid or unknown charset encoding",
+ SM_AFNetworkingOperationFailingURLResponseErrorKey: response,
+ SM_AFNetworkingOperationFailingURLResponseDataErrorKey: data,
+ SM_AFNetworkingOperationFailingURLResponseBodyErrorKey: @"Could not decode response data due to invalid or unknown charset encoding",
} mutableCopy];
- validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo], validationError);
+ validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:SM_AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo], validationError);
responseIsValid = NO;
} else if (self.acceptableStatusCodes && ![self.acceptableStatusCodes containsIndex:(NSUInteger)response.statusCode] && [response URL]) {
NSMutableDictionary *mutableUserInfo = [@{
- NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%ld)", @"AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode],
+ NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%ld)", @"SM_AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode],
NSURLErrorFailingURLErrorKey: [response URL],
- AFNetworkingOperationFailingURLResponseErrorKey: response,
+ SM_AFNetworkingOperationFailingURLResponseErrorKey: response,
} mutableCopy];
if (data) {
- mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
- mutableUserInfo[AFNetworkingOperationFailingURLResponseBodyErrorKey] = *decoded;
+ mutableUserInfo[SM_AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
+ mutableUserInfo[SM_AFNetworkingOperationFailingURLResponseBodyErrorKey] = *decoded;
}
- validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo], validationError);
+ validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:SM_AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo], validationError);
responseIsValid = NO;
}
}
@@ -125,7 +125,7 @@ - (BOOL)validateResponse:(NSHTTPURLResponse *)response
return responseIsValid;
}
-#pragma mark - AFURLResponseSerialization
+#pragma mark - SM_AFURLResponseSerialization
- (id)responseObjectForResponse:(NSURLResponse *)response
data:(NSData *)data
@@ -134,7 +134,7 @@ - (id)responseObjectForResponse:(NSURLResponse *)response
NSString* decoded = nil;
if (![self validateResponse:(NSHTTPURLResponse *)response data:data decoded:&decoded error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+ if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, SM_AFURLResponseSerializationErrorDomain)) {
return nil;
}
}