From 2ce7bae645bd5878014b974cad2114f106d710a0 Mon Sep 17 00:00:00 2001 From: Qingzhuo Zhen Date: Sun, 20 Feb 2022 18:32:40 -0800 Subject: [PATCH 1/6] feat:set up android module barebone --- android/build.gradle | 56 +++++++++++++++++++ android/consumer-rules.pro | 0 android/proguard-rules.pro | 21 +++++++ .../android/ExampleInstrumentedTest.java | 26 +++++++++ android/src/main/AndroidManifest.xml | 5 ++ .../com/amplitude/android/AndroidAmplitude.kt | 15 +++++ .../amplitude/android/AndroidConfiguration.kt | 23 ++++++++ .../android/plugins/AndroidContextPlugin.kt | 14 +++++ .../android/plugins/AndroidLifecyclePlugin.kt | 9 +++ .../android/utilities/AndroidLogger.kt | 31 ++++++++++ .../android/utilities/AndroidStorage.kt | 28 ++++++++++ .../amplitude/android/ExampleUnitTest.java | 17 ++++++ build.gradle | 12 ++-- gradle.properties | 4 ++ main/build.gradle | 1 + main/java/com/amplitude/Amplitude.kt | 2 +- main/java/com/amplitude/Configuration.kt | 2 +- main/java/com/amplitude/platform/Plugin.kt | 1 + main/java/com/amplitude/platform/Timeline.kt | 1 + settings.gradle | 2 + 20 files changed, 260 insertions(+), 10 deletions(-) create mode 100644 android/build.gradle create mode 100644 android/consumer-rules.pro create mode 100644 android/proguard-rules.pro create mode 100644 android/src/androidTest/java/com/amplitude/android/ExampleInstrumentedTest.java create mode 100644 android/src/main/AndroidManifest.xml create mode 100644 android/src/main/java/com/amplitude/android/AndroidAmplitude.kt create mode 100644 android/src/main/java/com/amplitude/android/AndroidConfiguration.kt create mode 100644 android/src/main/java/com/amplitude/android/plugins/AndroidContextPlugin.kt create mode 100644 android/src/main/java/com/amplitude/android/plugins/AndroidLifecyclePlugin.kt create mode 100644 android/src/main/java/com/amplitude/android/utilities/AndroidLogger.kt create mode 100644 android/src/main/java/com/amplitude/android/utilities/AndroidStorage.kt create mode 100644 android/src/test/java/com/amplitude/android/ExampleUnitTest.java create mode 100644 gradle.properties diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 00000000..297d20f1 --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,56 @@ +plugins { + id 'com.android.library' + id 'kotlin-android' +} + +android { + compileSdk 31 + + defaultConfig { + multiDexEnabled true + + minSdk 16 + targetSdk 31 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + coreLibraryDesugaringEnabled true + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + testOptions { + unitTests { + includeAndroidResources = true + } + } +} + +dependencies { + implementation project(':main') + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2' + + testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2' + testImplementation 'io.mockk:mockk:1.10.6' + testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2' + testImplementation 'org.junit.jupiter:junit-jupiter-params:5.7.2' + testImplementation 'org.robolectric:robolectric:4.7.3' + testImplementation 'androidx.test:core:1.4.0' +} \ No newline at end of file diff --git a/android/consumer-rules.pro b/android/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/android/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/android/src/androidTest/java/com/amplitude/android/ExampleInstrumentedTest.java b/android/src/androidTest/java/com/amplitude/android/ExampleInstrumentedTest.java new file mode 100644 index 00000000..93d372ad --- /dev/null +++ b/android/src/androidTest/java/com/amplitude/android/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.amplitude.android; + +import android.content.Context; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.amplitude.android.test", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..b8490463 --- /dev/null +++ b/android/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/android/src/main/java/com/amplitude/android/AndroidAmplitude.kt b/android/src/main/java/com/amplitude/android/AndroidAmplitude.kt new file mode 100644 index 00000000..68c4d215 --- /dev/null +++ b/android/src/main/java/com/amplitude/android/AndroidAmplitude.kt @@ -0,0 +1,15 @@ +package com.amplitude.android + +import android.content.Context +import com.amplitude.Amplitude +import com.amplitude.platform.plugins.AmplitudeDestination + +open class AndroidAmplitude( + val context: Context, + configuration: AndroidConfiguration +): Amplitude(configuration) { + + override fun build() { + add(AmplitudeDestination()) + } +} diff --git a/android/src/main/java/com/amplitude/android/AndroidConfiguration.kt b/android/src/main/java/com/amplitude/android/AndroidConfiguration.kt new file mode 100644 index 00000000..6ab94daa --- /dev/null +++ b/android/src/main/java/com/amplitude/android/AndroidConfiguration.kt @@ -0,0 +1,23 @@ +package com.amplitude.android + +import com.amplitude.Configuration +import com.amplitude.Constants +import com.amplitude.LoggerProvider +import com.amplitude.StorageProvider +import com.amplitude.android.utilities.AndroidLoggerProvider +import com.amplitude.android.utilities.AndroidStorageProvider +import com.amplitude.events.BaseEvent + +class AndroidConfiguration( + apiKey: String, + flushQueueSize: Int = Constants.FLUSH_QUEUE_SIZE, + flushIntervalMillis: Int = Constants.FLUSH_INTERVAL_MILLIS, + optOut: Boolean = false, + storageProvider: StorageProvider = AndroidStorageProvider(), + loggerProvider: LoggerProvider = AndroidLoggerProvider(), + minIdLength: Int? = null, + callback: ((BaseEvent) -> Unit)? = null, + useAdvertisingIdForDeviceId: Boolean = false, + useAppSetIdForDeviceId: Boolean = false, + enableCoppaControl: Boolean = false +) : Configuration(apiKey, flushQueueSize, flushIntervalMillis, optOut, storageProvider, loggerProvider, minIdLength, callback) \ No newline at end of file diff --git a/android/src/main/java/com/amplitude/android/plugins/AndroidContextPlugin.kt b/android/src/main/java/com/amplitude/android/plugins/AndroidContextPlugin.kt new file mode 100644 index 00000000..831725cb --- /dev/null +++ b/android/src/main/java/com/amplitude/android/plugins/AndroidContextPlugin.kt @@ -0,0 +1,14 @@ +package com.amplitude.android.plugins + +import com.amplitude.Amplitude +import com.amplitude.events.BaseEvent +import com.amplitude.platform.Plugin + +class AndroidContextPlugin : Plugin { + override val type: Plugin.Type = Plugin.Type.Before + override lateinit var amplitude: Amplitude + + override fun execute(event: BaseEvent): BaseEvent? { + return event + } +} diff --git a/android/src/main/java/com/amplitude/android/plugins/AndroidLifecyclePlugin.kt b/android/src/main/java/com/amplitude/android/plugins/AndroidLifecyclePlugin.kt new file mode 100644 index 00000000..87387143 --- /dev/null +++ b/android/src/main/java/com/amplitude/android/plugins/AndroidLifecyclePlugin.kt @@ -0,0 +1,9 @@ +package com.amplitude.android.plugins + +import com.amplitude.Amplitude +import com.amplitude.platform.Plugin + +class AndroidLifecyclePlugin : Plugin { + override val type: Plugin.Type = Plugin.Type.Utility + override lateinit var amplitude: Amplitude +} diff --git a/android/src/main/java/com/amplitude/android/utilities/AndroidLogger.kt b/android/src/main/java/com/amplitude/android/utilities/AndroidLogger.kt new file mode 100644 index 00000000..b55bf2d8 --- /dev/null +++ b/android/src/main/java/com/amplitude/android/utilities/AndroidLogger.kt @@ -0,0 +1,31 @@ +package com.amplitude.android.utilities + +import com.amplitude.Amplitude +import com.amplitude.Logger +import com.amplitude.LoggerProvider + +class AndroidLogger() : Logger { + override var logMode: Logger.LogMode = Logger.LogMode.INFO + + override fun debug(message: String) { + TODO("Not yet implemented") + } + + override fun error(message: String) { + TODO("Not yet implemented") + } + + override fun info(message: String) { + TODO("Not yet implemented") + } + + override fun warn(message: String) { + TODO("Not yet implemented") + } +} + +class AndroidLoggerProvider() : LoggerProvider { + override fun getLogger(amplitude: Amplitude): Logger { + return AndroidLogger() + } +} diff --git a/android/src/main/java/com/amplitude/android/utilities/AndroidStorage.kt b/android/src/main/java/com/amplitude/android/utilities/AndroidStorage.kt new file mode 100644 index 00000000..3a6387f5 --- /dev/null +++ b/android/src/main/java/com/amplitude/android/utilities/AndroidStorage.kt @@ -0,0 +1,28 @@ +package com.amplitude.android.utilities + +import com.amplitude.Amplitude +import com.amplitude.Storage +import com.amplitude.StorageProvider +import com.amplitude.events.BaseEvent + +class AndroidStorage( + val amplitude: Amplitude +) : Storage { + override fun write(event: BaseEvent) { + TODO("Not yet implemented") + } + + override fun rollover() { + TODO("Not yet implemented") + } + + override fun getEvents(): List { + TODO("Not yet implemented") + } +} + +class AndroidStorageProvider: StorageProvider { + override fun getStorage(amplitude: Amplitude): Storage { + return AndroidStorage(amplitude) + } +} diff --git a/android/src/test/java/com/amplitude/android/ExampleUnitTest.java b/android/src/test/java/com/amplitude/android/ExampleUnitTest.java new file mode 100644 index 00000000..c174dff9 --- /dev/null +++ b/android/src/test/java/com/amplitude/android/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.amplitude.android; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 08e2b0d6..a59442d8 100644 --- a/build.gradle +++ b/build.gradle @@ -2,9 +2,11 @@ buildscript { ext.kotlin_version = "1.5.10" repositories { mavenCentral() + google() } dependencies { + classpath 'com.android.tools.build:gradle:7.0.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -17,16 +19,10 @@ allprojects{ maven { url "https://kotlin.bintray.com/kotlinx" } } - apply plugin: "kotlin" - - compileKotlin { + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { + freeCompilerArgs = ['-Xjvm-default=enable'] jvmTarget = "1.8" - javaParameters = true } } - - dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..9650bbc4 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +android.useAndroidX=true +android.enableJetifier=true +kotlin.code.style=official diff --git a/main/build.gradle b/main/build.gradle index 82844727..e7503230 100644 --- a/main/build.gradle +++ b/main/build.gradle @@ -1,5 +1,6 @@ plugins { id 'java' + id 'kotlin' id 'org.jetbrains.kotlin.jvm' } diff --git a/main/java/com/amplitude/Amplitude.kt b/main/java/com/amplitude/Amplitude.kt index 363950cd..e83a9a28 100644 --- a/main/java/com/amplitude/Amplitude.kt +++ b/main/java/com/amplitude/Amplitude.kt @@ -37,7 +37,7 @@ open class Amplitude internal constructor( */ constructor(configuration: com.amplitude.Configuration) : this(configuration, com.amplitude.State()) - internal fun build() { + open fun build() { add(ContextPlugin()) add(AmplitudeDestination()) diff --git a/main/java/com/amplitude/Configuration.kt b/main/java/com/amplitude/Configuration.kt index 024b9364..dfcd2e03 100644 --- a/main/java/com/amplitude/Configuration.kt +++ b/main/java/com/amplitude/Configuration.kt @@ -4,7 +4,7 @@ import com.amplitude.events.BaseEvent import com.amplitude.utilities.ConsoleLoggerProvider import com.amplitude.utilities.InMemoryStorageProvider -data class Configuration( +open class Configuration( val apiKey: String, val flushQueueSize: Int = Constants.FLUSH_QUEUE_SIZE, val flushIntervalMillis: Int = Constants.FLUSH_INTERVAL_MILLIS, diff --git a/main/java/com/amplitude/platform/Plugin.kt b/main/java/com/amplitude/platform/Plugin.kt index 23855944..9c3ea5b0 100644 --- a/main/java/com/amplitude/platform/Plugin.kt +++ b/main/java/com/amplitude/platform/Plugin.kt @@ -11,6 +11,7 @@ interface Plugin { Before, Enrichment, Destination, + Utility, Observe } diff --git a/main/java/com/amplitude/platform/Timeline.kt b/main/java/com/amplitude/platform/Timeline.kt index 2a60fb48..50d095f2 100644 --- a/main/java/com/amplitude/platform/Timeline.kt +++ b/main/java/com/amplitude/platform/Timeline.kt @@ -8,6 +8,7 @@ internal class Timeline { Plugin.Type.Before to Mediator(mutableListOf()), Plugin.Type.Enrichment to Mediator(mutableListOf()), Plugin.Type.Destination to Mediator(mutableListOf()), + Plugin.Type.Utility to Mediator(mutableListOf()) ) lateinit var amplitude: com.amplitude.Amplitude diff --git a/settings.gradle b/settings.gradle index abacde80..97e26944 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,3 +3,5 @@ include 'main' project(':main').projectDir = file('main') include 'samples:kotlin-jvm-app' project(':samples:kotlin-jvm-app').projectDir = file('samples/kotlin-jvm-app') +include 'android' +project(':android').projectDir = file('android') From 61cf64468a8234bca0b3bce3f40896099c369b90 Mon Sep 17 00:00:00 2001 From: Qingzhuo Zhen Date: Sun, 20 Feb 2022 23:10:32 -0800 Subject: [PATCH 2/6] feat: re-structure and rename main to core module --- android/build.gradle | 2 +- {main => core}/build.gradle | 9 +++++---- .../src/main}/java/com/amplitude/Amplitude.kt | 0 .../src/main}/java/com/amplitude/Configuration.kt | 0 .../src/main}/java/com/amplitude/Constants.kt | 0 {main => core/src/main}/java/com/amplitude/Logger.kt | 0 {main => core/src/main}/java/com/amplitude/State.kt | 0 .../src/main}/java/com/amplitude/Storage.kt | 0 .../src/main}/java/com/amplitude/events/BaseEvent.kt | 0 .../main}/java/com/amplitude/events/EventOptions.kt | 0 .../java/com/amplitude/events/GroupIdentifyEvent.kt | 0 .../src/main}/java/com/amplitude/events/Identify.kt | 0 .../main}/java/com/amplitude/events/IdentifyEvent.kt | 0 .../src/main}/java/com/amplitude/events/Plan.kt | 0 .../src/main}/java/com/amplitude/events/Revenue.kt | 0 .../main}/java/com/amplitude/events/RevenueEvent.kt | 0 .../java/com/amplitude/platform/EventPipeline.kt | 0 .../main}/java/com/amplitude/platform/Mediator.kt | 0 .../src/main}/java/com/amplitude/platform/Plugin.kt | 0 .../main}/java/com/amplitude/platform/Timeline.kt | 0 .../platform/plugins/AmplitudeDestination.kt | 0 .../com/amplitude/platform/plugins/ContextPlugin.kt | 0 .../java/com/amplitude/utilities/ConsoleLogger.kt | 0 .../main}/java/com/amplitude/utilities/HttpClient.kt | 0 .../java/com/amplitude/utilities/InMemoryStorage.kt | 0 .../main}/java/com/amplitude/utilities/JSONUtil.kt | 0 core/src/test/kotlin/com/amplitude/AmplitudeTest.kt | 12 ++++++++++++ .../test/kotlin/com/amplitude/ConfigurationTest.kt | 12 ++++++++++++ samples/kotlin-jvm-app/build.gradle | 2 +- .../kotlin-jvm-app/{java => src/main/kotlin}/main.kt | 0 settings.gradle | 4 ++-- 31 files changed, 33 insertions(+), 8 deletions(-) rename {main => core}/build.gradle (72%) rename {main => core/src/main}/java/com/amplitude/Amplitude.kt (100%) rename {main => core/src/main}/java/com/amplitude/Configuration.kt (100%) rename {main => core/src/main}/java/com/amplitude/Constants.kt (100%) rename {main => core/src/main}/java/com/amplitude/Logger.kt (100%) rename {main => core/src/main}/java/com/amplitude/State.kt (100%) rename {main => core/src/main}/java/com/amplitude/Storage.kt (100%) rename {main => core/src/main}/java/com/amplitude/events/BaseEvent.kt (100%) rename {main => core/src/main}/java/com/amplitude/events/EventOptions.kt (100%) rename {main => core/src/main}/java/com/amplitude/events/GroupIdentifyEvent.kt (100%) rename {main => core/src/main}/java/com/amplitude/events/Identify.kt (100%) rename {main => core/src/main}/java/com/amplitude/events/IdentifyEvent.kt (100%) rename {main => core/src/main}/java/com/amplitude/events/Plan.kt (100%) rename {main => core/src/main}/java/com/amplitude/events/Revenue.kt (100%) rename {main => core/src/main}/java/com/amplitude/events/RevenueEvent.kt (100%) rename {main => core/src/main}/java/com/amplitude/platform/EventPipeline.kt (100%) rename {main => core/src/main}/java/com/amplitude/platform/Mediator.kt (100%) rename {main => core/src/main}/java/com/amplitude/platform/Plugin.kt (100%) rename {main => core/src/main}/java/com/amplitude/platform/Timeline.kt (100%) rename {main => core/src/main}/java/com/amplitude/platform/plugins/AmplitudeDestination.kt (100%) rename {main => core/src/main}/java/com/amplitude/platform/plugins/ContextPlugin.kt (100%) rename {main => core/src/main}/java/com/amplitude/utilities/ConsoleLogger.kt (100%) rename {main => core/src/main}/java/com/amplitude/utilities/HttpClient.kt (100%) rename {main => core/src/main}/java/com/amplitude/utilities/InMemoryStorage.kt (100%) rename {main => core/src/main}/java/com/amplitude/utilities/JSONUtil.kt (100%) create mode 100644 core/src/test/kotlin/com/amplitude/AmplitudeTest.kt create mode 100644 core/src/test/kotlin/com/amplitude/ConfigurationTest.kt rename samples/kotlin-jvm-app/{java => src/main/kotlin}/main.kt (100%) diff --git a/android/build.gradle b/android/build.gradle index 297d20f1..0d4f74a4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -40,7 +40,7 @@ android { } dependencies { - implementation project(':main') + implementation project(':core') implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2' diff --git a/main/build.gradle b/core/build.gradle similarity index 72% rename from main/build.gradle rename to core/build.gradle index e7503230..08e5845b 100644 --- a/main/build.gradle +++ b/core/build.gradle @@ -14,15 +14,16 @@ repositories { mavenCentral() } -apply plugin: 'idea' - -sourceSets.main.java.srcDirs = ['java'] - dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // MAIN DEPS implementation 'org.json:json:20211205' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2' + + testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.2' + + testImplementation platform("org.junit:junit-bom:5.7.2") + testImplementation "org.junit.jupiter:junit-jupiter" } test { diff --git a/main/java/com/amplitude/Amplitude.kt b/core/src/main/java/com/amplitude/Amplitude.kt similarity index 100% rename from main/java/com/amplitude/Amplitude.kt rename to core/src/main/java/com/amplitude/Amplitude.kt diff --git a/main/java/com/amplitude/Configuration.kt b/core/src/main/java/com/amplitude/Configuration.kt similarity index 100% rename from main/java/com/amplitude/Configuration.kt rename to core/src/main/java/com/amplitude/Configuration.kt diff --git a/main/java/com/amplitude/Constants.kt b/core/src/main/java/com/amplitude/Constants.kt similarity index 100% rename from main/java/com/amplitude/Constants.kt rename to core/src/main/java/com/amplitude/Constants.kt diff --git a/main/java/com/amplitude/Logger.kt b/core/src/main/java/com/amplitude/Logger.kt similarity index 100% rename from main/java/com/amplitude/Logger.kt rename to core/src/main/java/com/amplitude/Logger.kt diff --git a/main/java/com/amplitude/State.kt b/core/src/main/java/com/amplitude/State.kt similarity index 100% rename from main/java/com/amplitude/State.kt rename to core/src/main/java/com/amplitude/State.kt diff --git a/main/java/com/amplitude/Storage.kt b/core/src/main/java/com/amplitude/Storage.kt similarity index 100% rename from main/java/com/amplitude/Storage.kt rename to core/src/main/java/com/amplitude/Storage.kt diff --git a/main/java/com/amplitude/events/BaseEvent.kt b/core/src/main/java/com/amplitude/events/BaseEvent.kt similarity index 100% rename from main/java/com/amplitude/events/BaseEvent.kt rename to core/src/main/java/com/amplitude/events/BaseEvent.kt diff --git a/main/java/com/amplitude/events/EventOptions.kt b/core/src/main/java/com/amplitude/events/EventOptions.kt similarity index 100% rename from main/java/com/amplitude/events/EventOptions.kt rename to core/src/main/java/com/amplitude/events/EventOptions.kt diff --git a/main/java/com/amplitude/events/GroupIdentifyEvent.kt b/core/src/main/java/com/amplitude/events/GroupIdentifyEvent.kt similarity index 100% rename from main/java/com/amplitude/events/GroupIdentifyEvent.kt rename to core/src/main/java/com/amplitude/events/GroupIdentifyEvent.kt diff --git a/main/java/com/amplitude/events/Identify.kt b/core/src/main/java/com/amplitude/events/Identify.kt similarity index 100% rename from main/java/com/amplitude/events/Identify.kt rename to core/src/main/java/com/amplitude/events/Identify.kt diff --git a/main/java/com/amplitude/events/IdentifyEvent.kt b/core/src/main/java/com/amplitude/events/IdentifyEvent.kt similarity index 100% rename from main/java/com/amplitude/events/IdentifyEvent.kt rename to core/src/main/java/com/amplitude/events/IdentifyEvent.kt diff --git a/main/java/com/amplitude/events/Plan.kt b/core/src/main/java/com/amplitude/events/Plan.kt similarity index 100% rename from main/java/com/amplitude/events/Plan.kt rename to core/src/main/java/com/amplitude/events/Plan.kt diff --git a/main/java/com/amplitude/events/Revenue.kt b/core/src/main/java/com/amplitude/events/Revenue.kt similarity index 100% rename from main/java/com/amplitude/events/Revenue.kt rename to core/src/main/java/com/amplitude/events/Revenue.kt diff --git a/main/java/com/amplitude/events/RevenueEvent.kt b/core/src/main/java/com/amplitude/events/RevenueEvent.kt similarity index 100% rename from main/java/com/amplitude/events/RevenueEvent.kt rename to core/src/main/java/com/amplitude/events/RevenueEvent.kt diff --git a/main/java/com/amplitude/platform/EventPipeline.kt b/core/src/main/java/com/amplitude/platform/EventPipeline.kt similarity index 100% rename from main/java/com/amplitude/platform/EventPipeline.kt rename to core/src/main/java/com/amplitude/platform/EventPipeline.kt diff --git a/main/java/com/amplitude/platform/Mediator.kt b/core/src/main/java/com/amplitude/platform/Mediator.kt similarity index 100% rename from main/java/com/amplitude/platform/Mediator.kt rename to core/src/main/java/com/amplitude/platform/Mediator.kt diff --git a/main/java/com/amplitude/platform/Plugin.kt b/core/src/main/java/com/amplitude/platform/Plugin.kt similarity index 100% rename from main/java/com/amplitude/platform/Plugin.kt rename to core/src/main/java/com/amplitude/platform/Plugin.kt diff --git a/main/java/com/amplitude/platform/Timeline.kt b/core/src/main/java/com/amplitude/platform/Timeline.kt similarity index 100% rename from main/java/com/amplitude/platform/Timeline.kt rename to core/src/main/java/com/amplitude/platform/Timeline.kt diff --git a/main/java/com/amplitude/platform/plugins/AmplitudeDestination.kt b/core/src/main/java/com/amplitude/platform/plugins/AmplitudeDestination.kt similarity index 100% rename from main/java/com/amplitude/platform/plugins/AmplitudeDestination.kt rename to core/src/main/java/com/amplitude/platform/plugins/AmplitudeDestination.kt diff --git a/main/java/com/amplitude/platform/plugins/ContextPlugin.kt b/core/src/main/java/com/amplitude/platform/plugins/ContextPlugin.kt similarity index 100% rename from main/java/com/amplitude/platform/plugins/ContextPlugin.kt rename to core/src/main/java/com/amplitude/platform/plugins/ContextPlugin.kt diff --git a/main/java/com/amplitude/utilities/ConsoleLogger.kt b/core/src/main/java/com/amplitude/utilities/ConsoleLogger.kt similarity index 100% rename from main/java/com/amplitude/utilities/ConsoleLogger.kt rename to core/src/main/java/com/amplitude/utilities/ConsoleLogger.kt diff --git a/main/java/com/amplitude/utilities/HttpClient.kt b/core/src/main/java/com/amplitude/utilities/HttpClient.kt similarity index 100% rename from main/java/com/amplitude/utilities/HttpClient.kt rename to core/src/main/java/com/amplitude/utilities/HttpClient.kt diff --git a/main/java/com/amplitude/utilities/InMemoryStorage.kt b/core/src/main/java/com/amplitude/utilities/InMemoryStorage.kt similarity index 100% rename from main/java/com/amplitude/utilities/InMemoryStorage.kt rename to core/src/main/java/com/amplitude/utilities/InMemoryStorage.kt diff --git a/main/java/com/amplitude/utilities/JSONUtil.kt b/core/src/main/java/com/amplitude/utilities/JSONUtil.kt similarity index 100% rename from main/java/com/amplitude/utilities/JSONUtil.kt rename to core/src/main/java/com/amplitude/utilities/JSONUtil.kt diff --git a/core/src/test/kotlin/com/amplitude/AmplitudeTest.kt b/core/src/test/kotlin/com/amplitude/AmplitudeTest.kt new file mode 100644 index 00000000..973c031c --- /dev/null +++ b/core/src/test/kotlin/com/amplitude/AmplitudeTest.kt @@ -0,0 +1,12 @@ +package com.amplitude + +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.Test + +internal class AmplitudeTest { + + @Test + fun `test place holder` () { + assertTrue(true) + } +} \ No newline at end of file diff --git a/core/src/test/kotlin/com/amplitude/ConfigurationTest.kt b/core/src/test/kotlin/com/amplitude/ConfigurationTest.kt new file mode 100644 index 00000000..548fcee5 --- /dev/null +++ b/core/src/test/kotlin/com/amplitude/ConfigurationTest.kt @@ -0,0 +1,12 @@ +package com.amplitude + +import org.junit.jupiter.api.Test + +import org.junit.jupiter.api.Assertions.* + +internal class ConfigurationTest { + + @Test + fun isValid() { + } +} \ No newline at end of file diff --git a/samples/kotlin-jvm-app/build.gradle b/samples/kotlin-jvm-app/build.gradle index 49ac063d..d5746f35 100644 --- a/samples/kotlin-jvm-app/build.gradle +++ b/samples/kotlin-jvm-app/build.gradle @@ -20,5 +20,5 @@ sourceSets.main.java.srcDirs = ['java'] dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2' - implementation project(':main') + implementation project(':core') } \ No newline at end of file diff --git a/samples/kotlin-jvm-app/java/main.kt b/samples/kotlin-jvm-app/src/main/kotlin/main.kt similarity index 100% rename from samples/kotlin-jvm-app/java/main.kt rename to samples/kotlin-jvm-app/src/main/kotlin/main.kt diff --git a/settings.gradle b/settings.gradle index 97e26944..a3992254 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ rootProject.name = 'kotlin-sdk' -include 'main' -project(':main').projectDir = file('main') +include 'core' +project(':core').projectDir = file('core') include 'samples:kotlin-jvm-app' project(':samples:kotlin-jvm-app').projectDir = file('samples/kotlin-jvm-app') include 'android' From 5f1f963f81b152f448b72321737e6008925f3f4b Mon Sep 17 00:00:00 2001 From: Qingzhuo Zhen Date: Tue, 22 Feb 2022 17:23:53 -0800 Subject: [PATCH 3/6] patch: rename --- .../amplitude/android/{AndroidAmplitude.kt => Amplitude.kt} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename android/src/main/java/com/amplitude/android/{AndroidAmplitude.kt => Amplitude.kt} (81%) diff --git a/android/src/main/java/com/amplitude/android/AndroidAmplitude.kt b/android/src/main/java/com/amplitude/android/Amplitude.kt similarity index 81% rename from android/src/main/java/com/amplitude/android/AndroidAmplitude.kt rename to android/src/main/java/com/amplitude/android/Amplitude.kt index 68c4d215..717efb71 100644 --- a/android/src/main/java/com/amplitude/android/AndroidAmplitude.kt +++ b/android/src/main/java/com/amplitude/android/Amplitude.kt @@ -4,10 +4,10 @@ import android.content.Context import com.amplitude.Amplitude import com.amplitude.platform.plugins.AmplitudeDestination -open class AndroidAmplitude( +open class Amplitude( val context: Context, configuration: AndroidConfiguration -): Amplitude(configuration) { +): com.amplitude.Amplitude(configuration) { override fun build() { add(AmplitudeDestination()) From 834726412c8a029f50d8f08d9074598a01c6ffda Mon Sep 17 00:00:00 2001 From: Qingzhuo Zhen Date: Wed, 23 Feb 2022 23:07:07 -0800 Subject: [PATCH 4/6] patch: resolve comments --- .../src/main/java/com/amplitude/android/Amplitude.kt | 5 +---- .../{AndroidConfiguration.kt => Configuration.kt} | 9 +++++---- core/src/main/java/com/amplitude/Configuration.kt | 10 ++++++++-- core/src/main/java/com/amplitude/Constants.kt | 2 -- 4 files changed, 14 insertions(+), 12 deletions(-) rename android/src/main/java/com/amplitude/android/{AndroidConfiguration.kt => Configuration.kt} (82%) diff --git a/android/src/main/java/com/amplitude/android/Amplitude.kt b/android/src/main/java/com/amplitude/android/Amplitude.kt index 717efb71..389499c7 100644 --- a/android/src/main/java/com/amplitude/android/Amplitude.kt +++ b/android/src/main/java/com/amplitude/android/Amplitude.kt @@ -1,12 +1,9 @@ package com.amplitude.android -import android.content.Context -import com.amplitude.Amplitude import com.amplitude.platform.plugins.AmplitudeDestination open class Amplitude( - val context: Context, - configuration: AndroidConfiguration + configuration: Configuration ): com.amplitude.Amplitude(configuration) { override fun build() { diff --git a/android/src/main/java/com/amplitude/android/AndroidConfiguration.kt b/android/src/main/java/com/amplitude/android/Configuration.kt similarity index 82% rename from android/src/main/java/com/amplitude/android/AndroidConfiguration.kt rename to android/src/main/java/com/amplitude/android/Configuration.kt index 6ab94daa..d2b8eef5 100644 --- a/android/src/main/java/com/amplitude/android/AndroidConfiguration.kt +++ b/android/src/main/java/com/amplitude/android/Configuration.kt @@ -1,17 +1,18 @@ package com.amplitude.android +import android.content.Context import com.amplitude.Configuration -import com.amplitude.Constants import com.amplitude.LoggerProvider import com.amplitude.StorageProvider import com.amplitude.android.utilities.AndroidLoggerProvider import com.amplitude.android.utilities.AndroidStorageProvider import com.amplitude.events.BaseEvent -class AndroidConfiguration( +class Configuration( apiKey: String, - flushQueueSize: Int = Constants.FLUSH_QUEUE_SIZE, - flushIntervalMillis: Int = Constants.FLUSH_INTERVAL_MILLIS, + context: Context, + flushQueueSize: Int = FLUSH_QUEUE_SIZE, + flushIntervalMillis: Int = FLUSH_INTERVAL_MILLIS, optOut: Boolean = false, storageProvider: StorageProvider = AndroidStorageProvider(), loggerProvider: LoggerProvider = AndroidLoggerProvider(), diff --git a/core/src/main/java/com/amplitude/Configuration.kt b/core/src/main/java/com/amplitude/Configuration.kt index dfcd2e03..94abb379 100644 --- a/core/src/main/java/com/amplitude/Configuration.kt +++ b/core/src/main/java/com/amplitude/Configuration.kt @@ -6,14 +6,20 @@ import com.amplitude.utilities.InMemoryStorageProvider open class Configuration( val apiKey: String, - val flushQueueSize: Int = Constants.FLUSH_QUEUE_SIZE, - val flushIntervalMillis: Int = Constants.FLUSH_INTERVAL_MILLIS, + val flushQueueSize: Int = FLUSH_QUEUE_SIZE, + val flushIntervalMillis: Int = FLUSH_INTERVAL_MILLIS, val optOut: Boolean = false, val storageProvider: StorageProvider = InMemoryStorageProvider(), val loggerProvider: LoggerProvider = ConsoleLoggerProvider(), val minIdLength: Int? = null, val callback: ((BaseEvent) -> Unit)? = null ) { + + companion object { + const val FLUSH_QUEUE_SIZE = 30 + const val FLUSH_INTERVAL_MILLIS = 30 * 1000 // 30s + } + fun isValid(): Boolean { return apiKey.isNotBlank() && flushQueueSize > 0 && flushIntervalMillis > 0 && isMinIdLengthValid() } diff --git a/core/src/main/java/com/amplitude/Constants.kt b/core/src/main/java/com/amplitude/Constants.kt index 662f68b1..59e55c85 100644 --- a/core/src/main/java/com/amplitude/Constants.kt +++ b/core/src/main/java/com/amplitude/Constants.kt @@ -5,8 +5,6 @@ object Constants { const val SDK_VERSION = "0.0.1" const val DEFAULT_API_HOST = "https://api2.amplitude.com/2/httpapi" const val EU_DEFAULT_API_HOST = "https://api.eu.amplitude.com/2/httpapi" - const val FLUSH_QUEUE_SIZE = 30 - const val FLUSH_INTERVAL_MILLIS = 30 * 1000 // 30s const val IDENTIFY_EVENT = "\$identify" const val GROUP_IDENTIFY_EVENT = "\$groupidentify" const val AMP_REVENUE_EVENT = "revenue_amount" From 6480859ddc3df1da7d08f0912cd59e0ee6ef8e21 Mon Sep 17 00:00:00 2001 From: Qingzhuo Zhen Date: Wed, 23 Feb 2022 23:08:39 -0800 Subject: [PATCH 5/6] patch: resolve comment --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 0d4f74a4..07f0bc33 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -44,11 +44,11 @@ dependencies { implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2' - testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2' testImplementation 'io.mockk:mockk:1.10.6' testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2' testImplementation 'org.junit.jupiter:junit-jupiter-params:5.7.2' testImplementation 'org.robolectric:robolectric:4.7.3' From 3fe03d7e8a538a9ab237d773add96b22d0dff840 Mon Sep 17 00:00:00 2001 From: Qingzhuo Zhen Date: Thu, 24 Feb 2022 17:51:14 -0800 Subject: [PATCH 6/6] patch: resolve comments --- .../java/com/amplitude/android/Amplitude.kt | 5 +-- .../com/amplitude/android/Configuration.kt | 8 ++--- .../android/plugins/AndroidContextPlugin.kt | 6 ++-- .../android/plugins/AndroidLifecyclePlugin.kt | 4 +-- .../android/utilities/AndroidLogger.kt | 6 ++-- .../android/utilities/AndroidStorage.kt | 8 ++--- core/build.gradle | 2 +- core/src/main/java/com/amplitude/State.kt | 5 --- .../com/amplitude/{ => core}/Amplitude.kt | 34 +++++++++---------- .../com/amplitude/{ => core}/Configuration.kt | 8 ++--- .../com/amplitude/{ => core}/Constants.kt | 2 +- .../java/com/amplitude/{ => core}/Logger.kt | 2 +- .../src/main/java/com/amplitude/core/State.kt | 5 +++ .../java/com/amplitude/{ => core}/Storage.kt | 4 +-- .../amplitude/{ => core}/events/BaseEvent.kt | 2 +- .../{ => core}/events/EventOptions.kt | 2 +- .../{ => core}/events/GroupIdentifyEvent.kt | 2 +- .../amplitude/{ => core}/events/Identify.kt | 2 +- .../{ => core}/events/IdentifyEvent.kt | 2 +- .../com/amplitude/{ => core}/events/Plan.kt | 2 +- .../amplitude/{ => core}/events/Revenue.kt | 2 +- .../{ => core}/events/RevenueEvent.kt | 4 +-- .../{ => core}/platform/EventPipeline.kt | 12 +++---- .../amplitude/{ => core}/platform/Mediator.kt | 10 +++--- .../amplitude/{ => core}/platform/Plugin.kt | 20 +++++------ .../amplitude/{ => core}/platform/Timeline.kt | 8 ++--- .../platform/plugins/AmplitudeDestination.kt | 18 +++++----- .../platform/plugins/ContextPlugin.kt | 13 +++---- .../{ => core}/utilities/ConsoleLogger.kt | 10 +++--- .../{ => core}/utilities/HttpClient.kt | 10 ++---- .../{ => core}/utilities/InMemoryStorage.kt | 10 +++--- .../{ => core}/utilities/JSONUtil.kt | 6 ++-- .../com/amplitude/{ => core}/AmplitudeTest.kt | 2 +- .../amplitude/{ => core}/ConfigurationTest.kt | 2 +- .../kotlin-jvm-app/src/main/kotlin/main.kt | 6 ++-- 35 files changed, 120 insertions(+), 124 deletions(-) delete mode 100644 core/src/main/java/com/amplitude/State.kt rename core/src/main/java/com/amplitude/{ => core}/Amplitude.kt (75%) rename core/src/main/java/com/amplitude/{ => core}/Configuration.kt (81%) rename core/src/main/java/com/amplitude/{ => core}/Constants.kt (94%) rename core/src/main/java/com/amplitude/{ => core}/Logger.kt (93%) create mode 100644 core/src/main/java/com/amplitude/core/State.kt rename core/src/main/java/com/amplitude/{ => core}/Storage.kt (73%) rename core/src/main/java/com/amplitude/{ => core}/events/BaseEvent.kt (89%) rename core/src/main/java/com/amplitude/{ => core}/events/EventOptions.kt (97%) rename core/src/main/java/com/amplitude/{ => core}/events/GroupIdentifyEvent.kt (56%) rename core/src/main/java/com/amplitude/{ => core}/events/Identify.kt (94%) rename core/src/main/java/com/amplitude/{ => core}/events/IdentifyEvent.kt (53%) rename core/src/main/java/com/amplitude/{ => core}/events/Plan.kt (73%) rename core/src/main/java/com/amplitude/{ => core}/events/Revenue.kt (98%) rename core/src/main/java/com/amplitude/{ => core}/events/RevenueEvent.kt (57%) rename core/src/main/java/com/amplitude/{ => core}/platform/EventPipeline.kt (94%) rename core/src/main/java/com/amplitude/{ => core}/platform/Mediator.kt (88%) rename core/src/main/java/com/amplitude/{ => core}/platform/Plugin.kt (82%) rename core/src/main/java/com/amplitude/{ => core}/platform/Timeline.kt (90%) rename core/src/main/java/com/amplitude/{ => core}/platform/plugins/AmplitudeDestination.kt (72%) rename core/src/main/java/com/amplitude/{ => core}/platform/plugins/ContextPlugin.kt (56%) rename core/src/main/java/com/amplitude/{ => core}/utilities/ConsoleLogger.kt (79%) rename core/src/main/java/com/amplitude/{ => core}/utilities/HttpClient.kt (94%) rename core/src/main/java/com/amplitude/{ => core}/utilities/InMemoryStorage.kt (80%) rename core/src/main/java/com/amplitude/{ => core}/utilities/JSONUtil.kt (97%) rename core/src/test/kotlin/com/amplitude/{ => core}/AmplitudeTest.kt (87%) rename core/src/test/kotlin/com/amplitude/{ => core}/ConfigurationTest.kt (84%) diff --git a/android/src/main/java/com/amplitude/android/Amplitude.kt b/android/src/main/java/com/amplitude/android/Amplitude.kt index 389499c7..198bfc7a 100644 --- a/android/src/main/java/com/amplitude/android/Amplitude.kt +++ b/android/src/main/java/com/amplitude/android/Amplitude.kt @@ -1,10 +1,11 @@ package com.amplitude.android -import com.amplitude.platform.plugins.AmplitudeDestination +import com.amplitude.core.Amplitude +import com.amplitude.core.platform.plugins.AmplitudeDestination open class Amplitude( configuration: Configuration -): com.amplitude.Amplitude(configuration) { +): Amplitude(configuration) { override fun build() { add(AmplitudeDestination()) diff --git a/android/src/main/java/com/amplitude/android/Configuration.kt b/android/src/main/java/com/amplitude/android/Configuration.kt index d2b8eef5..e71b026e 100644 --- a/android/src/main/java/com/amplitude/android/Configuration.kt +++ b/android/src/main/java/com/amplitude/android/Configuration.kt @@ -1,12 +1,12 @@ package com.amplitude.android import android.content.Context -import com.amplitude.Configuration -import com.amplitude.LoggerProvider -import com.amplitude.StorageProvider +import com.amplitude.core.Configuration +import com.amplitude.core.LoggerProvider +import com.amplitude.core.StorageProvider import com.amplitude.android.utilities.AndroidLoggerProvider import com.amplitude.android.utilities.AndroidStorageProvider -import com.amplitude.events.BaseEvent +import com.amplitude.core.events.BaseEvent class Configuration( apiKey: String, diff --git a/android/src/main/java/com/amplitude/android/plugins/AndroidContextPlugin.kt b/android/src/main/java/com/amplitude/android/plugins/AndroidContextPlugin.kt index 831725cb..73bd0ef9 100644 --- a/android/src/main/java/com/amplitude/android/plugins/AndroidContextPlugin.kt +++ b/android/src/main/java/com/amplitude/android/plugins/AndroidContextPlugin.kt @@ -1,8 +1,8 @@ package com.amplitude.android.plugins -import com.amplitude.Amplitude -import com.amplitude.events.BaseEvent -import com.amplitude.platform.Plugin +import com.amplitude.core.Amplitude +import com.amplitude.core.events.BaseEvent +import com.amplitude.core.platform.Plugin class AndroidContextPlugin : Plugin { override val type: Plugin.Type = Plugin.Type.Before diff --git a/android/src/main/java/com/amplitude/android/plugins/AndroidLifecyclePlugin.kt b/android/src/main/java/com/amplitude/android/plugins/AndroidLifecyclePlugin.kt index 87387143..d8f98a2f 100644 --- a/android/src/main/java/com/amplitude/android/plugins/AndroidLifecyclePlugin.kt +++ b/android/src/main/java/com/amplitude/android/plugins/AndroidLifecyclePlugin.kt @@ -1,7 +1,7 @@ package com.amplitude.android.plugins -import com.amplitude.Amplitude -import com.amplitude.platform.Plugin +import com.amplitude.core.Amplitude +import com.amplitude.core.platform.Plugin class AndroidLifecyclePlugin : Plugin { override val type: Plugin.Type = Plugin.Type.Utility diff --git a/android/src/main/java/com/amplitude/android/utilities/AndroidLogger.kt b/android/src/main/java/com/amplitude/android/utilities/AndroidLogger.kt index b55bf2d8..fe34ca80 100644 --- a/android/src/main/java/com/amplitude/android/utilities/AndroidLogger.kt +++ b/android/src/main/java/com/amplitude/android/utilities/AndroidLogger.kt @@ -1,8 +1,8 @@ package com.amplitude.android.utilities -import com.amplitude.Amplitude -import com.amplitude.Logger -import com.amplitude.LoggerProvider +import com.amplitude.core.Amplitude +import com.amplitude.core.Logger +import com.amplitude.core.LoggerProvider class AndroidLogger() : Logger { override var logMode: Logger.LogMode = Logger.LogMode.INFO diff --git a/android/src/main/java/com/amplitude/android/utilities/AndroidStorage.kt b/android/src/main/java/com/amplitude/android/utilities/AndroidStorage.kt index 3a6387f5..befd0179 100644 --- a/android/src/main/java/com/amplitude/android/utilities/AndroidStorage.kt +++ b/android/src/main/java/com/amplitude/android/utilities/AndroidStorage.kt @@ -1,9 +1,9 @@ package com.amplitude.android.utilities -import com.amplitude.Amplitude -import com.amplitude.Storage -import com.amplitude.StorageProvider -import com.amplitude.events.BaseEvent +import com.amplitude.core.Amplitude +import com.amplitude.core.Storage +import com.amplitude.core.StorageProvider +import com.amplitude.core.events.BaseEvent class AndroidStorage( val amplitude: Amplitude diff --git a/core/build.gradle b/core/build.gradle index 08e5845b..18d1a6e0 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -17,7 +17,7 @@ repositories { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // MAIN DEPS - implementation 'org.json:json:20211205' + compileOnly 'org.json:json:20211205' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2' testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.2' diff --git a/core/src/main/java/com/amplitude/State.kt b/core/src/main/java/com/amplitude/State.kt deleted file mode 100644 index e675fb79..00000000 --- a/core/src/main/java/com/amplitude/State.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.amplitude - -class State { - -} \ No newline at end of file diff --git a/core/src/main/java/com/amplitude/Amplitude.kt b/core/src/main/java/com/amplitude/core/Amplitude.kt similarity index 75% rename from core/src/main/java/com/amplitude/Amplitude.kt rename to core/src/main/java/com/amplitude/core/Amplitude.kt index e83a9a28..ab624c19 100644 --- a/core/src/main/java/com/amplitude/Amplitude.kt +++ b/core/src/main/java/com/amplitude/core/Amplitude.kt @@ -1,19 +1,19 @@ -package com.amplitude - -import com.amplitude.events.BaseEvent -import com.amplitude.events.Identify -import com.amplitude.events.Revenue -import com.amplitude.events.RevenueEvent -import com.amplitude.platform.Plugin -import com.amplitude.platform.Timeline -import com.amplitude.platform.plugins.AmplitudeDestination -import com.amplitude.platform.plugins.ContextPlugin +package com.amplitude.core + +import com.amplitude.core.events.BaseEvent +import com.amplitude.core.events.Identify +import com.amplitude.core.events.Revenue +import com.amplitude.core.events.RevenueEvent +import com.amplitude.core.platform.Plugin +import com.amplitude.core.platform.Timeline +import com.amplitude.core.platform.plugins.AmplitudeDestination +import com.amplitude.core.platform.plugins.ContextPlugin import kotlinx.coroutines.* import java.util.concurrent.Executors open class Amplitude internal constructor( - val configuration: com.amplitude.Configuration, - val store: com.amplitude.State, + val configuration: Configuration, + val store: State, val amplitudeScope: CoroutineScope = CoroutineScope(SupervisorJob()), val amplitudeDispatcher: CoroutineDispatcher = Executors.newCachedThreadPool().asCoroutineDispatcher(), val networkIODispatcher: CoroutineDispatcher = Executors.newSingleThreadExecutor().asCoroutineDispatcher(), @@ -21,8 +21,8 @@ open class Amplitude internal constructor( ){ internal val timeline: Timeline - val storage: com.amplitude.Storage - val logger: com.amplitude.Logger + val storage: Storage + val logger: Logger init { require(configuration.isValid()) { "invalid configuration" } @@ -35,7 +35,7 @@ open class Amplitude internal constructor( /** * Public Constructor */ - constructor(configuration: com.amplitude.Configuration) : this(configuration, com.amplitude.State()) + constructor(configuration: Configuration) : this(configuration, State()) open fun build() { add(ContextPlugin()) @@ -100,12 +100,12 @@ open class Amplitude internal constructor( } } - fun add(plugin: Plugin) : com.amplitude.Amplitude { + fun add(plugin: Plugin) : Amplitude { this.timeline.add(plugin) return this } - fun remove(plugin: Plugin): com.amplitude.Amplitude { + fun remove(plugin: Plugin): Amplitude { this.timeline.remove(plugin) return this } diff --git a/core/src/main/java/com/amplitude/Configuration.kt b/core/src/main/java/com/amplitude/core/Configuration.kt similarity index 81% rename from core/src/main/java/com/amplitude/Configuration.kt rename to core/src/main/java/com/amplitude/core/Configuration.kt index 94abb379..5589b4e4 100644 --- a/core/src/main/java/com/amplitude/Configuration.kt +++ b/core/src/main/java/com/amplitude/core/Configuration.kt @@ -1,8 +1,8 @@ -package com.amplitude +package com.amplitude.core -import com.amplitude.events.BaseEvent -import com.amplitude.utilities.ConsoleLoggerProvider -import com.amplitude.utilities.InMemoryStorageProvider +import com.amplitude.core.events.BaseEvent +import com.amplitude.core.utilities.ConsoleLoggerProvider +import com.amplitude.core.utilities.InMemoryStorageProvider open class Configuration( val apiKey: String, diff --git a/core/src/main/java/com/amplitude/Constants.kt b/core/src/main/java/com/amplitude/core/Constants.kt similarity index 94% rename from core/src/main/java/com/amplitude/Constants.kt rename to core/src/main/java/com/amplitude/core/Constants.kt index 59e55c85..babbb448 100644 --- a/core/src/main/java/com/amplitude/Constants.kt +++ b/core/src/main/java/com/amplitude/core/Constants.kt @@ -1,4 +1,4 @@ -package com.amplitude +package com.amplitude.core object Constants { const val SDK_LIBRARY = "amplitude-kotlin" diff --git a/core/src/main/java/com/amplitude/Logger.kt b/core/src/main/java/com/amplitude/core/Logger.kt similarity index 93% rename from core/src/main/java/com/amplitude/Logger.kt rename to core/src/main/java/com/amplitude/core/Logger.kt index 66f48d8f..88e1c1e8 100644 --- a/core/src/main/java/com/amplitude/Logger.kt +++ b/core/src/main/java/com/amplitude/core/Logger.kt @@ -1,4 +1,4 @@ -package com.amplitude +package com.amplitude.core interface Logger { enum class LogMode(i: Int) { diff --git a/core/src/main/java/com/amplitude/core/State.kt b/core/src/main/java/com/amplitude/core/State.kt new file mode 100644 index 00000000..faaf8a75 --- /dev/null +++ b/core/src/main/java/com/amplitude/core/State.kt @@ -0,0 +1,5 @@ +package com.amplitude.core + +class State { + +} \ No newline at end of file diff --git a/core/src/main/java/com/amplitude/Storage.kt b/core/src/main/java/com/amplitude/core/Storage.kt similarity index 73% rename from core/src/main/java/com/amplitude/Storage.kt rename to core/src/main/java/com/amplitude/core/Storage.kt index 0678b83f..e71785e2 100644 --- a/core/src/main/java/com/amplitude/Storage.kt +++ b/core/src/main/java/com/amplitude/core/Storage.kt @@ -1,6 +1,6 @@ -package com.amplitude +package com.amplitude.core -import com.amplitude.events.BaseEvent +import com.amplitude.core.events.BaseEvent interface Storage { fun write(event: BaseEvent) diff --git a/core/src/main/java/com/amplitude/events/BaseEvent.kt b/core/src/main/java/com/amplitude/core/events/BaseEvent.kt similarity index 89% rename from core/src/main/java/com/amplitude/events/BaseEvent.kt rename to core/src/main/java/com/amplitude/core/events/BaseEvent.kt index d034b9c2..a28817cf 100644 --- a/core/src/main/java/com/amplitude/events/BaseEvent.kt +++ b/core/src/main/java/com/amplitude/core/events/BaseEvent.kt @@ -1,4 +1,4 @@ -package com.amplitude.events +package com.amplitude.core.events import org.json.JSONObject diff --git a/core/src/main/java/com/amplitude/events/EventOptions.kt b/core/src/main/java/com/amplitude/core/events/EventOptions.kt similarity index 97% rename from core/src/main/java/com/amplitude/events/EventOptions.kt rename to core/src/main/java/com/amplitude/core/events/EventOptions.kt index 333c9b26..e50c94b1 100644 --- a/core/src/main/java/com/amplitude/events/EventOptions.kt +++ b/core/src/main/java/com/amplitude/core/events/EventOptions.kt @@ -1,4 +1,4 @@ -package com.amplitude.events +package com.amplitude.core.events open class EventOptions { var userId: String? = null diff --git a/core/src/main/java/com/amplitude/events/GroupIdentifyEvent.kt b/core/src/main/java/com/amplitude/core/events/GroupIdentifyEvent.kt similarity index 56% rename from core/src/main/java/com/amplitude/events/GroupIdentifyEvent.kt rename to core/src/main/java/com/amplitude/core/events/GroupIdentifyEvent.kt index d22d1d1b..573a3821 100644 --- a/core/src/main/java/com/amplitude/events/GroupIdentifyEvent.kt +++ b/core/src/main/java/com/amplitude/core/events/GroupIdentifyEvent.kt @@ -1,4 +1,4 @@ -package com.amplitude.events +package com.amplitude.core.events class GroupIdentifyEvent : BaseEvent() { } diff --git a/core/src/main/java/com/amplitude/events/Identify.kt b/core/src/main/java/com/amplitude/core/events/Identify.kt similarity index 94% rename from core/src/main/java/com/amplitude/events/Identify.kt rename to core/src/main/java/com/amplitude/core/events/Identify.kt index cbdd6b75..7b4a0c68 100644 --- a/core/src/main/java/com/amplitude/events/Identify.kt +++ b/core/src/main/java/com/amplitude/core/events/Identify.kt @@ -1,4 +1,4 @@ -package com.amplitude.events +package com.amplitude.core.events enum class IdentifyOperation(val operation: String) { SET("\$set"), diff --git a/core/src/main/java/com/amplitude/events/IdentifyEvent.kt b/core/src/main/java/com/amplitude/core/events/IdentifyEvent.kt similarity index 53% rename from core/src/main/java/com/amplitude/events/IdentifyEvent.kt rename to core/src/main/java/com/amplitude/core/events/IdentifyEvent.kt index a0978d96..f9fe2308 100644 --- a/core/src/main/java/com/amplitude/events/IdentifyEvent.kt +++ b/core/src/main/java/com/amplitude/core/events/IdentifyEvent.kt @@ -1,4 +1,4 @@ -package com.amplitude.events +package com.amplitude.core.events class IdentifyEvent : BaseEvent() { } diff --git a/core/src/main/java/com/amplitude/events/Plan.kt b/core/src/main/java/com/amplitude/core/events/Plan.kt similarity index 73% rename from core/src/main/java/com/amplitude/events/Plan.kt rename to core/src/main/java/com/amplitude/core/events/Plan.kt index 6d0b10ec..54ff7f65 100644 --- a/core/src/main/java/com/amplitude/events/Plan.kt +++ b/core/src/main/java/com/amplitude/core/events/Plan.kt @@ -1,4 +1,4 @@ -package com.amplitude.events +package com.amplitude.core.events open class Plan( var branch: String?, diff --git a/core/src/main/java/com/amplitude/events/Revenue.kt b/core/src/main/java/com/amplitude/core/events/Revenue.kt similarity index 98% rename from core/src/main/java/com/amplitude/events/Revenue.kt rename to core/src/main/java/com/amplitude/core/events/Revenue.kt index e745c19b..92b0dcd5 100644 --- a/core/src/main/java/com/amplitude/events/Revenue.kt +++ b/core/src/main/java/com/amplitude/core/events/Revenue.kt @@ -1,4 +1,4 @@ -package com.amplitude.events +package com.amplitude.core.events import org.json.JSONException import org.json.JSONObject diff --git a/core/src/main/java/com/amplitude/events/RevenueEvent.kt b/core/src/main/java/com/amplitude/core/events/RevenueEvent.kt similarity index 57% rename from core/src/main/java/com/amplitude/events/RevenueEvent.kt rename to core/src/main/java/com/amplitude/core/events/RevenueEvent.kt index 2404a0d8..796dbe19 100644 --- a/core/src/main/java/com/amplitude/events/RevenueEvent.kt +++ b/core/src/main/java/com/amplitude/core/events/RevenueEvent.kt @@ -1,6 +1,6 @@ -package com.amplitude.events +package com.amplitude.core.events -import com.amplitude.Constants +import com.amplitude.core.Constants class RevenueEvent : BaseEvent() { override var eventType = Constants.AMP_REVENUE_EVENT diff --git a/core/src/main/java/com/amplitude/platform/EventPipeline.kt b/core/src/main/java/com/amplitude/core/platform/EventPipeline.kt similarity index 94% rename from core/src/main/java/com/amplitude/platform/EventPipeline.kt rename to core/src/main/java/com/amplitude/core/platform/EventPipeline.kt index 6b60fa4c..47f77001 100644 --- a/core/src/main/java/com/amplitude/platform/EventPipeline.kt +++ b/core/src/main/java/com/amplitude/core/platform/EventPipeline.kt @@ -1,19 +1,17 @@ -package com.amplitude.platform +package com.amplitude.core.platform -import com.amplitude.Constants -import com.amplitude.events.BaseEvent -import com.amplitude.utilities.HttpClient +import com.amplitude.core.Amplitude +import com.amplitude.core.events.BaseEvent +import com.amplitude.core.utilities.HttpClient import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED import kotlinx.coroutines.channels.consumeEach -import java.io.File -import java.io.FileInputStream import java.lang.Exception import java.util.concurrent.atomic.AtomicInteger internal class EventPipeline( - private val amplitude: com.amplitude.Amplitude + private val amplitude: Amplitude ) { diff --git a/core/src/main/java/com/amplitude/platform/Mediator.kt b/core/src/main/java/com/amplitude/core/platform/Mediator.kt similarity index 88% rename from core/src/main/java/com/amplitude/platform/Mediator.kt rename to core/src/main/java/com/amplitude/core/platform/Mediator.kt index 3b0c5ec1..d6781193 100644 --- a/core/src/main/java/com/amplitude/platform/Mediator.kt +++ b/core/src/main/java/com/amplitude/core/platform/Mediator.kt @@ -1,9 +1,9 @@ -package com.amplitude.platform +package com.amplitude.core.platform -import com.amplitude.events.BaseEvent -import com.amplitude.events.GroupIdentifyEvent -import com.amplitude.events.IdentifyEvent -import com.amplitude.events.RevenueEvent +import com.amplitude.core.events.BaseEvent +import com.amplitude.core.events.GroupIdentifyEvent +import com.amplitude.core.events.IdentifyEvent +import com.amplitude.core.events.RevenueEvent internal class Mediator(private val plugins: MutableList) { fun add(plugin: Plugin) = synchronized(plugins) { diff --git a/core/src/main/java/com/amplitude/platform/Plugin.kt b/core/src/main/java/com/amplitude/core/platform/Plugin.kt similarity index 82% rename from core/src/main/java/com/amplitude/platform/Plugin.kt rename to core/src/main/java/com/amplitude/core/platform/Plugin.kt index 9c3ea5b0..00b79520 100644 --- a/core/src/main/java/com/amplitude/platform/Plugin.kt +++ b/core/src/main/java/com/amplitude/core/platform/Plugin.kt @@ -1,10 +1,10 @@ -package com.amplitude.platform +package com.amplitude.core.platform -import com.amplitude.Amplitude -import com.amplitude.events.BaseEvent -import com.amplitude.events.GroupIdentifyEvent -import com.amplitude.events.IdentifyEvent -import com.amplitude.events.RevenueEvent +import com.amplitude.core.Amplitude +import com.amplitude.core.events.BaseEvent +import com.amplitude.core.events.GroupIdentifyEvent +import com.amplitude.core.events.IdentifyEvent +import com.amplitude.core.events.RevenueEvent interface Plugin { enum class Type { @@ -16,9 +16,9 @@ interface Plugin { } val type: Type - var amplitude: com.amplitude.Amplitude + var amplitude: Amplitude - fun setup(amplitude: com.amplitude.Amplitude) { + fun setup(amplitude: Amplitude) { this.amplitude = amplitude } @@ -50,10 +50,10 @@ interface EventPlugin : Plugin { abstract class DestinationPlugin: EventPlugin { override val type: Plugin.Type = Plugin.Type.Destination private val timeline: Timeline = Timeline() - override lateinit var amplitude: com.amplitude.Amplitude + override lateinit var amplitude: Amplitude internal var enabled = true - override fun setup(amplitude: com.amplitude.Amplitude) { + override fun setup(amplitude: Amplitude) { super.setup(amplitude) timeline.amplitude = amplitude } diff --git a/core/src/main/java/com/amplitude/platform/Timeline.kt b/core/src/main/java/com/amplitude/core/platform/Timeline.kt similarity index 90% rename from core/src/main/java/com/amplitude/platform/Timeline.kt rename to core/src/main/java/com/amplitude/core/platform/Timeline.kt index 50d095f2..419e8099 100644 --- a/core/src/main/java/com/amplitude/platform/Timeline.kt +++ b/core/src/main/java/com/amplitude/core/platform/Timeline.kt @@ -1,7 +1,7 @@ -package com.amplitude.platform +package com.amplitude.core.platform -import com.amplitude.Amplitude -import com.amplitude.events.BaseEvent +import com.amplitude.core.Amplitude +import com.amplitude.core.events.BaseEvent internal class Timeline { internal val plugins: Map = mapOf( @@ -10,7 +10,7 @@ internal class Timeline { Plugin.Type.Destination to Mediator(mutableListOf()), Plugin.Type.Utility to Mediator(mutableListOf()) ) - lateinit var amplitude: com.amplitude.Amplitude + lateinit var amplitude: Amplitude fun process(incomingEvent: BaseEvent): BaseEvent? { val beforeResult = applyPlugins(Plugin.Type.Before, incomingEvent) diff --git a/core/src/main/java/com/amplitude/platform/plugins/AmplitudeDestination.kt b/core/src/main/java/com/amplitude/core/platform/plugins/AmplitudeDestination.kt similarity index 72% rename from core/src/main/java/com/amplitude/platform/plugins/AmplitudeDestination.kt rename to core/src/main/java/com/amplitude/core/platform/plugins/AmplitudeDestination.kt index 618ceea8..dabaf1e9 100644 --- a/core/src/main/java/com/amplitude/platform/plugins/AmplitudeDestination.kt +++ b/core/src/main/java/com/amplitude/core/platform/plugins/AmplitudeDestination.kt @@ -1,12 +1,12 @@ -package com.amplitude.platform.plugins - -import com.amplitude.Amplitude -import com.amplitude.events.BaseEvent -import com.amplitude.events.GroupIdentifyEvent -import com.amplitude.events.IdentifyEvent -import com.amplitude.events.RevenueEvent -import com.amplitude.platform.DestinationPlugin -import com.amplitude.platform.EventPipeline +package com.amplitude.core.platform.plugins + +import com.amplitude.core.Amplitude +import com.amplitude.core.events.BaseEvent +import com.amplitude.core.events.GroupIdentifyEvent +import com.amplitude.core.events.IdentifyEvent +import com.amplitude.core.events.RevenueEvent +import com.amplitude.core.platform.DestinationPlugin +import com.amplitude.core.platform.EventPipeline class AmplitudeDestination : DestinationPlugin() { private lateinit var pipeline: EventPipeline diff --git a/core/src/main/java/com/amplitude/platform/plugins/ContextPlugin.kt b/core/src/main/java/com/amplitude/core/platform/plugins/ContextPlugin.kt similarity index 56% rename from core/src/main/java/com/amplitude/platform/plugins/ContextPlugin.kt rename to core/src/main/java/com/amplitude/core/platform/plugins/ContextPlugin.kt index afebe5dd..e03c61fa 100644 --- a/core/src/main/java/com/amplitude/platform/plugins/ContextPlugin.kt +++ b/core/src/main/java/com/amplitude/core/platform/plugins/ContextPlugin.kt @@ -1,14 +1,15 @@ -package com.amplitude.platform.plugins +package com.amplitude.core.platform.plugins -import com.amplitude.Constants -import com.amplitude.events.BaseEvent -import com.amplitude.platform.Plugin +import com.amplitude.core.Amplitude +import com.amplitude.core.Constants +import com.amplitude.core.events.BaseEvent +import com.amplitude.core.platform.Plugin class ContextPlugin : Plugin { override val type: Plugin.Type = Plugin.Type.Before - override lateinit var amplitude: com.amplitude.Amplitude + override lateinit var amplitude: Amplitude - override fun setup(amplitude: com.amplitude.Amplitude) { + override fun setup(amplitude: Amplitude) { super.setup(amplitude) } diff --git a/core/src/main/java/com/amplitude/utilities/ConsoleLogger.kt b/core/src/main/java/com/amplitude/core/utilities/ConsoleLogger.kt similarity index 79% rename from core/src/main/java/com/amplitude/utilities/ConsoleLogger.kt rename to core/src/main/java/com/amplitude/core/utilities/ConsoleLogger.kt index 4e8b725e..227bb9ec 100644 --- a/core/src/main/java/com/amplitude/utilities/ConsoleLogger.kt +++ b/core/src/main/java/com/amplitude/core/utilities/ConsoleLogger.kt @@ -1,9 +1,9 @@ -package com.amplitude.utilities +package com.amplitude.core.utilities -import com.amplitude.Amplitude -import com.amplitude.Logger -import com.amplitude.LoggerProvider -import com.amplitude.Logger.LogMode +import com.amplitude.core.Amplitude +import com.amplitude.core.Logger +import com.amplitude.core.LoggerProvider +import com.amplitude.core.Logger.LogMode class ConsoleLogger() : Logger { override var logMode: LogMode = LogMode.INFO diff --git a/core/src/main/java/com/amplitude/utilities/HttpClient.kt b/core/src/main/java/com/amplitude/core/utilities/HttpClient.kt similarity index 94% rename from core/src/main/java/com/amplitude/utilities/HttpClient.kt rename to core/src/main/java/com/amplitude/core/utilities/HttpClient.kt index 1c7988b1..7628e401 100644 --- a/core/src/main/java/com/amplitude/utilities/HttpClient.kt +++ b/core/src/main/java/com/amplitude/core/utilities/HttpClient.kt @@ -1,16 +1,12 @@ -package com.amplitude.utilities +package com.amplitude.core.utilities -import com.amplitude.Configuration -import com.amplitude.Constants -import com.amplitude.events.BaseEvent -import org.json.JSONArray -import org.json.JSONObject +import com.amplitude.core.Configuration +import com.amplitude.core.Constants import java.io.* import java.net.HttpURLConnection import java.net.MalformedURLException import java.net.URL import java.nio.charset.StandardCharsets -import javax.net.ssl.HttpsURLConnection internal class HttpClient( private val configuration: Configuration diff --git a/core/src/main/java/com/amplitude/utilities/InMemoryStorage.kt b/core/src/main/java/com/amplitude/core/utilities/InMemoryStorage.kt similarity index 80% rename from core/src/main/java/com/amplitude/utilities/InMemoryStorage.kt rename to core/src/main/java/com/amplitude/core/utilities/InMemoryStorage.kt index cfff82f0..aa8aadcc 100644 --- a/core/src/main/java/com/amplitude/utilities/InMemoryStorage.kt +++ b/core/src/main/java/com/amplitude/core/utilities/InMemoryStorage.kt @@ -1,9 +1,9 @@ -package com.amplitude.utilities +package com.amplitude.core.utilities -import com.amplitude.Amplitude -import com.amplitude.Storage -import com.amplitude.StorageProvider -import com.amplitude.events.BaseEvent +import com.amplitude.core.Amplitude +import com.amplitude.core.Storage +import com.amplitude.core.StorageProvider +import com.amplitude.core.events.BaseEvent class InMemoryStorage( val amplitude: Amplitude diff --git a/core/src/main/java/com/amplitude/utilities/JSONUtil.kt b/core/src/main/java/com/amplitude/core/utilities/JSONUtil.kt similarity index 97% rename from core/src/main/java/com/amplitude/utilities/JSONUtil.kt rename to core/src/main/java/com/amplitude/core/utilities/JSONUtil.kt index 8fefe219..3b52645b 100644 --- a/core/src/main/java/com/amplitude/utilities/JSONUtil.kt +++ b/core/src/main/java/com/amplitude/core/utilities/JSONUtil.kt @@ -1,7 +1,7 @@ -package com.amplitude.utilities +package com.amplitude.core.utilities -import com.amplitude.Constants -import com.amplitude.events.BaseEvent +import com.amplitude.core.Constants +import com.amplitude.core.events.BaseEvent import org.json.JSONArray import org.json.JSONException import org.json.JSONObject diff --git a/core/src/test/kotlin/com/amplitude/AmplitudeTest.kt b/core/src/test/kotlin/com/amplitude/core/AmplitudeTest.kt similarity index 87% rename from core/src/test/kotlin/com/amplitude/AmplitudeTest.kt rename to core/src/test/kotlin/com/amplitude/core/AmplitudeTest.kt index 973c031c..f60fb8ad 100644 --- a/core/src/test/kotlin/com/amplitude/AmplitudeTest.kt +++ b/core/src/test/kotlin/com/amplitude/core/AmplitudeTest.kt @@ -1,4 +1,4 @@ -package com.amplitude +package com.amplitude.core import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test diff --git a/core/src/test/kotlin/com/amplitude/ConfigurationTest.kt b/core/src/test/kotlin/com/amplitude/core/ConfigurationTest.kt similarity index 84% rename from core/src/test/kotlin/com/amplitude/ConfigurationTest.kt rename to core/src/test/kotlin/com/amplitude/core/ConfigurationTest.kt index 548fcee5..f06d3661 100644 --- a/core/src/test/kotlin/com/amplitude/ConfigurationTest.kt +++ b/core/src/test/kotlin/com/amplitude/core/ConfigurationTest.kt @@ -1,4 +1,4 @@ -package com.amplitude +package com.amplitude.core import org.junit.jupiter.api.Test diff --git a/samples/kotlin-jvm-app/src/main/kotlin/main.kt b/samples/kotlin-jvm-app/src/main/kotlin/main.kt index 449f69af..47efef3d 100644 --- a/samples/kotlin-jvm-app/src/main/kotlin/main.kt +++ b/samples/kotlin-jvm-app/src/main/kotlin/main.kt @@ -1,6 +1,6 @@ -import com.amplitude.Amplitude -import com.amplitude.Configuration -import com.amplitude.events.BaseEvent +import com.amplitude.core.Amplitude +import com.amplitude.core.Configuration +import com.amplitude.core.events.BaseEvent import kotlinx.coroutines.runBlocking fun main() {