From 1288efe9e74fb633b2c0f7a44b33b76509c7a12f Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Fri, 7 Aug 2020 16:48:36 -0700 Subject: [PATCH 01/16] Converted files to userleap name --- Cartfile | 2 +- ...mple.podspec => mParticle-UserLeap.podspec | 0 .../project.pbxproj | 137 ++++++++++-------- .../xcschemes/mParticle-Example.xcscheme | 4 - .../xcschemes/mParticle_ExampleTests.xcscheme | 0 .../Info.plist | 0 .../MPKitUserLeap.h | 2 +- .../MPKitUserLeap.m | 25 ++-- .../mParticle_UserLeap.h | 2 +- .../Info.plist | 0 .../mParticle_UserLeapTests.m | 12 +- 11 files changed, 100 insertions(+), 84 deletions(-) rename mParticle-Example.podspec => mParticle-UserLeap.podspec (100%) rename {mParticle-Example.xcodeproj => mParticle-UserLeap.xcodeproj}/project.pbxproj (70%) rename {mParticle-Example.xcodeproj => mParticle-UserLeap.xcodeproj}/xcshareddata/xcschemes/mParticle-Example.xcscheme (96%) rename {mParticle-Example.xcodeproj => mParticle-UserLeap.xcodeproj}/xcshareddata/xcschemes/mParticle_ExampleTests.xcscheme (100%) rename {mParticle-Example => mParticle-UserLeap}/Info.plist (100%) rename mParticle-Example/MPKitExample.h => mParticle-UserLeap/MPKitUserLeap.h (88%) rename mParticle-Example/MPKitExample.m => mParticle-UserLeap/MPKitUserLeap.m (95%) rename mParticle-Example/mParticle_Example.h => mParticle-UserLeap/mParticle_UserLeap.h (77%) rename {mParticle_ExampleTests => mParticle_UserLeapTests}/Info.plist (100%) rename mParticle_ExampleTests/mParticle_ExampleTests.m => mParticle_UserLeapTests/mParticle_UserLeapTests.m (53%) diff --git a/Cartfile b/Cartfile index e561982..4e3b6b1 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ -#github "Example/Example" ~> 1.2.3 +binary "https://raw.githubusercontent.com/UserLeap/userleap-ios-sdk-releases/master/UserLeapKit.json" github "mparticle/mparticle-apple-sdk" ~> 7.7.0 diff --git a/mParticle-Example.podspec b/mParticle-UserLeap.podspec similarity index 100% rename from mParticle-Example.podspec rename to mParticle-UserLeap.podspec diff --git a/mParticle-Example.xcodeproj/project.pbxproj b/mParticle-UserLeap.xcodeproj/project.pbxproj similarity index 70% rename from mParticle-Example.xcodeproj/project.pbxproj rename to mParticle-UserLeap.xcodeproj/project.pbxproj index 39bf8e9..ec4a438 100644 --- a/mParticle-Example.xcodeproj/project.pbxproj +++ b/mParticle-UserLeap.xcodeproj/project.pbxproj @@ -7,12 +7,14 @@ objects = { /* Begin PBXBuildFile section */ - DBB01A601DC1478A00A7B188 /* mParticle_Example.h in Headers */ = {isa = PBXBuildFile; fileRef = DBB01A5E1DC1478A00A7B188 /* mParticle_Example.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DBB01A681DC1480700A7B188 /* MPKitExample.h in Headers */ = {isa = PBXBuildFile; fileRef = DBB01A661DC1480700A7B188 /* MPKitExample.h */; }; - DBB01A691DC1480700A7B188 /* MPKitExample.m in Sources */ = {isa = PBXBuildFile; fileRef = DBB01A671DC1480700A7B188 /* MPKitExample.m */; }; + DAD96C8624DB31DB0021695F /* UserLeapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAD96C8524DB31DB0021695F /* UserLeapKit.framework */; }; + DAD96C8724DB31DB0021695F /* UserLeapKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DAD96C8524DB31DB0021695F /* UserLeapKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + DADFEBB024DB2F0600F96A85 /* MPKitUserLeap.h in Headers */ = {isa = PBXBuildFile; fileRef = DADFEBAD24DB2F0600F96A85 /* MPKitUserLeap.h */; }; + DADFEBB124DB2F0600F96A85 /* mParticle_UserLeap.h in Headers */ = {isa = PBXBuildFile; fileRef = DADFEBAE24DB2F0600F96A85 /* mParticle_UserLeap.h */; }; + DADFEBB224DB2F0600F96A85 /* MPKitUserLeap.m in Sources */ = {isa = PBXBuildFile; fileRef = DADFEBAF24DB2F0600F96A85 /* MPKitUserLeap.m */; }; + DADFEBB824DB30C400F96A85 /* mParticle_UserLeapTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DADFEBB724DB30C400F96A85 /* mParticle_UserLeapTests.m */; }; DBB01A6B1DC1491D00A7B188 /* mParticle_Apple_SDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBB01A6A1DC1491D00A7B188 /* mParticle_Apple_SDK.framework */; }; - FF0BB63E217A84E800B0556C /* mParticle_ExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FF0BB63D217A84E800B0556C /* mParticle_ExampleTests.m */; }; - FF0BB640217A84E800B0556C /* mParticle_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBB01A5B1DC1478A00A7B188 /* mParticle_Example.framework */; }; + FF0BB640217A84E800B0556C /* mParticle_UserLeap.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBB01A5B1DC1478A00A7B188 /* mParticle_UserLeap.framework */; }; FF13226221878D9C002AA653 /* mParticle_Apple_SDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBB01A6A1DC1491D00A7B188 /* mParticle_Apple_SDK.framework */; }; /* End PBXBuildFile section */ @@ -26,16 +28,31 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + DAD96C8824DB31DB0021695F /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + DAD96C8724DB31DB0021695F /* UserLeapKit.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ - DBB01A5B1DC1478A00A7B188 /* mParticle_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = mParticle_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DBB01A5E1DC1478A00A7B188 /* mParticle_Example.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mParticle_Example.h; sourceTree = ""; }; + DAD96C8524DB31DB0021695F /* UserLeapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserLeapKit.framework; path = Carthage/Build/iOS/UserLeapKit.framework; sourceTree = ""; }; + DADFEBAD24DB2F0600F96A85 /* MPKitUserLeap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPKitUserLeap.h; sourceTree = ""; }; + DADFEBAE24DB2F0600F96A85 /* mParticle_UserLeap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mParticle_UserLeap.h; sourceTree = ""; }; + DADFEBAF24DB2F0600F96A85 /* MPKitUserLeap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPKitUserLeap.m; sourceTree = ""; }; + DADFEBB424DB2F3800F96A85 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DADFEBB724DB30C400F96A85 /* mParticle_UserLeapTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = mParticle_UserLeapTests.m; sourceTree = ""; }; + DBB01A5B1DC1478A00A7B188 /* mParticle_UserLeap.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = mParticle_UserLeap.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DBB01A5F1DC1478A00A7B188 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DBB01A661DC1480700A7B188 /* MPKitExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPKitExample.h; sourceTree = ""; }; - DBB01A671DC1480700A7B188 /* MPKitExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPKitExample.m; sourceTree = ""; }; DBB01A6A1DC1491D00A7B188 /* mParticle_Apple_SDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mParticle_Apple_SDK.framework; path = Carthage/Build/iOS/mParticle_Apple_SDK.framework; sourceTree = ""; }; - FF0BB63B217A84E800B0556C /* mParticle_ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = mParticle_ExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - FF0BB63D217A84E800B0556C /* mParticle_ExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = mParticle_ExampleTests.m; sourceTree = ""; }; - FF0BB63F217A84E800B0556C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + FF0BB63B217A84E800B0556C /* mParticle_UserLeapTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = mParticle_UserLeapTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -43,6 +60,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + DAD96C8624DB31DB0021695F /* UserLeapKit.framework in Frameworks */, DBB01A6B1DC1491D00A7B188 /* mParticle_Apple_SDK.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -51,7 +69,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FF0BB640217A84E800B0556C /* mParticle_Example.framework in Frameworks */, + FF0BB640217A84E800B0556C /* mParticle_UserLeap.framework in Frameworks */, FF13226221878D9C002AA653 /* mParticle_Apple_SDK.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -63,8 +81,8 @@ isa = PBXGroup; children = ( DBB01A6A1DC1491D00A7B188 /* mParticle_Apple_SDK.framework */, - DBB01A5D1DC1478A00A7B188 /* mParticle-Example */, - FF0BB63C217A84E800B0556C /* mParticle_ExampleTests */, + DBB01A5D1DC1478A00A7B188 /* mParticle-UserLeap */, + FF0BB63C217A84E800B0556C /* mParticle_UserLeapTests */, DBB01A5C1DC1478A00A7B188 /* Products */, FF13226121878D9C002AA653 /* Frameworks */, ); @@ -73,35 +91,36 @@ DBB01A5C1DC1478A00A7B188 /* Products */ = { isa = PBXGroup; children = ( - DBB01A5B1DC1478A00A7B188 /* mParticle_Example.framework */, - FF0BB63B217A84E800B0556C /* mParticle_ExampleTests.xctest */, + DBB01A5B1DC1478A00A7B188 /* mParticle_UserLeap.framework */, + FF0BB63B217A84E800B0556C /* mParticle_UserLeapTests.xctest */, ); name = Products; sourceTree = ""; }; - DBB01A5D1DC1478A00A7B188 /* mParticle-Example */ = { + DBB01A5D1DC1478A00A7B188 /* mParticle-UserLeap */ = { isa = PBXGroup; children = ( - DBB01A661DC1480700A7B188 /* MPKitExample.h */, - DBB01A671DC1480700A7B188 /* MPKitExample.m */, - DBB01A5E1DC1478A00A7B188 /* mParticle_Example.h */, + DADFEBAE24DB2F0600F96A85 /* mParticle_UserLeap.h */, + DADFEBAD24DB2F0600F96A85 /* MPKitUserLeap.h */, + DADFEBAF24DB2F0600F96A85 /* MPKitUserLeap.m */, DBB01A5F1DC1478A00A7B188 /* Info.plist */, ); - path = "mParticle-Example"; + path = "mParticle-UserLeap"; sourceTree = ""; }; - FF0BB63C217A84E800B0556C /* mParticle_ExampleTests */ = { + FF0BB63C217A84E800B0556C /* mParticle_UserLeapTests */ = { isa = PBXGroup; children = ( - FF0BB63D217A84E800B0556C /* mParticle_ExampleTests.m */, - FF0BB63F217A84E800B0556C /* Info.plist */, + DADFEBB724DB30C400F96A85 /* mParticle_UserLeapTests.m */, + DADFEBB424DB2F3800F96A85 /* Info.plist */, ); - path = mParticle_ExampleTests; + path = mParticle_UserLeapTests; sourceTree = ""; }; FF13226121878D9C002AA653 /* Frameworks */ = { isa = PBXGroup; children = ( + DAD96C8524DB31DB0021695F /* UserLeapKit.framework */, ); name = Frameworks; sourceTree = ""; @@ -113,48 +132,48 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - DBB01A601DC1478A00A7B188 /* mParticle_Example.h in Headers */, - DBB01A681DC1480700A7B188 /* MPKitExample.h in Headers */, + DADFEBB024DB2F0600F96A85 /* MPKitUserLeap.h in Headers */, + DADFEBB124DB2F0600F96A85 /* mParticle_UserLeap.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - DBB01A5A1DC1478A00A7B188 /* mParticle-Example */ = { + DBB01A5A1DC1478A00A7B188 /* mParticle-UserLeap */ = { isa = PBXNativeTarget; - buildConfigurationList = DBB01A631DC1478A00A7B188 /* Build configuration list for PBXNativeTarget "mParticle-Example" */; + buildConfigurationList = DBB01A631DC1478A00A7B188 /* Build configuration list for PBXNativeTarget "mParticle-UserLeap" */; buildPhases = ( DBB01A561DC1478A00A7B188 /* Sources */, DBB01A571DC1478A00A7B188 /* Frameworks */, DBB01A581DC1478A00A7B188 /* Headers */, DBB01A591DC1478A00A7B188 /* Resources */, + DAD96C8824DB31DB0021695F /* Embed Frameworks */, ); buildRules = ( ); dependencies = ( ); - name = "mParticle-Example"; + name = "mParticle-UserLeap"; productName = "mParticle-Example"; - productReference = DBB01A5B1DC1478A00A7B188 /* mParticle_Example.framework */; + productReference = DBB01A5B1DC1478A00A7B188 /* mParticle_UserLeap.framework */; productType = "com.apple.product-type.framework"; }; - FF0BB63A217A84E800B0556C /* mParticle_ExampleTests */ = { + FF0BB63A217A84E800B0556C /* mParticle_UserLeapTests */ = { isa = PBXNativeTarget; - buildConfigurationList = FF0BB645217A84E800B0556C /* Build configuration list for PBXNativeTarget "mParticle_ExampleTests" */; + buildConfigurationList = FF0BB645217A84E800B0556C /* Build configuration list for PBXNativeTarget "mParticle_UserLeapTests" */; buildPhases = ( FF0BB637217A84E800B0556C /* Sources */, FF0BB638217A84E800B0556C /* Frameworks */, - FF0BB639217A84E800B0556C /* Resources */, ); buildRules = ( ); dependencies = ( FF0BB642217A84E800B0556C /* PBXTargetDependency */, ); - name = mParticle_ExampleTests; + name = mParticle_UserLeapTests; productName = mParticle_ExampleTests; - productReference = FF0BB63B217A84E800B0556C /* mParticle_ExampleTests.xctest */; + productReference = FF0BB63B217A84E800B0556C /* mParticle_UserLeapTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ @@ -176,11 +195,12 @@ }; }; }; - buildConfigurationList = DBB01A551DC1478A00A7B188 /* Build configuration list for PBXProject "mParticle-Example" */; + buildConfigurationList = DBB01A551DC1478A00A7B188 /* Build configuration list for PBXProject "mParticle-UserLeap" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = DBB01A511DC1478A00A7B188; @@ -188,8 +208,8 @@ projectDirPath = ""; projectRoot = ""; targets = ( - DBB01A5A1DC1478A00A7B188 /* mParticle-Example */, - FF0BB63A217A84E800B0556C /* mParticle_ExampleTests */, + DBB01A5A1DC1478A00A7B188 /* mParticle-UserLeap */, + FF0BB63A217A84E800B0556C /* mParticle_UserLeapTests */, ); }; /* End PBXProject section */ @@ -202,13 +222,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - FF0BB639217A84E800B0556C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -216,7 +229,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - DBB01A691DC1480700A7B188 /* MPKitExample.m in Sources */, + DADFEBB224DB2F0600F96A85 /* MPKitUserLeap.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -224,7 +237,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - FF0BB63E217A84E800B0556C /* mParticle_ExampleTests.m in Sources */, + DADFEBB824DB30C400F96A85 /* mParticle_UserLeapTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -233,7 +246,7 @@ /* Begin PBXTargetDependency section */ FF0BB642217A84E800B0556C /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = DBB01A5A1DC1478A00A7B188 /* mParticle-Example */; + target = DBB01A5A1DC1478A00A7B188 /* mParticle-UserLeap */; targetProxy = FF0BB641217A84E800B0556C /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -242,6 +255,7 @@ DBB01A611DC1478A00A7B188 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; @@ -293,6 +307,7 @@ DBB01A621DC1478A00A7B188 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; @@ -347,11 +362,11 @@ "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", ); - INFOPLIST_FILE = "mParticle-Example/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/mParticle-UserLeap/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-Example"; + PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-UserLeap"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; }; @@ -369,11 +384,11 @@ "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", ); - INFOPLIST_FILE = "mParticle-Example/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/mParticle-UserLeap/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-Example"; + PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-UserLeap"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; }; @@ -402,12 +417,12 @@ "$(PROJECT_DIR)/Carthage/Build/iOS", ); GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = mParticle_ExampleTests/Info.plist; + INFOPLIST_FILE = mParticle_UserLeapTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(PROJECT_DIR)/Carthage/Build/iOS"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-ExampleTests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-UserLeapTests"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -436,11 +451,11 @@ "$(PROJECT_DIR)/Carthage/Build/iOS", ); GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = mParticle_ExampleTests/Info.plist; + INFOPLIST_FILE = mParticle_UserLeapTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(PROJECT_DIR)/Carthage/Build/iOS"; MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-ExampleTests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-UserLeapTests"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -449,7 +464,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - DBB01A551DC1478A00A7B188 /* Build configuration list for PBXProject "mParticle-Example" */ = { + DBB01A551DC1478A00A7B188 /* Build configuration list for PBXProject "mParticle-UserLeap" */ = { isa = XCConfigurationList; buildConfigurations = ( DBB01A611DC1478A00A7B188 /* Debug */, @@ -458,7 +473,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - DBB01A631DC1478A00A7B188 /* Build configuration list for PBXNativeTarget "mParticle-Example" */ = { + DBB01A631DC1478A00A7B188 /* Build configuration list for PBXNativeTarget "mParticle-UserLeap" */ = { isa = XCConfigurationList; buildConfigurations = ( DBB01A641DC1478A00A7B188 /* Debug */, @@ -467,7 +482,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - FF0BB645217A84E800B0556C /* Build configuration list for PBXNativeTarget "mParticle_ExampleTests" */ = { + FF0BB645217A84E800B0556C /* Build configuration list for PBXNativeTarget "mParticle_UserLeapTests" */ = { isa = XCConfigurationList; buildConfigurations = ( FF0BB643217A84E800B0556C /* Debug */, diff --git a/mParticle-Example.xcodeproj/xcshareddata/xcschemes/mParticle-Example.xcscheme b/mParticle-UserLeap.xcodeproj/xcshareddata/xcschemes/mParticle-Example.xcscheme similarity index 96% rename from mParticle-Example.xcodeproj/xcshareddata/xcschemes/mParticle-Example.xcscheme rename to mParticle-UserLeap.xcodeproj/xcshareddata/xcschemes/mParticle-Example.xcscheme index f71135c..70d4ef8 100644 --- a/mParticle-Example.xcodeproj/xcshareddata/xcschemes/mParticle-Example.xcscheme +++ b/mParticle-UserLeap.xcodeproj/xcshareddata/xcschemes/mParticle-Example.xcscheme @@ -29,8 +29,6 @@ shouldUseLaunchSchemeArgsEnv = "YES"> - - - - +@interface MPKitUserLeap : NSObject @property (nonatomic, strong, nonnull) NSDictionary *configuration; @property (nonatomic, strong, nullable) NSDictionary *launchOptions; diff --git a/mParticle-Example/MPKitExample.m b/mParticle-UserLeap/MPKitUserLeap.m similarity index 95% rename from mParticle-Example/MPKitExample.m rename to mParticle-UserLeap/MPKitUserLeap.m index 66d5d31..3b9e82e 100644 --- a/mParticle-Example/MPKitExample.m +++ b/mParticle-UserLeap/MPKitUserLeap.m @@ -1,14 +1,16 @@ -#import "MPKitExample.h" +#import "MPKitUserLeap.h" /* Import your header file here */ -//#if defined(__has_include) && __has_include() -//#import -//#else -//#import "Example.h" -//#endif +#if defined(__has_include) && __has_include() +#import +#import +#else +#import "UserLeapKit.h" +#import "UserLeapKit-Swift.h" +#endif -@implementation MPKitExample +@implementation MPKitUserLeap /* mParticle will supply a unique kit code for you. Please contact our team @@ -18,7 +20,7 @@ + (NSNumber *)kitCode { } + (void)load { - MPKitRegister *kitRegister = [[MPKitRegister alloc] initWithName:@"Example" className:@"MPKitExample"]; + MPKitRegister *kitRegister = [[MPKitRegister alloc] initWithName:@"UserLeap" className:@"MPKitUserLeap"]; [MParticle registerExtension:kitRegister]; } @@ -30,8 +32,8 @@ - (MPKitExecStatus *)execStatus:(MPKitReturnCode)returnCode { #pragma mark Kit instance and lifecycle - (MPKitExecStatus *)didFinishLaunchingWithConfiguration:(NSDictionary *)configuration { - NSString *apiKey = configuration[@""]; - if (!apiKey) { + NSString *environmentId = configuration[@"environmentId"]; + if (!environmentId || ![environmentId isKindOfClass:[NSString class]] || environmentId.length == 0) { return [self execStatus:MPKitReturnCodeRequirementsNotMet]; } @@ -49,6 +51,9 @@ - (void)start { /* Start your SDK here. The configuration dictionary can be retrieved from self->_configuration */ +// [[UserLeap shared] configure:@{}]; +// [UserLeap shared]; + [[UserLeap shared] configure:@{}]; self->_started = YES; diff --git a/mParticle-Example/mParticle_Example.h b/mParticle-UserLeap/mParticle_UserLeap.h similarity index 77% rename from mParticle-Example/mParticle_Example.h rename to mParticle-UserLeap/mParticle_UserLeap.h index 5458d1f..4208c32 100644 --- a/mParticle-Example/mParticle_Example.h +++ b/mParticle-UserLeap/mParticle_UserLeap.h @@ -3,4 +3,4 @@ FOUNDATION_EXPORT double mParticle_ExampleVersionNumber; FOUNDATION_EXPORT const unsigned char mParticle_ExampleVersionString[]; -#import +#import diff --git a/mParticle_ExampleTests/Info.plist b/mParticle_UserLeapTests/Info.plist similarity index 100% rename from mParticle_ExampleTests/Info.plist rename to mParticle_UserLeapTests/Info.plist diff --git a/mParticle_ExampleTests/mParticle_ExampleTests.m b/mParticle_UserLeapTests/mParticle_UserLeapTests.m similarity index 53% rename from mParticle_ExampleTests/mParticle_ExampleTests.m rename to mParticle_UserLeapTests/mParticle_UserLeapTests.m index 5baa60f..7ce3b8d 100644 --- a/mParticle_ExampleTests/mParticle_ExampleTests.m +++ b/mParticle_UserLeapTests/mParticle_UserLeapTests.m @@ -1,11 +1,11 @@ #import -#import "MPKitExample.h" +#import "MPKitUserLeap.h" -@interface mParticle_ExampleTests : XCTestCase +@interface mParticle_UserLeapTests : XCTestCase @end -@implementation mParticle_ExampleTests +@implementation mParticle_UserLeapTests - (void)setUp { // Put setup code here. This method is called before the invocation of each test method in the class. @@ -16,12 +16,12 @@ - (void)tearDown { } - (void)testModuleID { - XCTAssertEqualObjects([MPKitExample kitCode], @123); + XCTAssertEqualObjects([MPKitUserLeap kitCode], @123); } - (void)testStarted { - MPKitExample *exampleKit = [[MPKitExample alloc] init]; - [exampleKit didFinishLaunchingWithConfiguration:@{@"":@"12345"}]; + MPKitUserLeap *exampleKit = [[MPKitUserLeap alloc] init]; + [exampleKit didFinishLaunchingWithConfiguration:@{@"environmentId":@"fyi3PTZxk"}]; XCTAssertTrue(exampleKit.started); } From 34607c8337e028f867706e24f440a96b2a88229a Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Thu, 15 Oct 2020 17:09:48 -0700 Subject: [PATCH 02/16] implemented identity, attributes and events --- Cartfile | 2 +- mParticle-UserLeap/MPKitUserLeap.m | 346 ++++++++--------------------- 2 files changed, 99 insertions(+), 249 deletions(-) diff --git a/Cartfile b/Cartfile index 4e3b6b1..4a3aa19 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ -binary "https://raw.githubusercontent.com/UserLeap/userleap-ios-sdk-releases/master/UserLeapKit.json" +binary "https://raw.githubusercontent.com/UserLeap/userleap-ios-sdk-releases/main/UserLeapKit.json" github "mparticle/mparticle-apple-sdk" ~> 7.7.0 diff --git a/mParticle-UserLeap/MPKitUserLeap.m b/mParticle-UserLeap/MPKitUserLeap.m index 3b9e82e..8523813 100644 --- a/mParticle-UserLeap/MPKitUserLeap.m +++ b/mParticle-UserLeap/MPKitUserLeap.m @@ -16,7 +16,7 @@ @implementation MPKitUserLeap mParticle will supply a unique kit code for you. Please contact our team */ + (NSNumber *)kitCode { - return @123; + return @1169; } + (void)load { @@ -48,13 +48,8 @@ - (void)start { static dispatch_once_t kitPredicate; dispatch_once(&kitPredicate, ^{ - /* - Start your SDK here. The configuration dictionary can be retrieved from self->_configuration - */ -// [[UserLeap shared] configure:@{}]; -// [UserLeap shared]; - [[UserLeap shared] configure:@{}]; - + [[UserLeap shared] configureWithEnvironment:self->_configuration[@"environmentId"]]; + self->_started = YES; dispatch_async(dispatch_get_main_queue(), ^{ @@ -68,260 +63,115 @@ - (void)start { } - (id const)providerKitInstance { - if (![self started]) { - return nil; - } - - /* - If your company SDK instance is available and is applicable (Please return nil if your SDK is based on class methods) - */ - BOOL kitInstanceAvailable = NO; - if (kitInstanceAvailable) { - /* Return an instance of your company's SDK (if applicable) */ - return nil; - } else { - return nil; - } + return [self started] ? UserLeap.shared : nil; } - #pragma mark Application -/* - Implement this method if your SDK handles a user interacting with a remote notification action -*/ -// - (MPKitExecStatus *)handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -// } -/* - Implement this method if your SDK receives and handles remote notifications -*/ -// - (MPKitExecStatus *)receivedUserNotification:(NSDictionary *)userInfo { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -// } - -/* - Implement this method if your SDK registers the device token for remote notifications -*/ -// - (MPKitExecStatus *)setDeviceToken:(NSData *)deviceToken { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -// } - -/* - Implement this method if your SDK handles continueUserActivity method from the App Delegate -*/ -// - (nonnull MPKitExecStatus *)continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(void(^ _Nonnull)(NSArray * _Nullable restorableObjects))restorationHandler { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -// } - -/* - Implement this method if your SDK handles the iOS 9 and above App Delegate method to open URL with options -*/ -// - (nonnull MPKitExecStatus *)openURL:(nonnull NSURL *)url options:(nullable NSDictionary *)options { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -// } - -/* - Implement this method if your SDK handles the iOS 8 and below App Delegate method open URL -*/ -// - (nonnull MPKitExecStatus *)openURL:(nonnull NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(nullable id)annotation { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -// } +//we currently don't need to handle any of these #pragma mark User attributes -/* - Implement this method if your SDK allows for incrementing numeric user attributes. -*/ -//- (MPKitExecStatus *)onIncrementUserAttribute:(FilteredMParticleUser *)user { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -//} - -/* - Implement this method if your SDK resets user attributes. -*/ -//- (MPKitExecStatus *)onRemoveUserAttribute:(FilteredMParticleUser *)user { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -//} - -/* - Implement this method if your SDK sets user attributes. -*/ -//- (MPKitExecStatus *)onSetUserAttribute:(FilteredMParticleUser *)user { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -//} -/* - Implement this method if your SDK supports setting value-less attributes -*/ -//- (MPKitExecStatus *)onSetUserTag:(FilteredMParticleUser *)user { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -//} +- (nonnull MPKitExecStatus *)setUserAttribute:(nonnull NSString *)key value:(nonnull id)value { + //only handle numbers and strings + //arrays and dicts will be handled in a later version + if ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]]) { + [[UserLeap shared] setVisitorAttributeWithKey:key value:[NSString stringWithFormat:@"%@",value]]; + } + return [self execStatus:MPKitReturnCodeSuccess]; +} -#pragma mark Identity -/* - Implement this method if your SDK should be notified any time the mParticle ID (MPID) changes. This will occur on initial install of the app, and potentially after a login or logout. -*/ -//- (MPKitExecStatus *)onIdentifyComplete:(FilteredMParticleUser *)user request:(FilteredMPIdentityApiRequest *)request { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -//} +- (nonnull MPKitExecStatus *)setUserIdentity:(nullable NSString *)identityString identityType:(MPUserIdentity)identityType { + MPKitReturnCode returnCode; + switch (identityType) { + case MPUserIdentityEmail: + [[UserLeap shared] setEmailAddress:identityString]; + returnCode = MPKitReturnCodeSuccess; + break; + case MPUserIdentityCustomerId: + case MPUserIdentityAlias: + [[UserLeap shared] setUserIdentifier:identityString]; + returnCode = MPKitReturnCodeSuccess; + break; + default: + returnCode = MPKitReturnCodeRequirementsNotMet; + break; + } + return [self execStatus:returnCode]; +} -/* - Implement this method if your SDK should be notified when the user logs in -*/ -//- (MPKitExecStatus *)onLoginComplete:(FilteredMParticleUser *)user request:(FilteredMPIdentityApiRequest *)request { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -//} +- (nonnull MPKitExecStatus *)setUserTag:(nonnull NSString *)tag { + [[UserLeap shared] setVisitorAttributeWithKey:tag value:@"1"]; + return [self execStatus:MPKitReturnCodeSuccess]; +} -/* - Implement this method if your SDK should be notified when the user logs out -*/ -//- (MPKitExecStatus *)onLogoutComplete:(FilteredMParticleUser *)user request:(FilteredMPIdentityApiRequest *)request { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -//} +#pragma mark Events -/* - Implement this method if your SDK should be notified when user identities change -*/ -//- (MPKitExecStatus *)onModifyComplete:(FilteredMParticleUser *)user request:(FilteredMPIdentityApiRequest *)request { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -//} +- (nonnull MPKitExecStatus *)logBaseEvent:(nonnull MPBaseEvent *)event { + UIViewController *controller = event.customAttributes[@"userleap_viewcontroller"]; + BOOL showSurvey = YES; + if (event.customAttributes[@"nosurvey"]) showSurvey = NO; + NSString *eventName = nil; + MPKitReturnCode returnCode; + switch (event.messageType) { + case MPMessageTypeEvent: + eventName = event.typeName; + returnCode = MPKitReturnCodeSuccess; + break; + case MPMessageTypeCommerceEvent: + eventName = [NSString stringWithFormat:@"Commerce - %@",event.typeName]; + returnCode = MPKitReturnCodeSuccess; + break; + default: + returnCode = MPKitReturnCodeUnavailable; + break; + } + if (!event) return [self execStatus:MPKitReturnCodeUnavailable]; + + void (^surveyDisplayer)(enum SurveyState state) = showSurvey ? ^void(enum SurveyState state) { + if (state == SurveyStateReady) { + [[UserLeap shared] presentSurveyFrom:controller ?: [self topViewController]]; + } + } : nil; + [[UserLeap shared] trackWithEventName:eventName handler:surveyDisplayer]; + return [self execStatus:MPKitReturnCodeSuccess]; +} -#pragma mark e-Commerce -/* - Implement this method if your SDK supports commerce events. - If your SDK does support commerce event, but does not support all commerce event actions available in the mParticle SDK, - expand the received commerce event into regular events and log them accordingly (see sample code below) - Please see MPCommerceEvent.h > MPCommerceEventAction for complete list -*/ -// - (MPKitExecStatus *)logCommerceEvent:(MPCommerceEvent *)commerceEvent { -// MPKitExecStatus *execStatus = [[MPKitExecStatus alloc] initWithSDKCode:[[self class] kitCode] returnCode:MPKitReturnCodeSuccess forwardCount:0]; -// -// // In this example, this SDK only supports the 'Purchase' commerce event action -// if (commerceEvent.action == MPCommerceEventActionPurchase) { -// /* Your code goes here. */ -// -// [execStatus incrementForwardCount]; -// } -// } else { // Other commerce events are expanded and logged as regular events -// NSArray *expandedInstructions = [commerceEvent expandedInstructions]; -// -// for (MPCommerceEventInstruction *commerceEventInstruction in expandedInstructions) { -// [self logEvent:commerceEventInstruction.event]; -// [execStatus incrementForwardCount]; -// } -// } -// -// return execStatus; -// } +- (nonnull MPKitExecStatus *)logout { + [[UserLeap shared] logout]; + return [self execStatus:MPKitReturnCodeSuccess]; +} -#pragma mark Events -/* - Implement this method if your SDK logs user events. - Please see MPEvent.h -*/ -// - (MPKitExecStatus *)logEvent:(MPEvent *)event { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -// } +#pragma mark - Utilities -/* - Implement this method if your SDK logs screen events - Please see MPEvent.h -*/ -// - (MPKitExecStatus *)logScreen:(MPEvent *)event { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -// } +- (UIViewController *)topViewController { + return [self topViewControllerWithRootViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; +} -#pragma mark Assorted -/* - Implement this method if your SDK implements an opt out mechanism for users. -*/ -// - (MPKitExecStatus *)setOptOut:(BOOL)optOut { -// /* Your code goes here. -// If the execution is not successful, please use a code other than MPKitReturnCodeSuccess for the execution status. -// Please see MPKitExecStatus.h for all exec status codes -// */ -// -// return [self execStatus:MPKitReturnCodeSuccess]; -// } +- (UIViewController *)topViewControllerWithRootViewController:(UIViewController *)viewController { + if ([viewController isKindOfClass:[UITabBarController class]]) { + UITabBarController *tabBarController = (UITabBarController *)viewController; + return [self topViewControllerWithRootViewController:tabBarController.selectedViewController]; + } else if ([viewController isKindOfClass:[UINavigationController class]]) { + UINavigationController *navContObj = (UINavigationController *)viewController; + return [self topViewControllerWithRootViewController:navContObj.visibleViewController]; + } else if (viewController.presentedViewController && !viewController.presentedViewController.isBeingDismissed) { + UIViewController *presentedViewController = viewController.presentedViewController; + return [self topViewControllerWithRootViewController:presentedViewController]; + } + else { + for (UIView *view in [viewController.view subviews]) + { + id subViewController = [view nextResponder]; + if ( subViewController && [subViewController isKindOfClass:[UIViewController class]]) + { + if ([(UIViewController *)subViewController presentedViewController] && ![subViewController presentedViewController].isBeingDismissed) { + return [self topViewControllerWithRootViewController:[(UIViewController *)subViewController presentedViewController]]; + } + } + } + return viewController; + } +} @end From a60e63894fddccc8b230d08a398aa123e918bdcc Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Thu, 15 Oct 2020 17:13:47 -0700 Subject: [PATCH 03/16] proper return code for unsupported attributes and updated no survey flag --- mParticle-UserLeap/MPKitUserLeap.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mParticle-UserLeap/MPKitUserLeap.m b/mParticle-UserLeap/MPKitUserLeap.m index 8523813..642d750 100644 --- a/mParticle-UserLeap/MPKitUserLeap.m +++ b/mParticle-UserLeap/MPKitUserLeap.m @@ -28,8 +28,6 @@ - (MPKitExecStatus *)execStatus:(MPKitReturnCode)returnCode { return [[MPKitExecStatus alloc] initWithSDKCode:self.class.kitCode returnCode:returnCode]; } -#pragma mark - MPKitInstanceProtocol methods - #pragma mark Kit instance and lifecycle - (MPKitExecStatus *)didFinishLaunchingWithConfiguration:(NSDictionary *)configuration { NSString *environmentId = configuration[@"environmentId"]; @@ -77,8 +75,9 @@ - (nonnull MPKitExecStatus *)setUserAttribute:(nonnull NSString *)key value:(non //arrays and dicts will be handled in a later version if ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]]) { [[UserLeap shared] setVisitorAttributeWithKey:key value:[NSString stringWithFormat:@"%@",value]]; + return [self execStatus:MPKitReturnCodeSuccess]; } - return [self execStatus:MPKitReturnCodeSuccess]; + return [self execStatus:MPKitReturnCodeUnavailable]; } - (nonnull MPKitExecStatus *)setUserIdentity:(nullable NSString *)identityString identityType:(MPUserIdentity)identityType { @@ -110,7 +109,7 @@ - (nonnull MPKitExecStatus *)setUserTag:(nonnull NSString *)tag { - (nonnull MPKitExecStatus *)logBaseEvent:(nonnull MPBaseEvent *)event { UIViewController *controller = event.customAttributes[@"userleap_viewcontroller"]; BOOL showSurvey = YES; - if (event.customAttributes[@"nosurvey"]) showSurvey = NO; + if (event.customAttributes[@"userleap_dont_show_survey"]) showSurvey = NO; NSString *eventName = nil; MPKitReturnCode returnCode; switch (event.messageType) { From 7b04bd4f89bf5444eb3249fe42374e9ea75b6823 Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Fri, 16 Oct 2020 10:50:46 -0700 Subject: [PATCH 04/16] added pull request template --- pull_request_template.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pull_request_template.md diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 0000000..b2da52f --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,36 @@ +## Description + + + +## Motivation and Context + + + + +## How Has This Been Tested? + + + + + +## Screenshots (if appropriate): + +## Types of changes + + + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) + +## Checklist: + + + + + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. From baa29f710d0834340ac221b4fa624f515a45d859 Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Tue, 20 Oct 2020 16:44:59 -0700 Subject: [PATCH 05/16] Added unit tests and fixed bug --- mParticle-UserLeap/MPKitUserLeap.m | 3 +- .../mParticle_UserLeapTests.m | 90 +++++++++++++++++-- 2 files changed, 86 insertions(+), 7 deletions(-) diff --git a/mParticle-UserLeap/MPKitUserLeap.m b/mParticle-UserLeap/MPKitUserLeap.m index 642d750..ba57dbf 100644 --- a/mParticle-UserLeap/MPKitUserLeap.m +++ b/mParticle-UserLeap/MPKitUserLeap.m @@ -11,7 +11,6 @@ #endif @implementation MPKitUserLeap - /* mParticle will supply a unique kit code for you. Please contact our team */ @@ -125,7 +124,7 @@ - (nonnull MPKitExecStatus *)logBaseEvent:(nonnull MPBaseEvent *)event { returnCode = MPKitReturnCodeUnavailable; break; } - if (!event) return [self execStatus:MPKitReturnCodeUnavailable]; + if (!eventName) return [self execStatus:MPKitReturnCodeUnavailable]; void (^surveyDisplayer)(enum SurveyState state) = showSurvey ? ^void(enum SurveyState state) { if (state == SurveyStateReady) { diff --git a/mParticle_UserLeapTests/mParticle_UserLeapTests.m b/mParticle_UserLeapTests/mParticle_UserLeapTests.m index 7ce3b8d..bd9a619 100644 --- a/mParticle_UserLeapTests/mParticle_UserLeapTests.m +++ b/mParticle_UserLeapTests/mParticle_UserLeapTests.m @@ -7,22 +7,102 @@ @interface mParticle_UserLeapTests : XCTestCase @implementation mParticle_UserLeapTests +static MPKitUserLeap *kit; + - (void)setUp { - // Put setup code here. This method is called before the invocation of each test method in the class. + if (!kit) { + kit = [[MPKitUserLeap alloc] init]; + [kit didFinishLaunchingWithConfiguration:@{@"environmentId":@"someEnvironmentId"}]; + } } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. } +#pragma mark - Tests + - (void)testModuleID { - XCTAssertEqualObjects([MPKitUserLeap kitCode], @123); + XCTAssertEqualObjects([MPKitUserLeap kitCode], @1169); } - (void)testStarted { - MPKitUserLeap *exampleKit = [[MPKitUserLeap alloc] init]; - [exampleKit didFinishLaunchingWithConfiguration:@{@"environmentId":@"fyi3PTZxk"}]; - XCTAssertTrue(exampleKit.started); + XCTestExpectation *exp = [[XCTestExpectation alloc] initWithDescription:@"desc"]; + NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.01 repeats:YES block:^(NSTimer * _Nonnull timer) { + if (kit.started) [exp fulfill]; + }]; + XCTWaiterResult result = [XCTWaiter waitForExpectations:@[exp] timeout:5]; + XCTAssertEqual(result, XCTWaiterResultCompleted); + XCTAssertTrue(kit.started); + XCTAssertNotNil(kit.providerKitInstance); + [timer invalidate]; +} + +- (void)testInvalidEnvironmentIdTypeReturnsFalse { + MPKitUserLeap *invalidKit = [[MPKitUserLeap alloc] init]; + MPKitExecStatus *status = [invalidKit didFinishLaunchingWithConfiguration:@{@"_environmentId":@"thekeyisinvalid"}]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeRequirementsNotMet); +} + +- (void)testSetAttributesWithStringValueReturnsSuccess { + MPKitExecStatus *status = [kit setUserAttribute:@"key" value:@"value"]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeSuccess); +} + +- (void)testSetAttributesWithNumberValueReturnsSuccess { + MPKitExecStatus *status = [kit setUserAttribute:@"key" value:@1]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeSuccess); +} + +- (void)testSetAttributesWithArrayReturnsFalse { + MPKitExecStatus *status = [kit setUserAttribute:@"key" value:@[@"value"]]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeUnavailable); +} + +- (void)testSetAttributesWithDictionaryReturnsFalse { + MPKitExecStatus *status = [kit setUserAttribute:@"key" value:@{@"value":@1}]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeUnavailable); +} + +- (void)testSetEmailAddressReturnsTrue { + MPKitExecStatus *status = [kit setUserIdentity:@"someEmail@gmail.com" identityType:MPUserIdentityEmail]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeSuccess); +} + +- (void)testSetCustomerIdReturnsTrue { + MPKitExecStatus *status = [kit setUserIdentity:@"anything" identityType:MPUserIdentityCustomerId]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeSuccess); +} + +- (void)testSetUserTagReturnsTrue { + MPKitExecStatus *status = [kit setUserTag:@"something"]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeSuccess); +} + +- (void)testLogEventReturnsSuccess { + MPBaseEvent *event = [[MPBaseEvent alloc] initWithEventType:MPEventTypeAddToCart]; + event.messageType = MPMessageTypeEvent; + MPKitExecStatus *status = [kit logBaseEvent:event]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeSuccess); +} + +- (void)testLogCommerceEventReturnsSuccess { + MPBaseEvent *event = [[MPBaseEvent alloc] initWithEventType:MPEventTypeAddToCart]; + event.messageType = MPMessageTypeCommerceEvent; + MPKitExecStatus *status = [kit logBaseEvent:event]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeSuccess); +} + +- (void)testLogOtherEventReturnsUnsupported { + MPBaseEvent *event = [[MPBaseEvent alloc] initWithEventType:MPEventTypeAddToCart]; + event.messageType = MPMessageTypeMedia; + MPKitExecStatus *status = [kit logBaseEvent:event]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeUnavailable); +} + +- (void)testLogoutReturnsSuccess { + MPKitExecStatus *status = [kit logout]; + XCTAssertEqual(status.returnCode, MPKitReturnCodeSuccess); } @end From 59dfc6b3356e5b5a0fe65b6076e483e14735103c Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Tue, 20 Oct 2020 17:05:30 -0700 Subject: [PATCH 06/16] Added Cocoapods & Carthage --- mParticle-UserLeap.podspec | 14 +++++++------- mParticle_UserLeap.json | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 mParticle_UserLeap.json diff --git a/mParticle-UserLeap.podspec b/mParticle-UserLeap.podspec index 9fe1d29..a31f22e 100644 --- a/mParticle-UserLeap.podspec +++ b/mParticle-UserLeap.podspec @@ -1,20 +1,20 @@ Pod::Spec.new do |s| - s.name = "mParticle-Example" - s.version = "7.7.3" - s.summary = "Example integration for mParticle" + s.name = "mParticle-UserLeap" + s.version = "1.0.0" + s.summary = "UserLeap integration for mParticle" s.description = <<-DESC - This is the Example integration for mParticle. + Please find updated documentation at https://docs.userleap.com/integrations/mparticle DESC s.homepage = "https://www.mparticle.com" s.license = { :type => 'Apache 2.0', :file => 'LICENSE' } s.author = { "mParticle" => "support@mparticle.com" } - s.source = { :git => "https://github.com/mparticle-integrations/mparticle-apple-integration-example.git", :tag => s.version.to_s } + s.source = { :git => "https://github.com/mparticle-integrations/mparticle-apple-integration-userleap.git", :tag => s.version.to_s } s.social_media_url = "https://twitter.com/mparticle" s.ios.deployment_target = "9.0" - s.ios.source_files = 'mParticle-Example/*.{h,m}' + s.ios.source_files = 'mParticle-UserLeap/*.{h,m}' s.ios.dependency 'mParticle-Apple-SDK', '~> 7.7.0' - #s.ios.dependency 'Example', '~> 1.2' + s.ios.dependency 'UserLeapKit', '~> 3.1.0' end diff --git a/mParticle_UserLeap.json b/mParticle_UserLeap.json new file mode 100644 index 0000000..aed54f1 --- /dev/null +++ b/mParticle_UserLeap.json @@ -0,0 +1,3 @@ +{ + "1.0.0": "https://github.com/mparticle-integrations/mparticle-apple-integration-userleap/releases/download/1.0.0/mParticle_UserLeap.framework.zip" +} \ No newline at end of file From 079b021d294ac703a52cce65f35ab7da4ce30f0a Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Tue, 20 Oct 2020 23:25:25 -0700 Subject: [PATCH 07/16] update commerce event name --- mParticle-UserLeap/MPKitUserLeap.m | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mParticle-UserLeap/MPKitUserLeap.m b/mParticle-UserLeap/MPKitUserLeap.m index ba57dbf..0e1bbf8 100644 --- a/mParticle-UserLeap/MPKitUserLeap.m +++ b/mParticle-UserLeap/MPKitUserLeap.m @@ -113,11 +113,8 @@ - (nonnull MPKitExecStatus *)logBaseEvent:(nonnull MPBaseEvent *)event { MPKitReturnCode returnCode; switch (event.messageType) { case MPMessageTypeEvent: - eventName = event.typeName; - returnCode = MPKitReturnCodeSuccess; - break; case MPMessageTypeCommerceEvent: - eventName = [NSString stringWithFormat:@"Commerce - %@",event.typeName]; + eventName = event.typeName; returnCode = MPKitReturnCodeSuccess; break; default: From 9439b8c87838fbfb1c5ab5dfbb7eb4c50db2097a Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Mon, 30 Nov 2020 17:20:30 -0800 Subject: [PATCH 08/16] bump UserLeapKit version number --- mParticle-UserLeap.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mParticle-UserLeap.podspec b/mParticle-UserLeap.podspec index a31f22e..730795e 100644 --- a/mParticle-UserLeap.podspec +++ b/mParticle-UserLeap.podspec @@ -15,6 +15,6 @@ Pod::Spec.new do |s| s.ios.deployment_target = "9.0" s.ios.source_files = 'mParticle-UserLeap/*.{h,m}' - s.ios.dependency 'mParticle-Apple-SDK', '~> 7.7.0' - s.ios.dependency 'UserLeapKit', '~> 3.1.0' + s.ios.dependency 'mParticle-Apple-SDK', '~> 8.0.1' + s.ios.dependency 'UserLeapKit', '3.1.1' end From 921fe5ddf4d894be9a42c0f91f322aea3732b0c4 Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Mon, 30 Nov 2020 17:22:14 -0800 Subject: [PATCH 09/16] remove pull_request_template --- pull_request_template.md | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 pull_request_template.md diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index b2da52f..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,36 +0,0 @@ -## Description - - - -## Motivation and Context - - - - -## How Has This Been Tested? - - - - - -## Screenshots (if appropriate): - -## Types of changes - - - -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - -## Checklist: - - - - - -- [ ] My code follows the code style of this project. -- [ ] My change requires a change to the documentation. -- [ ] I have updated the documentation accordingly. -- [ ] I have added tests to cover my changes. -- [ ] All new and existing tests passed. From d94fc965ff599ca36e02f475408bd0b822532fb7 Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Wed, 2 Dec 2020 16:39:34 -0800 Subject: [PATCH 10/16] use deprecated logEvent: --- mParticle-UserLeap/MPKitUserLeap.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mParticle-UserLeap/MPKitUserLeap.m b/mParticle-UserLeap/MPKitUserLeap.m index 0e1bbf8..dd450c3 100644 --- a/mParticle-UserLeap/MPKitUserLeap.m +++ b/mParticle-UserLeap/MPKitUserLeap.m @@ -105,7 +105,15 @@ - (nonnull MPKitExecStatus *)setUserTag:(nonnull NSString *)tag { #pragma mark Events +- (nonnull MPKitExecStatus *)logEvent:(MPEvent *)event { + return [self _handleEvent:event]; +} + - (nonnull MPKitExecStatus *)logBaseEvent:(nonnull MPBaseEvent *)event { + return [self _handleEvent:event]; +} + +- (nonnull MPKitExecStatus *)_handleEvent:(nonnull MPBaseEvent *)event { UIViewController *controller = event.customAttributes[@"userleap_viewcontroller"]; BOOL showSurvey = YES; if (event.customAttributes[@"userleap_dont_show_survey"]) showSurvey = NO; From 0f6853b3b3d03f69c6bff1866d8d9151a7f900c7 Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Wed, 2 Dec 2020 17:17:44 -0800 Subject: [PATCH 11/16] bump supported mParticle version --- mParticle-UserLeap.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mParticle-UserLeap.podspec b/mParticle-UserLeap.podspec index 730795e..e2bf5cf 100644 --- a/mParticle-UserLeap.podspec +++ b/mParticle-UserLeap.podspec @@ -15,6 +15,6 @@ Pod::Spec.new do |s| s.ios.deployment_target = "9.0" s.ios.source_files = 'mParticle-UserLeap/*.{h,m}' - s.ios.dependency 'mParticle-Apple-SDK', '~> 8.0.1' + s.ios.dependency 'mParticle-Apple-SDK', '~> 8.1' s.ios.dependency 'UserLeapKit', '3.1.1' end From d9656b623cf3361d6e1498157983b0e28aa06bea Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Wed, 13 Jan 2021 13:43:09 -0800 Subject: [PATCH 12/16] some fixes --- Cartfile | 2 +- mParticle-UserLeap/MPKitUserLeap.m | 41 +++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Cartfile b/Cartfile index 4a3aa19..6704eab 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ binary "https://raw.githubusercontent.com/UserLeap/userleap-ios-sdk-releases/main/UserLeapKit.json" -github "mparticle/mparticle-apple-sdk" ~> 7.7.0 +github "mparticle/mparticle-apple-sdk" ~> 8.1.2 diff --git a/mParticle-UserLeap/MPKitUserLeap.m b/mParticle-UserLeap/MPKitUserLeap.m index dd450c3..7d8ee93 100644 --- a/mParticle-UserLeap/MPKitUserLeap.m +++ b/mParticle-UserLeap/MPKitUserLeap.m @@ -103,18 +103,40 @@ - (nonnull MPKitExecStatus *)setUserTag:(nonnull NSString *)tag { return [self execStatus:MPKitReturnCodeSuccess]; } -#pragma mark Events +- (nonnull MPKitExecStatus *)onIdentifyComplete:(nonnull FilteredMParticleUser *)user + request:(nonnull FilteredMPIdentityApiRequest *)request { + return [self _handleLogin:user request:request]; +} -- (nonnull MPKitExecStatus *)logEvent:(MPEvent *)event { - return [self _handleEvent:event]; +- (nonnull MPKitExecStatus *)onLoginComplete:(nonnull FilteredMParticleUser *)user + request:(nonnull FilteredMPIdentityApiRequest *)request { + return [self _handleLogin:user request:request]; +} + +- (nonnull MPKitExecStatus *)_handleLogin:(nonnull FilteredMParticleUser *)user + request:(nonnull FilteredMPIdentityApiRequest *)request { + if (request.customerId) [[UserLeap shared] setUserIdentifier:request.customerId]; + if (request.email) [[UserLeap shared] setEmailAddress:request.email]; + return [self execStatus:MPKitReturnCodeSuccess]; +} + +- (nonnull MPKitExecStatus *)onModifyComplete:(FilteredMParticleUser *)user + request:(FilteredMPIdentityApiRequest *)request { + if (request.email) [[UserLeap shared] setEmailAddress:request.email]; + return [self execStatus:MPKitReturnCodeSuccess]; } -- (nonnull MPKitExecStatus *)logBaseEvent:(nonnull MPBaseEvent *)event { - return [self _handleEvent:event]; +- (nonnull MPKitExecStatus *)onLogoutComplete:(nonnull FilteredMParticleUser *)user + request:(nonnull FilteredMPIdentityApiRequest *)request { + [[UserLeap shared] logout]; + return [self execStatus:MPKitReturnCodeSuccess]; } -- (nonnull MPKitExecStatus *)_handleEvent:(nonnull MPBaseEvent *)event { - UIViewController *controller = event.customAttributes[@"userleap_viewcontroller"]; +#pragma mark Events + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +- (nonnull MPKitExecStatus *)logEvent:(MPEvent *)event { BOOL showSurvey = YES; if (event.customAttributes[@"userleap_dont_show_survey"]) showSurvey = NO; NSString *eventName = nil; @@ -122,7 +144,7 @@ - (nonnull MPKitExecStatus *)_handleEvent:(nonnull MPBaseEvent *)event { switch (event.messageType) { case MPMessageTypeEvent: case MPMessageTypeCommerceEvent: - eventName = event.typeName; + eventName = event.name; returnCode = MPKitReturnCodeSuccess; break; default: @@ -133,12 +155,13 @@ - (nonnull MPKitExecStatus *)_handleEvent:(nonnull MPBaseEvent *)event { void (^surveyDisplayer)(enum SurveyState state) = showSurvey ? ^void(enum SurveyState state) { if (state == SurveyStateReady) { - [[UserLeap shared] presentSurveyFrom:controller ?: [self topViewController]]; + [[UserLeap shared] presentSurveyFrom:[self topViewController]]; } } : nil; [[UserLeap shared] trackWithEventName:eventName handler:surveyDisplayer]; return [self execStatus:MPKitReturnCodeSuccess]; } +#pragma GCC diagnostic pop - (nonnull MPKitExecStatus *)logout { [[UserLeap shared] logout]; From 667f7d8505a14f3238eea3e33e6c59d0eee5b413 Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Wed, 3 Mar 2021 15:50:16 -0800 Subject: [PATCH 13/16] update dep versions --- Cartfile | 2 +- mParticle-UserLeap.podspec | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cartfile b/Cartfile index 6704eab..bb6e4ae 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ binary "https://raw.githubusercontent.com/UserLeap/userleap-ios-sdk-releases/main/UserLeapKit.json" -github "mparticle/mparticle-apple-sdk" ~> 8.1.2 +github "mparticle/mparticle-apple-sdk" ~> 8.2.0 diff --git a/mParticle-UserLeap.podspec b/mParticle-UserLeap.podspec index e2bf5cf..f67128f 100644 --- a/mParticle-UserLeap.podspec +++ b/mParticle-UserLeap.podspec @@ -15,6 +15,6 @@ Pod::Spec.new do |s| s.ios.deployment_target = "9.0" s.ios.source_files = 'mParticle-UserLeap/*.{h,m}' - s.ios.dependency 'mParticle-Apple-SDK', '~> 8.1' - s.ios.dependency 'UserLeapKit', '3.1.1' + s.ios.dependency 'mParticle-Apple-SDK', '~> 8.2' + s.ios.dependency 'UserLeapKit', '4.1.0' end From 041bbbb385e9a170542fa2bc8e99c51eae3bd5b3 Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Tue, 9 Mar 2021 15:45:47 -0800 Subject: [PATCH 14/16] handle commerce properly --- mParticle-UserLeap/MPKitUserLeap.m | 50 ++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/mParticle-UserLeap/MPKitUserLeap.m b/mParticle-UserLeap/MPKitUserLeap.m index 7d8ee93..9b10dfd 100644 --- a/mParticle-UserLeap/MPKitUserLeap.m +++ b/mParticle-UserLeap/MPKitUserLeap.m @@ -134,34 +134,50 @@ - (nonnull MPKitExecStatus *)onLogoutComplete:(nonnull FilteredMParticleUser *)u #pragma mark Events -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -- (nonnull MPKitExecStatus *)logEvent:(MPEvent *)event { - BOOL showSurvey = YES; - if (event.customAttributes[@"userleap_dont_show_survey"]) showSurvey = NO; - NSString *eventName = nil; - MPKitReturnCode returnCode; - switch (event.messageType) { - case MPMessageTypeEvent: - case MPMessageTypeCommerceEvent: - eventName = event.name; - returnCode = MPKitReturnCodeSuccess; - break; +NSString *commerceNameFromEvent(MPCommerceEvent *event) { + switch (event.action) { + case MPCommerceEventActionClick: + return @"click"; + case MPCommerceEventActionRefund: + return @"refund"; + case MPCommerceEventActionCheckout: + return @"checkout"; + case MPCommerceEventActionPurchase: + return @"purchase"; + case MPCommerceEventActionViewDetail: + return @"view detail"; + case MPCommerceEventActionAddToCart: + return @"add to cart"; + case MPCommerceEventActionCheckoutOptions: + return @"checkout options"; + case MPCommerceEventActionRemoveFromCart: + return @"remove from cart"; + case MPCommerceEventActionRemoveFromWishlist: + return @"remove from wishlist"; + case MPCommerceEventActionAddToWishList: + return @"add to wishlist"; default: - returnCode = MPKitReturnCodeUnavailable; break; } - if (!eventName) return [self execStatus:MPKitReturnCodeUnavailable]; + return nil; +} + +- (nonnull MPKitExecStatus *)logBaseEvent:(MPBaseEvent *)event { + NSString *name = nil; + if ([event isKindOfClass:[MPEvent class]]) name = ((MPEvent *)event).name; + else if ([event isKindOfClass:[MPCommerceEvent class]]) name = commerceNameFromEvent((MPCommerceEvent *)event); + if (!name) return [self execStatus:MPKitReturnCodeUnavailable]; + BOOL showSurvey = [event.timestamp timeIntervalSinceNow] > -5; + if (event.customAttributes[@"userleap_dont_show_survey"]) showSurvey = NO; void (^surveyDisplayer)(enum SurveyState state) = showSurvey ? ^void(enum SurveyState state) { if (state == SurveyStateReady) { [[UserLeap shared] presentSurveyFrom:[self topViewController]]; } } : nil; - [[UserLeap shared] trackWithEventName:eventName handler:surveyDisplayer]; + [[UserLeap shared] trackWithEventName:name handler:surveyDisplayer]; return [self execStatus:MPKitReturnCodeSuccess]; } -#pragma GCC diagnostic pop - (nonnull MPKitExecStatus *)logout { [[UserLeap shared] logout]; From 394f3c370ef886cbb4dc8bd6a046853df7e26afb Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Mon, 26 Apr 2021 22:35:06 -0700 Subject: [PATCH 15/16] Update author, source, social media and deployment target --- mParticle-UserLeap.podspec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mParticle-UserLeap.podspec b/mParticle-UserLeap.podspec index f67128f..196c0bb 100644 --- a/mParticle-UserLeap.podspec +++ b/mParticle-UserLeap.podspec @@ -9,11 +9,11 @@ Pod::Spec.new do |s| s.homepage = "https://www.mparticle.com" s.license = { :type => 'Apache 2.0', :file => 'LICENSE' } - s.author = { "mParticle" => "support@mparticle.com" } - s.source = { :git => "https://github.com/mparticle-integrations/mparticle-apple-integration-userleap.git", :tag => s.version.to_s } - s.social_media_url = "https://twitter.com/mparticle" + s.author = { "UserLeap" => "support@userleap.com" } + s.source = { :git => "https://github.com/UserLeap/userleap-mparticle-ios-kit.git", :tag => s.version.to_s } + s.social_media_url = "https://twitter.com/userleap" - s.ios.deployment_target = "9.0" + s.ios.deployment_target = "10.3" s.ios.source_files = 'mParticle-UserLeap/*.{h,m}' s.ios.dependency 'mParticle-Apple-SDK', '~> 8.2' s.ios.dependency 'UserLeapKit', '4.1.0' From cde8efba8d99e67aa89e263aec34cffdeb166fab Mon Sep 17 00:00:00 2001 From: Andrew Park Date: Tue, 27 Apr 2021 10:14:20 -0700 Subject: [PATCH 16/16] Update carthage url and add cocoapods exclude to be able to push to cocoapods --- mParticle-UserLeap.podspec | 6 ++++++ mParticle_UserLeap.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mParticle-UserLeap.podspec b/mParticle-UserLeap.podspec index 196c0bb..e136849 100644 --- a/mParticle-UserLeap.podspec +++ b/mParticle-UserLeap.podspec @@ -17,4 +17,10 @@ Pod::Spec.new do |s| s.ios.source_files = 'mParticle-UserLeap/*.{h,m}' s.ios.dependency 'mParticle-Apple-SDK', '~> 8.2' s.ios.dependency 'UserLeapKit', '4.1.0' + s.pod_target_xcconfig = { + 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' + } + s.user_target_xcconfig = { + 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' + } end diff --git a/mParticle_UserLeap.json b/mParticle_UserLeap.json index aed54f1..cef4525 100644 --- a/mParticle_UserLeap.json +++ b/mParticle_UserLeap.json @@ -1,3 +1,3 @@ { - "1.0.0": "https://github.com/mparticle-integrations/mparticle-apple-integration-userleap/releases/download/1.0.0/mParticle_UserLeap.framework.zip" + "1.0.0": "https://github.com/UserLeap/userleap-mparticle-ios-kit/releases/download/1.0.0/UserLeap_mParticle.framework.zip" } \ No newline at end of file