Skip to content

Commit 4864d5a

Browse files
author
王洋洋
committed
Release 4.5.15
1 parent eab2732 commit 4864d5a

29 files changed

+208
-73
lines changed

SensorsAnalyticsSDK.podspec

Lines changed: 3 additions & 7 deletions
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.14"
3+
s.version = "4.5.15"
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}" }
@@ -27,12 +27,8 @@ Pod::Spec.new do |s|
2727
b.dependency 'SensorsAnalyticsSDK/__Store'
2828
end
2929

30-
s.subspec 'Extension' do |e|
31-
e.dependency 'SensorsAnalyticsSDK/Base'
32-
end
33-
3430
s.subspec 'Common' do |c|
35-
c.dependency 'SensorsAnalyticsSDK/Extension'
31+
c.dependency 'SensorsAnalyticsSDK/Base'
3632
c.public_header_files = 'SensorsAnalyticsSDK/JSBridge/SensorsAnalyticsSDK+JavaScriptBridge.h'
3733
c.source_files = 'SensorsAnalyticsSDK/Core/SAAlertController.{h,m}', 'SensorsAnalyticsSDK/JSBridge/**/*.{h,m}'
3834
c.ios.source_files = 'SensorsAnalyticsSDK/RemoteConfig/**/*.{h,m}', 'SensorsAnalyticsSDK/ChannelMatch/**/*.{h,m}', 'SensorsAnalyticsSDK/Encrypt/**/*.{h,m}', 'SensorsAnalyticsSDK/Deeplink/**/*.{h,m}', 'SensorsAnalyticsSDK/DebugMode/**/*.{h,m}', 'SensorsAnalyticsSDK/Core/SAAlertController.h', 'SensorsAnalyticsSDK/UIRelated/**/*.{h,m}'
@@ -112,7 +108,7 @@ Pod::Spec.new do |s|
112108
end
113109

114110
s.subspec 'ApplicationExtension' do |e|
115-
e.dependency 'SensorsAnalyticsSDK/Extension'
111+
e.dependency 'SensorsAnalyticsSDK/Base'
116112
e.source_files = 'SensorsAnalyticsSDK/AppExtension/*.{h,m}'
117113
e.public_header_files = 'SensorsAnalyticsSDK/AppExtension/SensorsAnalyticsSDK+SAAppExtension.h'
118114
end

SensorsAnalyticsSDK.xcodeproj/xcshareddata/xcschemes/SensorsAnalyticsTests.xcscheme

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55
<BuildAction
66
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "NO"
13+
buildForArchiving = "NO"
14+
buildForAnalyzing = "NO">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "CB6EBAE2228551EC003CFBA8"
18+
BuildableName = "SensorsAnalyticsTests.xctest"
19+
BlueprintName = "SensorsAnalyticsTests"
20+
ReferencedContainer = "container:SensorsAnalyticsSDK.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
824
</BuildAction>
925
<TestAction
1026
buildConfiguration = "Debug"
@@ -42,6 +58,15 @@
4258
savedToolIdentifier = ""
4359
useCustomWorkingDirectory = "NO"
4460
debugDocumentVersioning = "YES">
61+
<MacroExpansion>
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "CB6EBAE2228551EC003CFBA8"
65+
BuildableName = "SensorsAnalyticsTests.xctest"
66+
BlueprintName = "SensorsAnalyticsTests"
67+
ReferencedContainer = "container:SensorsAnalyticsSDK.xcodeproj">
68+
</BuildableReference>
69+
</MacroExpansion>
4570
</ProfileAction>
4671
<AnalyzeAction
4772
buildConfiguration = "Debug">

