Skip to content

Commit

Permalink
feat: Update to Partner latest version 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansi-mParticle committed Aug 28, 2024
1 parent 037adb1 commit c5eb818
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 25 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ android {

dependencies {
testImplementation files('libs/java-json.jar')
api 'com.adjust.sdk:adjust-android:4.38.3'
api 'com.adjust.sdk:adjust-android:5.0.0'
}
19 changes: 8 additions & 11 deletions src/main/kotlin/com/mparticle/kits/AdjustKit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AdjustKit : KitIntegration(), OnAttributionChangedListener, ActivityLifecy
if (deeplinkResponseListenerProxy != null) {
val listener = deeplinkResponseListenerProxy
if (listener != null) {
config.setOnDeeplinkResponseListener { deeplink ->
config.setOnDeferredDeeplinkResponseListener { deeplink ->
listener.launchReceivedDeeplink(
deeplink
)
Expand All @@ -50,12 +50,11 @@ class AdjustKit : KitIntegration(), OnAttributionChangedListener, ActivityLifecy
if (!production) {
config.setLogLevel(LogLevel.VERBOSE)
}
config.setEventBufferingEnabled(false)
val fbAppId = getSettings()[FB_APP_ID_KEY]
if (fbAppId != null) {
config.setFbAppId(fbAppId);
}
Adjust.onCreate(config)
Adjust.initSdk(config)
setAdidIntegrationAttribute()
(context.applicationContext as Application).registerActivityLifecycleCallbacks(this)
return emptyList()
Expand All @@ -66,7 +65,7 @@ class AdjustKit : KitIntegration(), OnAttributionChangedListener, ActivityLifecy
}

override fun setOptOut(optOutStatus: Boolean): List<ReportingMessage> {
Adjust.setEnabled(!optOutStatus)
if (!optOutStatus) Adjust.enable() else Adjust.disable()
val messageList: MutableList<ReportingMessage> = LinkedList()
messageList.add(
ReportingMessage(
Expand Down Expand Up @@ -99,22 +98,21 @@ class AdjustKit : KitIntegration(), OnAttributionChangedListener, ActivityLifecy
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {}
override fun onActivityStarted(activity: Activity) {}
override fun onActivityResumed(activity: Activity) {
Adjust.onResume()
}

override fun onActivityPaused(activity: Activity) {
Adjust.onPause()
}

override fun onActivityStopped(activity: Activity) {}
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
override fun onActivityDestroyed(activity: Activity) {}
private fun setAdidIntegrationAttribute() {
val integrationAttributes = integrationAttributes
val adid = Adjust.getAdid()
if (adid != null) {
integrationAttributes[ADJUST_ID_KEY] = adid
setIntegrationAttributes(integrationAttributes)
Adjust.getAdid { adid ->
if (adid != null) {
integrationAttributes[ADJUST_ID_KEY] = adid
setIntegrationAttributes(integrationAttributes)
}
}
}

Expand All @@ -137,7 +135,6 @@ class AdjustKit : KitIntegration(), OnAttributionChangedListener, ActivityLifecy
.putOpt("adgroup", attribution.adgroup)
.putOpt("creative", attribution.creative)
.putOpt("click_label", attribution.clickLabel)
.putOpt("adid", attribution.adid)
}
}
}
13 changes: 0 additions & 13 deletions src/test/kotlin/com/mparticle/kits/AdjustKitTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,6 @@ class AdjustKitTests {
Assert.fail("$className not found as a known integration.")
}

@Test
@Throws(JSONException::class)
fun testAttributionToJSON() {
val originalAttributionJSON = attributionJSON
val attribution = AdjustAttribution.fromJson(
originalAttributionJSON,
originalAttributionJSON.getString("adid"),
"android"
)
val attributionJSON = toJSON(attribution)
Assert.assertEquals(originalAttributionJSON.toString(), attributionJSON.toString())
}

@get:Throws(JSONException::class)
private val attributionJSON: JSONObject
get() {
Expand Down

0 comments on commit c5eb818

Please sign in to comment.