Skip to content

Commit

Permalink
Release 4.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
王洋洋 committed Aug 18, 2022
1 parent f6c9585 commit f6420b6
Show file tree
Hide file tree
Showing 14 changed files with 685 additions and 3 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.2"
s.version = "4.4.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 Expand Up @@ -37,7 +37,7 @@ Pod::Spec.new do |s|
c.public_header_files = 'SensorsAnalyticsSDK/JSBridge/SensorsAnalyticsSDK+JavaScriptBridge.h'
c.source_files = 'SensorsAnalyticsSDK/Core/SAAlertController.{h,m}', 'SensorsAnalyticsSDK/JSBridge/**/*.{h,m}'
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'
c.ios.public_header_files = 'SensorsAnalyticsSDK/{Encrypt,RemoteConfig,ChannelMatch,Deeplink,DebugMode}/{SAConfigOptions,SensorsAnalyticsSDK}+*.h', 'SensorsAnalyticsSDK/Encrypt/SAEncryptProtocol.h', 'SensorsAnalyticsSDK/Encrypt/SASecretKey.h'
c.ios.public_header_files = 'SensorsAnalyticsSDK/{Encrypt,RemoteConfig,ChannelMatch,Deeplink,DebugMode}/{SAConfigOptions,SensorsAnalyticsSDK}+*.h', 'SensorsAnalyticsSDK/Encrypt/SAEncryptProtocol.h', 'SensorsAnalyticsSDK/Encrypt/SASecretKey.h', 'SensorsAnalyticsSDK/Deeplink/SASlinkCreator.h'
end

