diff --git a/build.gradle b/build.gradle index d50048f..9c6765c 100644 --- a/build.gradle +++ b/build.gradle @@ -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' } diff --git a/src/main/kotlin/com/mparticle/kits/AdjustKit.kt b/src/main/kotlin/com/mparticle/kits/AdjustKit.kt index 475ce06..b35e202 100644 --- a/src/main/kotlin/com/mparticle/kits/AdjustKit.kt +++ b/src/main/kotlin/com/mparticle/kits/AdjustKit.kt @@ -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 ) @@ -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() @@ -66,7 +65,7 @@ class AdjustKit : KitIntegration(), OnAttributionChangedListener, ActivityLifecy } override fun setOptOut(optOutStatus: Boolean): List { - Adjust.setEnabled(!optOutStatus) + if (!optOutStatus) Adjust.enable() else Adjust.disable() val messageList: MutableList = LinkedList() messageList.add( ReportingMessage( @@ -99,11 +98,9 @@ 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) {} @@ -111,10 +108,11 @@ class AdjustKit : KitIntegration(), OnAttributionChangedListener, ActivityLifecy 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) + } } } @@ -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) } } } diff --git a/src/test/kotlin/com/mparticle/kits/AdjustKitTests.kt b/src/test/kotlin/com/mparticle/kits/AdjustKitTests.kt index d0a7382..0ec51e2 100644 --- a/src/test/kotlin/com/mparticle/kits/AdjustKitTests.kt +++ b/src/test/kotlin/com/mparticle/kits/AdjustKitTests.kt @@ -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() {