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

feat: Update to Partner latest version 5.0.0 #98

Merged
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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ apply plugin: 'kotlin-android'

android {
defaultConfig {
minSdkVersion 16
minSdkVersion 21
}
testOptions {
unitTests.all {
Expand All @@ -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
Loading