From 197b87dc09f93eaf6ec625dc70d2dc0f5f655e1f Mon Sep 17 00:00:00 2001 From: jg zhu <13913514919@189.cn> Date: Fri, 26 Mar 2021 17:49:13 +0800 Subject: [PATCH] Release 2.5.2 --- SensorsAnalyticsSDK.podspec | 9 +- SensorsAnalyticsSDK.xcodeproj/project.pbxproj | 125 ++------------- .../AppPush/SAAppPushConstants.h | 58 ------- .../AppPush/SAAppPushConstants.m | 62 -------- .../AppPush/SAAppPushManager.h | 32 ---- .../AppPush/SAAppPushManager.m | 66 -------- .../AppPush/SAApplicationDelegateProxy.h | 29 ---- .../AppPush/SAApplicationDelegateProxy.m | 125 --------------- .../AppPush/SANotificationUtil.h | 37 ----- .../AppPush/SANotificationUtil.m | 95 ------------ .../SAUNUserNotificationCenterDelegateProxy.h | 35 ----- .../SAUNUserNotificationCenterDelegateProxy.m | 76 --------- .../AppPush/UIApplication+PushClick.h | 32 ---- .../AppPush/UIApplication+PushClick.m | 53 ------- .../UNUserNotificationCenter+PushClick.h | 33 ---- .../UNUserNotificationCenter+PushClick.m | 41 ----- .../Cell/NSObject+SACellClick.h} | 16 +- .../Cell/NSObject+SACellClick.m} | 41 +---- .../Cell}/SAClassHelper.h | 4 + .../Cell}/SAClassHelper.m | 0 .../Cell}/SADelegateProxy.h | 27 +--- .../Cell}/SADelegateProxy.m | 146 ++++++++---------- .../Cell}/SAMethodHelper.h | 0 .../Cell}/SAMethodHelper.m | 7 - .../Cell/SAScrollViewDelegateProxy.h | 30 ---- .../Cell/SAScrollViewDelegateProxy.m | 61 -------- .../AutoTrack/Cell/UIScrollView+AutoTrack.m | 17 +- SensorsAnalyticsSDK/Core/SAConfigOptions.h | 3 - SensorsAnalyticsSDK/Core/SAConfigOptions.m | 1 - SensorsAnalyticsSDK/Core/SAModuleManager.h | 5 - SensorsAnalyticsSDK/Core/SAModuleManager.m | 12 -- SensorsAnalyticsSDK/Core/SAModuleProtocol.h | 6 - .../Core/SensorsAnalyticsSDK.m | 8 +- 33 files changed, 101 insertions(+), 1191 deletions(-) delete mode 100644 SensorsAnalyticsSDK/AppPush/SAAppPushConstants.h delete mode 100644 SensorsAnalyticsSDK/AppPush/SAAppPushConstants.m delete mode 100644 SensorsAnalyticsSDK/AppPush/SAAppPushManager.h delete mode 100644 SensorsAnalyticsSDK/AppPush/SAAppPushManager.m delete mode 100644 SensorsAnalyticsSDK/AppPush/SAApplicationDelegateProxy.h delete mode 100644 SensorsAnalyticsSDK/AppPush/SAApplicationDelegateProxy.m delete mode 100644 SensorsAnalyticsSDK/AppPush/SANotificationUtil.h delete mode 100644 SensorsAnalyticsSDK/AppPush/SANotificationUtil.m delete mode 100644 SensorsAnalyticsSDK/AppPush/SAUNUserNotificationCenterDelegateProxy.h delete mode 100644 SensorsAnalyticsSDK/AppPush/SAUNUserNotificationCenterDelegateProxy.m delete mode 100644 SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.h delete mode 100644 SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.m delete mode 100644 SensorsAnalyticsSDK/AppPush/UNUserNotificationCenter+PushClick.h delete mode 100644 SensorsAnalyticsSDK/AppPush/UNUserNotificationCenter+PushClick.m rename SensorsAnalyticsSDK/Core/{HookDelegate/NSObject+DelegateProxy.h => AutoTrack/Cell/NSObject+SACellClick.h} (71%) rename SensorsAnalyticsSDK/Core/{HookDelegate/NSObject+DelegateProxy.m => AutoTrack/Cell/NSObject+SACellClick.m} (60%) rename SensorsAnalyticsSDK/Core/{HookDelegate => AutoTrack/Cell}/SAClassHelper.h (91%) rename SensorsAnalyticsSDK/Core/{HookDelegate => AutoTrack/Cell}/SAClassHelper.m (100%) rename SensorsAnalyticsSDK/Core/{HookDelegate => AutoTrack/Cell}/SADelegateProxy.h (54%) rename SensorsAnalyticsSDK/Core/{HookDelegate => AutoTrack/Cell}/SADelegateProxy.m (63%) rename SensorsAnalyticsSDK/Core/{HookDelegate => AutoTrack/Cell}/SAMethodHelper.h (100%) rename SensorsAnalyticsSDK/Core/{HookDelegate => AutoTrack/Cell}/SAMethodHelper.m (93%) delete mode 100644 SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.h delete mode 100644 SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.m diff --git a/SensorsAnalyticsSDK.podspec b/SensorsAnalyticsSDK.podspec index c88edce8..66863067 100644 --- a/SensorsAnalyticsSDK.podspec +++ b/SensorsAnalyticsSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SensorsAnalyticsSDK" - s.version = "2.5.1" + s.version = "2.5.2" 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}" } @@ -46,13 +46,6 @@ Pod::Spec.new do |s| # f.exclude_files = "SensorsAnalyticsSDK/Location/**/*.{h,m}" end - # 推送点击 - s.subspec 'AppPush' do |f| - f.dependency 'SensorsAnalyticsSDK/Core' - f.source_files = "SensorsAnalyticsSDK/AppPush/**/*.{h,m}" - f.private_header_files = 'SensorsAnalyticsSDK/AppPush/**/*.h' - end - # 禁用设备方向采集 s.subspec 'DISABLE_TRACK_DEVICE_ORIENTATION' do |f| f.dependency 'SensorsAnalyticsSDK/Core' diff --git a/SensorsAnalyticsSDK.xcodeproj/project.pbxproj b/SensorsAnalyticsSDK.xcodeproj/project.pbxproj index 4bf3ed7d..cabe1ce7 100644 --- a/SensorsAnalyticsSDK.xcodeproj/project.pbxproj +++ b/SensorsAnalyticsSDK.xcodeproj/project.pbxproj @@ -40,10 +40,12 @@ 4D4DB2C725B7D19C00938842 /* SAClassHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D4DB2BD25B7D19B00938842 /* SAClassHelper.h */; }; 4D4DB2C825B7D19C00938842 /* SADelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D4DB2BE25B7D19B00938842 /* SADelegateProxy.h */; }; 4D4DB2C925B7D19C00938842 /* UIScrollView+AutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D4DB2BF25B7D19B00938842 /* UIScrollView+AutoTrack.h */; }; + 4D4DB2CA25B7D19C00938842 /* NSObject+SACellClick.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D4DB2C025B7D19B00938842 /* NSObject+SACellClick.h */; }; 4D4DB2CB25B7D19C00938842 /* SAMethodHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D4DB2C125B7D19B00938842 /* SAMethodHelper.h */; }; 4D4DB2CC25B7D19C00938842 /* UIScrollView+AutoTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D4DB2C225B7D19B00938842 /* UIScrollView+AutoTrack.m */; }; 4D4DB2CD25B7D19C00938842 /* SAMethodHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D4DB2C325B7D19B00938842 /* SAMethodHelper.m */; }; 4D4DB2CE25B7D19C00938842 /* SAClassHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D4DB2C425B7D19B00938842 /* SAClassHelper.m */; }; + 4D4DB2CF25B7D19C00938842 /* NSObject+SACellClick.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D4DB2C525B7D19B00938842 /* NSObject+SACellClick.m */; }; 4D4DB2D025B7D19C00938842 /* SADelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D4DB2C625B7D19B00938842 /* SADelegateProxy.m */; }; 4D4DB2E425B7D1F300938842 /* UIViewController+AutoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D4DB2D725B7D1F200938842 /* UIViewController+AutoTrack.h */; }; 4D4DB2E525B7D1F300938842 /* SAAutoTrackUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D4DB2D825B7D1F200938842 /* SAAutoTrackUtils.h */; }; @@ -199,29 +201,9 @@ CB6EBAF522855222003CFBA8 /* ca.der.cer in Resources */ = {isa = PBXBuildFile; fileRef = CB6EBAF122855222003CFBA8 /* ca.der.cer */; }; CB6EBAF622855222003CFBA8 /* SANetworkTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CB6EBAF222855222003CFBA8 /* SANetworkTests.m */; }; F214CE58249A07DF00A2633D /* SADatabaseUnitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F214CE57249A07DF00A2633D /* SADatabaseUnitTest.m */; }; - F277F5BF25CF9A43009B5CE6 /* SAApplicationDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = F277F5B125CF9A43009B5CE6 /* SAApplicationDelegateProxy.m */; }; - F277F5C025CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = F277F5B225CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.h */; }; - F277F5C125CF9A43009B5CE6 /* SANotificationUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = F277F5B325CF9A43009B5CE6 /* SANotificationUtil.m */; }; - F277F5C225CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.m in Sources */ = {isa = PBXBuildFile; fileRef = F277F5B425CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.m */; }; - F277F5C325CF9A43009B5CE6 /* UIApplication+PushClick.h in Headers */ = {isa = PBXBuildFile; fileRef = F277F5B525CF9A43009B5CE6 /* UIApplication+PushClick.h */; }; - F277F5C525CF9A43009B5CE6 /* SAAppPushConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = F277F5B725CF9A43009B5CE6 /* SAAppPushConstants.h */; }; - F277F5C625CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = F277F5B825CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.m */; }; - F277F5C725CF9A43009B5CE6 /* SAApplicationDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = F277F5B925CF9A43009B5CE6 /* SAApplicationDelegateProxy.h */; }; - F277F5C825CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.h in Headers */ = {isa = PBXBuildFile; fileRef = F277F5BA25CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.h */; }; - F277F5C925CF9A43009B5CE6 /* SANotificationUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = F277F5BB25CF9A43009B5CE6 /* SANotificationUtil.h */; }; - F277F5CA25CF9A43009B5CE6 /* UIApplication+PushClick.m in Sources */ = {isa = PBXBuildFile; fileRef = F277F5BC25CF9A43009B5CE6 /* UIApplication+PushClick.m */; }; - F277F5CB25CF9A43009B5CE6 /* SAAppPushConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = F277F5BD25CF9A43009B5CE6 /* SAAppPushConstants.m */; }; - F277F5D525CFBF38009B5CE6 /* SAScrollViewDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = F277F5D325CFBF38009B5CE6 /* SAScrollViewDelegateProxy.h */; }; - F277F5D625CFBF38009B5CE6 /* SAScrollViewDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = F277F5D425CFBF38009B5CE6 /* SAScrollViewDelegateProxy.m */; }; - F277F5E325CFCE56009B5CE6 /* NSObject+DelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = F277F5E125CFCE56009B5CE6 /* NSObject+DelegateProxy.m */; }; - F277F5E425CFCE56009B5CE6 /* NSObject+DelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = F277F5E225CFCE56009B5CE6 /* NSObject+DelegateProxy.h */; }; - F2E9723125E637820009A2B9 /* SAAppPushManager.h in Headers */ = {isa = PBXBuildFile; fileRef = F2E9722F25E637820009A2B9 /* SAAppPushManager.h */; }; - F2E9723225E637820009A2B9 /* SAAppPushManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F2E9723025E637820009A2B9 /* SAAppPushManager.m */; }; FC23719523D0519A00DDD708 /* SALinkHandlerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FC23719423D0519A00DDD708 /* SALinkHandlerTests.m */; }; FC3C58DA23BEEFB000D83BF4 /* SATrackTimerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FC3C58D923BEEFB000D83BF4 /* SATrackTimerTests.m */; }; FC80AB7C242CB17A006D1D25 /* SAIdentifierTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FC80AB7B242CB17A006D1D25 /* SAIdentifierTests.m */; }; - FCEA7FBA25F8D95400C81687 /* SACAIDUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = FCEA7FB825F8D95400C81687 /* SACAIDUtils.m */; }; - FCEA7FBB25F8D95400C81687 /* SACAIDUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = FCEA7FB925F8D95400C81687 /* SACAIDUtils.h */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -295,10 +277,12 @@ 4D4DB2BD25B7D19B00938842 /* SAClassHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAClassHelper.h; sourceTree = ""; }; 4D4DB2BE25B7D19B00938842 /* SADelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SADelegateProxy.h; sourceTree = ""; }; 4D4DB2BF25B7D19B00938842 /* UIScrollView+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+AutoTrack.h"; sourceTree = ""; }; + 4D4DB2C025B7D19B00938842 /* NSObject+SACellClick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+SACellClick.h"; sourceTree = ""; }; 4D4DB2C125B7D19B00938842 /* SAMethodHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAMethodHelper.h; sourceTree = ""; }; 4D4DB2C225B7D19B00938842 /* UIScrollView+AutoTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+AutoTrack.m"; sourceTree = ""; }; 4D4DB2C325B7D19B00938842 /* SAMethodHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAMethodHelper.m; sourceTree = ""; }; 4D4DB2C425B7D19B00938842 /* SAClassHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAClassHelper.m; sourceTree = ""; }; + 4D4DB2C525B7D19B00938842 /* NSObject+SACellClick.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+SACellClick.m"; sourceTree = ""; }; 4D4DB2C625B7D19B00938842 /* SADelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SADelegateProxy.m; sourceTree = ""; }; 4D4DB2D725B7D1F200938842 /* UIViewController+AutoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+AutoTrack.h"; sourceTree = ""; }; 4D4DB2D825B7D1F200938842 /* SAAutoTrackUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAutoTrackUtils.h; sourceTree = ""; }; @@ -450,29 +434,9 @@ CB6EBAF122855222003CFBA8 /* ca.der.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = ca.der.cer; sourceTree = ""; }; CB6EBAF222855222003CFBA8 /* SANetworkTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SANetworkTests.m; sourceTree = ""; }; F214CE57249A07DF00A2633D /* SADatabaseUnitTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SADatabaseUnitTest.m; path = SensorsAnalyticsTests/Tracker/SADatabaseUnitTest.m; sourceTree = SOURCE_ROOT; }; - F277F5B125CF9A43009B5CE6 /* SAApplicationDelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAApplicationDelegateProxy.m; sourceTree = ""; }; - F277F5B225CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAUNUserNotificationCenterDelegateProxy.h; sourceTree = ""; }; - F277F5B325CF9A43009B5CE6 /* SANotificationUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SANotificationUtil.m; sourceTree = ""; }; - F277F5B425CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UNUserNotificationCenter+PushClick.m"; sourceTree = ""; }; - F277F5B525CF9A43009B5CE6 /* UIApplication+PushClick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication+PushClick.h"; sourceTree = ""; }; - F277F5B725CF9A43009B5CE6 /* SAAppPushConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAppPushConstants.h; sourceTree = ""; }; - F277F5B825CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAUNUserNotificationCenterDelegateProxy.m; sourceTree = ""; }; - F277F5B925CF9A43009B5CE6 /* SAApplicationDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAApplicationDelegateProxy.h; sourceTree = ""; }; - F277F5BA25CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UNUserNotificationCenter+PushClick.h"; sourceTree = ""; }; - F277F5BB25CF9A43009B5CE6 /* SANotificationUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SANotificationUtil.h; sourceTree = ""; }; - F277F5BC25CF9A43009B5CE6 /* UIApplication+PushClick.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIApplication+PushClick.m"; sourceTree = ""; }; - F277F5BD25CF9A43009B5CE6 /* SAAppPushConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAppPushConstants.m; sourceTree = ""; }; - F277F5D325CFBF38009B5CE6 /* SAScrollViewDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAScrollViewDelegateProxy.h; sourceTree = ""; }; - F277F5D425CFBF38009B5CE6 /* SAScrollViewDelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAScrollViewDelegateProxy.m; sourceTree = ""; }; - F277F5E125CFCE56009B5CE6 /* NSObject+DelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+DelegateProxy.m"; sourceTree = ""; }; - F277F5E225CFCE56009B5CE6 /* NSObject+DelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+DelegateProxy.h"; sourceTree = ""; }; - F2E9722F25E637820009A2B9 /* SAAppPushManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAAppPushManager.h; sourceTree = ""; }; - F2E9723025E637820009A2B9 /* SAAppPushManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAppPushManager.m; sourceTree = ""; }; FC23719423D0519A00DDD708 /* SALinkHandlerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SALinkHandlerTests.m; sourceTree = ""; }; FC3C58D923BEEFB000D83BF4 /* SATrackTimerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SATrackTimerTests.m; sourceTree = ""; }; FC80AB7B242CB17A006D1D25 /* SAIdentifierTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SAIdentifierTests.m; sourceTree = ""; }; - FCEA7FB825F8D95400C81687 /* SACAIDUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SACAIDUtils.m; sourceTree = ""; }; - FCEA7FB925F8D95400C81687 /* SACAIDUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SACAIDUtils.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -570,8 +534,14 @@ 4D4DB28C25B7D17E00938842 /* Cell */ = { isa = PBXGroup; children = ( - F277F5D325CFBF38009B5CE6 /* SAScrollViewDelegateProxy.h */, - F277F5D425CFBF38009B5CE6 /* SAScrollViewDelegateProxy.m */, + 4D4DB2C025B7D19B00938842 /* NSObject+SACellClick.h */, + 4D4DB2C525B7D19B00938842 /* NSObject+SACellClick.m */, + 4D4DB2BD25B7D19B00938842 /* SAClassHelper.h */, + 4D4DB2C425B7D19B00938842 /* SAClassHelper.m */, + 4D4DB2BE25B7D19B00938842 /* SADelegateProxy.h */, + 4D4DB2C625B7D19B00938842 /* SADelegateProxy.m */, + 4D4DB2C125B7D19B00938842 /* SAMethodHelper.h */, + 4D4DB2C325B7D19B00938842 /* SAMethodHelper.m */, 4D4DB2BF25B7D19B00938842 /* UIScrollView+AutoTrack.h */, 4D4DB2C225B7D19B00938842 /* UIScrollView+AutoTrack.m */, ); @@ -642,7 +612,6 @@ 881A416D253D7B4F00854F69 /* Builder */, 881A414E253D7B4F00854F69 /* Channel */, 881A4165253D7B4F00854F69 /* Encrypt */, - F2346B7D25E0AE5600AA3684 /* HookDelegate */, 881A40FE253D7B4F00854F69 /* JSBridge */, 4DA89BBC25C2BC1E003ABA43 /* Network */, 881A40F8253D7B4F00854F69 /* RemoteConfig */, @@ -900,9 +869,7 @@ CB30BFD122840EBF0004061D /* SensorsAnalyticsSDK */ = { isa = PBXGroup; children = ( - F277F5B025CF9A43009B5CE6 /* AppPush */, 881A40D2253D7B4F00854F69 /* Core */, - FCEA7FB725F8D95400C81687 /* CAID */, 881A4224253D7B5E00854F69 /* Location */, 453FC62425EE3D6300591C47 /* Gesture */, CB30C0AB22840F1B0004061D /* Resources */, @@ -956,51 +923,6 @@ path = Resources; sourceTree = ""; }; - FCEA7FB725F8D95400C81687 /* CAID */ = { - isa = PBXGroup; - children = ( - FCEA7FB925F8D95400C81687 /* SACAIDUtils.h */, - FCEA7FB825F8D95400C81687 /* SACAIDUtils.m */, - ); - path = CAID; - sourceTree = ""; - }; - F2346B7D25E0AE5600AA3684 /* HookDelegate */ = { - isa = PBXGroup; - children = ( - F277F5E225CFCE56009B5CE6 /* NSObject+DelegateProxy.h */, - F277F5E125CFCE56009B5CE6 /* NSObject+DelegateProxy.m */, - 4D4DB2BD25B7D19B00938842 /* SAClassHelper.h */, - 4D4DB2C425B7D19B00938842 /* SAClassHelper.m */, - 4D4DB2BE25B7D19B00938842 /* SADelegateProxy.h */, - 4D4DB2C625B7D19B00938842 /* SADelegateProxy.m */, - 4D4DB2C125B7D19B00938842 /* SAMethodHelper.h */, - 4D4DB2C325B7D19B00938842 /* SAMethodHelper.m */, - ); - path = HookDelegate; - sourceTree = ""; - }; - F277F5B025CF9A43009B5CE6 /* AppPush */ = { - isa = PBXGroup; - children = ( - F277F5B925CF9A43009B5CE6 /* SAApplicationDelegateProxy.h */, - F277F5B125CF9A43009B5CE6 /* SAApplicationDelegateProxy.m */, - F277F5B725CF9A43009B5CE6 /* SAAppPushConstants.h */, - F277F5BD25CF9A43009B5CE6 /* SAAppPushConstants.m */, - F2E9722F25E637820009A2B9 /* SAAppPushManager.h */, - F2E9723025E637820009A2B9 /* SAAppPushManager.m */, - F277F5BB25CF9A43009B5CE6 /* SANotificationUtil.h */, - F277F5B325CF9A43009B5CE6 /* SANotificationUtil.m */, - F277F5B225CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.h */, - F277F5B825CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.m */, - F277F5B525CF9A43009B5CE6 /* UIApplication+PushClick.h */, - F277F5BC25CF9A43009B5CE6 /* UIApplication+PushClick.m */, - F277F5BA25CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.h */, - F277F5B425CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.m */, - ); - path = AppPush; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1023,17 +945,12 @@ 4D4DB2EA25B7D1F300938842 /* UIApplication+AutoTrack.h in Headers */, 881A420F253D7B5000854F69 /* SAAlertController.h in Headers */, 4D9E5DB525943BCD0095A0D0 /* SAPropertyDescription.h in Headers */, - 4D4DB2E925B7D1F300938842 /* UIGestureRecognizer+AutoTrack.h in Headers */, - F277F5C025CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.h in Headers */, 881A419A253D7B4F00854F69 /* SADeviceOrientationManager.h in Headers */, 4D2D53C22591EB3A00805141 /* SAReadWriteLock.h in Headers */, 881A4201253D7B5000854F69 /* SAAppExtensionDataManager.h in Headers */, 884B423F25540DEE00416DB6 /* SensorsAnalyticsSDK+Public.h in Headers */, - F277F5C725CF9A43009B5CE6 /* SAApplicationDelegateProxy.h in Headers */, 881A41F1253D7B5000854F69 /* SensorsAnalyticsSDK.h in Headers */, 453ECA1525DE4B0700E5DFB6 /* SAViewElementInfo.h in Headers */, - F277F5D525CFBF38009B5CE6 /* SAScrollViewDelegateProxy.h in Headers */, - F277F5C525CF9A43009B5CE6 /* SAAppPushConstants.h in Headers */, 4DA89BC325C2BC1E003ABA43 /* SANetwork.h in Headers */, 881A41A2253D7B4F00854F69 /* SAModuleManager.h in Headers */, 4D9E5DAD25943BCD0095A0D0 /* SAAuxiliaryToolManager.h in Headers */, @@ -1050,10 +967,8 @@ A835227525E5FD75005D69D5 /* SARSAEncryptor.h in Headers */, A835227825E5FD75005D69D5 /* SAEncryptManager.h in Headers */, 4D4DB2CA25B7D19C00938842 /* NSObject+SACellClick.h in Headers */, - F277F5C925CF9A43009B5CE6 /* SANotificationUtil.h in Headers */, 881A41A0253D7B4F00854F69 /* SensorsAnalyticsSDK+Private.h in Headers */, 4D9E5DB625943BCD0095A0D0 /* SAVisualizedSnapshotMessage.h in Headers */, - F277F5C825CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.h in Headers */, A8A87E532568EBD500E16895 /* SARemoteConfigCommonOperator.h in Headers */, 881A4212253D7B5000854F69 /* SAIdentifier.h in Headers */, 881A4214253D7B5000854F69 /* SAKeyChainItemWrapper.h in Headers */, @@ -1078,15 +993,12 @@ 881A419C253D7B4F00854F69 /* SAConstants+Private.h in Headers */, 4D4DB2EE25B7D1F300938842 /* SAAutoTrackProperty.h in Headers */, 881A419F253D7B4F00854F69 /* SAHTTPSession.h in Headers */, - F2E9723125E637820009A2B9 /* SAAppPushManager.h in Headers */, 4D9E5DB825943BCD0095A0D0 /* SAVisualizedUtils.h in Headers */, - F277F5E425CFCE56009B5CE6 /* NSObject+DelegateProxy.h in Headers */, 881A41F4253D7B5000854F69 /* SAChannelMatchManager.h in Headers */, 4D9E5DBE25943BCE0095A0D0 /* SAClassDescription.h in Headers */, 4D9E5DC125943BCE0095A0D0 /* SAEnumDescription.h in Headers */, 453FC63D25EE3D6300591C47 /* SAGeneralGestureViewProcessor.h in Headers */, A835227125E5FD75005D69D5 /* SAECCEncryptor.h in Headers */, - F277F5C325CF9A43009B5CE6 /* UIApplication+PushClick.h in Headers */, 4D4DB2E425B7D1F300938842 /* UIViewController+AutoTrack.h in Headers */, 4D9E5DBF25943BCE0095A0D0 /* SAVisualizedAbstractMessage.h in Headers */, 4D9E5DBC25943BCE0095A0D0 /* SAVisualizedAutoTrackObjectSerializer.h in Headers */, @@ -1102,7 +1014,6 @@ 4D4DB2E725B7D1F300938842 /* SAReferrerManager.h in Headers */, 4D9E5DC925943BCE0095A0D0 /* SAApplicationStateSerializer.h in Headers */, 881A419B253D7B4F00854F69 /* SAConfigOptions.h in Headers */, - FCEA7FBB25F8D95400C81687 /* SACAIDUtils.h in Headers */, 4D9E5DC325943BCE0095A0D0 /* SATypeDescription.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1265,12 +1176,9 @@ 4D2D539D2591EB2100805141 /* SAEventFlush.m in Sources */, 4D2D53A02591EB2100805141 /* SADatabase.m in Sources */, 453ECA1625DE4B0700E5DFB6 /* SAViewElementInfo.m in Sources */, - F277F5D625CFBF38009B5CE6 /* SAScrollViewDelegateProxy.m in Sources */, 4D4DB2CE25B7D19C00938842 /* SAClassHelper.m in Sources */, 881A4220253D7B5000854F69 /* SAFileStore.m in Sources */, - F277F5C625CF9A43009B5CE6 /* SAUNUserNotificationCenterDelegateProxy.m in Sources */, 4D4DB2EB25B7D1F300938842 /* UIView+AutoTrack.m in Sources */, - F277F5C125CF9A43009B5CE6 /* SANotificationUtil.m in Sources */, 4DA89BC125C2BC1E003ABA43 /* SANetwork.m in Sources */, 4D9E5DB125943BCD0095A0D0 /* SAObjectSerializerConfig.m in Sources */, A835227A25E5FD75005D69D5 /* SAAbstractEncryptor.m in Sources */, @@ -1280,7 +1188,7 @@ 4D9E5DC525943BCE0095A0D0 /* SAObjectIdentityProvider.m in Sources */, 4D9E5DAA25943BCD0095A0D0 /* SAVisualizedObjectSerializerManger.m in Sources */, 4D9E5DA725943BCD0095A0D0 /* SAVisualizedAutoTrackObjectSerializer.m in Sources */, - F277F5E325CFCE56009B5CE6 /* NSObject+DelegateProxy.m in Sources */, + 4D4DB2CF25B7D19C00938842 /* NSObject+SACellClick.m in Sources */, 4D2D53842591EB0600805141 /* SAFileLogger.m in Sources */, 881A41E4253D7B5000854F69 /* SAKeyChainItemWrapper.m in Sources */, 881A41AA253D7B4F00854F69 /* SAScriptMessageHandler.m in Sources */, @@ -1297,7 +1205,6 @@ 4D9E5DD625943BDF0095A0D0 /* UIView+SAElementPath.m in Sources */, 881A41FE253D7B5000854F69 /* SAConstants.m in Sources */, 4D9E5DC225943BCE0095A0D0 /* SAApplicationStateSerializer.m in Sources */, - F277F5CA25CF9A43009B5CE6 /* UIApplication+PushClick.m in Sources */, 881A4195253D7B4F00854F69 /* SAObject+SAConfigOptions.m in Sources */, 881A41F9253D7B5000854F69 /* SAConfigOptions.m in Sources */, 4D4DB2EF25B7D1F300938842 /* SAAutoTrackUtils.m in Sources */, @@ -1313,7 +1220,6 @@ A8A87E512568EBD500E16895 /* SARemoteConfigModel.m in Sources */, 4D4DB2CC25B7D19C00938842 /* UIScrollView+AutoTrack.m in Sources */, 4D4DB2F025B7D1F300938842 /* UIViewController+AutoTrack.m in Sources */, - F277F5CB25CF9A43009B5CE6 /* SAAppPushConstants.m in Sources */, A8A87E4E2568EBD500E16895 /* SARemoteConfigCheckOperator.m in Sources */, 453FC63E25EE3D6300591C47 /* SAGestureViewProcessorFactory.m in Sources */, 4D9E5DB225943BCD0095A0D0 /* SAVisualizedAbstractMessage.m in Sources */, @@ -1323,21 +1229,16 @@ 4D2D53A22591EB2100805141 /* SAEventRecord.m in Sources */, 4D2D53BB2591EB3A00805141 /* SAWeakPropertyContainer.m in Sources */, 881A4202253D7B5000854F69 /* SAModuleManager.m in Sources */, - F2E9723225E637820009A2B9 /* SAAppPushManager.m in Sources */, 881A41FC253D7B5000854F69 /* SASwizzle.m in Sources */, 4D9E5DB725943BCD0095A0D0 /* SAAuxiliaryToolManager.m in Sources */, 881A4207253D7B5000854F69 /* SAHTTPSession.m in Sources */, 4D9E5DB325943BCD0095A0D0 /* SAObjectSerializerContext.m in Sources */, - F277F5C225CF9A43009B5CE6 /* UNUserNotificationCenter+PushClick.m in Sources */, 4D9E5DA925943BCD0095A0D0 /* SAVisualizedConnection.m in Sources */, A8A87E4D2568EBD500E16895 /* SARemoteConfigManager.m in Sources */, 4D9E5DBA25943BCE0095A0D0 /* SAJSTouchEventView.m in Sources */, - FCEA7FBA25F8D95400C81687 /* SACAIDUtils.m in Sources */, 4D9E5DC825943BCE0095A0D0 /* SAValueTransformers.m in Sources */, 881A4210253D7B5000854F69 /* SAIdentifier.m in Sources */, 4D9E5DC725943BCE0095A0D0 /* SAVisualizedUtils.m in Sources */, - F277F5BF25CF9A43009B5CE6 /* SAApplicationDelegateProxy.m in Sources */, - 881A4209253D7B5000854F69 /* SAEncryptUtils.m in Sources */, 4D9E5DA825943BCD0095A0D0 /* NSInvocation+SAHelpers.m in Sources */, 453ECA2C25DE4C5B00E5DFB6 /* SAViewElementInfoFactory.m in Sources */, 881A41A1253D7B4F00854F69 /* SAAppExtensionDataManager.m in Sources */, diff --git a/SensorsAnalyticsSDK/AppPush/SAAppPushConstants.h b/SensorsAnalyticsSDK/AppPush/SAAppPushConstants.h deleted file mode 100644 index d47f5a08..00000000 --- a/SensorsAnalyticsSDK/AppPush/SAAppPushConstants.h +++ /dev/null @@ -1,58 +0,0 @@ -// -// SAAppPushConstants.h -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/18. -// Copyright © 2021 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 - -//AppPush Notification related -extern NSString * const kSAEventNameNotificationClick; -extern NSString * const kSAEventPropertyNotificationTitle; -extern NSString * const kSAEventPropertyNotificationContent; -extern NSString * const kSAEventPropertyNotificationServiceName; -extern NSString * const kSAEventPropertyNotificationChannel; -extern NSString * const kSAEventPropertyNotificationServiceNameLocal; -extern NSString * const kSAEventPropertyNotificationServiceNameJPUSH; -extern NSString * const kSAEventPropertyNotificationServiceNameGeTui; -extern NSString * const kSAEventPropertyNotificationChannelApple; - -//identifier for third part push service -extern NSString * const kSAPushServiceKeyJPUSH; -extern NSString * const kSAPushServiceKeyGeTui; -extern NSString * const kSAPushServiceKeySF; - -//APNS related key -extern NSString * const kSAPushAppleUserInfoKeyAps; -extern NSString * const kSAPushAppleUserInfoKeyAlert; -extern NSString * const kSAPushAppleUserInfoKeyTitle; -extern NSString * const kSAPushAppleUserInfoKeyBody; - -//sf_data related properties -extern NSString * const kSFMessageTitle; -extern NSString * const kSFPlanStrategyID; -extern NSString * const kSFChannelCategory; -extern NSString * const kSFAudienceID; -extern NSString * const kSFChannelID; -extern NSString * const kSFLinkUrl; -extern NSString * const kSFPlanType; -extern NSString * const kSFChannelServiceName; -extern NSString * const kSFMessageID; -extern NSString * const kSFPlanID; -extern NSString * const kSFStrategyUnitID; -extern NSString * const kSFEnterPlanTime; -extern NSString * const kSFMessageContent; diff --git a/SensorsAnalyticsSDK/AppPush/SAAppPushConstants.m b/SensorsAnalyticsSDK/AppPush/SAAppPushConstants.m deleted file mode 100644 index 87a66e1c..00000000 --- a/SensorsAnalyticsSDK/AppPush/SAAppPushConstants.m +++ /dev/null @@ -1,62 +0,0 @@ -// -// SAAppPushConstants.m -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/18. -// Copyright © 2021 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. -// - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - -#import "SAAppPushConstants.h" - -//AppPush Notification related -NSString * const kSAEventNameNotificationClick = @"$AppPushClick"; -NSString * const kSAEventPropertyNotificationTitle = @"$app_push_msg_title"; -NSString * const kSAEventPropertyNotificationContent = @"$app_push_msg_content"; -NSString * const kSAEventPropertyNotificationServiceName = @"$app_push_service_name"; -NSString * const kSAEventPropertyNotificationChannel = @"$app_push_channel"; -NSString * const kSAEventPropertyNotificationServiceNameLocal = @"Local"; -NSString * const kSAEventPropertyNotificationServiceNameJPUSH = @"JPush"; -NSString * const kSAEventPropertyNotificationServiceNameGeTui = @"GeTui"; -NSString * const kSAEventPropertyNotificationChannelApple = @"Apple"; - -//identifier for third part push service -NSString * const kSAPushServiceKeyJPUSH = @"_j_business"; -NSString * const kSAPushServiceKeyGeTui = @"_ge_"; -NSString * const kSAPushServiceKeySF = @"sf_data"; - -//APNS related key -NSString * const kSAPushAppleUserInfoKeyAps = @"aps"; -NSString * const kSAPushAppleUserInfoKeyAlert = @"alert"; -NSString * const kSAPushAppleUserInfoKeyTitle = @"title"; -NSString * const kSAPushAppleUserInfoKeyBody = @"body"; - -//sf_data related properties -NSString * const kSFMessageTitle = @"$sf_msg_title"; -NSString * const kSFPlanStrategyID = @"$sf_plan_strategy_id"; -NSString * const kSFChannelCategory = @"$sf_channel_category"; -NSString * const kSFAudienceID = @"$sf_audience_id"; -NSString * const kSFChannelID = @"$sf_channel_id"; -NSString * const kSFLinkUrl = @"$sf_link_url"; -NSString * const kSFPlanType = @"$sf_plan_type"; -NSString * const kSFChannelServiceName = @"$sf_channel_service_name"; -NSString * const kSFMessageID = @"$sf_msg_id"; -NSString * const kSFPlanID = @"$sf_plan_id"; -NSString * const kSFStrategyUnitID = @"$sf_strategy_unit_id"; -NSString * const kSFEnterPlanTime = @"$sf_enter_plan_time"; -NSString * const kSFMessageContent = @"$sf_msg_content"; diff --git a/SensorsAnalyticsSDK/AppPush/SAAppPushManager.h b/SensorsAnalyticsSDK/AppPush/SAAppPushManager.h deleted file mode 100644 index d804aeed..00000000 --- a/SensorsAnalyticsSDK/AppPush/SAAppPushManager.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// SANotificationManager.h -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/18. -// Copyright © 2021 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 -#import "SAModuleProtocol.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SAAppPushManager : NSObject - -@property (nonatomic, assign, getter=isEnable) BOOL enable; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/AppPush/SAAppPushManager.m b/SensorsAnalyticsSDK/AppPush/SAAppPushManager.m deleted file mode 100644 index 40726305..00000000 --- a/SensorsAnalyticsSDK/AppPush/SAAppPushManager.m +++ /dev/null @@ -1,66 +0,0 @@ -// -// SANotificationManager.m -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/18. -// Copyright © 2021 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. -// - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - -#import "SAAppPushManager.h" -#import "SAApplicationDelegateProxy.h" -#import "SASwizzle.h" -#import "SALog.h" -#import "UIApplication+PushClick.h" - -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 -#import "SAUNUserNotificationCenterDelegateProxy.h" -#endif - -@implementation SAAppPushManager - -- (void)setEnable:(BOOL)enable { - _enable = enable; - if (enable) { - [self proxyNotifications]; - } -} - -- (void)setLaunchOptions:(NSDictionary *)launchOptions { - [UIApplication sharedApplication].sensorsdata_launchOptions = launchOptions; -} - -- (void)proxyNotifications { - //UIApplicationDelegate proxy - [SAApplicationDelegateProxy resolveOptionalSelectorsForDelegate:[UIApplication sharedApplication].delegate]; - [SAApplicationDelegateProxy proxyDelegate:[UIApplication sharedApplication].delegate selectors:[NSSet setWithArray:@[@"application:didReceiveLocalNotification:", @"application:didReceiveRemoteNotification:fetchCompletionHandler:"]]]; - - //UNUserNotificationCenterDelegate proxy - if (@available(iOS 10.0, *)) { - if ([UNUserNotificationCenter currentNotificationCenter].delegate) { - [SAUNUserNotificationCenterDelegateProxy proxyDelegate:[UNUserNotificationCenter currentNotificationCenter].delegate selectors:[NSSet setWithArray:@[@"userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:"]]]; - } - NSError *error = NULL; - [UNUserNotificationCenter sa_swizzleMethod:@selector(setDelegate:) withMethod:@selector(sensorsdata_setDelegate:) error:&error]; - if (error) { - SALogError(@"proxy notification delegate error: %@", error); - } - } -} - -@end diff --git a/SensorsAnalyticsSDK/AppPush/SAApplicationDelegateProxy.h b/SensorsAnalyticsSDK/AppPush/SAApplicationDelegateProxy.h deleted file mode 100644 index c7a41912..00000000 --- a/SensorsAnalyticsSDK/AppPush/SAApplicationDelegateProxy.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// SAApplicationDelegateProxy.h -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/7. -// Copyright © 2021 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 "SADelegateProxy.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SAApplicationDelegateProxy : SADelegateProxy - -@end - -NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/AppPush/SAApplicationDelegateProxy.m b/SensorsAnalyticsSDK/AppPush/SAApplicationDelegateProxy.m deleted file mode 100644 index cf73fd8d..00000000 --- a/SensorsAnalyticsSDK/AppPush/SAApplicationDelegateProxy.m +++ /dev/null @@ -1,125 +0,0 @@ -// -// SAApplicationDelegateProxy.m -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/7. -// Copyright © 2021 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. -// - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - -#import "SAApplicationDelegateProxy.h" -#import "SAClassHelper.h" -#import "NSObject+DelegateProxy.h" -#import "UIApplication+PushClick.h" -#import "SensorsAnalyticsSDK.h" -#import "SAAppPushConstants.h" -#import "SALog.h" -#import "SANotificationUtil.h" -#import - -@implementation SAApplicationDelegateProxy - -- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { - SEL selector = @selector(application:didReceiveRemoteNotification:fetchCompletionHandler:); - [SAApplicationDelegateProxy invokeWithTarget:self selector:selector, application, userInfo, completionHandler]; - [SAApplicationDelegateProxy trackEventWithTarget:self application:application remoteNotification:userInfo]; -} - -- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { - SEL selector = @selector(application:didReceiveLocalNotification:); - [SAApplicationDelegateProxy invokeWithTarget:self selector:selector, application, notification]; - [SAApplicationDelegateProxy trackEventWithTarget:self application:application localNotification:notification]; -} - -+ (void)trackEventWithTarget:(NSObject *)target application:(UIApplication *)application remoteNotification:(NSDictionary *)userInfo { - // 当 target 和 delegate 不相等时为消息转发, 此时无需重复采集事件 - if (target != application.delegate) { - return; - } - //track notification - if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) { - SALogInfo(@"iOS version >= 10.0, callback for %@ was ignored.", @"application:didReceiveRemoteNotification:fetchCompletionHandler:"); - return; - } - - if (application.applicationState != UIApplicationStateInactive) { - return; - } - - NSMutableDictionary *properties = [[NSMutableDictionary alloc] init]; - properties[kSAEventPropertyNotificationChannel] = kSAEventPropertyNotificationChannelApple; - - if (userInfo) { - NSString *title = nil; - NSString *content = nil; - id alert = userInfo[kSAPushAppleUserInfoKeyAps][kSAPushAppleUserInfoKeyAlert]; - if ([alert isKindOfClass:[NSDictionary class]]) { - title = alert[kSAPushAppleUserInfoKeyTitle]; - content = alert[kSAPushAppleUserInfoKeyBody]; - } else if ([alert isKindOfClass:[NSString class]]) { - content = alert; - } - if (userInfo[kSAPushServiceKeySF]) { - properties[kSFMessageTitle] = title; - properties[kSFMessageContent] = content; - } - properties[kSAEventPropertyNotificationTitle] = title; - properties[kSAEventPropertyNotificationContent] = content; - [properties addEntriesFromDictionary:[SANotificationUtil propertiesFromUserInfo:userInfo]]; - } - - [[SensorsAnalyticsSDK sharedInstance] track:kSAEventNameNotificationClick withProperties:properties]; -} - -+ (void)trackEventWithTarget:(NSObject *)target application:(UIApplication *)application localNotification:(UILocalNotification *)notification { - // 当 target 和 delegate 不相等时为消息转发, 此时无需重复采集事件 - if (target != application.delegate) { - return; - } - //track notification - BOOL isValidPushClick = NO; - if (application.applicationState == UIApplicationStateInactive) { - isValidPushClick = YES; - } else if (application.sensorsdata_launchOptions[UIApplicationLaunchOptionsLocalNotificationKey]) { - isValidPushClick = YES; - application.sensorsdata_launchOptions = nil; - } - - if (!isValidPushClick) { - SALogInfo(@"Invalid app push callback, AppPushClick was ignored."); - return; - } - - NSMutableDictionary *properties = [[NSMutableDictionary alloc] init]; - properties[kSAEventPropertyNotificationContent] = notification.alertBody; - properties[kSFMessageContent] = notification.alertBody; - properties[kSAEventPropertyNotificationServiceName] = kSAEventPropertyNotificationServiceNameLocal; - - if (@available(iOS 8.2, *)) { - properties[kSAEventPropertyNotificationTitle] = notification.alertTitle; - properties[kSFMessageTitle] = notification.alertTitle; - } - - [[SensorsAnalyticsSDK sharedInstance] track:kSAEventNameNotificationClick withProperties:properties]; -} - -+ (NSSet *)optionalSelectors { - return [NSSet setWithArray:@[@"application:didReceiveLocalNotification:", @"application:didReceiveRemoteNotification:fetchCompletionHandler:"]]; -} - -@end diff --git a/SensorsAnalyticsSDK/AppPush/SANotificationUtil.h b/SensorsAnalyticsSDK/AppPush/SANotificationUtil.h deleted file mode 100644 index 629d61da..00000000 --- a/SensorsAnalyticsSDK/AppPush/SANotificationUtil.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// SANotificationUtil.h -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/18. -// Copyright © 2021 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 - -NS_ASSUME_NONNULL_BEGIN - -@interface SANotificationUtil : NSObject - -+ (NSDictionary *)propertiesFromUserInfo:(NSDictionary *)userInfo; - -@end - -@interface NSString (SFPushKey) - -- (NSString *)sensorsdata_sfPushKey; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/AppPush/SANotificationUtil.m b/SensorsAnalyticsSDK/AppPush/SANotificationUtil.m deleted file mode 100644 index 1156b2cd..00000000 --- a/SensorsAnalyticsSDK/AppPush/SANotificationUtil.m +++ /dev/null @@ -1,95 +0,0 @@ -// -// SANotificationUtil.m -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/18. -// Copyright © 2021 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. -// - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - -#import "SANotificationUtil.h" -#import "SAAppPushConstants.h" -#import "SALog.h" - -@implementation SANotificationUtil - -+ (NSDictionary *)propertiesFromUserInfo:(NSDictionary *)userInfo { - - NSMutableDictionary *properties = [[NSMutableDictionary alloc] init]; - - if (userInfo[kSAPushServiceKeyJPUSH]) { - properties[kSAEventPropertyNotificationServiceName] = kSAEventPropertyNotificationServiceNameJPUSH; - } - - if (userInfo[kSAPushServiceKeyGeTui]) { - properties[kSAEventPropertyNotificationServiceName] = kSAEventPropertyNotificationServiceNameGeTui; - } - - //SF related properties - NSString *sfDataString = userInfo[kSAPushServiceKeySF]; - - if ([sfDataString isKindOfClass:[NSString class]]) { - NSData *sfData = [userInfo[kSAPushServiceKeySF] dataUsingEncoding:NSUTF8StringEncoding]; - NSError *error; - NSDictionary *sfProperties; - if (sfData) { - @try { - sfProperties = [NSJSONSerialization JSONObjectWithData:sfData options:0 error:&error]; - } @catch (NSException *exception) { - SALogError(@"%@", exception); - } @finally { - if (!error && [sfProperties isKindOfClass:[NSDictionary class]]) { - [properties addEntriesFromDictionary:[self propertiesFromSFData:sfProperties]]; - } - } - - } - } - - return [properties copy]; -} - -+ (NSDictionary *)propertiesFromSFData:(NSDictionary *)sfData { - NSMutableDictionary *properties = [[NSMutableDictionary alloc] init]; - properties[kSFPlanStrategyID] = sfData[kSFPlanStrategyID.sensorsdata_sfPushKey]; - properties[kSFChannelCategory] = sfData[kSFChannelCategory.sensorsdata_sfPushKey]; - properties[kSFAudienceID] = sfData[kSFAudienceID.sensorsdata_sfPushKey]; - properties[kSFChannelID] = sfData[kSFChannelID.sensorsdata_sfPushKey]; - properties[kSFLinkUrl] = sfData[kSFLinkUrl.sensorsdata_sfPushKey]; - properties[kSFPlanType] = sfData[kSFPlanType.sensorsdata_sfPushKey]; - properties[kSFChannelServiceName] = sfData[kSFChannelServiceName.sensorsdata_sfPushKey]; - properties[kSFMessageID] = sfData[kSFMessageID.sensorsdata_sfPushKey]; - properties[kSFPlanID] = sfData[kSFPlanID.sensorsdata_sfPushKey]; - properties[kSFStrategyUnitID] = sfData[kSFStrategyUnitID.sensorsdata_sfPushKey]; - properties[kSFEnterPlanTime] = sfData[kSFEnterPlanTime.sensorsdata_sfPushKey]; - return [properties copy]; -} - -@end - -@implementation NSString (SFPushKey) - -- (NSString *)sensorsdata_sfPushKey { - NSString *prefix = @"$"; - if ([self hasPrefix:prefix]) { - return [self substringFromIndex:[prefix length]]; - } - return self; -} - -@end diff --git a/SensorsAnalyticsSDK/AppPush/SAUNUserNotificationCenterDelegateProxy.h b/SensorsAnalyticsSDK/AppPush/SAUNUserNotificationCenterDelegateProxy.h deleted file mode 100644 index 6837324f..00000000 --- a/SensorsAnalyticsSDK/AppPush/SAUNUserNotificationCenterDelegateProxy.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// SAUNUserNotificationCenterDelegateProxy.h -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/7. -// Copyright © 2021 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 "SADelegateProxy.h" - -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 -#import -#endif - -NS_ASSUME_NONNULL_BEGIN - -@interface SAUNUserNotificationCenterDelegateProxy : SADelegateProxy - - - -@end - -NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/AppPush/SAUNUserNotificationCenterDelegateProxy.m b/SensorsAnalyticsSDK/AppPush/SAUNUserNotificationCenterDelegateProxy.m deleted file mode 100644 index 5292aae7..00000000 --- a/SensorsAnalyticsSDK/AppPush/SAUNUserNotificationCenterDelegateProxy.m +++ /dev/null @@ -1,76 +0,0 @@ -// -// SAUNUserNotificationCenterDelegateProxy.m -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/7. -// Copyright © 2021 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. -// - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - -#import "SAUNUserNotificationCenterDelegateProxy.h" -#import "SAClassHelper.h" -#import "NSObject+DelegateProxy.h" -#import "SAAppPushConstants.h" -#import "SensorsAnalyticsSDK.h" -#import "SALog.h" -#import "SANotificationUtil.h" -#import - -@implementation SAUNUserNotificationCenterDelegateProxy - -- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler API_AVAILABLE(ios(10.0)){ - SEL selector = @selector(userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:); - [SAUNUserNotificationCenterDelegateProxy invokeWithTarget:self selector:selector, center, response, completionHandler]; - [SAUNUserNotificationCenterDelegateProxy trackEventWithTarget:self notificationCenter:center notificationResponse:response]; -} - -+ (void)trackEventWithTarget:(NSObject *)target notificationCenter:(UNUserNotificationCenter *)center notificationResponse:(UNNotificationResponse *)response API_AVAILABLE(ios(10.0)){ - // 当 target 和 delegate 不相等时为消息转发, 此时无需重复采集事件 - if (target != center.delegate) { - return; - } - //track notification - NSMutableDictionary *properties = [[NSMutableDictionary alloc] init]; - UNNotificationRequest *request = response.notification.request; - BOOL isRemoteNotification = [request.trigger isKindOfClass:[UNPushNotificationTrigger class]]; - if (isRemoteNotification) { - properties[kSAEventPropertyNotificationChannel] = kSAEventPropertyNotificationChannelApple; - } else { - properties[kSAEventPropertyNotificationServiceName] = kSAEventPropertyNotificationServiceNameLocal; - } - - properties[kSAEventPropertyNotificationTitle] = request.content.title; - properties[kSAEventPropertyNotificationContent] = request.content.body; - - NSDictionary *userInfo = request.content.userInfo; - if (userInfo) { - [properties addEntriesFromDictionary:[SANotificationUtil propertiesFromUserInfo:userInfo]]; - if (userInfo[kSAPushServiceKeySF]) { - properties[kSFMessageTitle] = request.content.title; - properties[kSFMessageContent] = request.content.body; - } - } - - [[SensorsAnalyticsSDK sharedInstance] track:kSAEventNameNotificationClick withProperties:properties]; -} - -+ (NSSet *)optionalSelectors { - return [NSSet setWithArray:@[@"userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:"]]; -} - -@end diff --git a/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.h b/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.h deleted file mode 100644 index c161e0ef..00000000 --- a/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// UIApplication+AutoTrack.h -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/7. -// Copyright © 2021 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 - -NS_ASSUME_NONNULL_BEGIN - -@interface UIApplication (PushClick) - -- (void)sensorsdata_setDelegate:(id )delegate; -@property (nonatomic, copy, nullable) NSDictionary *sensorsdata_launchOptions; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.m b/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.m deleted file mode 100644 index 83b03a26..00000000 --- a/SensorsAnalyticsSDK/AppPush/UIApplication+PushClick.m +++ /dev/null @@ -1,53 +0,0 @@ -// -// UIApplication+AutoTrack.m -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/7. -// Copyright © 2021 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. -// - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - -#import "UIApplication+AutoTrack.h" -#import "SAApplicationDelegateProxy.h" -#import - -static void *const kSALaunchOptions = (void *)&kSALaunchOptions; - -@implementation UIApplication (PushClick) - -- (void)sensorsdata_setDelegate:(id)delegate { - //resolve optional selectors - [SAApplicationDelegateProxy resolveOptionalSelectorsForDelegate:delegate]; - - [self sensorsdata_setDelegate:delegate]; - - if (!self.delegate) { - return; - } - [SAApplicationDelegateProxy proxyDelegate:self.delegate selectors:[NSSet setWithArray:@[@"application:didReceiveLocalNotification:", @"application:didReceiveRemoteNotification:fetchCompletionHandler:"]]]; -} - -- (NSDictionary *)sensorsdata_launchOptions { - return objc_getAssociatedObject(self, kSALaunchOptions); -} - -- (void)setSensorsdata_launchOptions:(NSDictionary *)sensorsdata_launchOptions { - objc_setAssociatedObject(self, kSALaunchOptions, sensorsdata_launchOptions, OBJC_ASSOCIATION_COPY); -} - -@end diff --git a/SensorsAnalyticsSDK/AppPush/UNUserNotificationCenter+PushClick.h b/SensorsAnalyticsSDK/AppPush/UNUserNotificationCenter+PushClick.h deleted file mode 100644 index d71bc2e7..00000000 --- a/SensorsAnalyticsSDK/AppPush/UNUserNotificationCenter+PushClick.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// UNUserNotificationCenter+AutoTrack.h -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/7. -// Copyright © 2021 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. -// - -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 -#import -#endif - -NS_ASSUME_NONNULL_BEGIN - -@interface UNUserNotificationCenter (PushClick) - -- (void)sensorsdata_setDelegate:(id )delegate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/AppPush/UNUserNotificationCenter+PushClick.m b/SensorsAnalyticsSDK/AppPush/UNUserNotificationCenter+PushClick.m deleted file mode 100644 index e8f7efdb..00000000 --- a/SensorsAnalyticsSDK/AppPush/UNUserNotificationCenter+PushClick.m +++ /dev/null @@ -1,41 +0,0 @@ -// -// UNUserNotificationCenter+AutoTrack.m -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/7. -// Copyright © 2021 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. -// - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - -#import "UNUserNotificationCenter+PushClick.h" -#import "SAUNUserNotificationCenterDelegateProxy.h" - -@implementation UNUserNotificationCenter (PushClick) - -- (void)sensorsdata_setDelegate:(id)delegate { - //resolve optional selectors - [SAUNUserNotificationCenterDelegateProxy resolveOptionalSelectorsForDelegate:delegate]; - - [self sensorsdata_setDelegate:delegate]; - if (!self.delegate) { - return; - } - [SAUNUserNotificationCenterDelegateProxy proxyDelegate:self.delegate selectors:[NSSet setWithArray:@[@"userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:"]]]; -} - -@end diff --git a/SensorsAnalyticsSDK/Core/HookDelegate/NSObject+DelegateProxy.h b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/NSObject+SACellClick.h similarity index 71% rename from SensorsAnalyticsSDK/Core/HookDelegate/NSObject+DelegateProxy.h rename to SensorsAnalyticsSDK/Core/AutoTrack/Cell/NSObject+SACellClick.h index ffb74314..0faa6682 100644 --- a/SensorsAnalyticsSDK/Core/HookDelegate/NSObject+DelegateProxy.h +++ b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/NSObject+SACellClick.h @@ -1,5 +1,5 @@ // -// NSObject+DelegateProxy.h +// NSObject+SACellClick.h // SensorsAnalyticsSDK // // Created by yuqiang on 2020/11/5. @@ -18,27 +18,23 @@ // limitations under the License. // +#if ! __has_feature(objc_arc) +#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. +#endif + #import NS_ASSUME_NONNULL_BEGIN -@interface NSObject (DelegateProxy) +@interface NSObject (SACellClick) /// 用于记录创建子类时的原始父类名称 @property (nonatomic, copy, nullable) NSString *sensorsdata_className; -@property (nonatomic, copy, nullable) NSSet *sensorsdata_selectors; -@property (nonatomic, copy, nullable) NSSet *sensorsdata_optionalSelectors; -@property (nonatomic, strong, nullable) id sensorsdata_delegateProxy; /// 注册一个操作,在对象释放时调用; 重复调用该方法时,只有第一次调用时的 block 生效 /// @param deallocBlock 操作 - (void)sensorsdata_registerDeallocBlock:(void (^)(void))deallocBlock; - -/// hook respondsToSelector to resolve optional selectors -/// @param aSelector selector -- (BOOL)sensorsdata_respondsToSelector:(SEL)aSelector; - @end NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/Core/HookDelegate/NSObject+DelegateProxy.m b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/NSObject+SACellClick.m similarity index 60% rename from SensorsAnalyticsSDK/Core/HookDelegate/NSObject+DelegateProxy.m rename to SensorsAnalyticsSDK/Core/AutoTrack/Cell/NSObject+SACellClick.m index 052f3b0f..ea32b6d9 100644 --- a/SensorsAnalyticsSDK/Core/HookDelegate/NSObject+DelegateProxy.m +++ b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/NSObject+SACellClick.m @@ -22,7 +22,7 @@ #error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. #endif -#import "NSObject+DelegateProxy.h" +#import "NSObject+SACellClick.h" #import @interface SADelegateProxyParasite : NSObject @@ -41,9 +41,6 @@ - (void)dealloc { static void *const kSADelegateProxyParasiteName = (void *)&kSADelegateProxyParasiteName; static void *const kSADelegateProxyClassName = (void *)&kSADelegateProxyClassName; -static void *const kSADelegateSelectors = (void *)&kSADelegateSelectors; -static void *const kSADelegateOptionalSelectors = (void *)&kSADelegateOptionalSelectors; -static void *const kSADelegateProxy = (void *)&kSADelegateProxy; @interface NSObject (SACellClick) @@ -51,7 +48,7 @@ @interface NSObject (SACellClick) @end -@implementation NSObject (DelegateProxy) +@implementation NSObject (SACellClick) - (SADelegateProxyParasite *)sensorsdata_parasite { return objc_getAssociatedObject(self, kSADelegateProxyParasiteName); @@ -69,30 +66,6 @@ - (void)setSensorsdata_className:(NSString *)sensorsdata_className { objc_setAssociatedObject(self, kSADelegateProxyClassName, sensorsdata_className, OBJC_ASSOCIATION_COPY); } -- (NSSet *)sensorsdata_selectors { - return objc_getAssociatedObject(self, kSADelegateSelectors); -} - -- (void)setSensorsdata_selectors:(NSSet *)sensorsdata_selectors { - objc_setAssociatedObject(self, kSADelegateSelectors, sensorsdata_selectors, OBJC_ASSOCIATION_COPY); -} - -- (NSSet *)sensorsdata_optionalSelectors { - return objc_getAssociatedObject(self, kSADelegateOptionalSelectors); -} - -- (void)setSensorsdata_optionalSelectors:(NSSet *)sensorsdata_optionalSelectors { - objc_setAssociatedObject(self, kSADelegateOptionalSelectors, sensorsdata_optionalSelectors, OBJC_ASSOCIATION_COPY); -} - -- (id)sensorsdata_delegateProxy { - return objc_getAssociatedObject(self, kSADelegateProxy); -} - -- (void)setSensorsdata_delegateProxy:(id)sensorsdata_delegateProxy { - objc_setAssociatedObject(self, kSADelegateProxy, sensorsdata_delegateProxy, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - - (void)sensorsdata_registerDeallocBlock:(void (^)(void))deallocBlock { if (!self.sensorsdata_parasite) { self.sensorsdata_parasite = [[SADelegateProxyParasite alloc] init]; @@ -100,14 +73,4 @@ - (void)sensorsdata_registerDeallocBlock:(void (^)(void))deallocBlock { } } -- (BOOL)sensorsdata_respondsToSelector:(SEL)aSelector { - if ([self sensorsdata_respondsToSelector:aSelector]) { - return YES; - } - if ([self.sensorsdata_optionalSelectors containsObject:NSStringFromSelector(aSelector)]) { - return YES; - } - return NO; -} - @end diff --git a/SensorsAnalyticsSDK/Core/HookDelegate/SAClassHelper.h b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAClassHelper.h similarity index 91% rename from SensorsAnalyticsSDK/Core/HookDelegate/SAClassHelper.h rename to SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAClassHelper.h index 69f913e8..b5710cb1 100644 --- a/SensorsAnalyticsSDK/Core/HookDelegate/SAClassHelper.h +++ b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAClassHelper.h @@ -18,6 +18,10 @@ // limitations under the License. // +#if ! __has_feature(objc_arc) +#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. +#endif + #import NS_ASSUME_NONNULL_BEGIN diff --git a/SensorsAnalyticsSDK/Core/HookDelegate/SAClassHelper.m b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAClassHelper.m similarity index 100% rename from SensorsAnalyticsSDK/Core/HookDelegate/SAClassHelper.m rename to SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAClassHelper.m diff --git a/SensorsAnalyticsSDK/Core/HookDelegate/SADelegateProxy.h b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SADelegateProxy.h similarity index 54% rename from SensorsAnalyticsSDK/Core/HookDelegate/SADelegateProxy.h rename to SensorsAnalyticsSDK/Core/AutoTrack/Cell/SADelegateProxy.h index 4ce4f45a..cf5f4adb 100644 --- a/SensorsAnalyticsSDK/Core/HookDelegate/SADelegateProxy.h +++ b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SADelegateProxy.h @@ -22,29 +22,14 @@ NS_ASSUME_NONNULL_BEGIN -@protocol SAHookDelegateProtocol -@optional -+ (NSSet *)optionalSelectors; - -@end - -@interface SADelegateProxy : NSObject - -/// proxy delegate with selectors -/// @param delegate delegate object, such as UITableViewDelegate、UICollectionViewDelegate, etc. -/// @param selectors delegate proxy methods, such as "tableView:didSelectRowAtIndexPath:"、"collectionView:didSelectItemAtIndexPath:", etc. -+ (void)proxyDelegate:(id)delegate selectors:(NSSet*)selectors; - - -/// forward selector with arguments -/// @param target target -/// @param selector selector -+ (void)invokeWithTarget:(NSObject *)target selector:(SEL)selector, ...; +@interface SADelegateProxy : NSObject +/** + 对 TableView 和 CollectionView 的单元格选中方法进行代理 -/// actions for optional selectors -/// @param delegate delegate object -+ (void)resolveOptionalSelectorsForDelegate:(id)delegate; + @param delegate 代理:UITableViewDelegate、UICollectionViewDelegate 等 + */ ++ (void)proxyWithDelegate:(id)delegate; @end diff --git a/SensorsAnalyticsSDK/Core/HookDelegate/SADelegateProxy.m b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SADelegateProxy.m similarity index 63% rename from SensorsAnalyticsSDK/Core/HookDelegate/SADelegateProxy.m rename to SensorsAnalyticsSDK/Core/AutoTrack/Cell/SADelegateProxy.m index d2f8df99..ab2a4e59 100644 --- a/SensorsAnalyticsSDK/Core/HookDelegate/SADelegateProxy.m +++ b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SADelegateProxy.m @@ -25,53 +25,47 @@ #import "SADelegateProxy.h" #import "SAClassHelper.h" #import "SAMethodHelper.h" +#import "NSObject+SACellClick.h" #import "SALog.h" +#import "SAAutoTrackUtils.h" #import "SAAutoTrackProperty.h" -#import "NSObject+DelegateProxy.h" +#import "SensorsAnalyticsSDK+Private.h" +#import "SAConstants+Private.h" #import +typedef void (*SensorsDidSelectImplementation)(id, SEL, UIScrollView *, NSIndexPath *); + @implementation SADelegateProxy -/// Overridden instance class method -- (Class)class { - if (self.sensorsdata_className) { - return NSClassFromString(self.sensorsdata_className); ++ (void)proxyWithDelegate:(id)delegate { + @try { + [SADelegateProxy hookDidSelectMethodWithDelegate:delegate]; + } @catch (NSException *exception) { + return SALogError(@"%@", exception); } - return [super class]; } -+ (void)proxyDelegate:(id)delegate selectors:(NSSet *)selectors { - if (selectors.count < 1) { ++ (void)hookDidSelectMethodWithDelegate:(id)delegate { + // 当前代理对象已经处理过 + if ([delegate sensorsdata_className]) { return; } - Class proxyClass = [self class]; - NSMutableSet *delegateSelectors = [NSMutableSet setWithSet:[self selectorsFor:delegate withSelectors:selectors]]; + SEL tablViewSelector = @selector(tableView:didSelectRowAtIndexPath:); + SEL collectionViewSelector = @selector(collectionView:didSelectItemAtIndexPath:); - // 当前代理对象已经处理过 - if ([delegate sensorsdata_className]) { - NSMutableSet *currentSelectors = [NSMutableSet setWithSet:((NSObject *)delegate).sensorsdata_selectors]; - if (currentSelectors.count > 0) { - [delegateSelectors minusSet:currentSelectors]; - } - - if (delegateSelectors.count < 1) { - return; - } - - [self addInstanceMethodWithSelectors:delegateSelectors fromClass:proxyClass toClass:[SAClassHelper realClassWithObject:delegate]]; - [delegateSelectors unionSet:currentSelectors]; - ((NSObject *)delegate).sensorsdata_selectors = [delegateSelectors copy]; - ((NSObject *)delegate).sensorsdata_delegateProxy = self; + BOOL canResponseTableView = [delegate respondsToSelector:tablViewSelector]; + BOOL canResponseCollectionView = [delegate respondsToSelector:collectionViewSelector]; + + // 代理对象未实现单元格选中方法, 则不处理 + if (!canResponseTableView && !canResponseCollectionView) { return; } - - ((NSObject *)delegate).sensorsdata_selectors = [delegateSelectors copy]; - ((NSObject *)delegate).sensorsdata_delegateProxy = self; + Class proxyClass = [SADelegateProxy class]; // KVO 创建子类后会重写 - (Class)class 方法, 直接通过 object.class 无法获取真实的类 Class realClass = [SAClassHelper realClassWithObject:delegate]; // 如果当前代理对象归属为 KVO 创建的类, 则无需新建子类 - if ([self isKVOClass:realClass]) { + if ([SADelegateProxy isKVOClass:realClass]) { // 记录 KVO 的父类(KVO 会重写 class 方法, 返回父类) [delegate setSensorsdata_className:NSStringFromClass([delegate class])]; if ([realClass isKindOfClass:[NSObject class]]) { @@ -79,8 +73,9 @@ + (void)proxyDelegate:(id)delegate selectors:(NSSet *)selectors { [SAMethodHelper addInstanceMethodWithSelector:@selector(removeObserver:forKeyPath:) fromClass:proxyClass toClass:realClass]; } - // 给 KVO 的类添加需要 hook 的方法 - [self addInstanceMethodWithSelectors:delegateSelectors fromClass:proxyClass toClass:realClass]; + // 给 KVO 的类添加 cell 点击方法, 采集点击事件 + [SAMethodHelper addInstanceMethodWithSelector:tablViewSelector fromClass:proxyClass toClass:realClass]; + [SAMethodHelper addInstanceMethodWithSelector:collectionViewSelector fromClass:proxyClass toClass:realClass]; return; } @@ -91,8 +86,9 @@ + (void)proxyDelegate:(id)delegate selectors:(NSSet *)selectors { return; } - // 给新创建的类添加需要 hook 的方法 - [self addInstanceMethodWithSelectors:delegateSelectors fromClass:proxyClass toClass:dynamicClass]; + // 给新创建的类添加 cell 点击方法, 采集点击事件 + [SAMethodHelper addInstanceMethodWithSelector:tablViewSelector fromClass:proxyClass toClass:dynamicClass]; + [SAMethodHelper addInstanceMethodWithSelector:collectionViewSelector fromClass:proxyClass toClass:dynamicClass]; if ([realClass isKindOfClass:[NSObject class]]) { // 新建子类后,需要监听是否添加了 KVO, 因为添加 KVO 属性监听后, KVO 会重写 Class 方法, 导致获取的 Class 为神策添加的子类 @@ -118,64 +114,56 @@ + (void)proxyDelegate:(id)delegate selectors:(NSSet *)selectors { } } -+ (void)addInstanceMethodWithSelectors:(NSSet *)selectors fromClass:(Class)fromClass toClass:(Class)toClass { - for (NSString *selector in selectors) { - SEL sel = NSSelectorFromString(selector); - [SAMethodHelper addInstanceMethodWithSelector:sel fromClass:fromClass toClass:toClass]; - } -} +@end -+ (NSSet *)selectorsFor:(id)object withSelectors:(NSSet *)selectors { - NSMutableSet *validSelectors = [[NSMutableSet alloc] init]; - for (NSString *selector in selectors) { - SEL aSelector = NSSelectorFromString(selector); - if (aSelector && [object respondsToSelector:aSelector]) { - [validSelectors addObject:selector]; - } +#pragma mark - UITableViewDelegate & UICollectionViewDelegate + +@implementation SADelegateProxy (SubclassMethod) + +/// Overridden instance class method +- (Class)class { + if (self.sensorsdata_className) { + return NSClassFromString(self.sensorsdata_className); } - return [validSelectors copy]; + return [super class]; } -+ (void)invokeWithTarget:(NSObject *)target selector:(SEL)selector, ... { ++ (void)invokeWithTarget:(NSObject *)target selector:(SEL)selector scrollView:(UIScrollView *)scrollView indexPath:(NSIndexPath *)indexPath { Class originalClass = NSClassFromString(target.sensorsdata_className) ?: target.superclass; - if (![target forwardingTargetForSelector:selector] && ![originalClass instancesRespondToSelector:selector]) { - return; - } - va_list args; - va_start(args, selector); - id arg1 = nil, arg2 = nil, arg3 = nil, arg4 = nil; - NSInteger count = [NSStringFromSelector(selector) componentsSeparatedByString:@":"].count - 1; - for (NSInteger i = 0; i < count; i++) { - i == 0 ? (arg1 = va_arg(args, id)) : nil; - i == 1 ? (arg2 = va_arg(args, id)) : nil; - i == 2 ? (arg3 = va_arg(args, id)) : nil; - i == 3 ? (arg4 = va_arg(args, id)) : nil; - } struct objc_super targetSuper = { .receiver = target, .super_class = originalClass }; // 消息转发给原始类 - void (*func)(struct objc_super *, SEL, id, id, id, id) = (void *)&objc_msgSendSuper; - func(&targetSuper, selector, arg1, arg2, arg3, arg4); - va_end(args); -} - -+ (void)resolveOptionalSelectorsForDelegate:(id)delegate { - NSSet *currentOptionalSelectors = ((NSObject *)delegate).sensorsdata_optionalSelectors; - NSMutableSet *optionalSelectors = [[NSMutableSet alloc] init]; - if (currentOptionalSelectors) { - [optionalSelectors unionSet:currentOptionalSelectors]; - } + void (*func)(struct objc_super *, SEL, id, id) = (void *)&objc_msgSendSuper; + func(&targetSuper, selector, scrollView, indexPath); - if ([self respondsToSelector:@selector(optionalSelectors)] &&[self optionalSelectors]) { - [optionalSelectors unionSet:[self optionalSelectors]]; + // 当 target 和 delegate 不相等时为消息转发, 此时无需重复采集事件 + if (target != scrollView.delegate) { + return; } - ((NSObject *)delegate).sensorsdata_optionalSelectors = [optionalSelectors copy]; + + NSMutableDictionary *properties = [SAAutoTrackUtils propertiesWithAutoTrackObject:(UIScrollView *)scrollView didSelectedAtIndexPath:indexPath]; + if (!properties) { + return; + } + NSDictionary *dic = [SAAutoTrackUtils propertiesWithAutoTrackDelegate:scrollView didSelectedAtIndexPath:indexPath]; + [properties addEntriesFromDictionary:dic]; + + [[SensorsAnalyticsSDK sharedInstance] trackAutoEvent:SA_EVENT_NAME_APP_CLICK properties:properties]; } -@end +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + SEL methodSelector = @selector(tableView:didSelectRowAtIndexPath:); + [SADelegateProxy invokeWithTarget:self selector:methodSelector scrollView:tableView indexPath:indexPath]; +} +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + SEL methodSelector = @selector(collectionView:didSelectItemAtIndexPath:); + [SADelegateProxy invokeWithTarget:self selector:methodSelector scrollView:collectionView indexPath:indexPath]; +} + +@end #pragma mark - KVO @implementation SADelegateProxy (KVO) @@ -199,16 +187,12 @@ - (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath { if (oldClassIsKVO && !newClassIsKVO) { // 清空已经记录的原始类 self.sensorsdata_className = nil; - Class delegateProxy = [self.sensorsdata_delegateProxy class]; - if ([delegateProxy respondsToSelector:NSSelectorFromString(@"proxyDelegate:selectors:")]) { - [delegateProxy proxyDelegate:self selectors:self.sensorsdata_selectors]; - } + [SADelegateProxy proxyWithDelegate:self]; } } @end - #pragma mark - Utils /// Delegate 的类前缀 static NSString *const kSADelegateSuffix = @"__CN.SENSORSDATA"; diff --git a/SensorsAnalyticsSDK/Core/HookDelegate/SAMethodHelper.h b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAMethodHelper.h similarity index 100% rename from SensorsAnalyticsSDK/Core/HookDelegate/SAMethodHelper.h rename to SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAMethodHelper.h diff --git a/SensorsAnalyticsSDK/Core/HookDelegate/SAMethodHelper.m b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAMethodHelper.m similarity index 93% rename from SensorsAnalyticsSDK/Core/HookDelegate/SAMethodHelper.m rename to SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAMethodHelper.m index f98882fc..ed572df8 100644 --- a/SensorsAnalyticsSDK/Core/HookDelegate/SAMethodHelper.m +++ b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAMethodHelper.m @@ -18,10 +18,6 @@ // limitations under the License. // -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - #import "SAMethodHelper.h" #import #import "SALog.h" @@ -42,9 +38,6 @@ + (void)addInstanceMethodWithSelector:(SEL)methodSelector fromClass:(Class)fromC + (void)addInstanceMethodWithDestinationSelector:(SEL)destinationSelector sourceSelector:(SEL)sourceSelector fromClass:(Class)fromClass toClass:(Class)toClass { // 获取一个实例方法的指针 Method method = class_getInstanceMethod(fromClass, sourceSelector); - if (!method) { - return; - } // 返回该方法的实现 IMP methodIMP = method_getImplementation(method); // 获取该方法的返回类型 diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.h b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.h deleted file mode 100644 index f0d12e08..00000000 --- a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// SAScrollViewDelegateProxy.h -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/6. -// Copyright © 2021 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 "SADelegateProxy.h" -#import "NSObject+DelegateProxy.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SAScrollViewDelegateProxy : SADelegateProxy - -@end - -NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.m b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.m deleted file mode 100644 index 97dff971..00000000 --- a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/SAScrollViewDelegateProxy.m +++ /dev/null @@ -1,61 +0,0 @@ -// -// SAScrollViewDelegateProxy.m -// SensorsAnalyticsSDK -// -// Created by 陈玉国 on 2021/1/6. -// Copyright © 2021 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. -// - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - -#import "SAScrollViewDelegateProxy.h" -#import "SAAutoTrackUtils.h" -#import "SensorsAnalyticsSDK+Private.h" -#import "SAConstants+Private.h" -#import - -@implementation SAScrollViewDelegateProxy - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - SEL methodSelector = @selector(tableView:didSelectRowAtIndexPath:); - [SAScrollViewDelegateProxy invokeWithTarget:self selector:methodSelector, tableView, indexPath]; - [SAScrollViewDelegateProxy trackEventWithTarget:self scrollView:tableView atIndexPath:indexPath]; -} - -- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - SEL methodSelector = @selector(collectionView:didSelectItemAtIndexPath:); - [SAScrollViewDelegateProxy invokeWithTarget:self selector:methodSelector, collectionView, indexPath]; - [SAScrollViewDelegateProxy trackEventWithTarget:self scrollView:collectionView atIndexPath:indexPath]; -} - -+ (void)trackEventWithTarget:(NSObject *)target scrollView:(UIScrollView *)scrollView atIndexPath:(NSIndexPath *)indexPath { - // 当 target 和 delegate 不相等时为消息转发, 此时无需重复采集事件 - if (target != scrollView.delegate) { - return; - } - - NSMutableDictionary *properties = [SAAutoTrackUtils propertiesWithAutoTrackObject:(UIScrollView *)scrollView didSelectedAtIndexPath:indexPath]; - if (!properties) { - return; - } - NSDictionary *dic = [SAAutoTrackUtils propertiesWithAutoTrackDelegate:scrollView didSelectedAtIndexPath:indexPath]; - [properties addEntriesFromDictionary:dic]; - - [[SensorsAnalyticsSDK sharedInstance] trackAutoEvent:SA_EVENT_NAME_APP_CLICK properties:properties]; -} - -@end diff --git a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/UIScrollView+AutoTrack.m b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/UIScrollView+AutoTrack.m index 59708043..62fd842e 100644 --- a/SensorsAnalyticsSDK/Core/AutoTrack/Cell/UIScrollView+AutoTrack.m +++ b/SensorsAnalyticsSDK/Core/AutoTrack/Cell/UIScrollView+AutoTrack.m @@ -18,25 +18,17 @@ // limitations under the License. // -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - #import "UIScrollView+AutoTrack.h" -#import "SAScrollViewDelegateProxy.h" +#import "SADelegateProxy.h" #import #import #import "SensorsAnalyticsSDK.h" #import "SAConstants+Private.h" #import "SensorsAnalyticsSDK+Private.h" - @implementation UITableView (AutoTrack) - (void)sensorsdata_setDelegate:(id )delegate { - //resolve optional selectors - [SAScrollViewDelegateProxy resolveOptionalSelectorsForDelegate:delegate]; - [self sensorsdata_setDelegate:delegate]; if (self.delegate == nil) { @@ -48,7 +40,7 @@ - (void)sensorsdata_setDelegate:(id )delegate { } // 使用委托类去 hook 点击事件方法 - [SAScrollViewDelegateProxy proxyDelegate:self.delegate selectors:[NSSet setWithArray:@[@"tableView:didSelectRowAtIndexPath:"]]]; + [SADelegateProxy proxyWithDelegate:self.delegate]; } @end @@ -57,9 +49,6 @@ - (void)sensorsdata_setDelegate:(id )delegate { @implementation UICollectionView (AutoTrack) - (void)sensorsdata_setDelegate:(id )delegate { - //resolve optional selectors - [SAScrollViewDelegateProxy resolveOptionalSelectorsForDelegate:delegate]; - [self sensorsdata_setDelegate:delegate]; if (self.delegate == nil) { @@ -71,7 +60,7 @@ - (void)sensorsdata_setDelegate:(id )delegate { } // 使用委托类去 hook 点击事件方法 - [SAScrollViewDelegateProxy proxyDelegate:self.delegate selectors:[NSSet setWithArray:@[@"collectionView:didSelectItemAtIndexPath:"]]]; + [SADelegateProxy proxyWithDelegate:self.delegate]; } @end diff --git a/SensorsAnalyticsSDK/Core/SAConfigOptions.h b/SensorsAnalyticsSDK/Core/SAConfigOptions.h index a5a1bf9d..ae8c0dd6 100644 --- a/SensorsAnalyticsSDK/Core/SAConfigOptions.h +++ b/SensorsAnalyticsSDK/Core/SAConfigOptions.h @@ -159,9 +159,6 @@ NS_ASSUME_NONNULL_BEGIN /// 开启前向页面标题采集功能,默认不开启 @property (nonatomic, assign) BOOL enableReferrerTitle; -///开启自动采集通知 -@property (nonatomic, assign) BOOL enableTrackPush; - @end diff --git a/SensorsAnalyticsSDK/Core/SAConfigOptions.m b/SensorsAnalyticsSDK/Core/SAConfigOptions.m index 00a72fe8..dfb089b3 100644 --- a/SensorsAnalyticsSDK/Core/SAConfigOptions.m +++ b/SensorsAnalyticsSDK/Core/SAConfigOptions.m @@ -86,7 +86,6 @@ - (id)copyWithZone:(nullable NSZone *)zone { options.enableMultipleChannelMatch = self.enableMultipleChannelMatch; options.enableReferrerTitle = self.enableReferrerTitle; - options.enableTrackPush = self.enableTrackPush; return options; } diff --git a/SensorsAnalyticsSDK/Core/SAModuleManager.h b/SensorsAnalyticsSDK/Core/SAModuleManager.h index 205f0088..f2250e7c 100644 --- a/SensorsAnalyticsSDK/Core/SAModuleManager.h +++ b/SensorsAnalyticsSDK/Core/SAModuleManager.h @@ -27,7 +27,6 @@ typedef NS_ENUM(NSUInteger, SAModuleType) { SAModuleTypeLocation, SAModuleTypeChannelMatch, SAModuleTypeEncrypt, - SAModuleTypeAppPush, }; @interface SAModuleManager : NSObject @@ -63,10 +62,6 @@ typedef NS_ENUM(NSUInteger, SAModuleType) { @end -@interface SAModuleManager (PushClick) - -@end - #pragma mark - @interface SAModuleManager (Gesture) diff --git a/SensorsAnalyticsSDK/Core/SAModuleManager.m b/SensorsAnalyticsSDK/Core/SAModuleManager.m index c52e135e..51f891d5 100644 --- a/SensorsAnalyticsSDK/Core/SAModuleManager.m +++ b/SensorsAnalyticsSDK/Core/SAModuleManager.m @@ -30,7 +30,6 @@ static NSString * const kSALocationModuleName = @"Location"; static NSString * const kSAChannelMatchModuleName = @"ChannelMatch"; static NSString * const kSAEncryptModuleName = @"Encrypt"; -static NSString * const kSANotificationModuleName = @"AppPush"; static NSString * const kSAGestureModuleName = @"Gesture"; @interface SAModuleManager () @@ -105,8 +104,6 @@ - (NSString *)moduleNameForType:(SAModuleType)type { return kSAChannelMatchModuleName; case SAModuleTypeEncrypt: return kSAEncryptModuleName; - case SAModuleTypeAppPush: - return kSANotificationModuleName; default: return nil; } @@ -199,15 +196,6 @@ - (void)handleEncryptWithConfig:(nonnull NSDictionary *)encryptConfig { @end -@implementation SAModuleManager (PushClick) - -- (void)setLaunchOptions:(NSDictionary *)launchOptions { - id manager = (id)[[SAModuleManager sharedInstance] managerForModuleType:SAModuleTypeAppPush]; - [manager setLaunchOptions:launchOptions]; -} - -@end - #pragma mark - @implementation SAModuleManager (Gesture) diff --git a/SensorsAnalyticsSDK/Core/SAModuleProtocol.h b/SensorsAnalyticsSDK/Core/SAModuleProtocol.h index 13301960..edbf0833 100644 --- a/SensorsAnalyticsSDK/Core/SAModuleProtocol.h +++ b/SensorsAnalyticsSDK/Core/SAModuleProtocol.h @@ -87,12 +87,6 @@ NS_ASSUME_NONNULL_BEGIN @end -@protocol SAAppPushModuleProtocol - -- (void)setLaunchOptions:(NSDictionary *)launchOptions; - -@end - #pragma mark - @protocol SAGestureModuleProtocol diff --git a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m index 21f6d655..9427e5a8 100755 --- a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m +++ b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m @@ -79,7 +79,7 @@ #import "SAChannelMatchManager.h" #import "SAReferrerManager.h" -#define VERSION @"2.5.1" +#define VERSION @"2.5.2" static NSUInteger const SA_PROPERTY_LENGTH_LIMITATION = 8191; @@ -371,11 +371,6 @@ - (instancetype)initWithConfigOptions:(nonnull SAConfigOptions *)configOptions d if (_configOptions.enableJavaScriptBridge || _configOptions.enableVisualizedAutoTrack || _configOptions.enableHeatMap) { [self swizzleWebViewMethod]; } - - if (_configOptions.enableTrackPush) { - [[SAModuleManager sharedInstance] setEnable:YES forModuleType:SAModuleTypeAppPush]; - [SAModuleManager sharedInstance].launchOptions = configOptions.launchOptions; - } } } @catch(NSException *exception) { @@ -2252,7 +2247,6 @@ - (void)_enableAutoTrack { SEL selector = NSSelectorFromString(@"sensorsdata_setDelegate:"); [UITableView sa_swizzleMethod:@selector(setDelegate:) withMethod:selector error:NULL]; - [NSObject sa_swizzleMethod:@selector(respondsToSelector:) withMethod:@selector(sensorsdata_respondsToSelector:) error:NULL]; [UICollectionView sa_swizzleMethod:@selector(setDelegate:) withMethod:selector error:NULL]; });