Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Adjust SDK to 5.0.1 #12

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dependencies {

// Partner Dependencies
dependencies {
implementation("com.adjust.sdk:adjust-android:4.38.0")
implementation("com.adjust.sdk:adjust-android:5.0.1")
}

// Test Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,13 @@ class AdjustDestination : DestinationPlugin(), AndroidLifecycle {
it.appToken, environment
)

if (it.setEventBufferingEnabled) {
adjustConfig.setEventBufferingEnabled(true)
}
if (it.trackAttributionData) {
// registering a delegate callback to notify tracker attribution changes.
val listener: OnAttributionChangedListener =
AdjustSegmentAttributionChangedListener(analytics)
adjustConfig.setOnAttributionChangedListener(listener)
}
Adjust.onCreate(adjustConfig)
Adjust.initSdk(adjustConfig)
Adjust.onResume()
analytics.log("Adjust Destination loaded")
}
Expand Down Expand Up @@ -96,8 +93,8 @@ class AdjustDestination : DestinationPlugin(), AndroidLifecycle {

override fun reset() {
super.reset()
Adjust.resetSessionPartnerParameters()
analytics.log("Adjust.resetSessionPartnerParameters()")
Adjust.removeGlobalPartnerParameters()
analytics.log("Adjust.removeGlobalPartnerParameters()")
}

/**
Expand All @@ -116,16 +113,16 @@ class AdjustDestination : DestinationPlugin(), AndroidLifecycle {
}

/**
* adding session Partner parameters to Adjust. It will merge session partner parameters with event partner parameter.
* adding global Partner parameters to Adjust. It will merge global partner parameters with event partner parameter.
*/
private fun setPartnerParams(payload: BaseEvent) {
if (payload.userId.isNotEmpty()) {
Adjust.addSessionPartnerParameter("userId", payload.userId)
analytics.log("Adjust.addSessionPartnerParameter(userId, ${payload.userId})")
Adjust.addGlobalPartnerParameter("userId", payload.userId)
analytics.log("Adjust.addGlobalPartnerParameter(userId, ${payload.userId})")
}
if (payload.anonymousId.isNotEmpty()) {
Adjust.addSessionPartnerParameter("anonymousId", payload.anonymousId)
analytics.log("Adjust.addSessionPartnerParameter(anonymousId, ${payload.anonymousId})")
Adjust.addGlobalPartnerParameter("anonymousId", payload.anonymousId)
analytics.log("Adjust.addGlobalPartnerParameter(anonymousId, ${payload.anonymousId})")
}
}

Expand Down Expand Up @@ -166,7 +163,7 @@ data class AdjustSettings(
var appToken: String,
// Adjust Segment value for Send to Production Environment on Adjust
var setEnvironmentProduction: Boolean = false,
// Adjust Segment value to Buffer and batch events sent to Adjust
// (Deprecated) Removed in Adjust v5, has no effect and will be removed
var setEventBufferingEnabled: Boolean = false,
// Adjust Segment value to track Attribution Data
var trackAttributionData: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class AdjustDestinationTests {
}
val identifyEvent = adjustDestination.identify(sampleIdentifyEvent)
assertNotNull(identifyEvent)
verify { Adjust.addSessionPartnerParameter("userId", "adjust-UserID-123") }
verify { Adjust.addGlobalPartnerParameter("userId", "adjust-UserID-123") }
}

@Test
Expand All @@ -158,7 +158,7 @@ class AdjustDestinationTests {
val identifyEvent = adjustDestination.identify(sampleIdentifyEvent)
assertNotNull(identifyEvent)
verify {
Adjust.addSessionPartnerParameter(
Adjust.addGlobalPartnerParameter(
"anonymousId",
"adjust-anonId-123"
)
Expand All @@ -168,7 +168,7 @@ class AdjustDestinationTests {
@Test
fun `reset is handled correctly`() {
adjustDestination.reset()
verify { Adjust.resetSessionPartnerParameters() }
verify { Adjust.removeGlobalPartnerParameters() }
}

@Test
Expand Down
Loading