s.subspec 'Core' do |c|
Expand Down
16 changes: 16 additions & 0 deletions SensorsAnalyticsSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@
F2B643F62832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = F2B643F42832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.h */; settings = {ATTRIBUTES = (Public, ); }; };
F2B643F72832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = F2B643F52832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.m */; };
F2CFD14726EB04A8007A9253 /* SAConfigOptions+RemoteConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = F2CFD14526EB04A8007A9253 /* SAConfigOptions+RemoteConfig.h */; settings = {ATTRIBUTES = (Public, ); }; };
F2E364872876EE94008D9151 /* SASlinkCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = F2E364852876EE94008D9151 /* SASlinkCreator.h */; settings = {ATTRIBUTES = (Public, ); }; };
F2E364882876EE94008D9151 /* SASlinkCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = F2E364862876EE94008D9151 /* SASlinkCreator.m */; };
F2E36483287682E6008D9151 /* SADeviceWhiteList.h in Headers */ = {isa = PBXBuildFile; fileRef = F2E36481287682E6008D9151 /* SADeviceWhiteList.h */; };
F2E36484287682E6008D9151 /* SADeviceWhiteList.m in Sources */ = {isa = PBXBuildFile; fileRef = F2E36482287682E6008D9151 /* SADeviceWhiteList.m */; };
F2E4AB9D26EC86C800BA7F01 /* SensorsAnalyticsSDK+Location.h in Headers */ = {isa = PBXBuildFile; fileRef = F2E4AB9B26EC86C800BA7F01 /* SensorsAnalyticsSDK+Location.h */; settings = {ATTRIBUTES = (Public, ); }; };
F2E4AB9E26EC86C800BA7F01 /* SensorsAnalyticsSDK+Location.m in Sources */ = {isa = PBXBuildFile; fileRef = F2E4AB9C26EC86C800BA7F01 /* SensorsAnalyticsSDK+Location.m */; };
F2E4ABA126ECAA8600BA7F01 /* SensorsAnalyticsSDK+DeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = F2E4AB9F26ECAA8600BA7F01 /* SensorsAnalyticsSDK+DeviceOrientation.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -941,6 +945,10 @@
F2B643F42832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SensorsAnalyticsSDK+SAAppExtension.h"; sourceTree = "<group>"; };
F2B643F52832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SensorsAnalyticsSDK+SAAppExtension.m"; sourceTree = "<group>"; };
F2CFD14526EB04A8007A9253 /* SAConfigOptions+RemoteConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SAConfigOptions+RemoteConfig.h"; sourceTree = "<group>"; };
F2E364852876EE94008D9151 /* SASlinkCreator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SASlinkCreator.h; sourceTree = "<group>"; };
F2E364862876EE94008D9151 /* SASlinkCreator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SASlinkCreator.m; sourceTree = "<group>"; };
F2E36481287682E6008D9151 /* SADeviceWhiteList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SADeviceWhiteList.h; sourceTree = "<group>"; };
F2E36482287682E6008D9151 /* SADeviceWhiteList.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SADeviceWhiteList.m; sourceTree = "<group>"; };
F2E4AB9B26EC86C800BA7F01 /* SensorsAnalyticsSDK+Location.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SensorsAnalyticsSDK+Location.h"; sourceTree = "<group>"; };
F2E4AB9C26EC86C800BA7F01 /* SensorsAnalyticsSDK+Location.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SensorsAnalyticsSDK+Location.m"; sourceTree = "<group>"; };
F2E4AB9F26ECAA8600BA7F01 /* SensorsAnalyticsSDK+DeviceOrientation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SensorsAnalyticsSDK+DeviceOrientation.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1818,6 +1826,10 @@
A8BCC4D826872A3F00B72040 /* SADeepLinkManager.m */,
F2E4ABA326ECAC5400BA7F01 /* SensorsAnalyticsSDK+DeepLink.h */,
F2E4ABA426ECAC5400BA7F01 /* SensorsAnalyticsSDK+DeepLink.m */,
F2E364852876EE94008D9151 /* SASlinkCreator.h */,
F2E364862876EE94008D9151 /* SASlinkCreator.m */,
F2E36481287682E6008D9151 /* SADeviceWhiteList.h */,
F2E36482287682E6008D9151 /* SADeviceWhiteList.m */,
);
path = Deeplink;
sourceTree = "<group>";
Expand Down Expand Up @@ -2109,6 +2121,7 @@
4DD1284B25F872A4008C0B1E /* SAWebElementView.h in Headers */,
F277F5C925CF9A43009B5CE6 /* SANotificationUtil.h in Headers */,
A8CC223E2685E50C00E96A03 /* SARemoteConfigModel.h in Headers */,
F2E36483287682E6008D9151 /* SADeviceWhiteList.h in Headers */,
881A41A0253D7B4F00854F69 /* SensorsAnalyticsSDK+Private.h in Headers */,
A8356DC22656459A00FD64AA /* SensorsAnalyticsSDK+SAAutoTrack.h in Headers */,
F2066973271FFEE10002ABDF /* UIViewController+SAPageLeave.h in Headers */,
Expand Down Expand Up @@ -2184,6 +2197,7 @@
F277F5C325CF9A43009B5CE6 /* UIApplication+SAPushClick.h in Headers */,
FCBECDF727DEDF6400361D6C /* SADeepLinkEventProcessor.h in Headers */,
F277F5E425CFCE56009B5CE6 /* NSObject+SADelegateProxy.h in Headers */,
F2E364872876EE94008D9151 /* SASlinkCreator.h in Headers */,
F277F5C325CF9A43009B5CE6 /* UIApplication+SAPushClick.h in Headers */,
F2B643F62832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.h in Headers */,
F277F5E425CFCE56009B5CE6 /* NSObject+SADelegateProxy.h in Headers */,
Expand Down Expand Up @@ -2505,6 +2519,7 @@
4DD1286125F872A4008C0B1E /* SAPropertyDescription.m in Sources */,
4DA89BC425C2BC1E003ABA43 /* SAReachability.m in Sources */,
F277F5CB25CF9A43009B5CE6 /* SAAppPushConstants.m in Sources */,
F2E364882876EE94008D9151 /* SASlinkCreator.m in Sources */,
4DD1286325F872A4008C0B1E /* SAVisualizedAutoTrackObjectSerializer.m in Sources */,
45BD80CF26F0B49700DCC759 /* SAThreadSafeDictionary.m in Sources */,
881A4193253D7B4F00854F69 /* SensorsAnalyticsSDK.m in Sources */,
Expand Down Expand Up @@ -2546,6 +2561,7 @@
A8356DDA2656459A00FD64AA /* SAAppStartTracker.m in Sources */,
4D4DB2CD25B7D19C00938842 /* SAMethodHelper.m in Sources */,
F23CA0092701715E002EEACA /* WKWebView+SABridge.m in Sources */,
F2E36484287682E6008D9151 /* SADeviceWhiteList.m in Sources */,
88E6BEDE278ECE5E006B1E4C /* SAAppVersionPropertyPlugin.m in Sources */,
883BAAB12669CD18008105D2 /* SAExceptionManager.m in Sources */,
4DD1286625F872A4008C0B1E /* SAVisualizedAbstractMessage.m in Sources */,
Expand Down
2 changes: 1 addition & 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.2"
#define VERSION @"4.4.3"

