From 001dae18f342b5d40ffe7dfa2681a6b5d2659da2 Mon Sep 17 00:00:00 2001 From: Michael Grosse Huelsewiesche Date: Tue, 10 Dec 2024 16:00:42 -0500 Subject: [PATCH] Updating Adjust SDK to 5.0.1 --- Package.swift | 8 +++--- Sources/SegmentAdjust/AdjustDestination.swift | 26 +++++++------------ 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Package.swift b/Package.swift index 1db94ff..4431e7e 100644 --- a/Package.swift +++ b/Package.swift @@ -7,7 +7,7 @@ let package = Package( name: "SegmentAdjust", platforms: [ .iOS("13.0"), - .tvOS("11.0"), + .tvOS("12.0"), .watchOS("7.1") ], products: [ @@ -25,16 +25,16 @@ let package = Package( from: "1.4.1" ), .package( - name: "Adjust", + name: "AdjustSdk", url: "https://github.com/adjust/ios_sdk.git", - from: "4.38.0") + from: "5.0.1") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages this package depends on. .target( name: "SegmentAdjust", - dependencies: ["Segment", "Adjust"]) + dependencies: ["Segment", "AdjustSdk"]) // TESTS ARE HANDLED VIA THE EXAMPLE APP. ] diff --git a/Sources/SegmentAdjust/AdjustDestination.swift b/Sources/SegmentAdjust/AdjustDestination.swift index 06797bf..49003a1 100644 --- a/Sources/SegmentAdjust/AdjustDestination.swift +++ b/Sources/SegmentAdjust/AdjustDestination.swift @@ -29,7 +29,7 @@ import Foundation import Segment -import Adjust +import AdjustSdk @objc(SEGAdjustDestination) open class ObjCSegmentAdjust: NSObject, ObjCPlugin, ObjCPluginShim { @@ -61,29 +61,21 @@ open class AdjustDestination: NSObject, DestinationPlugin { } let adjustConfig = ADJConfig(appToken: settings.appToken, environment: environment) - - if let bufferingEnabled = settings.setEventBufferingEnabled { - adjustConfig?.eventBufferingEnabled = bufferingEnabled - } - + if let _ = settings.trackAttributionData { adjustConfig?.delegate = self } - if let useDelay = settings.setDelay, useDelay == true, let delayTime = settings.delayTime { - adjustConfig?.delayStart = delayTime - } - - Adjust.appDidLaunch(adjustConfig) + Adjust.initSdk(adjustConfig) } public func identify(event: IdentifyEvent) -> IdentifyEvent? { if let userId = event.userId, userId.count > 0 { - Adjust.addSessionPartnerParameter("user_id", value: userId) + Adjust.addGlobalPartnerParameter("user_id", forKey: userId) } if let anonId = event.anonymousId, anonId.count > 0 { - Adjust.addSessionPartnerParameter("anonymous_id", value: anonId) + Adjust.addGlobalPartnerParameter("anonymous_id", forKey: anonId) } return event @@ -91,7 +83,7 @@ open class AdjustDestination: NSObject, DestinationPlugin { public func track(event: TrackEvent) -> TrackEvent? { if let anonId = event.anonymousId, anonId.count > 0 { - Adjust.addSessionPartnerParameter("anonymous_id", value: anonId) + Adjust.addGlobalPartnerParameter("anonymous_id", forKey: anonId) } if let token = mappedCustomEventToken(eventName: event.event) { @@ -123,12 +115,12 @@ open class AdjustDestination: NSObject, DestinationPlugin { } public func reset() { - Adjust.resetSessionPartnerParameters() + Adjust.removeGlobalPartnerParameters() } } extension AdjustDestination: RemoteNotifications{ public func registeredForRemoteNotifications(deviceToken: Data) { - Adjust.setDeviceToken(deviceToken) + Adjust.setPushToken(deviceToken) } } // Example of versioning for your plugin @@ -141,8 +133,10 @@ extension AdjustDestination: VersionedPlugin { private struct AdjustSettings: Codable { let appToken: String let setEnvironmentProduction: Bool? + @available(*, deprecated) let setEventBufferingEnabled: Bool? let trackAttributionData: Bool? + @available(*, deprecated) let setDelay: Bool? let customEvents: JSON? let delayTime: Double?