Skip to content

Commit

Permalink
Release 3.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
zhujg-00 committed Aug 21, 2021
1 parent b2278ec commit 90a3da5
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Example/SensorsData/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

SAConfigOptions *options = [[SAConfigOptions alloc] initWithServerURL:Sa_Default_ServerURL launchOptions:launchOptions];
options.autoTrackEventType = SensorsAnalyticsEventTypeAppStart | SensorsAnalyticsEventTypeAppEnd | SensorsAnalyticsEventTypeAppClick | SensorsAnalyticsEventTypeAppViewScreen;
options.flushNetworkPolicy = SensorsAnalyticsNetworkTypeALL;
options.enableTrackAppCrash = YES;
// options.flushInterval = 10 * 1000;
// options.flushBulkSize = 100;
Expand All @@ -60,7 +61,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[[SensorsAnalyticsSDK sharedInstance] trackAppInstallWithProperties:@{@"testValue" : @"testKey"}];
//[[SensorsAnalyticsSDK sharedInstance] addHeatMapViewControllers:[NSArray arrayWithObject:@"DemoController"]];

[[SensorsAnalyticsSDK sharedInstance] setFlushNetworkPolicy:SensorsAnalyticsNetworkTypeALL];
[[SensorsAnalyticsSDK sharedInstance] enableTrackScreenOrientation:YES];
[[SensorsAnalyticsSDK sharedInstance] enableTrackGPSLocation:YES];

