Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 12.2.0-beta.1 #607

Merged
merged 24 commits into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
316 changes: 155 additions & 161 deletions AVOS/AVOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions AVOS/AVOSCloud/Analytics/AVAnalyticsImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,7 @@ -(void)postRecording {
} else if (self.reportPolicy == AV_BATCH) {
[self sendWithBatch];
} else if (self.reportPolicy == AV_SENDWIFIONLY) {
if ([AVAnalyticsUtils isWiFiConnection]) {
[self sendWithBatch];
}
[self sendWithBatch];
} else if (self.reportPolicy == AV_SEND_INTERVAL) {
[self sendWithInterval];
}
Expand Down
1 change: 0 additions & 1 deletion AVOS/AVOSCloud/Analytics/AVAnalyticsUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

+(NSString *)safeString:(NSString *)string;

+(BOOL)isWiFiConnection AV_WATCH_UNAVAILABLE;
+(NSString *)deviceId AV_WATCH_UNAVAILABLE AV_OSX_UNAVAILABLE;

@end
31 changes: 0 additions & 31 deletions AVOS/AVOSCloud/Analytics/AVAnalyticsUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,34 +149,6 @@ +(NSString *)language

#if !TARGET_OS_WATCH

static NSString *const WiFiType = @"WiFi";
static NSString *const WWANType = @"WWAN";

+(BOOL)isWiFiConnection {
return [[AVAnalyticsUtils connectionType] isEqualToString:WiFiType];
}

+(NSString *)connectionType
{
NSString *type = @"";
LCNetworkReachabilityManager *reachabilityManager = [LCNetworkReachabilityManager sharedManager];

[reachabilityManager startMonitoring];

switch (reachabilityManager.networkReachabilityStatus) {
case AFNetworkReachabilityStatusUnknown:
break;
case AFNetworkReachabilityStatusNotReachable:
break;
case AFNetworkReachabilityStatusReachableViaWiFi:
type = WiFiType;
case AFNetworkReachabilityStatusReachableViaWWAN:
type = WWANType;
}

return type;
}

