Skip to content

Commit

Permalink
Release 4.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
王洋洋 committed Jul 14, 2022
1 parent b3144e4 commit 0387b24
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 20 deletions.
4 changes: 2 additions & 2 deletions 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.4.0"
s.version = "4.4.1"
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 All @@ -22,7 +22,7 @@ Pod::Spec.new do |s|
core_dir = "SensorsAnalyticsSDK/Core/"
b.source_files = core_dir + "**/*.{h,m}"
b.exclude_files = core_dir + "SAAlertController.h", core_dir + "SAAlertController.m"
b.public_header_files = core_dir + "SensorsAnalyticsSDK.h", core_dir + "SensorsAnalyticsSDK+Public.h", core_dir + "SASecurityPolicy.h", core_dir + "SAConfigOptions.h", core_dir + "SAConstants.h", core_dir + "PropertyPlugin/SAPropertyPluginProtocol.h"
b.public_header_files = core_dir + "SensorsAnalyticsSDK.h", core_dir + "SensorsAnalyticsSDK+Public.h", core_dir + "SASecurityPolicy.h", core_dir + "SAConfigOptions.h", core_dir + "SAConstants.h", core_dir + "PropertyPlugin/SAPropertyPlugin.h"
b.resource = 'SensorsAnalyticsSDK/SensorsAnalyticsSDK.bundle'
b.ios.frameworks = 'CoreTelephony'
b.dependency 'SensorsAnalyticsSDK/__Store'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ - (void)requestWithInput:(SAFlowData *)input completion:(void (^)(BOOL success))
SAURLSessionTaskCompletionHandler handler = ^(NSData * _Nullable data, NSHTTPURLResponse * _Nullable response, NSError * _Nullable error) {
if (error || ![response isKindOfClass:[NSHTTPURLResponse class]]) {
input.message = [NSString stringWithFormat:@"%@ network failure: %@", self, error ? error : @"Unknown error"];
input.state = SAFlowStateStop;
return completion(NO);
}

Expand Down Expand Up @@ -115,9 +114,8 @@ - (void)requestWithInput:(SAFlowData *)input completion:(void (^)(BOOL success))
BOOL flushSuccess = input.configOptions.debugMode != SensorsAnalyticsDebugOff || successCode;
if (!flushSuccess) {
input.message = [NSString stringWithFormat:@"flush failed, statusCode: %ld",statusCode];
input.state = SAFlowStateStop;
}
completion(YES);
completion(flushSuccess);
};

