Skip to content

Commit 001804f

Browse files
author
jg zhu
committed
Release 0.2.2
1 parent c2fc37c commit 001804f

4 files changed

Lines changed: 10 additions & 8 deletions

File tree

SensorsABTest/DataManger/SABExperimentDataManager.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,8 @@ - (instancetype)init {
4949
_serialQueue = dispatch_queue_create([serialQueueLabel UTF8String], DISPATCH_QUEUE_SERIAL);
5050
[self resgisterStorePlugins];
5151

52-
/* 读取本地缓存前,需要先读取自定义主体 ID
53-
如果读取为 nil,初始化空 Dictionary,方便后续使用 isEqualToDictionary: 判断
54-
*/
55-
_customIDs = [[SABStoreManager sharedInstance] dictionaryForKey:kSABCustomIDsFileName] ?: [NSDictionary dictionary];
56-
52+
// 读取本地缓存前,需要先读取自定义主体 ID
53+
_customIDs = [[SABStoreManager sharedInstance] dictionaryForKey:kSABCustomIDsFileName];
5754

5855
// 读取本地缓存
5956
[self unarchiveExperimentResult];
@@ -119,8 +116,11 @@ - (void)unarchiveExperimentResult {
119116
SABFetchResultResponse *resultResponse = (SABFetchResultResponse *)result;
120117
NSString *distinctId = [SABBridge distinctId];
121118
NSDictionary *customIDs = resultResponse.userIdenty.customIDs;
119+
// 校验 customIDs
120+
BOOL isSameCustomIDs = (customIDs.count == 0 && self.customIDs.count == 0) || [customIDs isEqualToDictionary:self.customIDs];
122121
// 校验缓存试验的 distinctId
123-
if ([resultResponse.userIdenty.distinctId isEqualToString:distinctId] && [customIDs isEqualToDictionary:self.customIDs] && resultResponse.results.count > 0) {
122+
BOOL isSameDistinctId = [resultResponse.userIdenty.distinctId isEqualToString:distinctId];
123+
if (isSameDistinctId && isSameCustomIDs && resultResponse.results.count > 0) {
124124
self.resultResponse = resultResponse;
125125
SABLogInfo(@"unarchiveExperimentResult success jsonObject %@", resultResponse.responseObject);
126126
}

SensorsABTest/DataManger/SABFetchResultResponse.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ - (void)encodeWithCoder:(nonnull NSCoder *)coder {
5353
[coder encodeObject:self.distinctId forKey:@"distinctId"];
5454
[coder encodeObject:self.loginId forKey:@"loginId"];
5555
[coder encodeObject:self.anonymousId forKey:@"anonymousId"];
56+
[coder encodeObject:self.customIDs forKey:@"customIDs"];
5657
}
5758

5859
- (nullable instancetype)initWithCoder:(nonnull NSCoder *)coder {
5960
if (self = [super init]) {
6061
self.distinctId = [coder decodeObjectForKey:@"distinctId"];
6162
self.loginId = [coder decodeObjectForKey:@"loginId"];
6263
self.anonymousId = [coder decodeObjectForKey:@"anonymousId"];
64+
self.customIDs = [coder decodeObjectForKey:@"customIDs"];
6365
}
6466
return self;
6567
}

SensorsABTest/SABConstants.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#import "SABConstants.h"
2626

2727
// 当前版本号
28-
NSString *const kSABLibVersion = @"0.2.1";
28+
NSString *const kSABLibVersion = @"0.2.2";
2929

3030
// SA 最低支持版本
3131
NSString *const kSABMinSupportedSALibVersion = @"4.2.0";

SensorsABTesting.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 = 'SensorsABTesting'
3-
s.version = "0.2.1"
3+
s.version = "0.2.2"
44
s.summary = 'The official iOS/macOS SDK of Sensors A/B Testing.'
55
s.homepage = 'http://www.sensorsdata.cn'
66
s.license = { :type => 'Apache 2.0', :file => 'LICENSE' }

0 commit comments

Comments
 (0)