void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag;

Expand Down
46 changes: 46 additions & 0 deletions SensorsAnalyticsSDK/Deeplink/SADeepLinkConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,49 @@ extern NSString *const kSAResponsePropertyParameter;
extern NSString *const kSAResponsePropertyADChannel;

NSSet* sensorsdata_preset_channel_keys(void);

//dynamic slink related message

//dynamic slink related code
extern NSInteger kSADynamicSlinkStatusCodeSuccess;
extern NSInteger kSADynamicSlinkStatusCodeLessParams;
extern NSInteger kSADynamicSlinkStatusCodeNoNetwork;
extern NSInteger kSADynamicSlinkStatusCodeoNoDomain;
extern NSInteger kSADynamicSlinkStatusCodeResponseError;

//dynamic slink event name and properties
extern NSString *const kSADynamicSlinkEventName;
extern NSString *const kSADynamicSlinkEventPropertyChannelType;
extern NSString *const kSADynamicSlinkEventPropertyChannelName;
extern NSString *const kSADynamicSlinkEventPropertySource;
extern NSString *const kSADynamicSlinkEventPropertyData;
extern NSString *const kSADynamicSlinkEventPropertyShortURL;
extern NSString *const kSADynamicSlinkEventPropertyStatus;
extern NSString *const kSADynamicSlinkEventPropertyMessage;
extern NSString *const kSADynamicSlinkEventPropertyID;
extern NSString *const kSADynamicSlinkEventPropertyTemplateID;
extern NSString *const kSADynamicSlinkEventPropertyType;
extern NSString *const kSADynamicSlinkEventPropertyTypeDynamic;

//dynamic slink API path
extern NSString *const kSADynamicSlinkAPIPath;

//dynamic slink API params
extern NSString *const kSADynamicSlinkParamProject;
extern NSString *const kSADynamicSlinkParamTemplateID;
extern NSString *const kSADynamicSlinkParamType;
extern NSString *const kSADynamicSlinkParamName;
extern NSString *const kSADynamicSlinkParamChannelType;
extern NSString *const kSADynamicSlinkParamChannelName;
extern NSString *const kSADynamicSlinkParamFixedUTM;
extern NSString *const kSADynamicSlinkParamUTMSource;
extern NSString *const kSADynamicSlinkParamUTMCampaign;
extern NSString *const kSADynamicSlinkParamUTMMedium;
extern NSString *const kSADynamicSlinkParamUTMTerm;
extern NSString *const kSADynamicSlinkParamUTMContent;
extern NSString *const kSADynamicSlinkParamCustom;
extern NSString *const kSADynamicSlinkParamRoute;
extern NSString *const kSADynamicSlinkParamURIScheme;
extern NSString *const kSADynamicSlinkParamLandingPageType;
extern NSString *const kSADynamicSlinkParamLandingPage;
extern NSString *const kSADynamicSlinkParamJumpAddress;
45 changes: 45 additions & 0 deletions SensorsAnalyticsSDK/Deeplink/SADeepLinkConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,48 @@
NSSet* sensorsdata_preset_channel_keys(void) {
return [NSSet setWithObjects:@"utm_campaign", @"utm_content", @"utm_medium", @"utm_source", @"utm_term", nil];
}

