From 488e574806d7a09bf126435fea739cc3a1e5d84d Mon Sep 17 00:00:00 2001 From: Ben Baron Date: Fri, 26 Apr 2024 09:49:51 -0500 Subject: [PATCH] feat: Update Kochava to v8 and remove Cocoapods --- .github/workflows/ios-kit-release.yml | 8 ------ Package.swift | 33 ++++++++++++++++-------- README.md | 14 +++++------ Scripts/release.sh | 6 ++--- VERSION | 1 + mParticle-Kochava-NoTracking | 1 + mParticle-Kochava.podspec | 20 --------------- mParticle-Kochava/MPKitKochava.m | 36 +++++++++++++-------------- 8 files changed, 51 insertions(+), 68 deletions(-) create mode 100644 VERSION create mode 120000 mParticle-Kochava-NoTracking delete mode 100755 mParticle-Kochava.podspec diff --git a/.github/workflows/ios-kit-release.yml b/.github/workflows/ios-kit-release.yml index 3397790..785cb63 100644 --- a/.github/workflows/ios-kit-release.yml +++ b/.github/workflows/ios-kit-release.yml @@ -37,7 +37,6 @@ jobs: needs: create-release-branch env: GITHUB_ACCESS_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} - COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} steps: - name: Checkout uses: actions/checkout@v3 @@ -45,7 +44,6 @@ jobs: - name: Validate environment run: | env | grep -q '^GITHUB_ACCESS_TOKEN=' || (echo "Required environment variable GITHUB_ACCESS_TOKEN is not set" && exit 1) - env | grep -q '^COCOAPODS_TRUNK_TOKEN=' || (echo "Required environment variable COCOAPODS_TRUNK_TOKEN is not set" && exit 1) - name: Setup git config run: | @@ -105,12 +103,6 @@ jobs: git status git push origin HEAD:release/${{ github.run_number }} - - name: Release to CocoaPods - if: ${{ github.event.inputs.dryRun == 'false'}} - run: | - sudo gem install xcodeproj - pod trunk push --allow-warnings - sync-repository: name: Finalize release needs: release diff --git a/Package.swift b/Package.swift index 11efb8b..69e882d 100644 --- a/Package.swift +++ b/Package.swift @@ -5,36 +5,49 @@ import PackageDescription let package = Package( name: "mParticle-Kochava", platforms: [ - .iOS("12.4"), - .tvOS("12.4"), + .iOS("13.0"), + .tvOS("13.0"), ], products: [ .library( name: "mParticle-Kochava", targets: ["mParticle-Kochava"]), + .library( + name: "mParticle-Kochava-NoTracking", + targets: ["mParticle-Kochava-NoTracking"]), ], dependencies: [ .package( name: "mParticle-Apple-SDK", url: "https://github.com/mParticle/mparticle-apple-sdk", - .upToNextMajor(from: "8.3.0") + .upToNextMajor(from: "8.19.0") + ), + .package( + name: "KochavaNetworking", + url: "https://github.com/Kochava/Apple-SwiftPackage-KochavaNetworking-XCFramework", + .upToNextMajor(from: "8.0.0") ), .package( - name: "KochavaCore", - url: "https://github.com/Kochava/Apple-SwiftPackage-KochavaCore", - .upToNextMajor(from: "7.0.0") + name: "KochavaMeasurement", + url: "https://github.com/Kochava/Apple-SwiftPackage-KochavaMeasurement-XCFramework", + .upToNextMajor(from: "8.0.0") ), .package( - name: "KochavaTracker", - url: "https://github.com/Kochava/Apple-SwiftPackage-KochavaTracker.git", - .upToNextMajor(from: "7.0.0") + name: "KochavaTracking", + url: "https://github.com/Kochava/Apple-SwiftPackage-KochavaTracking-XCFramework", + .upToNextMajor(from: "8.0.0") ), ], targets: [ .target( name: "mParticle-Kochava", - dependencies: ["mParticle-Apple-SDK", "KochavaCore", "KochavaTracker"], + dependencies: ["mParticle-Apple-SDK", "KochavaNetworking", "KochavaMeasurement", "KochavaTracking"], path: "mParticle-Kochava", publicHeadersPath: "."), + .target( + name: "mParticle-Kochava-NoTracking", + dependencies: ["mParticle-Apple-SDK", "KochavaNetworking", "KochavaMeasurement"], + path: "mParticle-Kochava-NoTracking", + publicHeadersPath: "."), ] ) diff --git a/README.md b/README.md index 40717ba..395c742 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,19 @@ This repository contains the [Kochava](https://www.kochava.com) integration for ## Installation -KochavaTracker 4.0.0 and on is a Swift package. To install it, simply add this package as a dependency. +Kochava's SDK, as of version 8.0.0, no longer supports CocoaPods. As this version is the minimum required for App Store submission due to the iOS 17 privacy manifest changes, the mParticle Kochava Kit by association no longer supports CocoaPods either. In Xcode, see File > Swift Packages > Add Package Dependency ... > and enter the URL for this package repository. -## Integration using CocoaPods +The mParticle Kochava Kit contains two build targets: `mParticle-Kochava` and `mParticle-Kochava-NoTracking`. The `mParticle-Kochava` retains all of the same functionality of the previous version of Kochava, while the `mParticle-Kochava-NoTracking` removes the parts that Apple defines as "tracking". -Prior to 4.0.0, KochavaTracker supported CocoaPods. +Specifically this means, `mParticle-Kochava` depends on the `KochavaNetworking`, `KochavaMeasurement`, and `KochavaTracking` packages, while the `mParticle-Kochava-NoTracking` target only depends on the `KochavaNetworking` and `KochavaMeasurement` packages. -### Adding the integration +You can read more about that in Kochava's documentation here: https://support.kochava.com/sdk-integration/ios-sdk-integration/ios-migrating-to-v8/ -1. Add the kit dependency to your app's Podfile: +### Adding the integration - ``` - pod 'mParticle-Kochava', '~> 8.0' - ``` +1. Add this kit to your Xcode project using SPM, and choose either `mParticle-Kochava` or `mParticle-Kochava-NoTracking` 2. Follow the mParticle iOS SDK [quick-start](https://github.com/mParticle/mparticle-apple-sdk), then rebuild and launch your app, and verify that you see `"Included kits: { Kochava }"` in your Xcode console diff --git a/Scripts/release.sh b/Scripts/release.sh index e9459c3..b7d0f59 100755 --- a/Scripts/release.sh +++ b/Scripts/release.sh @@ -5,13 +5,13 @@ NOTES="$2" # Update version number # -# Update CocoaPods podspec file -sed -i '' 's/\(^ s.version[^=]*= \).*/\1"'"$VERSION"'"/' mParticle-Kochava.podspec +# Update VERSION file +echo $PREFIXED_VERSION > VERSION # Make the release commit in git # -git add mParticle-Kochava.podspec +git add VERSION git commit -m "chore(release): $VERSION [skip ci] $NOTES" diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..33edba2 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +v8.4.0 diff --git a/mParticle-Kochava-NoTracking b/mParticle-Kochava-NoTracking new file mode 120000 index 0000000..31768a6 --- /dev/null +++ b/mParticle-Kochava-NoTracking @@ -0,0 +1 @@ +mParticle-Kochava \ No newline at end of file diff --git a/mParticle-Kochava.podspec b/mParticle-Kochava.podspec deleted file mode 100755 index 7251191..0000000 --- a/mParticle-Kochava.podspec +++ /dev/null @@ -1,20 +0,0 @@ -Pod::Spec.new do |s| - s.name = "mParticle-Kochava" - s.version = "8.4.0" - s.summary = "Kochava integration for mParticle" - - s.description = <<-DESC - This is the Kochava integration for 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-kochava.git", :tag => "v" +s.version.to_s } - s.social_media_url = "https://twitter.com/mparticle" - - s.ios.deployment_target = "12.4" - s.ios.source_files = 'mParticle-Kochava/*.{h,m,mm}' - s.ios.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.9' - s.ios.dependency 'Apple-Cocoapod-KochavaTracker', '~> 7.0' -end diff --git a/mParticle-Kochava/MPKitKochava.m b/mParticle-Kochava/MPKitKochava.m index b47ec53..03b9a74 100644 --- a/mParticle-Kochava/MPKitKochava.m +++ b/mParticle-Kochava/MPKitKochava.m @@ -1,9 +1,9 @@ #import "MPKitKochava.h" #import "MPKochavaSpatialCoordinate.h" -#if defined(__has_include) && __has_include() -#import +#if defined(__has_include) && __has_include() +#import #else -#import "KochavaTracker.h" +#import "KochavaMeasurement.h" #endif NSString *const MPKitKochavaErrorKey = @"mParticle-Kochava Error"; @@ -136,8 +136,7 @@ - (NSError *)errorWithMessage:(NSString *)message { } - (void)retrieveAttributionWithCompletionHandler:(void(^)(NSDictionary *attribution))completionHandler { - [KVATracker.shared.attribution retrieveResultWithCompletionHandler:^(KVAAttributionResult * _Nonnull attributionResult) - { + [KVAMeasurement.shared.attribution retrieveResultWithClosure_didComplete:^(KVAMeasurement_Attribution_Result * _Nonnull attributionResult) { if (!attributionResult.rawDictionary) { [self->_kitApi onAttributionCompleteWithResult:nil error:[self errorWithMessage:@"Received nil attributionData from Kochava"]]; } else { @@ -252,24 +251,24 @@ - (MPKitExecStatus *)didFinishLaunchingWithConfiguration:(NSDictionary *)configu - (void)start { if (self.configuration[kvEnableATT]) { - KVATracker.shared.appTrackingTransparency.enabledBool = [self.configuration[kvEnableATT] boolValue] ? TRUE : FALSE; + KVAMeasurement.shared.appTrackingTransparency.enabledBool = [self.configuration[kvEnableATT] boolValue] ? TRUE : FALSE; } if (self.configuration[kvEnableATTPrompt]) { - KVATracker.shared.appTrackingTransparency.autoRequestTrackingAuthorizationBool = [self.configuration[kvEnableATTPrompt] boolValue] ? TRUE : FALSE; + KVAMeasurement.shared.appTrackingTransparency.autoRequestTrackingAuthorizationBool = [self.configuration[kvEnableATTPrompt] boolValue] ? TRUE : FALSE; if (self.configuration[kvWaitIntervalATT] && [self.configuration[kvEnableATTPrompt] boolValue]) { - KVATracker.shared.appTrackingTransparency.authorizationStatusWaitTimeInterval = [self.configuration[kvWaitIntervalATT] integerValue]; + KVAMeasurement.shared.appTrackingTransparency.authorizationStatusWaitTimeInterval = [self.configuration[kvWaitIntervalATT] integerValue]; } } - [KVATracker.shared startWithAppGUIDString:self.configuration[kvAppId]]; + [KVAMeasurement.shared startWithAppGUIDString:self.configuration[kvAppId]]; if (self.configuration[kvLimitAdTracking]) { - KVATracker.shared.appLimitAdTracking.boolean = [self.configuration[kvLimitAdTracking] boolValue]; + KVAMeasurement.shared.appLimitAdTracking.boolean = [self.configuration[kvLimitAdTracking] boolValue]; } if (self.configuration[kvEnableLogging]) { - KVALog.shared.level = [self.configuration[kvEnableLogging] boolValue] ? KVALogLevel.debug : KVALogLevel.never; + KVALog.shared.level = [self.configuration[kvEnableLogging] boolValue] ? KVALog_Level.debug : KVALog_Level.never; } if (self.configuration[kvUserIdentificationType] || self.configuration[kvEmailIdentificationType] ) { @@ -279,8 +278,7 @@ - (void)start { NSDictionary *userActivityDictionary = self.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey]; if (userActivityDictionary == nil) { - [KVADeeplink processWithURL:nil closure_didComplete:^(KVADeeplink * _Nonnull deeplink) - { + [KVADeeplink processWithURL:nil closure_didComplete:^(KVADeeplink * _Nonnull deeplink) { NSString *destinationString = deeplink.destinationString; if (destinationString.length == 0) { [self->_kitApi onAttributionCompleteWithResult:nil error:[self errorWithMessage:@"Received nil deeplink from Kochava"]]; @@ -318,7 +316,7 @@ - (void)start { } - (id const)providerKitInstance { - return [self started] ? KVATracker.shared : nil; + return [self started] ? KVAMeasurement.shared : nil; } - (MPKitAPI *)kitApi { @@ -330,7 +328,7 @@ - (MPKitAPI *)kitApi { } - (MPKitExecStatus *)setOptOut:(BOOL)optOut { - KVATracker.shared.appLimitAdTracking.boolean = optOut; + KVAMeasurement.shared.appLimitAdTracking.boolean = optOut; MPKitExecStatus *execStatus = [[MPKitExecStatus alloc] initWithSDKCode:@(MPKitInstanceKochava) returnCode:MPKitReturnCodeSuccess]; return execStatus; @@ -347,7 +345,7 @@ - (nonnull MPKitExecStatus *)logBaseEvent:(nonnull MPBaseEvent *)event { } - (MPKitExecStatus *)routeEvent:(MPEvent *)event { - KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEventType.custom]; + KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEvent_Type.custom]; kochavaEvent.customEventName = event.name; kochavaEvent.infoDictionary = event.customAttributes; [kochavaEvent send]; @@ -356,7 +354,7 @@ - (MPKitExecStatus *)routeEvent:(MPEvent *)event { } - (MPKitExecStatus *)routeCommerceEvent:(MPCommerceEvent *)commerceEvent { - KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEventType.custom]; + KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEvent_Type.custom]; NSString *eventName; if (commerceEvent.promotionContainer) { eventName = [NSString stringWithFormat:@"eCommerce - %@", KVNSStringFromPromotionAction(commerceEvent.promotionContainer.action)]; @@ -408,7 +406,7 @@ - (MPKitExecStatus *)routeCommerceEvent:(MPCommerceEvent *)commerceEvent { } - (MPKitExecStatus *)logScreen:(MPEvent *)event { - KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEventType.custom]; + KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEvent_Type.custom]; kochavaEvent.customEventName = [NSString stringWithFormat:@"Viewed %@", event.name]; kochavaEvent.infoDictionary = event.customAttributes; [kochavaEvent send]; @@ -465,7 +463,7 @@ - (MPKitExecStatus *)continueUserActivity:(NSUserActivity *)userActivity restora } - (MPKitExecStatus *)setATTStatus:(MPATTAuthorizationStatus)status withATTStatusTimestampMillis:(NSNumber *)attStatusTimestampMillis API_AVAILABLE(ios(14)){ - KVATracker.shared.appTrackingTransparency.enabledBool = YES; + KVAMeasurement.shared.appTrackingTransparency.enabledBool = YES; return [[MPKitExecStatus alloc] initWithSDKCode:@(MPKitInstanceKochava) returnCode:MPKitReturnCodeSuccess]; }