Expand Down
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 = "3.1.2"
s.version = "3.1.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
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ - (void)addCustomProperties:(NSDictionary *)properties error:(NSError **)error {
id originalTime = self.properties[kSAEventCommonOptionalPropertyTime];
if ([originalTime isKindOfClass:NSDate.class]) {
NSDate *customTime = (NSDate *)originalTime;
NSInteger customTimeInt = [customTime timeIntervalSince1970] * 1000;
int64_t customTimeInt = [customTime timeIntervalSince1970] * 1000;
if (customTimeInt >= kSAEventCommonOptionalPropertyTimeInt) {
self.timeStamp = customTimeInt;
} else {
SALogError(@"$time error %ld, Please check the value", (long)customTimeInt);
SALogError(@"$time error %lld, Please check the value", customTimeInt);
}
} else if (originalTime) {
SALogError(@"$time '%@' invalid, Please check the value", originalTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ - (id)sensorsdata_propertyValueWithKey:(NSString *)key error:(NSError *__autorel
@implementation NSDate (SAProperty)

- (id)sensorsdata_propertyValueWithKey:(NSString *)key error:(NSError *__autoreleasing _Nullable *)error {
NSDateFormatter *dateFormatter = [SADateFormatter dateFormatterFromString:kSAEventDateFormatter];
return [dateFormatter stringFromDate:self];
return self;
}

@end
Expand Down
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK/Core/SAConfigOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 是否在手动埋点事件中自动添加渠道匹配信息
@property (nonatomic, assign) BOOL enableAutoAddChannelCallbackEvent API_UNAVAILABLE(macos);

/// App 进入后台时,是否执行 flush 将数据发送到 SensrosAnalytics,默认为 YES
/// App 进入后台时是否等待数据发送结果。默认 YES,会等待数据发送结果;设置 NO,不会等待数据发送结果
@property (nonatomic, assign) BOOL flushBeforeEnterBackground;

/// 是否开启加密
Expand Down
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK/Core/SAConstants+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ extern NSString * const kSAEventPropertyAppRemoteConfig;
extern NSString * const kSAEventCommonOptionalPropertyProject;
extern NSString * const kSAEventCommonOptionalPropertyToken;
extern NSString * const kSAEventCommonOptionalPropertyTime;
extern long long const kSAEventCommonOptionalPropertyTimeInt;
extern int64_t const kSAEventCommonOptionalPropertyTimeInt;

#pragma mark--lib method
extern NSString * const kSALibMethodAuto;
Expand Down
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK/Core/SAConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
NSString * const kSAEventCommonOptionalPropertyToken = @"$token";
NSString * const kSAEventCommonOptionalPropertyTime = @"$time";
//神策成立时间,2015-05-15 10:24:00.000,某些时间戳判断(毫秒)
long long const kSAEventCommonOptionalPropertyTimeInt = 1431656640000;
int64_t const kSAEventCommonOptionalPropertyTimeInt = 1431656640000;

#pragma mark--lib method
NSString * const kSALibMethodAuto = @"autoTrack";
Expand Down
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#import "SAProfileEventObject.h"
#import "SAJSONUtil.h"

#define VERSION @"3.1.2"
#define VERSION @"3.1.3"

void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag;

Expand Down
11 changes: 10 additions & 1 deletion SensorsAnalyticsSDK/Encrypt/SAEncryptManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,16 @@ - (BOOL)handleURL:(nonnull NSURL *)url {
NSString *decodeKey = [urlKey hasPrefix:kSAEncryptECCPrefix] ? [urlKey substringFromIndex:kSAEncryptECCPrefix.length] : urlKey;

if ([loadVersion isEqualToString:urlVersion] && [currentKey isEqualToString:decodeKey]) {
message = @"密钥验证通过,所选密钥与 App 端密钥相同";
NSString *asymmetricType = [paramDic[@"asymmetricEncryptType"] stringByRemovingPercentEncoding];
NSString *symmetricType = [paramDic[@"symmetricEncryptType"] stringByRemovingPercentEncoding];
BOOL typeMatched = [secretKey.asymmetricEncryptType isEqualToString:asymmetricType] &&
[secretKey.symmetricEncryptType isEqualToString:symmetricType];
// 这里为了兼容老版本 SA 未下发秘钥类型,当某一个类型不存在时即当做老版本 SA 处理
if (!asymmetricType || !symmetricType || typeMatched) {
message = @"密钥验证通过,所选密钥与 App 端密钥相同";
} else {
message = [NSString stringWithFormat:@"密钥验证不通过,所选密钥与 App 端密钥不相同。所选密钥对称算法类型:%@,非对称算法类型:%@, App 端对称算法类型:%@, 非对称算法类型:%@", symmetricType, asymmetricType, secretKey.symmetricEncryptType, secretKey.asymmetricEncryptType];
}
} else if (![SAValidator isValidString:currentKey]) {
message = @"密钥验证不通过,App 端密钥为空";
} else {
Expand Down
7 changes: 1 addition & 6 deletions SensorsAnalyticsSDK/RemoteConfig/SARemoteConfigManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ - (void)setEnable:(BOOL)enable {

if (enable) {
self.operator = [[SARemoteConfigCommonOperator alloc] initWithConfigOptions:self.configOptions remoteConfigModel:nil];
[self tryToRequestRemoteConfig];
} else {
self.operator = nil;
}
Expand All @@ -71,12 +72,6 @@ - (void)appLifecycleStateWillChange:(NSNotification *)sender {
SAAppLifecycleState newState = [userInfo[kSAAppLifecycleNewStateKey] integerValue];
SAAppLifecycleState oldState = [userInfo[kSAAppLifecycleOldStateKey] integerValue];

// 冷启动
if (oldState == SAAppLifecycleStateInit && newState == SAAppLifecycleStateStart) {
[self tryToRequestRemoteConfig];
return;
}

// 热启动
if (oldState != SAAppLifecycleStateInit && newState == SAAppLifecycleStateStart) {
[self enableLocalRemoteConfig];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,6 @@ - (NSString *)description {
return [description copy];
}

- (void)dealloc {
// 释放绑定在 view 上的子节点
for (SAViewNode *node in self.subNodes) {
node.view.sensorsdata_viewNode = nil;
}
}

@end

@implementation SASegmentNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,4 @@ - (UIView *)viewWithPropertyConfig:(SAVisualPropertiesPropertyConfig *)config vi
return resultView;
}

- (void)dealloc {
// 释放 rootNode 绑定在 view 上的子节点
for (SAViewNode *node in self.rootNode.subNodes) {
node.view.sensorsdata_viewNode = nil;
}
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ - (void)setSensorsdata_viewNode:(SAViewNode *)sensorsdata_viewNode {
}

- (SAViewNode *)sensorsdata_viewNode {
// 自定义属性被关闭,就不再操作 viewNode
if (!SAVisualizedManager.sharedInstance.visualPropertiesTracker) {
return nil;
}
return objc_getAssociatedObject(self, kSAViewNodePropertyName);
}

Expand Down

0 comments on commit 90a3da5

Please sign in to comment.