Skip to content

Commit

Permalink
Merge pull request #12 from segment-integrations/MichaelGHSeg/update_…
Browse files Browse the repository at this point in the history
…adjust_501

Updating Adjust SDK to 5.0.1
  • Loading branch information
MichaelGHSeg authored Dec 10, 2024
2 parents 62dd54a + bc33d49 commit a04cb63
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
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

0 comments on commit a04cb63

Please sign in to comment.