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

fix package collision #3

Merged
merged 2 commits into from
Mar 8, 2022
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ implementation("com.segment.analytics.kotlin.destinations:amplitude:1.4.4")
Open the file where you setup and configure the Analytics-Kotlin library. Add this plugin to the list of imports.

```
import com.segment.analytics.kotlin.destinations.plugins.AmplitudeSession
import com.segment.analytics.kotlin.destinations.amplitude.AmplitudeSession
```

Just under your Analytics-Kotlin library setup, call `analytics.add(plugin = ...)` to add an instance of the plugin to the Analytics timeline.
Expand Down
6 changes: 5 additions & 1 deletion lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ plugins {
id("mvn-publish")
}

val VERSION_NAME: String by project

android {
compileSdk = 31
buildToolsVersion = "31.0.0"
Expand All @@ -17,6 +19,8 @@ android {

testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles("proguard-consumer-rules.pro")

buildConfigField("String", "VERSION_NAME", "\"$VERSION_NAME\"")
}

buildTypes {
Expand All @@ -38,7 +42,7 @@ android {
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.5")

implementation("com.segment.analytics.kotlin:android:1.4.3")
implementation("com.segment.analytics.kotlin:android:1.5.0")
implementation("androidx.multidex:multidex:2.0.1")

implementation("androidx.core:core-ktx:1.7.0")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.segment.analytics.kotlin.destinations.plugins
package com.segment.analytics.kotlin.destinations.amplitude

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry

import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand All @@ -19,6 +17,9 @@ class ExampleInstrumentedTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.segment.analytics.kotlin.destinations.plugins.test", appContext.packageName)
Assert.assertEquals(
"com.segment.analytics.kotlin.destinations.amplitude.test",
appContext.packageName
)
}
}
2 changes: 1 addition & 1 deletion lib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.segment.analytics.kotlin.destinations.plugins">
package="com.segment.analytics.kotlin.destinations.amplitude">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package com.segment.analytics.kotlin.destinations.plugins
package com.segment.analytics.kotlin.destinations.amplitude

import com.segment.analytics.kotlin.core.*
import com.segment.analytics.kotlin.core.platform.Plugin
import com.segment.analytics.kotlin.core.platform.plugins.logger.*
import com.segment.analytics.kotlin.core.platform.VersionedPlugin
import com.segment.analytics.kotlin.core.platform.plugins.logger.LogFilterKind
import com.segment.analytics.kotlin.core.platform.plugins.logger.log
import com.segment.analytics.kotlin.core.utilities.putIntegrations
import java.util.*
import kotlin.concurrent.schedule

// A Destination plugin that adds session tracking to Amplitude cloud mode.
class AmplitudeSession : Plugin {
class AmplitudeSession : Plugin, VersionedPlugin {

override val type: Plugin.Type = Plugin.Type.Enrichment
override lateinit var analytics: Analytics
Expand All @@ -19,7 +21,7 @@ class AmplitudeSession : Plugin {
private var timer: TimerTask? = null
private val fireTime: Long = 300000

override fun update(settings: Settings, type:Plugin.UpdateType) {
override fun update(settings: Settings, type: Plugin.UpdateType) {
active = settings.hasIntegrationSettings(key)
}

Expand Down Expand Up @@ -116,4 +118,8 @@ class AmplitudeSession : Plugin {
timer?.cancel()
sessionID = -1
}
}

override fun version(): String {
return BuildConfig.VERSION_NAME
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.segment.analytics.kotlin.destinations.plugins
package com.segment.analytics.kotlin.destinations.amplitude

import org.junit.Assert
import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
Expand All @@ -12,6 +11,6 @@ import org.junit.Assert.*
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
Assert.assertEquals(4, 2 + 2)
}
}