Skip to content

Commit cb875ad

Browse files
authored
feat: Update Kochava to v8 and remove Cocoapods (#24)
1 parent 7e84883 commit cb875ad

8 files changed

Lines changed: 51 additions & 68 deletions

File tree

.github/workflows/ios-kit-release.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@ jobs:
3737
needs: create-release-branch
3838
env:
3939
GITHUB_ACCESS_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
40-
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
4140
steps:
4241
- name: Checkout
4342
uses: actions/checkout@v3
4443

4544
- name: Validate environment
4645
run: |
4746
env | grep -q '^GITHUB_ACCESS_TOKEN=' || (echo "Required environment variable GITHUB_ACCESS_TOKEN is not set" && exit 1)
48-
env | grep -q '^COCOAPODS_TRUNK_TOKEN=' || (echo "Required environment variable COCOAPODS_TRUNK_TOKEN is not set" && exit 1)
4947
5048
- name: Setup git config
5149
run: |
@@ -105,12 +103,6 @@ jobs:
105103
git status
106104
git push origin HEAD:release/${{ github.run_number }}
107105
108-
- name: Release to CocoaPods
109-
if: ${{ github.event.inputs.dryRun == 'false'}}
110-
run: |
111-
sudo gem install xcodeproj
112-
pod trunk push --allow-warnings
113-
114106
sync-repository:
115107
name: Finalize release
116108
needs: release

Package.swift

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,49 @@ import PackageDescription
55
let package = Package(
66
name: "mParticle-Kochava",
77
platforms: [
8-
.iOS("12.4"),
9-
.tvOS("12.4"),
8+
.iOS("13.0"),
9+
.tvOS("13.0"),
1010
],
1111
products: [
1212
.library(
1313
name: "mParticle-Kochava",
1414
targets: ["mParticle-Kochava"]),
15+
.library(
16+
name: "mParticle-Kochava-NoTracking",
17+
targets: ["mParticle-Kochava-NoTracking"]),
1518
],
1619
dependencies: [
1720
.package(
1821
name: "mParticle-Apple-SDK",
1922
url: "https://github.com/mParticle/mparticle-apple-sdk",
20-
.upToNextMajor(from: "8.3.0")
23+
.upToNextMajor(from: "8.19.0")
24+
),
25+
.package(
26+
name: "KochavaNetworking",
27+
url: "https://github.com/Kochava/Apple-SwiftPackage-KochavaNetworking-XCFramework",
28+
.upToNextMajor(from: "8.0.0")
2129
),
2230
.package(
23-
name: "KochavaCore",
24-
url: "https://github.com/Kochava/Apple-SwiftPackage-KochavaCore",
25-
.upToNextMajor(from: "7.0.0")
31+
name: "KochavaMeasurement",
32+
url: "https://github.com/Kochava/Apple-SwiftPackage-KochavaMeasurement-XCFramework",
33+
.upToNextMajor(from: "8.0.0")
2634
),
2735
.package(
28-
name: "KochavaTracker",
29-
url: "https://github.com/Kochava/Apple-SwiftPackage-KochavaTracker.git",
30-
.upToNextMajor(from: "7.0.0")
36+
name: "KochavaTracking",
37+
url: "https://github.com/Kochava/Apple-SwiftPackage-KochavaTracking-XCFramework",
38+
.upToNextMajor(from: "8.0.0")
3139
),
3240
],
3341
targets: [
3442
.target(
3543
name: "mParticle-Kochava",
36-
dependencies: ["mParticle-Apple-SDK", "KochavaCore", "KochavaTracker"],
44+
dependencies: ["mParticle-Apple-SDK", "KochavaNetworking", "KochavaMeasurement", "KochavaTracking"],
3745
path: "mParticle-Kochava",
3846
publicHeadersPath: "."),
47+
.target(
48+
name: "mParticle-Kochava-NoTracking",
49+
dependencies: ["mParticle-Apple-SDK", "KochavaNetworking", "KochavaMeasurement"],
50+
path: "mParticle-Kochava-NoTracking",
51+
publicHeadersPath: "."),
3952
]
4053
)

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,19 @@ This repository contains the [Kochava](https://www.kochava.com) integration for
44

55
## Installation
66

7-
KochavaTracker 4.0.0 and on is a Swift package. To install it, simply add this package as a dependency.
7+
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.
88

99
In Xcode, see File > Swift Packages > Add Package Dependency ... > and enter the URL for this package repository.
1010

11-
## Integration using CocoaPods
11+
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".
1212

13-
Prior to 4.0.0, KochavaTracker supported CocoaPods.
13+
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.
1414

15-
### Adding the integration
15+
You can read more about that in Kochava's documentation here: https://support.kochava.com/sdk-integration/ios-sdk-integration/ios-migrating-to-v8/
1616

17-
1. Add the kit dependency to your app's Podfile:
17+
### Adding the integration
1818

19-
```
20-
pod 'mParticle-Kochava', '~> 8.0'
21-
```
19+
1. Add this kit to your Xcode project using SPM, and choose either `mParticle-Kochava` or `mParticle-Kochava-NoTracking`
2220

2321
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
2422

Scripts/release.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ NOTES="$2"
55
# Update version number
66
#
77

8-
# Update CocoaPods podspec file
9-
sed -i '' 's/\(^ s.version[^=]*= \).*/\1"'"$VERSION"'"/' mParticle-Kochava.podspec
8+
# Update VERSION file
9+
echo $PREFIXED_VERSION > VERSION
1010

1111
# Make the release commit in git
1212
#
1313

14-
git add mParticle-Kochava.podspec
14+
git add VERSION
1515
git commit -m "chore(release): $VERSION [skip ci]
1616
1717
$NOTES"

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v8.4.0

mParticle-Kochava-NoTracking

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mParticle-Kochava

mParticle-Kochava.podspec

Lines changed: 0 additions & 20 deletions
This file was deleted.

mParticle-Kochava/MPKitKochava.m

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#import "MPKitKochava.h"
22
#import "MPKochavaSpatialCoordinate.h"
3-
#if defined(__has_include) && __has_include(<KochavaTracker/KochavaTracker.h>)
4-
#import <KochavaTracker/KochavaTracker.h>
3+
#if defined(__has_include) && __has_include(<KochavaMeasurement/KochavaMeasurement.h>)
4+
#import <KochavaMeasurement/KochavaMeasurement.h>
55
#else
6-
#import "KochavaTracker.h"
6+
#import "KochavaMeasurement.h"
77
#endif
88

99
NSString *const MPKitKochavaErrorKey = @"mParticle-Kochava Error";
@@ -136,8 +136,7 @@ - (NSError *)errorWithMessage:(NSString *)message {
136136
}
137137

138138
- (void)retrieveAttributionWithCompletionHandler:(void(^)(NSDictionary *attribution))completionHandler {
139-
[KVATracker.shared.attribution retrieveResultWithCompletionHandler:^(KVAAttributionResult * _Nonnull attributionResult)
140-
{
139+
[KVAMeasurement.shared.attribution retrieveResultWithClosure_didComplete:^(KVAMeasurement_Attribution_Result * _Nonnull attributionResult) {
141140
if (!attributionResult.rawDictionary) {
142141
[self->_kitApi onAttributionCompleteWithResult:nil error:[self errorWithMessage:@"Received nil attributionData from Kochava"]];
143142
} else {
@@ -252,24 +251,24 @@ - (MPKitExecStatus *)didFinishLaunchingWithConfiguration:(NSDictionary *)configu
252251

253252
- (void)start {
254253
if (self.configuration[kvEnableATT]) {
255-
KVATracker.shared.appTrackingTransparency.enabledBool = [self.configuration[kvEnableATT] boolValue] ? TRUE : FALSE;
254+
KVAMeasurement.shared.appTrackingTransparency.enabledBool = [self.configuration[kvEnableATT] boolValue] ? TRUE : FALSE;
256255
}
257256

258257
if (self.configuration[kvEnableATTPrompt]) {
259-
KVATracker.shared.appTrackingTransparency.autoRequestTrackingAuthorizationBool = [self.configuration[kvEnableATTPrompt] boolValue] ? TRUE : FALSE;
258+
KVAMeasurement.shared.appTrackingTransparency.autoRequestTrackingAuthorizationBool = [self.configuration[kvEnableATTPrompt] boolValue] ? TRUE : FALSE;
260259
if (self.configuration[kvWaitIntervalATT] && [self.configuration[kvEnableATTPrompt] boolValue]) {
261-
KVATracker.shared.appTrackingTransparency.authorizationStatusWaitTimeInterval = [self.configuration[kvWaitIntervalATT] integerValue];
260+
KVAMeasurement.shared.appTrackingTransparency.authorizationStatusWaitTimeInterval = [self.configuration[kvWaitIntervalATT] integerValue];
262261
}
263262
}
264263

265-
[KVATracker.shared startWithAppGUIDString:self.configuration[kvAppId]];
264+
[KVAMeasurement.shared startWithAppGUIDString:self.configuration[kvAppId]];
266265

267266
if (self.configuration[kvLimitAdTracking]) {
268-
KVATracker.shared.appLimitAdTracking.boolean = [self.configuration[kvLimitAdTracking] boolValue];
267+
KVAMeasurement.shared.appLimitAdTracking.boolean = [self.configuration[kvLimitAdTracking] boolValue];
269268
}
270269

271270
if (self.configuration[kvEnableLogging]) {
272-
KVALog.shared.level = [self.configuration[kvEnableLogging] boolValue] ? KVALogLevel.debug : KVALogLevel.never;
271+
KVALog.shared.level = [self.configuration[kvEnableLogging] boolValue] ? KVALog_Level.debug : KVALog_Level.never;
273272
}
274273

275274
if (self.configuration[kvUserIdentificationType] || self.configuration[kvEmailIdentificationType] ) {
@@ -279,8 +278,7 @@ - (void)start {
279278
NSDictionary *userActivityDictionary = self.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey];
280279
if (userActivityDictionary == nil)
281280
{
282-
[KVADeeplink processWithURL:nil closure_didComplete:^(KVADeeplink * _Nonnull deeplink)
283-
{
281+
[KVADeeplink processWithURL:nil closure_didComplete:^(KVADeeplink * _Nonnull deeplink) {
284282
NSString *destinationString = deeplink.destinationString;
285283
if (destinationString.length == 0) {
286284
[self->_kitApi onAttributionCompleteWithResult:nil error:[self errorWithMessage:@"Received nil deeplink from Kochava"]];
@@ -318,7 +316,7 @@ - (void)start {
318316
}
319317

320318
- (id const)providerKitInstance {
321-
return [self started] ? KVATracker.shared : nil;
319+
return [self started] ? KVAMeasurement.shared : nil;
322320
}
323321

324322
- (MPKitAPI *)kitApi {
@@ -330,7 +328,7 @@ - (MPKitAPI *)kitApi {
330328
}
331329

332330
- (MPKitExecStatus *)setOptOut:(BOOL)optOut {
333-
KVATracker.shared.appLimitAdTracking.boolean = optOut;
331+
KVAMeasurement.shared.appLimitAdTracking.boolean = optOut;
334332

335333
MPKitExecStatus *execStatus = [[MPKitExecStatus alloc] initWithSDKCode:@(MPKitInstanceKochava) returnCode:MPKitReturnCodeSuccess];
336334
return execStatus;
@@ -347,7 +345,7 @@ - (nonnull MPKitExecStatus *)logBaseEvent:(nonnull MPBaseEvent *)event {
347345
}
348346

349347
- (MPKitExecStatus *)routeEvent:(MPEvent *)event {
350-
KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEventType.custom];
348+
KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEvent_Type.custom];
351349
kochavaEvent.customEventName = event.name;
352350
kochavaEvent.infoDictionary = event.customAttributes;
353351
[kochavaEvent send];
@@ -356,7 +354,7 @@ - (MPKitExecStatus *)routeEvent:(MPEvent *)event {
356354
}
357355

358356
- (MPKitExecStatus *)routeCommerceEvent:(MPCommerceEvent *)commerceEvent {
359-
KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEventType.custom];
357+
KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEvent_Type.custom];
360358
NSString *eventName;
361359
if (commerceEvent.promotionContainer) {
362360
eventName = [NSString stringWithFormat:@"eCommerce - %@", KVNSStringFromPromotionAction(commerceEvent.promotionContainer.action)];
@@ -408,7 +406,7 @@ - (MPKitExecStatus *)routeCommerceEvent:(MPCommerceEvent *)commerceEvent {
408406
}
409407

410408
- (MPKitExecStatus *)logScreen:(MPEvent *)event {
411-
KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEventType.custom];
409+
KVAEvent *kochavaEvent = [[KVAEvent alloc] initWithType:KVAEvent_Type.custom];
412410
kochavaEvent.customEventName = [NSString stringWithFormat:@"Viewed %@", event.name];
413411
kochavaEvent.infoDictionary = event.customAttributes;
414412
[kochavaEvent send];
@@ -465,7 +463,7 @@ - (MPKitExecStatus *)continueUserActivity:(NSUserActivity *)userActivity restora
465463
}
466464

467465
- (MPKitExecStatus *)setATTStatus:(MPATTAuthorizationStatus)status withATTStatusTimestampMillis:(NSNumber *)attStatusTimestampMillis API_AVAILABLE(ios(14)){
468-
KVATracker.shared.appTrackingTransparency.enabledBool = YES;
466+
KVAMeasurement.shared.appTrackingTransparency.enabledBool = YES;
469467

470468
return [[MPKitExecStatus alloc] initWithSDKCode:@(MPKitInstanceKochava) returnCode:MPKitReturnCodeSuccess];
471469
}

0 commit comments

Comments
 (0)