Skip to content

Commit

Permalink
Release 4.5.12
Browse files Browse the repository at this point in the history
  • Loading branch information
王洋洋 committed Jun 19, 2023
1 parent 6592644 commit 9525dc5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SensorsAnalyticsSDK"
s.version = "4.5.11"
s.version = "4.5.12"
s.summary = "The official iOS SDK of Sensors Analytics."
s.homepage = "http://www.sensorsdata.cn"
s.source = { :git => 'https://github.com/sensorsdata/sa-sdk-ios.git', :tag => "v#{s.version}" }
Expand Down
5 changes: 4 additions & 1 deletion SensorsAnalyticsSDK/Core/Flow/SAFlowData.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ typedef void(^SAFlowDataCompletion)(SAFlowData *output);

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

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

Expand Down
25 changes: 23 additions & 2 deletions SensorsAnalyticsSDK/Core/Interceptor/Flush/SAFlushInterceptor.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#import "SAModuleManager.h"
#import "SAURLUtils.h"
#import "SAJSONUtil.h"
#import "SAEventRecord.h"
#import "SensorsAnalyticsSDK+Private.h"
#import "SAConstants+Private.h"
#import "SALog.h"

NSString * const kSAFlushServerURL = @"serverURL";
Expand Down Expand Up @@ -100,8 +102,8 @@ - (void)requestWithInput:(SAFlowData *)input completion:(void (^)(BOOL success))
}
}

NSDictionary *dict = [SAJSONUtil JSONObjectWithString:input.json];
SALogDebug(@"%@ %@: %@", self, messageDesc, dict);
NSArray *eventLogs = [self eventLogsWithRecoeds:input.records];
SALogDebug(@"%@ %@: %@", self, messageDesc, eventLogs);

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

- (NSArray<NSDictionary *> *)eventLogsWithRecoeds:(NSArray <SAEventRecord *>*)records {
if (records.count == 0) {
return nil;
}
NSMutableArray <NSDictionary *>*eventSources = [NSMutableArray arrayWithCapacity:records.count];
for (SAEventRecord *record in records) {
if(!record.isEncrypted) {
[eventSources addObject:record.event];
continue;
}

// 针对加密的数据,只需要打印合并后的数据即可
if(record.event[kSAEncryptRecordKeyPayloads]){
[eventSources addObject:record.event];
}
}
return [eventSources copy];
}

@end
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#import "SALimitKeyManager.h"
#import "NSDictionary+SACopyProperties.h"

#define VERSION @"4.5.11"
#define VERSION @"4.5.12"

void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag;

Expand Down
1 change: 1 addition & 0 deletions SensorsAnalyticsSDK/Encrypt/SAConfigOptions+Encrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 是否开启埋点数据上报传输加密
@property (nonatomic, assign) BOOL enableTransportEncrypt API_UNAVAILABLE(macos);

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

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

0 comments on commit 9525dc5

Please sign in to comment.