From 88f1c1fbdadc2980da603f31eb6d717c0c720680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B4=8B=E6=B4=8B?= Date: Thu, 26 May 2022 16:22:28 +0800 Subject: [PATCH] Release 4.3.1 --- Example/Example.xcodeproj/project.pbxproj | 149 +--------------- .../xcschemes/SensorsDataExtention.xcscheme | 122 ------------- Example/SensorsData/AppDelegate.m | 2 - Example/SensorsDataExtention/Info.plist | 39 ---- .../MainInterface.storyboard | 30 ---- .../SensorsDataExtention.entitlements | 10 -- .../ShareViewController.h | 26 --- .../ShareViewController.m | 55 ------ .../SensorsAnalyticsExtension.h | 31 ---- SensorsAnalyticsSDK.podspec | 10 +- SensorsAnalyticsSDK.xcodeproj/project.pbxproj | 168 +++--------------- .../SensorsAnalyticsExtension.xcscheme | 80 --------- .../SAAppExtensionDataManager.h | 0 .../SAAppExtensionDataManager.m | 0 .../SensorsAnalyticsSDK+SAAppExtension.h | 38 ++++ .../SensorsAnalyticsSDK+SAAppExtension.m | 54 ++++++ .../Core/Builder/SASessionProperty.h | 4 + .../Core/Builder/SASessionProperty.m | 13 +- SensorsAnalyticsSDK/Core/SAConfigOptions.h | 3 + SensorsAnalyticsSDK/Core/SAConfigOptions.m | 13 +- .../Core/SensorsAnalyticsSDK+Public.h | 9 - .../Core/SensorsAnalyticsSDK.h | 4 + .../Core/SensorsAnalyticsSDK.m | 26 +-- .../Deeplink/SADeepLinkConstants.h | 2 + .../Deeplink/SADeepLinkConstants.m | 2 + .../Deeplink/SARequestDeepLinkProcessor.m | 31 +++- 26 files changed, 188 insertions(+), 733 deletions(-) delete mode 100644 Example/Example.xcodeproj/xcshareddata/xcschemes/SensorsDataExtention.xcscheme delete mode 100644 Example/SensorsDataExtention/Info.plist delete mode 100644 Example/SensorsDataExtention/MainInterface.storyboard delete mode 100644 Example/SensorsDataExtention/SensorsDataExtention.entitlements delete mode 100644 Example/SensorsDataExtention/ShareViewController.h delete mode 100644 Example/SensorsDataExtention/ShareViewController.m delete mode 100644 SensorsAnalyticsExtension/SensorsAnalyticsExtension.h delete mode 100644 SensorsAnalyticsSDK.xcodeproj/xcshareddata/xcschemes/SensorsAnalyticsExtension.xcscheme rename SensorsAnalyticsSDK/{Core => AppExtension}/SAAppExtensionDataManager.h (100%) rename SensorsAnalyticsSDK/{Core => AppExtension}/SAAppExtensionDataManager.m (100%) create mode 100644 SensorsAnalyticsSDK/AppExtension/SensorsAnalyticsSDK+SAAppExtension.h create mode 100644 SensorsAnalyticsSDK/AppExtension/SensorsAnalyticsSDK+SAAppExtension.m diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index b4098a3f..93de2f6a 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -8,11 +8,8 @@ /* Begin PBXBuildFile section */ 4DC0584E232F7C16008D5C7E /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DC0584D232F7C16008D5C7E /* AdSupport.framework */; }; - 4DCD115B22927F6E0091D129 /* SensorsAnalyticsExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB6EBB2522855F0C003CFBA8 /* SensorsAnalyticsExtension.framework */; }; - 4DCD115C22927F6E0091D129 /* SensorsAnalyticsExtension.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CB6EBB2522855F0C003CFBA8 /* SensorsAnalyticsExtension.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4DCD115D22927F790091D129 /* SensorsAnalyticsSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB30C2622284229F0004061D /* SensorsAnalyticsSDK.framework */; }; 4DCD115E22927F790091D129 /* SensorsAnalyticsSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CB30C2622284229F0004061D /* SensorsAnalyticsSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 8881569323B2F83900007AD1 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB30C23A228418000004061D /* MainInterface.storyboard */; }; 88EA2E85250F613C00B0FFB8 /* SensorsAnalyticsSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 88EA2E84250F613C00B0FFB8 /* SensorsAnalyticsSDK.framework */; }; 88EA2E86250F613C00B0FFB8 /* SensorsAnalyticsSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 88EA2E84250F613C00B0FFB8 /* SensorsAnalyticsSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; CB30C204228414420004061D /* TestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CB30C1D8228414420004061D /* TestViewController.m */; }; @@ -31,8 +28,6 @@ CB30C219228414940004061D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB30C1D5228414420004061D /* AppDelegate.swift */; }; CB30C21A228414940004061D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB30C1CE228414420004061D /* ViewController.swift */; }; CB30C2222284165A0004061D /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB30C2212284165A0004061D /* WebKit.framework */; }; - CB30C2332284173B0004061D /* SensorsDataExtention.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = CB30C2282284173B0004061D /* SensorsDataExtention.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - CB30C242228418000004061D /* ShareViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CB30C23B228418000004061D /* ShareViewController.m */; }; CB30C246228421C60004061D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB30C1E3228414420004061D /* Main.storyboard */; }; CB30C247228421C60004061D /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = CB30C1E1228414420004061D /* LaunchScreen.xib */; }; CB30C249228421E80004061D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB30C248228421E80004061D /* Foundation.framework */; }; @@ -50,22 +45,11 @@ CB30C269228422B40004061D /* SafariServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB30C268228422B40004061D /* SafariServices.framework */; }; CB30C26A228423080004061D /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB30C2212284165A0004061D /* WebKit.framework */; }; CB30C26B2284230F0004061D /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = CB30C25E2284227C0004061D /* libz.tbd */; }; - CB6EBB2622855F0C003CFBA8 /* SensorsAnalyticsExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB6EBB2522855F0C003CFBA8 /* SensorsAnalyticsExtension.framework */; }; CB6EBB4E22857075003CFBA8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB30C1D2228414420004061D /* Main.storyboard */; }; CB6EBB4F2285707D003CFBA8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB30C1D0228414420004061D /* LaunchScreen.storyboard */; }; FCA9E9AF2502399600837A31 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB30C24C228422090004061D /* CoreGraphics.framework */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - CB30C2312284173B0004061D /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = CB30C0B02284115D0004061D /* Project object */; - proxyType = 1; - remoteGlobalIDString = CB30C2272284173B0004061D; - remoteInfo = SensorsDataExtention; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXCopyFilesBuildPhase section */ CB30C21F228415E40004061D /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -74,7 +58,6 @@ dstSubfolderSpec = 10; files = ( 88EA2E86250F613C00B0FFB8 /* SensorsAnalyticsSDK.framework in Embed Frameworks */, - 4DCD115C22927F6E0091D129 /* SensorsAnalyticsExtension.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -85,7 +68,6 @@ dstPath = ""; dstSubfolderSpec = 13; files = ( - CB30C2332284173B0004061D /* SensorsDataExtention.appex in Embed App Extensions */, ); name = "Embed App Extensions"; runOnlyForDeploymentPostprocessing = 0; @@ -141,12 +123,6 @@ CB30C1F4228414420004061D /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; CB30C2212284165A0004061D /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; CB30C223228416640004061D /* SensorsAnalyticsSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SensorsAnalyticsSDK.framework; path = "../../../../Library/Developer/Xcode/DerivedData/SensorsAnalyticsSDK-hhqmjeoyzfdasagvypdnnkywlofx/Build/Products/Debug-iphoneos/SensorsAnalyticsSDK.framework"; sourceTree = ""; }; - CB30C2282284173B0004061D /* SensorsDataExtention.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SensorsDataExtention.appex; sourceTree = BUILT_PRODUCTS_DIR; }; - CB30C23A228418000004061D /* MainInterface.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MainInterface.storyboard; sourceTree = ""; }; - CB30C23B228418000004061D /* ShareViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShareViewController.m; sourceTree = ""; }; - CB30C23C228418000004061D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - CB30C23D228418000004061D /* ShareViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareViewController.h; sourceTree = ""; }; - CB30C240228418000004061D /* SensorsDataExtention.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = SensorsDataExtention.entitlements; sourceTree = ""; }; CB30C248228421E80004061D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; CB30C24A228421F60004061D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; CB30C24C228422090004061D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -168,6 +144,7 @@ CB6EBB5622857145003CFBA8 /* SensorsAnalyticsSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SensorsAnalyticsSDK.framework; path = "../../../../Library/Developer/Xcode/DerivedData/SensorsAnalyticsSDK-fmwsimfdiqmlilcpdnjdwbygrppo/Build/Products/Debug-iphoneos/SensorsAnalyticsSDK.framework"; sourceTree = ""; }; CB6EBB5722857145003CFBA8 /* SensorsAnalyticsSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SensorsAnalyticsSDK.framework; path = "../../../../Library/Developer/Xcode/DerivedData/SensorsAnalyticsSDK-fmwsimfdiqmlilcpdnjdwbygrppo/Build/Products/Debug-iphoneos/SensorsAnalyticsSDK.framework"; sourceTree = ""; }; CB6EBB5822857161003CFBA8 /* SensorsAnalyticsSDK.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SensorsAnalyticsSDK.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F21F106928337E23003B3C6E /* SensorsAnalyticsSDK.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SensorsAnalyticsSDK.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -187,7 +164,6 @@ CB30C2552284223B0004061D /* CoreLocation.framework in Frameworks */, CB30C2532284222D0004061D /* CoreMotion.framework in Frameworks */, CB30C251228422210004061D /* CFNetwork.framework in Frameworks */, - 4DCD115B22927F6E0091D129 /* SensorsAnalyticsExtension.framework in Frameworks */, CB30C24F228422190004061D /* CoreFoundation.framework in Frameworks */, CB30C24B228421F60004061D /* QuartzCore.framework in Frameworks */, CB30C249228421E80004061D /* Foundation.framework in Frameworks */, @@ -206,14 +182,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - CB30C2252284173B0004061D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - CB6EBB2622855F0C003CFBA8 /* SensorsAnalyticsExtension.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -222,7 +190,6 @@ children = ( CB30C1D7228414420004061D /* SensorsData */, CB30C1CD228414420004061D /* SensorsDataSwift */, - CB30C2292284173B0004061D /* SensorsDataExtention */, CB30C0B92284115D0004061D /* Products */, CB30C2202284165A0004061D /* Frameworks */, ); @@ -233,7 +200,6 @@ children = ( CB30C15C228413B20004061D /* SensorsData.app */, CB30C18C2284140E0004061D /* SensorsDataSwift.app */, - CB30C2282284173B0004061D /* SensorsDataExtention.appex */, ); name = Products; sourceTree = ""; @@ -294,6 +260,7 @@ CB30C2202284165A0004061D /* Frameworks */ = { isa = PBXGroup; children = ( + F21F106928337E23003B3C6E /* SensorsAnalyticsSDK.framework */, 88EA2E84250F613C00B0FFB8 /* SensorsAnalyticsSDK.framework */, 4DC0584D232F7C16008D5C7E /* AdSupport.framework */, CB6EBB5822857161003CFBA8 /* SensorsAnalyticsSDK.framework */, @@ -323,18 +290,6 @@ name = Frameworks; sourceTree = ""; }; - CB30C2292284173B0004061D /* SensorsDataExtention */ = { - isa = PBXGroup; - children = ( - CB30C240228418000004061D /* SensorsDataExtention.entitlements */, - CB30C23D228418000004061D /* ShareViewController.h */, - CB30C23B228418000004061D /* ShareViewController.m */, - CB30C23A228418000004061D /* MainInterface.storyboard */, - CB30C23C228418000004061D /* Info.plist */, - ); - path = SensorsDataExtention; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -351,7 +306,6 @@ buildRules = ( ); dependencies = ( - CB30C2322284173B0004061D /* PBXTargetDependency */, ); name = SensorsData; productName = HelloSensorsAnalytics; @@ -376,23 +330,6 @@ productReference = CB30C18C2284140E0004061D /* SensorsDataSwift.app */; productType = "com.apple.product-type.application"; }; - CB30C2272284173B0004061D /* SensorsDataExtention */ = { - isa = PBXNativeTarget; - buildConfigurationList = CB30C2342284173B0004061D /* Build configuration list for PBXNativeTarget "SensorsDataExtention" */; - buildPhases = ( - CB30C2242284173B0004061D /* Sources */, - CB30C2252284173B0004061D /* Frameworks */, - CB30C2262284173B0004061D /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SensorsDataExtention; - productName = SensorsDataExtention; - productReference = CB30C2282284173B0004061D /* SensorsDataExtention.appex */; - productType = "com.apple.product-type.app-extension"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -415,14 +352,6 @@ CB30C18B2284140E0004061D = { CreatedOnToolsVersion = 10.2.1; }; - CB30C2272284173B0004061D = { - CreatedOnToolsVersion = 10.2.1; - SystemCapabilities = { - com.apple.ApplicationGroups.iOS = { - enabled = 1; - }; - }; - }; }; }; buildConfigurationList = CB30C0B32284115D0004061D /* Build configuration list for PBXProject "Example" */; @@ -440,7 +369,6 @@ targets = ( CB30C15B228413B20004061D /* SensorsData */, CB30C18B2284140E0004061D /* SensorsDataSwift */, - CB30C2272284173B0004061D /* SensorsDataExtention */, ); }; /* End PBXProject section */ @@ -468,14 +396,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - CB30C2262284173B0004061D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8881569323B2F83900007AD1 /* MainInterface.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -504,24 +424,8 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - CB30C2242284173B0004061D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CB30C242228418000004061D /* ShareViewController.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - CB30C2322284173B0004061D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = CB30C2272284173B0004061D /* SensorsDataExtention */; - targetProxy = CB30C2312284173B0004061D /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ CB30C1D0228414420004061D /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; @@ -754,46 +658,6 @@ }; name = Release; }; - CB30C2352284173B0004061D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_ENTITLEMENTS = SensorsDataExtention/SensorsDataExtention.entitlements; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 75FYWDWHL5; - INFOPLIST_FILE = SensorsDataExtention/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = cn.sensorsdata.SensorsData.share; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - CB30C2362284173B0004061D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_ENTITLEMENTS = SensorsDataExtention/SensorsDataExtention.entitlements; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 75FYWDWHL5; - INFOPLIST_FILE = SensorsDataExtention/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = cn.sensorsdata.SensorsData.share; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -824,15 +688,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - CB30C2342284173B0004061D /* Build configuration list for PBXNativeTarget "SensorsDataExtention" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - CB30C2352284173B0004061D /* Debug */, - CB30C2362284173B0004061D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = CB30C0B02284115D0004061D /* Project object */; diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/SensorsDataExtention.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/SensorsDataExtention.xcscheme deleted file mode 100644 index e5e1eda0..00000000 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/SensorsDataExtention.xcscheme +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/SensorsData/AppDelegate.m b/Example/SensorsData/AppDelegate.m index dc66c30f..59adf0c1 100644 --- a/Example/SensorsData/AppDelegate.m +++ b/Example/SensorsData/AppDelegate.m @@ -20,7 +20,6 @@ #import "AppDelegate.h" #import -#import static NSString* Sa_Default_ServerURL = @"http://sdk-test.cloud.sensorsdata.cn:8006/sa?project=default&token=95c73ae661f85aa0"; @@ -111,7 +110,6 @@ - (void)applicationDidBecomeActive:(UIApplication *)application { //[[SAAppExtensionDataManager sharedInstance]readAllEventsWithGroupIdentifier:NULL]; //[[SAAppExtensionDataManager sharedInstance]writeEvent:@"eee" properties:@"" groupIdentifier:@"ff"]; //[[SAAppExtensionDataManager sharedInstance]fileDataCountForGroupIdentifier:@"ff"]; - [[SAAppExtensionDataManager sharedInstance]fileDataArrayWithPath:@"fff" limit:-1]; } - (void)applicationWillTerminate:(UIApplication *)application { diff --git a/Example/SensorsDataExtention/Info.plist b/Example/SensorsDataExtention/Info.plist deleted file mode 100644 index 80216600..00000000 --- a/Example/SensorsDataExtention/Info.plist +++ /dev/null @@ -1,39 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - 神策分析 - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - XPC! - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - NSExtension - - NSExtensionAttributes - - NSExtensionActivationRule - - NSExtensionActivationSupportsWebPageWithMaxCount - 1 - - - NSExtensionMainStoryboard - MainInterface - NSExtensionPointIdentifier - com.apple.share-services - - - diff --git a/Example/SensorsDataExtention/MainInterface.storyboard b/Example/SensorsDataExtention/MainInterface.storyboard deleted file mode 100644 index 970705df..00000000 --- a/Example/SensorsDataExtention/MainInterface.storyboard +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/SensorsDataExtention/SensorsDataExtention.entitlements b/Example/SensorsDataExtention/SensorsDataExtention.entitlements deleted file mode 100644 index 3f43415a..00000000 --- a/Example/SensorsDataExtention/SensorsDataExtention.entitlements +++ /dev/null @@ -1,10 +0,0 @@ - - - - - com.apple.security.application-groups - - group.cn.sensorsdata.SensorsData - - - diff --git a/Example/SensorsDataExtention/ShareViewController.h b/Example/SensorsDataExtention/ShareViewController.h deleted file mode 100644 index d1d0ab72..00000000 --- a/Example/SensorsDataExtention/ShareViewController.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// ShareViewController.h -// share -// -// Created by 王灼洲 on 2018/1/12. -// 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 -#import - -@interface ShareViewController : SLComposeServiceViewController - -@end diff --git a/Example/SensorsDataExtention/ShareViewController.m b/Example/SensorsDataExtention/ShareViewController.m deleted file mode 100644 index 9aec2b73..00000000 --- a/Example/SensorsDataExtention/ShareViewController.m +++ /dev/null @@ -1,55 +0,0 @@ -// -// ShareViewController.m -// share -// -// Created by 王灼洲 on 2018/1/12. -// 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 -#import "ShareViewController.h" - -@interface ShareViewController () - -@end - -@implementation ShareViewController - -- (BOOL)isContentValid { - // Do validation of contentText and/or NSExtensionContext attachments here - return YES; -} - -- (void)didSelectPost { - // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments. - - // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context. - [[SAAppExtensionDataManager sharedInstance]writeEvent:@"SharedExtensionPost" - properties:@{@"Action":@"Post",@"content":self.contentText?self.contentText :@""} - groupIdentifier:@"group.cn.com.sensorsAnalytics.share"]; - [self.extensionContext completeRequestReturningItems:@[] completionHandler:nil]; -} - --(void)didSelectCancel { - [[SAAppExtensionDataManager sharedInstance]writeEvent:@"SharedExtensionCancel" - properties:@{@"Action":@"Cancel",@"content":self.contentText?self.contentText :@""} - groupIdentifier:@"group.cn.com.sensorsAnalytics.share"]; -} -- (NSArray *)configurationItems { - // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here. - return @[]; -} - -@end diff --git a/SensorsAnalyticsExtension/SensorsAnalyticsExtension.h b/SensorsAnalyticsExtension/SensorsAnalyticsExtension.h deleted file mode 100644 index ac58f28a..00000000 --- a/SensorsAnalyticsExtension/SensorsAnalyticsExtension.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// SANetworkTests.m -// SANetworkTests -// -// Created by 张敏超 on 2019/3/12. -// 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 - -//! Project version number for SensorsAnalyticsExtension. -FOUNDATION_EXPORT double SensorsAnalyticsExtensionVersionNumber; - -//! Project version string for SensorsAnalyticsExtension. -FOUNDATION_EXPORT const unsigned char SensorsAnalyticsExtensionVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - -#import "SAAppExtensionDataManager.h" diff --git a/SensorsAnalyticsSDK.podspec b/SensorsAnalyticsSDK.podspec index c3bc147a..48ae54b1 100644 --- a/SensorsAnalyticsSDK.podspec +++ b/SensorsAnalyticsSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SensorsAnalyticsSDK" - s.version = "4.3.0" + s.version = "4.3.1" s.summary = "The official iOS SDK of Sensors Analytics." s.homepage = "http://www.sensorsdata.cn" s.source = { :git => 'https://github.com/sensorsdata/sa-sdk-ios.git', :tag => "v#{s.version}" } @@ -22,7 +22,7 @@ Pod::Spec.new do |s| core_dir = "SensorsAnalyticsSDK/Core/" b.source_files = core_dir + "**/*.{h,m}" b.exclude_files = core_dir + "SAAlertController.h", core_dir + "SAAlertController.m" - b.public_header_files = core_dir + "SensorsAnalyticsSDK.h", core_dir + "SensorsAnalyticsSDK+Public.h", core_dir + "SAAppExtensionDataManager.h", core_dir + "SASecurityPolicy.h", core_dir + "SAConfigOptions.h", core_dir + "SAConstants.h", core_dir + "PropertyPlugin/SAPropertyPluginProtocol.h" + b.public_header_files = core_dir + "SensorsAnalyticsSDK.h", core_dir + "SensorsAnalyticsSDK+Public.h", core_dir + "SASecurityPolicy.h", core_dir + "SAConfigOptions.h", core_dir + "SAConstants.h", core_dir + "PropertyPlugin/SAPropertyPluginProtocol.h" b.ios.resource = 'SensorsAnalyticsSDK/SensorsAnalyticsSDK.bundle' b.ios.frameworks = 'CoreTelephony' b.dependency 'SensorsAnalyticsSDK/__Store' @@ -112,4 +112,10 @@ Pod::Spec.new do |s| w.public_header_files = 'SensorsAnalyticsSDK/WKWebView/SensorsAnalyticsSDK+WKWebView.h' end + s.subspec 'ApplicationExtension' do |e| + e.dependency 'SensorsAnalyticsSDK/Extension' + e.source_files = 'SensorsAnalyticsSDK/AppExtension/*.{h,m}' + e.public_header_files = 'SensorsAnalyticsSDK/AppExtension/SensorsAnalyticsSDK+SAAppExtension.h' + end + end diff --git a/SensorsAnalyticsSDK.xcodeproj/project.pbxproj b/SensorsAnalyticsSDK.xcodeproj/project.pbxproj index f3878cf1..638725a9 100644 --- a/SensorsAnalyticsSDK.xcodeproj/project.pbxproj +++ b/SensorsAnalyticsSDK.xcodeproj/project.pbxproj @@ -162,15 +162,13 @@ 881A41FC253D7B5000854F69 /* SASwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = 881A4157253D7B4F00854F69 /* SASwizzle.m */; }; 881A41FD253D7B5000854F69 /* SAObject+SAConfigOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 881A4158253D7B4F00854F69 /* SAObject+SAConfigOptions.h */; }; 881A41FE253D7B5000854F69 /* SAConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 881A4159253D7B4F00854F69 /* SAConstants.m */; }; - 881A4201253D7B5000854F69 /* SAAppExtensionDataManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 881A415C253D7B4F00854F69 /* SAAppExtensionDataManager.h */; }; + 881A4201253D7B5000854F69 /* SAAppExtensionDataManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 881A415C253D7B4F00854F69 /* SAAppExtensionDataManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; 881A4202253D7B5000854F69 /* SAModuleManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 881A415D253D7B4F00854F69 /* SAModuleManager.m */; }; 881A4207253D7B5000854F69 /* SAHTTPSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 881A4163253D7B4F00854F69 /* SAHTTPSession.m */; }; 881A420F253D7B5000854F69 /* SAAlertController.h in Headers */ = {isa = PBXBuildFile; fileRef = 881A416C253D7B4F00854F69 /* SAAlertController.h */; }; 881A4214253D7B5000854F69 /* SAKeyChainItemWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 881A4172253D7B4F00854F69 /* SAKeyChainItemWrapper.h */; }; 881A4227253D7B5E00854F69 /* SALocationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 881A4225253D7B5E00854F69 /* SALocationManager.h */; }; 881A4228253D7B5E00854F69 /* SALocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 881A4226253D7B5E00854F69 /* SALocationManager.m */; }; - 881A4231253D7B8600854F69 /* SAAppExtensionDataManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 881A422F253D7B8600854F69 /* SAAppExtensionDataManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 881A4232253D7B8600854F69 /* SAAppExtensionDataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 881A4230253D7B8600854F69 /* SAAppExtensionDataManager.m */; }; 883BAAB02669CD18008105D2 /* SAExceptionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 883BAAAE2669CD18008105D2 /* SAExceptionManager.h */; }; 883BAAB12669CD18008105D2 /* SAExceptionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 883BAAAF2669CD18008105D2 /* SAExceptionManager.m */; }; 883ED1A12768AF0900A0706A /* SAAESCrypt.m in Sources */ = {isa = PBXBuildFile; fileRef = 883ED19F2768AF0900A0706A /* SAAESCrypt.m */; }; @@ -313,7 +311,6 @@ A8FEFB2C277C0ADA0011D0BB /* SASessionProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = A8FEFB2A277C0ADA0011D0BB /* SASessionProperty.h */; }; A8FEFB2D277C0ADA0011D0BB /* SASessionProperty.m in Sources */ = {isa = PBXBuildFile; fileRef = A8FEFB2B277C0ADA0011D0BB /* SASessionProperty.m */; }; CB30C09A22840EC00004061D /* SensorsAnalyticsSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = CB30C02E22840EBF0004061D /* SensorsAnalyticsSDK.bundle */; }; - CB30C31322843D3A0004061D /* SensorsAnalyticsExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = CB30C31122843D3A0004061D /* SensorsAnalyticsExtension.h */; settings = {ATTRIBUTES = (Public, ); }; }; CB6EBAE8228551ED003CFBA8 /* SensorsAnalyticsSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB30BD5422840CA40004061D /* SensorsAnalyticsSDK.framework */; }; CB6EBAF322855222003CFBA8 /* cert.outdate.cer in Resources */ = {isa = PBXBuildFile; fileRef = CB6EBAEF22855222003CFBA8 /* cert.outdate.cer */; }; CB6EBAF422855222003CFBA8 /* ca.cer1 in Resources */ = {isa = PBXBuildFile; fileRef = CB6EBAF022855222003CFBA8 /* ca.cer1 */; }; @@ -354,6 +351,8 @@ F27EA3D727393B4B00896B3A /* SACellClickDynamicSubclassPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = F27EA3D527393B4B00896B3A /* SACellClickDynamicSubclassPlugin.m */; }; F28997D7273B6D66005E7D5E /* SAGesturePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = F28997D5273B6D66005E7D5E /* SAGesturePlugin.h */; }; F28997D8273B6D66005E7D5E /* SAGesturePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = F28997D6273B6D66005E7D5E /* SAGesturePlugin.m */; }; + 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, ); }; }; 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 */; }; @@ -368,7 +367,6 @@ FC002920262C189E00A18FE3 /* SAConfigOptions+Encrypt.h in Headers */ = {isa = PBXBuildFile; fileRef = FC0028EF2629756400A18FE3 /* SAConfigOptions+Encrypt.h */; settings = {ATTRIBUTES = (Public, ); }; }; FC0A8C63276334F200109267 /* SADeepLinkConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = FC0A8C61276334F200109267 /* SADeepLinkConstants.h */; }; FC0A8C64276334F200109267 /* SADeepLinkConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = FC0A8C62276334F200109267 /* SADeepLinkConstants.m */; }; - FC23719523D0519A00DDD708 /* SALinkHandlerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FC23719423D0519A00DDD708 /* SALinkHandlerTests.m */; }; FC332DE727672606009122FC /* SADeepLinkProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = FC332DE527672606009122FC /* SADeepLinkProcessor.h */; }; FC332DE827672606009122FC /* SADeepLinkProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = FC332DE627672606009122FC /* SADeepLinkProcessor.m */; }; FCBECDF327DEDF4200361D6C /* SAQueryDeepLinkProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = FCBECDF127DEDF4200361D6C /* SAQueryDeepLinkProcessor.h */; }; @@ -583,8 +581,6 @@ 881A4172253D7B4F00854F69 /* SAKeyChainItemWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAKeyChainItemWrapper.h; sourceTree = ""; }; 881A4225253D7B5E00854F69 /* SALocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SALocationManager.h; sourceTree = ""; }; 881A4226253D7B5E00854F69 /* SALocationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SALocationManager.m; sourceTree = ""; }; - 881A422F253D7B8600854F69 /* SAAppExtensionDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SAAppExtensionDataManager.h; path = SensorsAnalyticsSDK/Core/SAAppExtensionDataManager.h; sourceTree = SOURCE_ROOT; }; - 881A4230253D7B8600854F69 /* SAAppExtensionDataManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SAAppExtensionDataManager.m; path = SensorsAnalyticsSDK/Core/SAAppExtensionDataManager.m; sourceTree = SOURCE_ROOT; }; 883BAAAE2669CD18008105D2 /* SAExceptionManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SAExceptionManager.h; sourceTree = ""; }; 883BAAAF2669CD18008105D2 /* SAExceptionManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SAExceptionManager.m; sourceTree = ""; }; 883ED19F2768AF0900A0706A /* SAAESCrypt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAAESCrypt.m; sourceTree = ""; }; @@ -723,8 +719,6 @@ A8FEFB2B277C0ADA0011D0BB /* SASessionProperty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SASessionProperty.m; sourceTree = ""; }; CB30BD5422840CA40004061D /* SensorsAnalyticsSDK.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SensorsAnalyticsSDK.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CB30C02E22840EBF0004061D /* SensorsAnalyticsSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SensorsAnalyticsSDK.bundle; sourceTree = ""; }; - CB30C30F22843D3A0004061D /* SensorsAnalyticsExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SensorsAnalyticsExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - CB30C31122843D3A0004061D /* SensorsAnalyticsExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SensorsAnalyticsExtension.h; sourceTree = ""; }; CB6EBAE3228551EC003CFBA8 /* SensorsAnalyticsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SensorsAnalyticsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; CB6EBAE5228551EC003CFBA8 /* SensorsAnalyticsTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SensorsAnalyticsTest.m; sourceTree = ""; }; CB6EBAE7228551EC003CFBA8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -768,6 +762,8 @@ F27EA3D527393B4B00896B3A /* SACellClickDynamicSubclassPlugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SACellClickDynamicSubclassPlugin.m; sourceTree = ""; }; F28997D5273B6D66005E7D5E /* SAGesturePlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SAGesturePlugin.h; sourceTree = ""; }; F28997D6273B6D66005E7D5E /* SAGesturePlugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SAGesturePlugin.m; sourceTree = ""; }; + F2B643F42832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SensorsAnalyticsSDK+SAAppExtension.h"; sourceTree = ""; }; + F2B643F52832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SensorsAnalyticsSDK+SAAppExtension.m"; sourceTree = ""; }; F2CFD14526EB04A8007A9253 /* SAConfigOptions+RemoteConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SAConfigOptions+RemoteConfig.h"; sourceTree = ""; }; F2E4AB9B26EC86C800BA7F01 /* SensorsAnalyticsSDK+Location.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SensorsAnalyticsSDK+Location.h"; sourceTree = ""; }; F2E4AB9C26EC86C800BA7F01 /* SensorsAnalyticsSDK+Location.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SensorsAnalyticsSDK+Location.m"; sourceTree = ""; }; @@ -807,13 +803,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - CB30C30C22843D3A0004061D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; CB6EBAE0228551EC003CFBA8 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1067,8 +1056,6 @@ 881A40D4253D7B4F00854F69 /* NSString+SAHashCode.m */, 881A416C253D7B4F00854F69 /* SAAlertController.h */, 881A40F1253D7B4F00854F69 /* SAAlertController.m */, - 881A415C253D7B4F00854F69 /* SAAppExtensionDataManager.h */, - 881A40F5253D7B4F00854F69 /* SAAppExtensionDataManager.m */, F211741F26E9A72B00D65E19 /* SAApplication.h */, F211742026E9A72B00D65E19 /* SAApplication.m */, 881A40EF253D7B4F00854F69 /* SAConfigOptions.h */, @@ -1525,7 +1512,6 @@ isa = PBXGroup; children = ( CB30BFD122840EBF0004061D /* SensorsAnalyticsSDK */, - CB30C31022843D3A0004061D /* SensorsAnalyticsExtension */, CB6EBAE4228551EC003CFBA8 /* SensorsAnalyticsTests */, CB30BD5522840CA40004061D /* Products */, 4D8CE4C522E872B400829B29 /* Frameworks */, @@ -1536,7 +1522,6 @@ isa = PBXGroup; children = ( CB30BD5422840CA40004061D /* SensorsAnalyticsSDK.framework */, - CB30C30F22843D3A0004061D /* SensorsAnalyticsExtension.framework */, CB6EBAE3228551EC003CFBA8 /* SensorsAnalyticsTests.xctest */, ); name = Products; @@ -1545,6 +1530,7 @@ CB30BFD122840EBF0004061D /* SensorsAnalyticsSDK */ = { isa = PBXGroup; children = ( + F2B643F328322EE800544BD2 /* AppExtension */, 88EC2DEE2757688400EF9778 /* Store */, A806642526905F6C00FFDEBA /* ChannelMatch */, A8BCC4DB26872B6600B72040 /* DebugMode */, @@ -1572,16 +1558,6 @@ name = Resources; sourceTree = ""; }; - CB30C31022843D3A0004061D /* SensorsAnalyticsExtension */ = { - isa = PBXGroup; - children = ( - 881A422F253D7B8600854F69 /* SAAppExtensionDataManager.h */, - 881A4230253D7B8600854F69 /* SAAppExtensionDataManager.m */, - CB30C31122843D3A0004061D /* SensorsAnalyticsExtension.h */, - ); - path = SensorsAnalyticsExtension; - sourceTree = ""; - }; CB6EBAE4228551EC003CFBA8 /* SensorsAnalyticsTests */ = { isa = PBXGroup; children = ( @@ -1690,6 +1666,17 @@ path = EventTrackerPlugin; sourceTree = ""; }; + F2B643F328322EE800544BD2 /* AppExtension */ = { + isa = PBXGroup; + children = ( + 881A415C253D7B4F00854F69 /* SAAppExtensionDataManager.h */, + 881A40F5253D7B4F00854F69 /* SAAppExtensionDataManager.m */, + F2B643F42832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.h */, + F2B643F52832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.m */, + ); + path = AppExtension; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1821,8 +1808,9 @@ 881A419F253D7B4F00854F69 /* SAHTTPSession.h in Headers */, F2E9723125E637820009A2B9 /* SAAppPushManager.h in Headers */, FCBECDF727DEDF6400361D6C /* SADeepLinkEventProcessor.h in Headers */, - F277F5E425CFCE56009B5CE6 /* NSObject+DelegateProxy.h in Headers */, - F277F5C325CF9A43009B5CE6 /* UIApplication+PushClick.h in Headers */, + F277F5E425CFCE56009B5CE6 /* NSObject+SADelegateProxy.h in Headers */, + F277F5C325CF9A43009B5CE6 /* UIApplication+SAPushClick.h in Headers */, + F2B643F62832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.h in Headers */, F277F5E425CFCE56009B5CE6 /* NSObject+SADelegateProxy.h in Headers */, F277F5C325CF9A43009B5CE6 /* UIApplication+SAPushClick.h in Headers */, 4DD128B925F8A003008C0B1E /* SensorsAnalyticsSDK+Visualized.h in Headers */, @@ -1865,15 +1853,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - CB30C30A22843D3A0004061D /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 881A4231253D7B8600854F69 /* SAAppExtensionDataManager.h in Headers */, - CB30C31322843D3A0004061D /* SensorsAnalyticsExtension.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ @@ -1895,24 +1874,6 @@ productReference = CB30BD5422840CA40004061D /* SensorsAnalyticsSDK.framework */; productType = "com.apple.product-type.framework"; }; - CB30C30E22843D3A0004061D /* SensorsAnalyticsExtension */ = { - isa = PBXNativeTarget; - buildConfigurationList = CB30C31422843D3A0004061D /* Build configuration list for PBXNativeTarget "SensorsAnalyticsExtension" */; - buildPhases = ( - CB30C30A22843D3A0004061D /* Headers */, - CB30C30B22843D3A0004061D /* Sources */, - CB30C30C22843D3A0004061D /* Frameworks */, - CB30C30D22843D3A0004061D /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SensorsAnalyticsExtension; - productName = "SensorsAnalyticsSDK Extension"; - productReference = CB30C30F22843D3A0004061D /* SensorsAnalyticsExtension.framework */; - productType = "com.apple.product-type.framework"; - }; CB6EBAE2228551EC003CFBA8 /* SensorsAnalyticsTests */ = { isa = PBXNativeTarget; buildConfigurationList = CB6EBAEB228551ED003CFBA8 /* Build configuration list for PBXNativeTarget "SensorsAnalyticsTests" */; @@ -1946,9 +1907,6 @@ CreatedOnToolsVersion = 10.2.1; LastSwiftMigration = 1250; }; - CB30C30E22843D3A0004061D = { - CreatedOnToolsVersion = 10.2.1; - }; CB6EBAE2228551EC003CFBA8 = { CreatedOnToolsVersion = 10.2.1; }; @@ -1968,7 +1926,6 @@ projectRoot = ""; targets = ( CB30BD5322840CA40004061D /* SensorsAnalyticsSDK */, - CB30C30E22843D3A0004061D /* SensorsAnalyticsExtension */, CB6EBAE2228551EC003CFBA8 /* SensorsAnalyticsTests */, ); }; @@ -1983,13 +1940,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - CB30C30D22843D3A0004061D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; CB6EBAE1228551EC003CFBA8 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2092,7 +2042,7 @@ A8BCC4DF26872B6600B72040 /* SADebugModeManager.m in Sources */, A8356DBF2656459A00FD64AA /* UIViewController+SAAutoTrack.m in Sources */, 45A5656B263C174300C9C41B /* SATrackEventObject.m in Sources */, - A8356DC42656459A00FD64AA /* UIApplication+AutoTrack.m in Sources */, + A8356DC42656459A00FD64AA /* UIApplication+SAAutoTrack.m in Sources */, FCBECE0027DEDF7F00361D6C /* SADeferredDeepLinkProcessor.m in Sources */, A8356DC42656459A00FD64AA /* UIApplication+SAAutoTrack.m in Sources */, F23CA0072701715E002EEACA /* SAJavaScriptBridgeManager.m in Sources */, @@ -2114,6 +2064,7 @@ 881A4195253D7B4F00854F69 /* SAObject+SAConfigOptions.m in Sources */, 881A41F9253D7B5000854F69 /* SAConfigOptions.m in Sources */, 88EC2DF22757689800EF9778 /* SAStoreManager.m in Sources */, + F2B643F72832302F00544BD2 /* SensorsAnalyticsSDK+SAAppExtension.m in Sources */, 4DD1286925F872A4008C0B1E /* SATypeDescription.m in Sources */, A8CC22372685E50C00E96A03 /* SARemoteConfigModel.m in Sources */, 4DD128C325F8A003008C0B1E /* SAVisualPropertiesConfig.m in Sources */, @@ -2177,14 +2128,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - CB30C30B22843D3A0004061D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 881A4232253D7B8600854F69 /* SAAppExtensionDataManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; CB6EBADF228551EC003CFBA8 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2425,64 +2368,6 @@ }; name = Release; }; - CB30C31522843D3A0004061D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = "$(SRCROOT)/SupportingFiles/SensorsAnalyticsExtension-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = ""; - MODULEMAP_PRIVATE_FILE = ""; - PRODUCT_BUNDLE_IDENTIFIER = "cn.sensorsdata.SensorsAnalyticsSDK-Extension"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - CB30C31622843D3A0004061D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = "$(SRCROOT)/SupportingFiles/SensorsAnalyticsExtension-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = ""; - MODULEMAP_PRIVATE_FILE = ""; - PRODUCT_BUNDLE_IDENTIFIER = "cn.sensorsdata.SensorsAnalyticsSDK-Extension"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; CB6EBAEC228551ED003CFBA8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -2541,15 +2426,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - CB30C31422843D3A0004061D /* Build configuration list for PBXNativeTarget "SensorsAnalyticsExtension" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - CB30C31522843D3A0004061D /* Debug */, - CB30C31622843D3A0004061D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; CB6EBAEB228551ED003CFBA8 /* Build configuration list for PBXNativeTarget "SensorsAnalyticsTests" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/SensorsAnalyticsSDK.xcodeproj/xcshareddata/xcschemes/SensorsAnalyticsExtension.xcscheme b/SensorsAnalyticsSDK.xcodeproj/xcshareddata/xcschemes/SensorsAnalyticsExtension.xcscheme deleted file mode 100644 index b2a4cbd9..00000000 --- a/SensorsAnalyticsSDK.xcodeproj/xcshareddata/xcschemes/SensorsAnalyticsExtension.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SensorsAnalyticsSDK/Core/SAAppExtensionDataManager.h b/SensorsAnalyticsSDK/AppExtension/SAAppExtensionDataManager.h similarity index 100% rename from SensorsAnalyticsSDK/Core/SAAppExtensionDataManager.h rename to SensorsAnalyticsSDK/AppExtension/SAAppExtensionDataManager.h diff --git a/SensorsAnalyticsSDK/Core/SAAppExtensionDataManager.m b/SensorsAnalyticsSDK/AppExtension/SAAppExtensionDataManager.m similarity index 100% rename from SensorsAnalyticsSDK/Core/SAAppExtensionDataManager.m rename to SensorsAnalyticsSDK/AppExtension/SAAppExtensionDataManager.m diff --git a/SensorsAnalyticsSDK/AppExtension/SensorsAnalyticsSDK+SAAppExtension.h b/SensorsAnalyticsSDK/AppExtension/SensorsAnalyticsSDK+SAAppExtension.h new file mode 100644 index 00000000..fa56c12c --- /dev/null +++ b/SensorsAnalyticsSDK/AppExtension/SensorsAnalyticsSDK+SAAppExtension.h @@ -0,0 +1,38 @@ +// +// SensorsAnalyticsSDK+SAAppExtension.h +// SensorsAnalyticsSDK +// +// Created by 陈玉国 on 2022/5/16. +// 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 "SensorsAnalyticsSDK.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SensorsAnalyticsSDK (SAAppExtension) + +/** + @abstract + * Track App Extension groupIdentifier 中缓存的数据 + * + * @param groupIdentifier groupIdentifier + * @param completion 完成 track 后的 callback + */ +- (void)trackEventFromExtensionWithGroupIdentifier:(NSString *)groupIdentifier completion:(void (^)(NSString *groupIdentifier, NSArray *events)) completion; + +@end + +NS_ASSUME_NONNULL_END diff --git a/SensorsAnalyticsSDK/AppExtension/SensorsAnalyticsSDK+SAAppExtension.m b/SensorsAnalyticsSDK/AppExtension/SensorsAnalyticsSDK+SAAppExtension.m new file mode 100644 index 00000000..4da413e2 --- /dev/null +++ b/SensorsAnalyticsSDK/AppExtension/SensorsAnalyticsSDK+SAAppExtension.m @@ -0,0 +1,54 @@ +// +// SensorsAnalyticsSDK+SAAppExtension.m +// SensorsAnalyticsSDK +// +// Created by 陈玉国 on 2022/5/16. +// 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. +// + +#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 "SensorsAnalyticsSDK+SAAppExtension.h" +#import "SALog.h" +#import "SAAppExtensionDataManager.h" +#import "SAConstants+Private.h" + +@implementation SensorsAnalyticsSDK (SAAppExtension) + +- (void)trackEventFromExtensionWithGroupIdentifier:(NSString *)groupIdentifier completion:(void (^)(NSString *groupIdentifier, NSArray *events)) completion { + @try { + if (groupIdentifier == nil || [groupIdentifier isEqualToString:@""]) { + return; + } + NSArray *eventArray = [[SAAppExtensionDataManager sharedInstance] readAllEventsWithGroupIdentifier:groupIdentifier]; + if (eventArray) { + for (NSDictionary *dict in eventArray) { + NSString *event = [dict[kSAEventName] copy]; + NSDictionary *properties = [dict[kSAEventProperties] copy]; + [[SensorsAnalyticsSDK sharedInstance] track:event withProperties:properties]; + } + [[SAAppExtensionDataManager sharedInstance] deleteEventsWithGroupIdentifier:groupIdentifier]; + if (completion) { + completion(groupIdentifier, eventArray); + } + } + } @catch (NSException *exception) { + SALogError(@"%@ error: %@", self, exception); + } +} + +@end diff --git a/SensorsAnalyticsSDK/Core/Builder/SASessionProperty.h b/SensorsAnalyticsSDK/Core/Builder/SASessionProperty.h index 2f584d21..21f8ec93 100644 --- a/SensorsAnalyticsSDK/Core/Builder/SASessionProperty.h +++ b/SensorsAnalyticsSDK/Core/Builder/SASessionProperty.h @@ -24,6 +24,10 @@ NS_ASSUME_NONNULL_BEGIN @interface SASessionProperty : NSObject +/// 设置事件间隔最大时长,默认值为 5 * 60 * 1000 毫秒。单位为毫秒 +- (instancetype)initWithMaxInterval:(NSInteger)maxInterval NS_DESIGNATED_INITIALIZER; +- (instancetype)init NS_UNAVAILABLE; + /// 移除本地保存的 session 信息 + (void)removeSessionModel; diff --git a/SensorsAnalyticsSDK/Core/Builder/SASessionProperty.m b/SensorsAnalyticsSDK/Core/Builder/SASessionProperty.m index c9ec646f..961a9e53 100644 --- a/SensorsAnalyticsSDK/Core/Builder/SASessionProperty.m +++ b/SensorsAnalyticsSDK/Core/Builder/SASessionProperty.m @@ -29,8 +29,6 @@ static NSString * const kSAEventPropertySessionID = @"$event_session_id"; /// session 数据模型 static NSString * const kSASessionModelKey = @"SASessionModel"; -/// session 中事件最大间隔 30 分钟(单位为毫秒) -static const NSUInteger kSASessionMaxInterval = 30 * 60 * 1000; /// session 最大时长是 12 小时(单位为毫秒) static const NSUInteger kSASessionMaxDuration = 12 * 60 * 60 * 1000; @@ -86,6 +84,7 @@ - (NSString *)description { @interface SASessionProperty () @property (nonatomic, strong) SASessionModel *sessionModel; +@property (nonatomic, assign) NSInteger sessionMaxInterval; @end @@ -97,8 +96,16 @@ + (void)removeSessionModel { [[SAStoreManager sharedInstance] removeObjectForKey:kSASessionModelKey]; } +- (instancetype)initWithMaxInterval:(NSInteger)maxInterval { + self = [super init]; + if (self) { + _sessionMaxInterval = maxInterval; + } + return self; +} + - (NSDictionary *)sessionPropertiesWithEventTime:(NSNumber *)eventTime { - NSNumber *maxIntervalEventTime = @(self.sessionModel.lastEventTime.unsignedLongLongValue + kSASessionMaxInterval); + NSNumber *maxIntervalEventTime = @(self.sessionModel.lastEventTime.unsignedLongLongValue + self.sessionMaxInterval); NSNumber *maxDurationEventTime = @(self.sessionModel.firstEventTime.unsignedLongLongValue + kSASessionMaxDuration); // 重新生成 session diff --git a/SensorsAnalyticsSDK/Core/SAConfigOptions.h b/SensorsAnalyticsSDK/Core/SAConfigOptions.h index 96a5bfaf..81e4de03 100644 --- a/SensorsAnalyticsSDK/Core/SAConfigOptions.h +++ b/SensorsAnalyticsSDK/Core/SAConfigOptions.h @@ -118,6 +118,9 @@ NS_ASSUME_NONNULL_BEGIN /// 是否进行 session 切割。默认 NO,不会进行 session 切割;设置 YES,会进行 session 切割 @property (nonatomic, assign) BOOL enableSession; +/// 设置 session 切割事件最大间隔时长,设置范围为正整数,单位为秒 +@property (nonatomic, assign) NSInteger eventSessionTimeout; + /// 是否禁用采集 deviceId @property (nonatomic, assign) BOOL disableDeviceId; diff --git a/SensorsAnalyticsSDK/Core/SAConfigOptions.m b/SensorsAnalyticsSDK/Core/SAConfigOptions.m index 329cdb54..69d78c76 100644 --- a/SensorsAnalyticsSDK/Core/SAConfigOptions.m +++ b/SensorsAnalyticsSDK/Core/SAConfigOptions.m @@ -24,7 +24,9 @@ #import "SAConfigOptions.h" #import "SensorsAnalyticsSDK+Private.h" -#import "SAIdentifier.h" + +/// session 中事件最大间隔 5 分钟(单位为秒) +static const NSUInteger kSASessionMaxInterval = 5 * 60; @interface SAConfigOptions () @@ -89,6 +91,8 @@ - (instancetype)initWithServerURL:(NSString *)serverURL launchOptions:(id)launch _minRequestHourInterval = 24; _maxRequestHourInterval = 48; + _eventSessionTimeout = kSASessionMaxInterval; + #ifdef SENSORS_ANALYTICS_ENABLE_AUTOTRACK_CHILD_VIEWSCREEN _enableAutoTrackChildViewScreen = YES; #endif @@ -131,6 +135,7 @@ - (id)copyWithZone:(nullable NSZone *)zone { options.disableSDK = self.disableSDK; options.storePlugins = self.storePlugins; options.enableSession = self.enableSession; + options.eventSessionTimeout = self.eventSessionTimeout; options.disableDeviceId = self.disableDeviceId; #if TARGET_OS_IOS @@ -206,6 +211,12 @@ - (void)setMaxRequestHourInterval:(NSInteger)maxRequestHourInterval { } } +- (void)setEventSessionTimeout:(NSInteger)eventSessionTimeout { + if (eventSessionTimeout > 0) { + _eventSessionTimeout = eventSessionTimeout; + } +} + - (void)registerStorePlugin:(id)plugin { [self.storePlugins addObject:plugin]; } diff --git a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Public.h b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Public.h index d93e5746..f52ee2fb 100644 --- a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Public.h +++ b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK+Public.h @@ -353,15 +353,6 @@ extern NSString * const SensorsAnalyticsIdentityKeyEmail; */ - (NSDictionary *)getLastScreenTrackProperties API_UNAVAILABLE(macos); -/** - @abstract - * Track App Extension groupIdentifier 中缓存的数据 - * - * @param groupIdentifier groupIdentifier - * @param completion 完成 track 后的 callback - */ -- (void)trackEventFromExtensionWithGroupIdentifier:(NSString *)groupIdentifier completion:(void (^)(NSString *groupIdentifier, NSArray *events)) completion; - /** * @abstract * 修改入库之前的事件属性 diff --git a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.h b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.h index b03a391f..d547c130 100755 --- a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.h +++ b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.h @@ -91,5 +91,9 @@ #import "SensorsAnalyticsSDK+WebView.h" #endif +#if __has_include("SensorsAnalyticsSDK+SAAppExtension.h") +#import "SensorsAnalyticsSDK+SAAppExtension.h" +#endif + #import "SAAESStorePlugin.h" diff --git a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m index cdc2d9d9..6865e9e5 100755 --- a/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m +++ b/SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m @@ -23,7 +23,6 @@ #endif #import "SensorsAnalyticsSDK.h" -#import "SAAppExtensionDataManager.h" #import "SAKeyChainItemWrapper.h" #import "SACommonUtility.h" #import "SAConstants+Private.h" @@ -53,7 +52,7 @@ #import "SAUserDefaultsStorePlugin.h" #import "SASessionProperty.h" -#define VERSION @"4.3.0" +#define VERSION @"4.3.1" void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag; @@ -215,7 +214,7 @@ - (instancetype)initWithConfigOptions:(nonnull SAConfigOptions *)configOptions { _superProperty = [[SASuperProperty alloc] init]; if (_configOptions.enableSession) { - _sessionProperty = [[SASessionProperty alloc] init]; + _sessionProperty = [[SASessionProperty alloc] initWithMaxInterval:_configOptions.eventSessionTimeout * 1000]; } else { [SASessionProperty removeSessionModel]; } @@ -919,27 +918,6 @@ - (SensorsAnalyticsDebugMode)debugMode { return SAModuleManager.sharedInstance.debugMode; } -- (void)trackEventFromExtensionWithGroupIdentifier:(NSString *)groupIdentifier completion:(void (^)(NSString *groupIdentifier, NSArray *events)) completion { - @try { - if (groupIdentifier == nil || [groupIdentifier isEqualToString:@""]) { - return; - } - NSArray *eventArray = [[SAAppExtensionDataManager sharedInstance] readAllEventsWithGroupIdentifier:groupIdentifier]; - if (eventArray) { - for (NSDictionary *dict in eventArray) { - SACustomEventObject *object = [[SACustomEventObject alloc] initWithEventId:dict[kSAEventName]]; - [self asyncTrackEventObject:object properties:dict[kSAEventProperties]]; - } - [[SAAppExtensionDataManager sharedInstance] deleteEventsWithGroupIdentifier:groupIdentifier]; - if (completion) { - completion(groupIdentifier, eventArray); - } - } - } @catch (NSException *exception) { - SALogError(@"%@ error: %@", self, exception); - } -} - #pragma mark - SensorsData Analytics - (void)profilePushKey:(NSString *)pushTypeKey pushId:(NSString *)pushId { diff --git a/SensorsAnalyticsSDK/Deeplink/SADeepLinkConstants.h b/SensorsAnalyticsSDK/Deeplink/SADeepLinkConstants.h index 746741fb..8b1dd3ff 100644 --- a/SensorsAnalyticsSDK/Deeplink/SADeepLinkConstants.h +++ b/SensorsAnalyticsSDK/Deeplink/SADeepLinkConstants.h @@ -59,6 +59,8 @@ extern NSString *const kSARequestPropertyProject; extern NSString *const kSAResponsePropertySLinkID; extern NSString *const kSAResponsePropertyCode; +extern NSString *const kSAResponsePropertyErrorMessage; +extern NSString *const kSAResponsePropertyErrorMsg; extern NSString *const kSAResponsePropertyMessage; // DeepLink diff --git a/SensorsAnalyticsSDK/Deeplink/SADeepLinkConstants.m b/SensorsAnalyticsSDK/Deeplink/SADeepLinkConstants.m index fd724aa5..a77b8cd8 100644 --- a/SensorsAnalyticsSDK/Deeplink/SADeepLinkConstants.m +++ b/SensorsAnalyticsSDK/Deeplink/SADeepLinkConstants.m @@ -62,6 +62,8 @@ #pragma mark - Response Property NSString *const kSAResponsePropertyCode = @"code"; +NSString *const kSAResponsePropertyErrorMessage = @"errorMsg"; +NSString *const kSAResponsePropertyErrorMsg = @"error_msg"; NSString *const kSAResponsePropertyMessage = @"msg"; NSString *const kSAResponsePropertySLinkID = @"ad_slink_id"; diff --git a/SensorsAnalyticsSDK/Deeplink/SARequestDeepLinkProcessor.m b/SensorsAnalyticsSDK/Deeplink/SARequestDeepLinkProcessor.m index 77e8f11b..0cf2a00a 100644 --- a/SensorsAnalyticsSDK/Deeplink/SARequestDeepLinkProcessor.m +++ b/SensorsAnalyticsSDK/Deeplink/SARequestDeepLinkProcessor.m @@ -62,7 +62,24 @@ + (BOOL)isCustomDeepLinkURL:(NSURL *)url { if (pathComponents.count < 2 || ![pathComponents[1] isEqualToString:@"slink"]) { return NO; } - return ([url.host isEqualToString:kSchemeDeepLinkHost] || [url.host isEqualToString:components.host]); + + NSString *primaryDomain = [self primaryDomainForURL:url]; + NSString *channelPrimaryDomain = [self primaryDomainForURL:components.URL]; + + if (!channelPrimaryDomain) { + return NO; + } + return ([url.host isEqualToString:kSchemeDeepLinkHost] || [primaryDomain isEqualToString:channelPrimaryDomain]); +} + ++ (NSString *)primaryDomainForURL:(NSURL *)url { + NSArray *hostArray = [url.host componentsSeparatedByString:@"."]; + if (hostArray.count < 2) { + return nil; + } + NSMutableArray *primaryDomainArray = [hostArray mutableCopy]; + [primaryDomainArray removeObjectAtIndex:0]; + return [primaryDomainArray componentsJoinedByString:@"."]; } - (BOOL)canWakeUp { @@ -81,18 +98,18 @@ - (NSURLRequest *)buildRequest { NSString *channelURL = SensorsAnalyticsSDK.sharedInstance.configOptions.customADChannelURL; SANetwork *network = SensorsAnalyticsSDK.sharedInstance.network; NSString *key = self.URL.lastPathComponent; + NSString *project = SensorsAnalyticsSDK.sharedInstance.network.project; if ([self.class isCustomDeepLinkURL:self.URL]) { components = [[NSURLComponents alloc] initWithString:channelURL]; components.path = [components.path stringByAppendingPathComponent:@"/slink/config/query"]; - components.query = [NSString stringWithFormat:@"key=%@", key]; } else if ([self.class isNormalDeepLinkURL:self.URL]) { components = network.baseURLComponents; components.path = [network.baseURLComponents.path stringByAppendingPathComponent:@"/sdk/deeplink/param"]; - NSString *project = SensorsAnalyticsSDK.sharedInstance.network.project; - components.query = [NSString stringWithFormat:@"key=%@&project=%@&system_type=IOS", key, project]; } + components.query = [NSString stringWithFormat:@"key=%@&project=%@&system_type=IOS", key, project]; + if (!components) { return nil; } @@ -124,7 +141,8 @@ - (void)requestDeepLinkInfo { if (response.statusCode == 200 && data) { NSDictionary *result = [SAJSONUtil JSONObjectWithData:data]; properties[kSAEventPropertyDeepLinkOptions] = result[kSAResponsePropertyParams]; - properties[kSAEventPropertyDeepLinkFailReason] = result[kSAResponsePropertyMessage]; + NSString *errorMsg = result[kSAResponsePropertyErrorMessage] ?: result[kSAResponsePropertyErrorMsg]; + properties[kSAEventPropertyDeepLinkFailReason] = errorMsg; properties[kSAEventPropertyADSLinkID] = result[kSAResponsePropertySLinkID]; // Result 事件中只需要添加 $utm_content 等属性,不需要添加 $latest_utm_content 等属性 @@ -135,7 +153,8 @@ - (void)requestDeepLinkInfo { latestChannels = [self acquireLatestChannels:result[kSAResponsePropertyChannelParams]]; obj.params = result[kSAResponsePropertyParams]; - obj.success = ([result[kSAResponsePropertyCode] integerValue] == 0); + NSInteger code = [result[kSAResponsePropertyCode] integerValue]; + obj.success = (code == 0 && errorMsg.length == 0); } else { NSString *codeMsg = [NSString stringWithFormat:@"http status code: %@",@(response.statusCode)]; properties[kSAEventPropertyDeepLinkFailReason] = error.localizedDescription ?: codeMsg;