NSURLRequest *request = [self buildFlushRequestWithInput:input];
Expand Down
2 changes: 0 additions & 2 deletions SensorsAnalyticsSDK/Core/PropertyPlugin/SAPropertyPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ typedef NS_ENUM(NSUInteger, SAPropertyPluginPriority) {
@property (nonatomic, copy, readonly) NSString *event;
@property (nonatomic, assign, readonly) SAEventType type;
@property (nonatomic, assign, readonly) UInt64 time;
/// 开机时间,用于统计事件时长
@property (nonatomic, assign, readonly) UInt64 currentSystemUpTime;

@property (nonatomic, strong, readonly) id<SAPropertyPluginLibFilter> lib;

Expand Down
5 changes: 0 additions & 5 deletions SensorsAnalyticsSDK/Core/SAConfigOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,9 @@ @interface SAConfigOptions ()<NSCopying>
@property (nonatomic, assign) BOOL enableDeviceOrientation;
@property (nonatomic, assign) BOOL enableRemoteConfig;
@property (nonatomic, assign) BOOL enableChannelMatch;
@property (nonatomic, assign) BOOL enableDebugMode;
@property (nonatomic, assign) BOOL enableDeepLink;
@property (nonatomic, assign) BOOL enableAutoTrack;

//@property (nonatomic) SensorsAnalyticsDebugMode debugMode;

@end

@implementation SAConfigOptions
Expand Down Expand Up @@ -111,7 +108,6 @@ - (instancetype)initWithServerURL:(NSString *)serverURL launchOptions:(id)launch
//default private switch
_enableRemoteConfig = YES;
_enableChannelMatch = YES;
_enableDebugMode = YES;
_enableDeepLink = YES;
_enableAutoTrack = YES;

Expand Down Expand Up @@ -178,7 +174,6 @@ - (id)copyWithZone:(nullable NSZone *)zone {
//private switch
options.enableRemoteConfig = self.enableRemoteConfig;
options.enableChannelMatch = self.enableChannelMatch;
options.enableDebugMode = self.enableDebugMode;
options.enableDeepLink = self.enableDeepLink;
options.enableAutoTrack = self.enableAutoTrack;
options.customADChannelURL = self.customADChannelURL;
Expand Down
3 changes: 0 additions & 3 deletions SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@
/// 需要在队列外执行
- (void)buildDynamicSuperProperties;

/// 注册属性插件
- (void)registerPropertyPlugin:(SAPropertyPlugin *)plugin;

#pragma mark - property
@property (nonatomic, strong, readonly) SAConfigOptions *configOptions;
@property (nonatomic, strong, readonly) SANetwork *network;
Expand Down
9 changes: 9 additions & 0 deletions SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Public.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#import <Foundation/Foundation.h>
#import "SAConstants.h"
#import "SAPropertyPlugin.h"

@class SASecurityPolicy;
@class SAConfigOptions;
Expand Down Expand Up @@ -417,6 +418,14 @@ extern NSString * const SensorsAnalyticsIdentityKeyEmail;
*/
- (NSDictionary *)currentSuperProperties;

/**
* @abstract
* 注册属性插件
*
* @param plugin 属性插件对象
*/
- (void)registerPropertyPlugin:(SAPropertyPlugin *)plugin;

/**
* @abstract
* 得到 SDK 的版本
Expand Down
7 changes: 6 additions & 1 deletion SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#import "SASessionPropertyPlugin.h"
#import "SAEventStore.h"

#define VERSION @"4.4.0"
#define VERSION @"4.4.1"

void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag;

Expand Down Expand Up @@ -1188,6 +1188,11 @@ - (void)trackFromH5WithEventObject:(SABaseEventObject *)object properties:(NSDic
#pragma mark - Deprecated
@implementation SensorsAnalyticsSDK (Deprecated)

// 广告 SDK 调用,暂时保留
- (void)asyncTrackEventObject:(SABaseEventObject *)object properties:(NSDictionary *)properties {
[self trackEventObject:object properties:properties];
}

- (NSInteger)flushInterval {
@synchronized(self) {
return self.configOptions.flushInterval;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#import "SAEventDurationPropertyPlugin.h"
#import "SAConstants+Private.h"
#import "SAPropertyPlugin+SAPrivate.h"
#import "SABaseEventObject.h"

@interface SAEventDurationPropertyPlugin()
@property (nonatomic, weak) SATrackTimer *trackTimer;
Expand Down Expand Up @@ -57,10 +58,12 @@ - (SAPropertyPluginPriority)priority {
}

- (NSDictionary<NSString *,id> *)properties {
if (!self.filter) {
if (![self.filter isKindOfClass:SABaseEventObject.class]) {
return nil;
}
NSNumber *eventDuration = [self.trackTimer eventDurationFromEventId:self.filter.event currentSysUpTime:self.filter.currentSystemUpTime];

SABaseEventObject *eventObject = (SABaseEventObject *)self.filter;
NSNumber *eventDuration = [self.trackTimer eventDurationFromEventId:eventObject.eventId currentSysUpTime:eventObject.currentSystemUpTime];
if (!eventDuration) {
return nil;
}
Expand Down
7 changes: 7 additions & 0 deletions SensorsAnalyticsSDK/DebugMode/SADebugModeManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ - (void)setConfigOptions:(SAConfigOptions *)configOptions {
self.enable = configOptions.debugMode != SensorsAnalyticsDebugOff;
}

- (BOOL)isEnable {
if ([SAApplication isAppExtension]) {
return NO;
}
return self.configOptions.debugMode != SensorsAnalyticsDebugOff;
}

#pragma mark - SAOpenURLProtocol

- (BOOL)canHandleURL:(nonnull NSURL *)url {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 禁用默认初始化
- (instancetype)init NS_UNAVAILABLE;
/// 禁用默认初始化
- (instancetype)new NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

/// 加载配置
- (void)loadConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 禁用默认初始化
- (instancetype)init NS_UNAVAILABLE;
/// 禁用默认初始化
- (instancetype)new NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

/// 视图添加或移除
- (void)didMoveToSuperviewWithView:(UIView *)view;
Expand Down

0 comments on commit 0387b24

Please sign in to comment.