Skip to content

Commit 9525dc5

Browse files
author
王洋洋
committed
Release 4.5.12
1 parent 6592644 commit 9525dc5

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed

SensorsAnalyticsSDK.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 = "SensorsAnalyticsSDK"
3-
s.version = "4.5.11"
3+
s.version = "4.5.12"
44
s.summary = "The official iOS SDK of Sensors Analytics."
55
s.homepage = "http://www.sensorsdata.cn"
66
s.source = { :git => 'https://github.com/sensorsdata/sa-sdk-ios.git', :tag => "v#{s.version}" }

SensorsAnalyticsSDK/Core/Flow/SAFlowData.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,12 @@ typedef void(^SAFlowDataCompletion)(SAFlowData *output);
6565

6666
/// 单条数据记录
6767
///
68-
/// eventObject 转 json 后,构建 record
68+
/// eventObject 转 json 后,构建 record,待入库
6969
@property (nonatomic, strong, nullable) SAEventRecord *record;
7070

71+
/// 多条数据记录
72+
///
73+
/// 从库中读取的数据记录,eventObject 转 json 后,构建 record,待上传
7174
@property (nonatomic, strong, nullable) NSArray<SAEventRecord *> *records;
7275
@property (nonatomic, strong, nullable) NSArray<NSString *> *recordIDs;
7376

SensorsAnalyticsSDK/Core/Interceptor/Flush/SAFlushInterceptor.m

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
#import "SAModuleManager.h"
2828
#import "SAURLUtils.h"
2929
#import "SAJSONUtil.h"
30+
#import "SAEventRecord.h"
3031
#import "SensorsAnalyticsSDK+Private.h"
32+
#import "SAConstants+Private.h"
3133
#import "SALog.h"
3234

3335
NSString * const kSAFlushServerURL = @"serverURL";
@@ -100,8 +102,8 @@ - (void)requestWithInput:(SAFlowData *)input completion:(void (^)(BOOL success))
100102
}
101103
}
102104

103-
NSDictionary *dict = [SAJSONUtil JSONObjectWithString:input.json];
104-
SALogDebug(@"%@ %@: %@", self, messageDesc, dict);
105+
NSArray *eventLogs = [self eventLogsWithRecoeds:input.records];
106+
SALogDebug(@"%@ %@: %@", self, messageDesc, eventLogs);
105107

106108
if (statusCode != 200) {
107109
SALogError(@"%@ ret_code: %ld, ret_content: %@", self, statusCode, urlResponseContent);
@@ -144,4 +146,23 @@ - (NSURLRequest *)buildFlushRequestWithInput:(SAFlowData *)input {
144146
return request;
145147
}
146148

149+
- (NSArray<NSDictionary *> *)eventLogsWithRecoeds:(NSArray <SAEventRecord *>*)records {
150+
if (records.count == 0) {
151+
return nil;
152+
}
153+
NSMutableArray <NSDictionary *>*eventSources = [NSMutableArray arrayWithCapacity:records.count];
154+
for (SAEventRecord *record in records) {
155+
if(!record.isEncrypted) {
156+
[eventSources addObject:record.event];
157+
continue;
158+
}
159+
160+
// 针对加密的数据,只需要打印合并后的数据即可
161+
if(record.event[kSAEncryptRecordKeyPayloads]){
162+
[eventSources addObject:record.event];
163+
}
164+
}
165+
return [eventSources copy];
166+
}
167+
147168
@end

SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
#import "SALimitKeyManager.h"
6565
#import "NSDictionary+SACopyProperties.h"
6666

67-
#define VERSION @"4.5.11"
67+
#define VERSION @"4.5.12"
6868

6969
void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag;
7070

SensorsAnalyticsSDK/Encrypt/SAConfigOptions+Encrypt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
3131
/// 是否开启埋点数据上报传输加密
3232
@property (nonatomic, assign) BOOL enableTransportEncrypt API_UNAVAILABLE(macos);
3333

34+
/// 注册埋点加密插件
3435
- (void)registerEncryptor:(id<SAEncryptProtocol>)encryptor API_UNAVAILABLE(macos);
3536

3637
/// 存储公钥的回调。务必保存秘钥所有字段信息

0 commit comments

Comments
 (0)