+(NSString *)deviceId
{
static NSString * uniqueIdentifier = nil;
Expand Down Expand Up @@ -302,9 +274,6 @@ +(NSMutableDictionary *)deviceInfo
if (sdkType) { dynamicDic[@"os"] = sdkType; }

#if !TARGET_OS_WATCH
NSString *connectionType = [AVAnalyticsUtils connectionType];
if (connectionType) { dynamicDic[@"access"] = connectionType; }

NSString *carrier = [AVAnalyticsUtils carrier];
if (carrier) { dynamicDic[@"carrier"] = carrier; }
#endif
Expand Down
2 changes: 1 addition & 1 deletion AVOS/AVOSCloud/UserAgent.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define SDK_VERSION @"12.1.3"
#define SDK_VERSION @"12.2.0-beta.1"
37 changes: 37 additions & 0 deletions AVOS/AVOSCloud/Vendor/LCNetworking/LCCompatibilityMacros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// LCCompatibilityMacros.h
// 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
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#ifndef LCCompatibilityMacros_h
#define LCCompatibilityMacros_h

#ifdef API_UNAVAILABLE
#define LC_API_UNAVAILABLE(x) API_UNAVAILABLE(x)
#else
#define LC_API_UNAVAILABLE(x)
#endif // API_UNAVAILABLE

#if __has_warning("-Wunguarded-availability-new")
#define LC_CAN_USE_AT_AVAILABLE 1
#else
#define LC_CAN_USE_AT_AVAILABLE 0
#endif

#endif /* LCCompatibilityMacros_h */
37 changes: 23 additions & 14 deletions ...Party/LCNetworking/LCHTTPSessionManager.h → ...endor/LCNetworking/LCHTTPSessionManager.h
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// AFHTTPSessionManager.h
// LCHTTPSessionManager.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -34,23 +34,23 @@
#import "LCURLSessionManager.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.
`LCHTTPSessionManager` is a subclass of `LCURLSessionManager` 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 `LCHTTPSessionManager`, 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.
For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `LCHTTPRequestOperationManager` may be used to similar effect.

## 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

Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to `<AFURLRequestSerialization>`.
Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to `<LCURLRequestSerialization>`.

Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to `<AFURLResponseSerialization>`
Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to `<LCURLResponseSerialization>`

## URL Construction Using Relative Paths

Expand Down Expand Up @@ -81,30 +81,39 @@ NS_ASSUME_NONNULL_BEGIN
@property (readonly, nonatomic, strong, nullable) NSURL *baseURL;

/**
Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies.
Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `LCHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies.

@warning `requestSerializer` must not be `nil`.
*/
@property (nonatomic, strong) LCHTTPRequestSerializer <LCURLRequestSerialization> * 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`.
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 `LCJSONResponseSerializer`.

@warning `responseSerializer` must not be `nil`.
*/
@property (nonatomic, strong) LCHTTPResponseSerializer <LCURLResponseSerialization> * responseSerializer;

///-------------------------------
/// @name Managing Security Policy
///-------------------------------

/**
The security policy used by created session to evaluate server trust for secure connections. `LCURLSessionManager` uses the `defaultPolicy` unless otherwise specified. A security policy configured with `LCSSLPinningModePublicKey` or `LCSSLPinningModeCertificate` 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) LCSecurityPolicy *securityPolicy;

///---------------------
/// @name Initialization
///---------------------

/**
Creates and returns an `AFHTTPSessionManager` object.
Creates and returns an `LCHTTPSessionManager` object.
*/
+ (instancetype)manager;

/**
Initializes an `AFHTTPSessionManager` object with the specified base URL.
Initializes an `LCHTTPSessionManager` object with the specified base URL.

@param url The base URL for the HTTP client.

Expand All @@ -113,7 +122,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithBaseURL:(nullable NSURL *)url;

/**
Initializes an `AFHTTPSessionManager` object with the specified base URL.
Initializes an `LCHTTPSessionManager` object with the specified base URL.

This is the designated initializer.

Expand Down Expand Up @@ -214,7 +223,7 @@ NS_ASSUME_NONNULL_BEGIN

@param URLString The URL string used to create the request URL.
@param parameters The parameters to be encoded according to the client request serializer.
@param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.
@param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `LCMultipartFormData` protocol.
@param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
@param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.

Expand All @@ -231,7 +240,7 @@ NS_ASSUME_NONNULL_BEGIN

@param URLString The URL string used to create the request URL.
@param parameters The parameters to be encoded according to the client request serializer.
@param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.
@param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `LCMultipartFormData` protocol.
@param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
@param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
@param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
Expand Down
25 changes: 18 additions & 7 deletions ...Party/LCNetworking/LCHTTPSessionManager.m → ...endor/LCNetworking/LCHTTPSessionManager.m
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// AFHTTPSessionManager.m
// LCHTTPSessionManager.m
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -98,6 +98,23 @@ - (void)setResponseSerializer:(LCHTTPResponseSerializer <LCURLResponseSerializat
[super setResponseSerializer:responseSerializer];
}

@dynamic securityPolicy;

- (void)setSecurityPolicy:(LCSecurityPolicy *)securityPolicy {
if (securityPolicy.SSLPinningMode != LCSSLPinningModeNone && ![self.baseURL.scheme isEqualToString:@"https"]) {
NSString *pinningMode = @"Unknown Pinning Mode";
switch (securityPolicy.SSLPinningMode) {
case LCSSLPinningModeNone: pinningMode = @"LCSSLPinningModeNone"; break;
case LCSSLPinningModeCertificate: pinningMode = @"LCSSLPinningModeCertificate"; break;
case LCSSLPinningModePublicKey: pinningMode = @"LCSSLPinningModePublicKey"; 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
Expand Down Expand Up @@ -186,12 +203,9 @@ - (NSURLSessionDataTask *)POST:(NSString *)URLString
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;
Expand Down Expand Up @@ -262,12 +276,9 @@ - (NSURLSessionDataTask *)dataTaskWithHTTPMethod:(NSString *)method
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;
Expand Down
Loading