SensorsAnalyticsSDK/AutoTrack/SAAutoTrackManager.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ - (void)setEnable:(BOOL)enable {
117117

118118
#pragma mark - SAAutoTrackModuleProtocol
119119

120-
- (void)trackAppEndWhenCrashed {
120+
- (void)trackAppEndWhenCrashed NS_EXTENSION_UNAVAILABLE("AppEnd Event not supported for iOS extensions.") {
121121
if (!self.enable) {
122122
return;
123123
}
@@ -131,7 +131,7 @@ - (void)trackAppEndWhenCrashed {
131131
}];
132132
}
133133

134-
- (void)trackPageLeaveWhenCrashed {
134+
- (void)trackPageLeaveWhenCrashed NS_EXTENSION_UNAVAILABLE("PageLeave Event not supported for iOS extensions.") {
135135
if (!self.enable) {
136136
return;
137137
}

SensorsAnalyticsSDK/AutoTrack/SensorsAnalyticsSDK+SAAutoTrack.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ NS_ASSUME_NONNULL_BEGIN
7777
*
7878
* @param aClass View 对应的 Class
7979
*/
80-
- (void)ignoreViewType:(Class)aClass;
80+
- (void)ignoreViewType:(Class)aClass NS_EXTENSION_UNAVAILABLE("AutoTrack not supported for iOS extensions.");
8181

8282
/**
8383
* @abstract
@@ -95,7 +95,7 @@ NS_ASSUME_NONNULL_BEGIN
9595
*
9696
* @param controllers controller ‘字符串’数组
9797
*/
98-
- (void)ignoreAutoTrackViewControllers:(NSArray<NSString *> *)controllers;
98+
- (void)ignoreAutoTrackViewControllers:(NSArray<NSString *> *)controllers NS_EXTENSION_UNAVAILABLE("AutoTrack not supported for iOS extensions.");
9999

100100
/**
101101
* @abstract
@@ -156,7 +156,7 @@ NS_ASSUME_NONNULL_BEGIN
156156
* https://sensorsdata.cn/manual/ios_sdk.html
157157
* 该功能默认关闭
158158
*/
159-
- (void)enableAutoTrack:(SensorsAnalyticsAutoTrackEventType)eventType __attribute__((deprecated("已过时,请参考 SAConfigOptions 类的 autoTrackEventType")));
159+
- (void)enableAutoTrack:(SensorsAnalyticsAutoTrackEventType)eventType __attribute__((deprecated("已过时,请参考 SAConfigOptions 类的 autoTrackEventType"))) NS_EXTENSION_UNAVAILABLE("AutoTrack not supported for iOS extensions.");
160160

161161
@end
162162

SensorsAnalyticsSDK/ChannelMatch/SAChannelMatchManager.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ - (void)hideIndicator {
111111
_window = nil;
112112
}
113113

114-
- (UIWindow *)alertWindow {
114+
- (UIWindow *)alertWindow NS_EXTENSION_UNAVAILABLE("App Alert not supported for iOS extensions.") {
115115
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000)
116116
if (@available(iOS 13.0, *)) {
117117
__block UIWindowScene *scene = nil;

SensorsAnalyticsSDK/ChannelMatch/SensorsAnalyticsSDK+SAChannelMatch.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ NS_ASSUME_NONNULL_BEGIN
2929
3030
@param event event 的名称
3131
*/
32-
- (void)trackChannelEvent:(NSString *)event;
32+
- (void)trackChannelEvent:(NSString *)event NS_EXTENSION_UNAVAILABLE("ChannelMatch not supported for iOS extensions.");
3333

3434
/**
3535
调用 track 接口并附加渠道信息
3636
3737
@param event event 的名称
3838
@param propertyDict event 的属性
3939
*/
40-
- (void)trackChannelEvent:(NSString *)event properties:(nullable NSDictionary *)propertyDict;
40+
- (void)trackChannelEvent:(NSString *)event properties:(nullable NSDictionary *)propertyDict NS_EXTENSION_UNAVAILABLE("ChannelMatch not supported for iOS extensions.");
4141

4242
/**
4343
* @abstract
@@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
4646
* @discussion
4747
* 注意:如果之前使用 - trackInstallation: 触发的激活事件,需要继续保持原来的调用,无需改成 - trackAppInstall: ,否则会导致激活事件数据分离。
4848
*/
49-
- (void)trackAppInstall;
49+
- (void)trackAppInstall NS_EXTENSION_UNAVAILABLE("ChannelMatch not supported for iOS extensions.");
5050

5151
/**
5252
* @abstract
@@ -57,7 +57,7 @@ NS_ASSUME_NONNULL_BEGIN
5757
*
5858
* @param properties 激活事件的属性
5959
*/
60-
- (void)trackAppInstallWithProperties:(nullable NSDictionary *)properties;
60+
- (void)trackAppInstallWithProperties:(nullable NSDictionary *)properties NS_EXTENSION_UNAVAILABLE("ChannelMatch not supported for iOS extensions.");
6161

6262
/**
6363
* @abstract
@@ -69,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN
6969
* @param properties 激活事件的属性
7070
* @param disableCallback 是否关闭这次渠道匹配的回调请求
7171
*/
72-
- (void)trackAppInstallWithProperties:(nullable NSDictionary *)properties disableCallback:(BOOL)disableCallback;
72+
- (void)trackAppInstallWithProperties:(nullable NSDictionary *)properties disableCallback:(BOOL)disableCallback NS_EXTENSION_UNAVAILABLE("ChannelMatch not supported for iOS extensions.");
7373

7474
/**
7575
* @abstract
@@ -81,7 +81,7 @@ NS_ASSUME_NONNULL_BEGIN
8181
*
8282
* @param event event 的名称
8383
*/
84-
- (void)trackInstallation:(NSString *)event;
84+
- (void)trackInstallation:(NSString *)event NS_EXTENSION_UNAVAILABLE("ChannelMatch not supported for iOS extensions.");
8585

8686
/**
8787
* @abstract
@@ -98,7 +98,7 @@ NS_ASSUME_NONNULL_BEGIN
9898
* @param event event 的名称
9999
* @param propertyDict event 的属性
100100
*/
101-
- (void)trackInstallation:(NSString *)event withProperties:(nullable NSDictionary *)propertyDict;
101+
- (void)trackInstallation:(NSString *)event withProperties:(nullable NSDictionary *)propertyDict NS_EXTENSION_UNAVAILABLE("ChannelMatch not supported for iOS extensions.");
102102

103103
/**
104104
* @abstract
@@ -116,7 +116,7 @@ NS_ASSUME_NONNULL_BEGIN
116116
* @param propertyDict event 的属性
117117
* @param disableCallback 是否关闭这次渠道匹配的回调请求
118118
*/
119-
- (void)trackInstallation:(NSString *)event withProperties:(nullable NSDictionary *)propertyDict disableCallback:(BOOL)disableCallback;
119+
- (void)trackInstallation:(NSString *)event withProperties:(nullable NSDictionary *)propertyDict disableCallback:(BOOL)disableCallback NS_EXTENSION_UNAVAILABLE("ChannelMatch not supported for iOS extensions.");
120120

121121
@end
122122

SensorsAnalyticsSDK/Core/NSString+SAHashCode.m

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,16 @@
2828
@implementation NSString (HashCode)
2929

3030
- (int)sensorsdata_hashCode {
31-
int hash = 0;
32-
for (int i = 0; i<[self length]; i++) {
33-
NSString *s = [self substringWithRange:NSMakeRange(i, 1)];
34-
char *unicode = (char *)[s cStringUsingEncoding:NSUnicodeStringEncoding];
35-
int charactorUnicode = 0;
36-
37-
size_t length = strnlen(unicode, 4);
38-
for (int n = 0; n < length; n ++) {
39-
charactorUnicode += (int)((unicode[n] & 0xff) << (n * sizeof(char) * 8));
40-
}
41-
hash = hash * 31 + charactorUnicode;
31+
int hashCode = 0;
32+
NSUInteger length = [self length];
33+
if (length == 0) {
34+
return hashCode;
35+
}
36+
for (NSUInteger i = 0; i < length; i++) {
37+
unichar character = [self characterAtIndex:i];
38+
hashCode = hashCode * 31 + (int)character;
4239
}
43-
44-
return hash;
40+
return hashCode;
4541
}
42+
4643
@end

SensorsAnalyticsSDK/Core/SAAlertController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ - (void)showAlertController {
114114
[self presentViewController:alertController animated:YES completion:nil];
115115
}
116116

117-
- (UIWindow *)currentAlertWindow {
117+
- (UIWindow *)currentAlertWindow NS_EXTENSION_UNAVAILABLE("App Alert not supported for iOS extensions.") {
118118
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000)
119119
if (@available(iOS 13.0, *)) {
120120
__block UIWindowScene *scene = nil;

SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Public.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ extern NSString * const SensorsAnalyticsIdentityKeyEmail;
123123
* @param serverUrl 当前的 serverUrl
124124
* @param isRequestRemoteConfig 是否请求远程配置
125125
*/
126-
- (void)setServerUrl:(NSString *)serverUrl isRequestRemoteConfig:(BOOL)isRequestRemoteConfig API_UNAVAILABLE(macos);
126+
- (void)setServerUrl:(NSString *)serverUrl isRequestRemoteConfig:(BOOL)isRequestRemoteConfig API_UNAVAILABLE(macos) NS_EXTENSION_UNAVAILABLE("RemoteConfig not supported for iOS extensions.");
127127

128128
#pragma mark--cache and flush
129129

@@ -465,15 +465,15 @@ extern NSString * const SensorsAnalyticsIdentityKeyEmail;
465465
* @param url 打开的 URL
466466
* @return YES/NO
467467
*/
468-
- (BOOL)canHandleURL:(NSURL *)url API_UNAVAILABLE(macos);
468+
- (BOOL)canHandleURL:(NSURL *)url API_UNAVAILABLE(macos) NS_EXTENSION_UNAVAILABLE("HandleURL not supported for iOS extensions.");
469469

470470
/**
471471
* @abstract
472472
* 处理 url scheme 跳转打开 App
473473
*
474474
* @param url 打开本 app 的回调的 url
475475
*/
476-
- (BOOL)handleSchemeUrl:(NSURL *)url API_UNAVAILABLE(macos);
476+
- (BOOL)handleSchemeUrl:(NSURL *)url API_UNAVAILABLE(macos) NS_EXTENSION_UNAVAILABLE("HandleURL not supported for iOS extensions.");
477477

478478
#pragma mark - profile
479479
/**
@@ -624,7 +624,7 @@ extern NSString * const SensorsAnalyticsIdentityKeyEmail;
624624
* 注意:清除 keychain 中 kSAService 名下的数据,包括 distinct_id 标记。
625625
*
626626
*/
627-
- (void)clearKeychainData API_UNAVAILABLE(macos);
627+
- (void)clearKeychainData API_UNAVAILABLE(macos) NS_EXTENSION_UNAVAILABLE("KeychainData not supported for iOS extensions.");
628628

629629
@end
630630

@@ -692,7 +692,7 @@ extern NSString * const SensorsAnalyticsIdentityKeyEmail;
692692
目前 DebugMode 为动态开启,详细请参考说明文档:https://www.sensorsdata.cn/manual/ios_sdk.html
693693
@param debugMode 调试模式
694694
*/
695-
- (void)setDebugMode:(SensorsAnalyticsDebugMode)debugMode __attribute__((deprecated("已过时,建议动态开启调试模式"))) API_UNAVAILABLE(macos);
695+
- (void)setDebugMode:(SensorsAnalyticsDebugMode)debugMode __attribute__((deprecated("已过时,建议动态开启调试模式"))) API_UNAVAILABLE(macos) NS_EXTENSION_UNAVAILABLE("DebugMode not supported for iOS extensions.");
696696

697697
/**
698698
* @abstract

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.14"
67+
#define VERSION @"4.5.15"
6868

6969
void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag;
7070

0 commit comments

Comments
 (0)