Skip to content

Commit 8b25394

Browse files
authored
Merge pull request #573 from zapcannon87/master
release: 11.6.7
2 parents f4af3a6 + 54dc7b5 commit 8b25394

File tree

10 files changed

+26
-35
lines changed

10 files changed

+26
-35
lines changed

AVOS/AVOSCloud/AVOSCloud.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ typedef NS_ENUM(NSInteger, AVServiceRegion) {
307307

308308
@interface AVOSCloud (AVDeprecated)
309309

310+
+ (void)startNetworkStatistics __deprecated;
311+
310312
/**
311313
* Set third party file storage service. If uses China server, you can use QCloud or Qiniu, the default is Qiniu, if uses US server, the default is AWS S3.
312314
* @param type Qiniu, QCloud or AWS S3.

AVOS/AVOSCloud/AVOSCloud.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ + (void)setApplicationId:(NSString *)applicationId clientKey:(NSString *)clientK
108108
}
109109

110110
[self initializePaasClient];
111-
[[LCNetworkStatistics sharedInstance] start];
112111
[LCRouter sharedInstance];
113112

114113
LCInitialized = YES;
@@ -314,6 +313,10 @@ + (void)handleRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
314313

315314
// MARK: - Deprecated
316315

316+
+ (void)startNetworkStatistics {
317+
[[LCNetworkStatistics sharedInstance] start];
318+
}
319+
317320
#pragma clang diagnostic push
318321
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
319322
+ (void)setStorageType:(AVStorageType)storageType {}

AVOS/AVOSCloud/Push/AVInstallation.m

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ - (id)init
7373
return self;
7474
}
7575

76+
- (NSString *)hexadecimalStringFromData:(NSData *)data
77+
{
78+
NSUInteger dataLength = data.length;
79+
if (dataLength == 0) {
80+
return nil;
81+
}
82+
const unsigned char *dataBuffer = data.bytes;
83+
NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)];
84+
for (int i = 0; i < dataLength; ++i) {
85+
[hexString appendFormat:@"%02.2hhx", dataBuffer[i]];
86+
}
87+
return [hexString copy];
88+
}
89+
7690
- (void)setDeviceTokenFromData:(NSData *)deviceTokenData
7791
{
7892
[self setDeviceTokenFromData:deviceTokenData
@@ -82,34 +96,16 @@ - (void)setDeviceTokenFromData:(NSData *)deviceTokenData
8296
- (void)setDeviceTokenFromData:(NSData *)deviceTokenData
8397
teamId:(NSString *)teamId
8498
{
85-
if (!deviceTokenData || deviceTokenData.length == 0) {
86-
99+
NSString *newDeviceToken = [self hexadecimalStringFromData:deviceTokenData];
100+
if (!newDeviceToken) {
87101
return;
88102
}
89-
90-
NSCharacterSet *charactersSet = [NSCharacterSet characterSetWithCharactersInString:@"<>"];
91-
92-
NSString *newDeviceToken = [deviceTokenData.description stringByTrimmingCharactersInSet:charactersSet];
93-
94-
newDeviceToken = [newDeviceToken stringByReplacingOccurrencesOfString:@" " withString:@""];
95-
96-
if (newDeviceToken.length == 0) {
97-
98-
return;
99-
}
100-
101103
NSString *oldDeviceToken = self.deviceToken;
102-
103104
NSString *oldTeamId = self.apnsTeamId;
104-
105105
if (![oldDeviceToken isEqualToString:newDeviceToken] || ![teamId isEqualToString:oldTeamId]) {
106-
107106
self.deviceToken = newDeviceToken;
108-
109107
self.apnsTeamId = teamId;
110-
111108
[self._requestManager synchronize:^{
112-
113109
[self updateInstallationDictionary:[self._requestManager setDict]];
114110
}];
115111
}

AVOS/AVOSCloud/Router/LCRouter.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#import "AVErrorUtils.h"
1212
#import "AVPaasClient.h"
1313
#import "AVPersistenceUtils.h"
14-
#import "LCNetworkStatistics.h"
1514

1615
RouterCacheKey RouterCacheKeyApp = @"RouterCacheDataApp";
1716
RouterCacheKey RouterCacheKeyRTM = @"RouterCacheDataRTM";
@@ -425,7 +424,6 @@ - (void)customAppServerURL:(NSString *)URLString key:(RouterKey)key
425424
} else {
426425
[self->_customAppServerTable removeObjectForKey:key];
427426
}
428-
LCNetworkStatistics.sharedInstance.ignoreAlwaysCollectIfCustomedService = true;
429427
}
430428

431429
// MARK: - Misc

AVOS/AVOSCloud/Statistics/LCNetworkStatistics.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
@interface LCNetworkStatistics : NSObject
1212

13-
@property (nonatomic, assign) BOOL ignoreAlwaysCollectIfCustomedService;
14-
1513
+ (instancetype)sharedInstance;
1614

1715
- (void)addIncrementalAttribute:(NSInteger)amount forKey:(NSString *)key;

AVOS/AVOSCloud/Statistics/LCNetworkStatistics.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ - (instancetype)init {
5959

6060
if (self) {
6161
_cachedStatisticDictLock = [[NSRecursiveLock alloc] init];
62-
_ignoreAlwaysCollectIfCustomedService = false;
6362
}
6463

6564
return self;
@@ -241,11 +240,6 @@ - (BOOL)atTimeToUpload {
241240

242241
- (void)startInBackground
243242
{
244-
if (self.ignoreAlwaysCollectIfCustomedService) {
245-
246-
return;
247-
}
248-
249243
NSAssert(![NSThread isMainThread], @"This method must run in background.");
250244

251245
AV_WAIT_WITH_ROUTINE_TIL_TRUE(!self.enable, LCNetworkStatisticsCheckInterval, ({

AVOS/AVOSCloud/UserAgent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define SDK_VERSION @"v11.6.6"
1+
#define SDK_VERSION @"v11.6.7"

AVOSCloud.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'AVOSCloud'
3-
s.version = '11.6.6'
3+
s.version = '11.6.7'
44
s.homepage = 'https://leancloud.cn/'
55
s.summary = 'LeanCloud Objective-C SDK'
66
s.authors = 'LeanCloud'

AVOSCloudIM.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'AVOSCloudIM'
3-
s.version = '11.6.6'
3+
s.version = '11.6.7'
44
s.homepage = 'https://leancloud.cn/'
55
s.summary = 'LeanCloud IM Objective-C SDK'
66
s.authors = 'LeanCloud'

AVOSCloudLiveQuery.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'AVOSCloudLiveQuery'
3-
s.version = '11.6.6'
3+
s.version = '11.6.7'
44
s.homepage = 'https://leancloud.cn/'
55
s.summary = 'LeanCloud LiveQuery Objective-C SDK'
66
s.authors = 'LeanCloud'

0 commit comments

Comments
 (0)