//dynamic slink related code
NSInteger kSADynamicSlinkStatusCodeSuccess= 0;
NSInteger kSADynamicSlinkStatusCodeLessParams = 10001;
NSInteger kSADynamicSlinkStatusCodeNoNetwork = 10002;
NSInteger kSADynamicSlinkStatusCodeoNoDomain = 10003;
NSInteger kSADynamicSlinkStatusCodeResponseError = 10004;

//dynamic slink event name and properties
NSString *const kSADynamicSlinkEventName = @"$AdDynamicSlinkCreate";
NSString *const kSADynamicSlinkEventPropertyChannelType = @"$ad_dynamic_slink_channel_type";
NSString *const kSADynamicSlinkEventPropertyChannelName = @"$ad_dynamic_slink_channel_name";
NSString *const kSADynamicSlinkEventPropertySource = @"$ad_dynamic_slink_source";
NSString *const kSADynamicSlinkEventPropertyData = @"$ad_dynamic_slink_data";
NSString *const kSADynamicSlinkEventPropertyShortURL = @"$ad_dynamic_slink_short_url";
NSString *const kSADynamicSlinkEventPropertyStatus = @"$ad_dynamic_slink_status";
NSString *const kSADynamicSlinkEventPropertyMessage = @"$ad_dynamic_slink_msg";
NSString *const kSADynamicSlinkEventPropertyID = @"$ad_slink_id";
NSString *const kSADynamicSlinkEventPropertyTemplateID = @"$ad_slink_template_id";
NSString *const kSADynamicSlinkEventPropertyType = @"$ad_slink_type";
NSString *const kSADynamicSlinkEventPropertyTypeDynamic = @"dynamic";

//dynamic slink API path
NSString *const kSADynamicSlinkAPIPath = @"slink/dynamic/links";

//dynamic slink API params
NSString *const kSADynamicSlinkParamProject = @"project_name";
NSString *const kSADynamicSlinkParamTemplateID = @"slink_template_id";
NSString *const kSADynamicSlinkParamType = @"slink_type";
NSString *const kSADynamicSlinkParamName = @"name";
NSString *const kSADynamicSlinkParamChannelType = @"channel_type";
NSString *const kSADynamicSlinkParamChannelName = @"channel_name";
NSString *const kSADynamicSlinkParamFixedUTM = @"fixed_param";
NSString *const kSADynamicSlinkParamUTMSource = @"channel_utm_source";
NSString *const kSADynamicSlinkParamUTMCampaign = @"channel_utm_campaign";
NSString *const kSADynamicSlinkParamUTMMedium = @"channel_utm_medium";
NSString *const kSADynamicSlinkParamUTMTerm = @"channel_utm_term";
NSString *const kSADynamicSlinkParamUTMContent = @"channel_utm_content";
NSString *const kSADynamicSlinkParamCustom = @"custom_param";
NSString *const kSADynamicSlinkParamRoute = @"route_param";
NSString *const kSADynamicSlinkParamURIScheme = @"uri_scheme_suffix";
NSString *const kSADynamicSlinkParamLandingPageType = @"landing_page_type";
NSString *const kSADynamicSlinkParamLandingPage = @"other_landing_page_map";
NSString *const kSADynamicSlinkParamJumpAddress = @"jump_address";

10 changes: 10 additions & 0 deletions SensorsAnalyticsSDK/Deeplink/SADeeplinkManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#import "SAFirstDayPropertyPlugin.h"
#import "SAPropertyPluginManager.h"
#import "SALatestUtmPropertyPlugin.h"
#import "SADeviceWhiteList.h"


