Skip to content

Commit

Permalink
Release 4.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoyue committed Nov 28, 2024
1 parent a43dc33 commit e5c8c3d
Show file tree
Hide file tree
Showing 39 changed files with 81 additions and 338 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.8.2"
s.version = "4.8.3"
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
10 changes: 1 addition & 9 deletions SensorsAnalyticsSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@
4D762233284627C1006656DD /* SARepeatFlushInterceptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D762231284627C1006656DD /* SARepeatFlushInterceptor.m */; };
4D79695A2609D8FE001B0A6C /* SAEventIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7969582609D8FE001B0A6C /* SAEventIdentifier.h */; };
4D79695B2609D8FE001B0A6C /* SAEventIdentifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7969592609D8FE001B0A6C /* SAEventIdentifier.m */; };
4D7B252A2828AF430080BCF0 /* SACarrierNamePropertyPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7B25282828AF430080BCF0 /* SACarrierNamePropertyPlugin.h */; };
4D7B252B2828AF430080BCF0 /* SACarrierNamePropertyPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7B25292828AF430080BCF0 /* SACarrierNamePropertyPlugin.m */; };
4D958B1A2823D99E0086A71C /* SAFirstDayPropertyPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D958B182823D99E0086A71C /* SAFirstDayPropertyPlugin.h */; };
4D958B1B2823D99E0086A71C /* SAFirstDayPropertyPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D958B192823D99E0086A71C /* SAFirstDayPropertyPlugin.m */; };
4D958B1E2823E0960086A71C /* SAModulePropertyPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D958B1C2823E0960086A71C /* SAModulePropertyPlugin.h */; };
Expand Down Expand Up @@ -298,7 +296,7 @@
88E6BED6278D2930006B1E4C /* SADeviceIDPropertyPluginTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 88E6BED5278D2930006B1E4C /* SADeviceIDPropertyPluginTests.m */; };
88E6BEDD278ECE5E006B1E4C /* SAAppVersionPropertyPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 88E6BEDB278ECE5E006B1E4C /* SAAppVersionPropertyPlugin.h */; };
88E6BEDE278ECE5E006B1E4C /* SAAppVersionPropertyPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 88E6BEDC278ECE5E006B1E4C /* SAAppVersionPropertyPlugin.m */; };
88EC2DF12757689800EF9778 /* SAStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EC2DEF2757689800EF9778 /* SAStoreManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
88EC2DF12757689800EF9778 /* SAStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EC2DEF2757689800EF9778 /* SAStoreManager.h */; };
88EC2DF22757689800EF9778 /* SAStoreManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 88EC2DF02757689800EF9778 /* SAStoreManager.m */; };
88EC2DF4275768C500EF9778 /* SAStorePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EC2DF3275768C500EF9778 /* SAStorePlugin.h */; settings = {ATTRIBUTES = (Public, ); }; };
88EC2DF7275768DE00EF9778 /* SAFileStorePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EC2DF5275768DE00EF9778 /* SAFileStorePlugin.h */; };
Expand Down Expand Up @@ -708,8 +706,6 @@
4D762231284627C1006656DD /* SARepeatFlushInterceptor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SARepeatFlushInterceptor.m; sourceTree = "<group>"; };
4D7969582609D8FE001B0A6C /* SAEventIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SAEventIdentifier.h; sourceTree = "<group>"; };
4D7969592609D8FE001B0A6C /* SAEventIdentifier.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SAEventIdentifier.m; sourceTree = "<group>"; };
4D7B25282828AF430080BCF0 /* SACarrierNamePropertyPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SACarrierNamePropertyPlugin.h; sourceTree = "<group>"; };
4D7B25292828AF430080BCF0 /* SACarrierNamePropertyPlugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SACarrierNamePropertyPlugin.m; sourceTree = "<group>"; };
4D8CE4C622E872B400829B29 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
4D958B182823D99E0086A71C /* SAFirstDayPropertyPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SAFirstDayPropertyPlugin.h; sourceTree = "<group>"; };
4D958B192823D99E0086A71C /* SAFirstDayPropertyPlugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SAFirstDayPropertyPlugin.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1474,8 +1470,6 @@
4DA89BC025C2BC1E003ABA43 /* SAReachability.m */,
457A7CC227DB2AC900DB0512 /* SANetworkInfoPropertyPlugin.h */,
457A7CC327DB2AC900DB0512 /* SANetworkInfoPropertyPlugin.m */,
4D7B25282828AF430080BCF0 /* SACarrierNamePropertyPlugin.h */,
4D7B25292828AF430080BCF0 /* SACarrierNamePropertyPlugin.m */,
);
path = Network;
sourceTree = "<group>";
Expand Down Expand Up @@ -2428,7 +2422,6 @@
4DD1285725F872A4008C0B1E /* SAVisualizedManager.h in Headers */,
A8356DD82656459A00FD64AA /* SAAppClickTracker.h in Headers */,
4D4DB2C725B7D19C00938842 /* SAClassHelper.h in Headers */,
4D7B252A2828AF430080BCF0 /* SACarrierNamePropertyPlugin.h in Headers */,
4DA89BC225C2BC1E003ABA43 /* SAReachability.h in Headers */,
F226E67C28BC6415000443A7 /* UIView+SAElementContent.h in Headers */,
886E1E212726AC420084D1B3 /* SADeviceIDPropertyPlugin.h in Headers */,
Expand Down Expand Up @@ -2851,7 +2844,6 @@
A8BCC4A82686C2D800B72040 /* SAConfigOptions+Encrypt.m in Sources */,
881A41FE253D7B5000854F69 /* SAConstants.m in Sources */,
F277F5CA25CF9A43009B5CE6 /* UIApplication+SAPushClick.m in Sources */,
4D7B252B2828AF430080BCF0 /* SACarrierNamePropertyPlugin.m in Sources */,
881A4195253D7B4F00854F69 /* SAObject+SAConfigOptions.m in Sources */,
4DDF8BB32B972A5F0007D70D /* SAViewElementInfo.m in Sources */,
881A41F9253D7B5000854F69 /* SAConfigOptions.m in Sources */,
Expand Down
3 changes: 2 additions & 1 deletion SensorsAnalyticsSDK/ChannelMatch/SAChannelMatchManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ - (BOOL)isRelinkURL:(NSURL *)url {

- (void)showRelinkAlertWithURL:(NSURL *)url {
NSDictionary *queryItems = [SAURLUtils queryItemsWithURL:url];
NSString *deviceId = [queryItems[@"device_code"] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *deviceId = [queryItems[@"device_code"] stringByRemovingPercentEncoding];

// 重连二维码对应的设备信息
NSMutableSet *deviceIdSet = [NSMutableSet setWithArray:[deviceId componentsSeparatedByString:@"##"]];
// 当前设备的设备信息
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy, nullable) NSString *loginId;

/// 匿名 ID
@property (nonatomic, copy) NSString *anonymousId;
@property (nonatomic, copy, nullable) NSString *anonymousId;

/// 登录事件中的 匿名 ID
@property (nonatomic, copy) NSString *originalId;
Expand Down
1 change: 0 additions & 1 deletion SensorsAnalyticsSDK/Core/Builder/SAPresetPropertyObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ NS_ASSUME_NONNULL_BEGIN
- (NSString *)lib;
- (NSInteger)screenHeight;
- (NSInteger)screenWidth;
- (NSString *)carrier;
- (NSString *)appID;
- (NSString *)appName;
- (NSInteger)timezoneOffset;
Expand Down
4 changes: 0 additions & 4 deletions SensorsAnalyticsSDK/Core/Builder/SAPresetPropertyObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ - (NSInteger)screenWidth {
return 0;
}

- (NSString *)carrier {
return nil;
}

- (NSString *)appID {
return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

NS_ASSUME_NONNULL_BEGIN

/// 根据网络策略,判断是否上报
@interface SACanFlushInterceptor : SAInterceptor

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ - (void)processWithInput:(SAFlowData *)input completion:(SAFlowDataCompletion)co
}

// 判断当前网络类型是否符合同步数据的网络策略
SANetworkInfoPropertyPlugin *carrierPlugin = [[SANetworkInfoPropertyPlugin alloc] init];
if (!([carrierPlugin currentNetworkTypeOptions] & input.configOptions.flushNetworkPolicy)) {
SANetworkInfoPropertyPlugin *networkPlugin = [[SANetworkInfoPropertyPlugin alloc] init];
if (!([networkPlugin currentNetworkTypeOptions] & input.configOptions.flushNetworkPolicy)) {
input.state = SAFlowStateStop;
}
completion(input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

NS_ASSUME_NONNULL_BEGIN

/// HTTPBody 格式构建
@interface SAFlushHTTPBodyInterceptor : SAInterceptor

- (NSDictionary *)buildBodyWithFlowData:(SAFlowData *)flowData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,26 @@ - (void)processWithInput:(SAFlowData *)input completion:(SAFlowDataCompletion)co
NSParameterAssert(input.configOptions);
NSParameterAssert(input.records.count > 0);

input.HTTPBody = [self buildBodyWithInput:input];
NSData *httpBody = [self buildBodyWithInput:input];
if (!httpBody) {
input.state = SAFlowStateError;
input.message = @"Event message base64Encoded or Gzip compression failed, End the track flow";
return completion(input);
}

input.HTTPBody = httpBody;
completion(input);
}

- (NSData *)buildBodyWithInput:(SAFlowData *)input {
NSDictionary *bodyDic = [self buildBodyWithFlowData:input];
if (!bodyDic) {
return nil;
}
NSNumber *gzip = bodyDic[kSAFlushBodyKeyGzip];
NSString *data = bodyDic[kSAFlushBodyKeyData];
int hashCode = [data sensorsdata_hashCode];

data = [data stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet alphanumericCharacterSet]];
NSString *bodyString = [NSString stringWithFormat:@"crc=%d&gzip=%d&data_list=%@", hashCode, [gzip intValue], data];
if (input.isInstantEvent) {
Expand All @@ -58,9 +69,15 @@ - (NSDictionary *)buildBodyWithFlowData:(SAFlowData *)flowData {
NSString *jsonString = flowData.json;
// 使用gzip进行压缩
NSData *zippedData = [SAGzipUtility gzipData:[jsonString dataUsingEncoding:NSUTF8StringEncoding]];
if (!zippedData) {
return nil;
}
// base64
jsonString = [zippedData base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn];
NSDictionary *bodyDic = @{kSAFlushBodyKeyGzip: @(kSAFlushGzipCodePlainText), kSAFlushBodyKeyData: jsonString};
NSString *base64String = [zippedData base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn];
if (!base64String || ![base64String isKindOfClass:NSString.class]) {
return nil;
}
NSDictionary *bodyDic = @{kSAFlushBodyKeyGzip: @(kSAFlushGzipCodePlainText), kSAFlushBodyKeyData: base64String};
return bodyDic;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ - (NSURLRequest *)buildFlushRequestWithInput:(SAFlowData *)input {

NSMutableArray <NSDictionary *>*eventSources = [NSMutableArray arrayWithCapacity:records.count];
for (SAEventRecord *record in records) {
if (!record.event) {
//avoid crash when add object to array
if (![record.event isKindOfClass:[NSDictionary class]]) {
continue;
}
if(!record.isEncrypted) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

NS_ASSUME_NONNULL_BEGIN

// 多条埋点数据拼接组装
@interface SAFlushJSONInterceptor : SAInterceptor

- (NSString *)buildJSONStringWithFlowData:(SAFlowData *)flowData;
Expand Down
31 changes: 0 additions & 31 deletions SensorsAnalyticsSDK/Core/Network/SACarrierNamePropertyPlugin.h

This file was deleted.

172 changes: 0 additions & 172 deletions SensorsAnalyticsSDK/Core/Network/SACarrierNamePropertyPlugin.m

This file was deleted.

Loading

0 comments on commit e5c8c3d

Please sign in to comment.