@interface SADeepLinkManager () <SADeepLinkProcessorDelegate>
Expand All @@ -55,6 +56,8 @@ @interface SADeepLinkManager () <SADeepLinkProcessorDelegate>
/// 本次冷启动时的 DeepLinkURL
@property (nonatomic, strong) NSURL *deepLinkURL;

@property (nonatomic, strong) SADeviceWhiteList *whiteList;

@end

@implementation SADeepLinkManager
Expand Down Expand Up @@ -93,6 +96,7 @@ - (instancetype)init {
} else {
[self disableDeferredDeepLink];
}
_whiteList = [[SADeviceWhiteList alloc] init];
}
return self;
}
Expand Down Expand Up @@ -265,11 +269,17 @@ - (BOOL)canHandleURL:(NSURL *)url {
if (![url isKindOfClass:NSURL.class]) {
return NO;
}
if ([self.whiteList canHandleURL:url]) {
return YES;
}
SADeepLinkProcessor *processor = [SADeepLinkProcessorFactory processorFromURL:url customChannelKeys:self.customChannelKeys];
return processor.canWakeUp;
}

- (BOOL)handleURL:(NSURL *)url {
if ([self.whiteList canHandleURL:url]) {
return [self.whiteList handleURL:url];
}
// 当 url 和 _deepLinkURL 相同时,则表示本次触发是冷启动触发,已通过 acquireColdLaunchDeepLinkInfo 方法处理,这里不需要重复处理
NSString *absoluteString = _deepLinkURL.absoluteString;
_deepLinkURL = nil;
Expand Down
4 changes: 4 additions & 0 deletions SensorsAnalyticsSDK/Deeplink/SADeferredDeepLinkProcessor.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ - (void)requestForDeferredDeepLink:(NSURLRequest *)request {
properties[kSAEventPropertyADChannel] = result[kSAResponsePropertyADChannel];
properties[kSAEventPropertyDeepLinkFailReason] = result ? result[kSAResponsePropertyMessage] : @"response is null";
properties[kSAEventPropertyADSLinkID] = result[kSAResponsePropertySLinkID];
properties[kSADynamicSlinkEventPropertyTemplateID] = result[kSADynamicSlinkParamTemplateID];
properties[kSADynamicSlinkEventPropertyType] = result[kSADynamicSlinkParamType];;
obj.params = result[kSAResponsePropertyParameter];
obj.adChannels = result[kSAResponsePropertyADChannel];
obj.success = (result[kSAResponsePropertyCode] && [result[kSAResponsePropertyCode] integerValue] == 0);
Expand Down Expand Up @@ -118,6 +120,8 @@ - (void)requestForDeferredDeepLink:(NSURLRequest *)request {
NSMutableDictionary *jumpProps = [NSMutableDictionary dictionary];
jumpProps[kSAEventPropertyDeepLinkOptions] = obj.params;
jumpProps[kSAEventPropertyADSLinkID] = slinkID;
jumpProps[kSADynamicSlinkEventPropertyTemplateID] = properties[kSADynamicSlinkEventPropertyTemplateID];
jumpProps[kSADynamicSlinkEventPropertyType] = properties[kSADynamicSlinkEventPropertyType];

[SensorsAnalyticsSDK.sharedInstance trackEventObject:object properties:jumpProps];

Expand Down
31 changes: 31 additions & 0 deletions SensorsAnalyticsSDK/Deeplink/SADeviceWhiteList.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// SADeviceWhiteList.h
// SensorsAnalyticsSDK
//
// Created by 陈玉国 on 2022/7/7.
// Copyright © 2015-2022 Sensors Data Co., Ltd. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//


#import <Foundation/Foundation.h>
#import "SAModuleProtocol.h"

NS_ASSUME_NONNULL_BEGIN

@interface SADeviceWhiteList : NSObject <SAOpenURLProtocol>

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit f6420b6

Please sign in to comment.