From 81bdcb75426c24bff30505363f7c1c2a2fac9f28 Mon Sep 17 00:00:00 2001 From: HyunWoo Lee Date: Tue, 18 Jul 2023 17:36:14 +0900 Subject: [PATCH 1/3] Add amplitude dependency --- app/build.gradle.kts | 1 + gradle/libs.versions.toml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8421b1a2..d7c597f6 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -103,6 +103,7 @@ dependencies { implementation(libs.coil.core) implementation(libs.bundles.retrofit) implementation(libs.kakao.login) + implementation(libs.amplitude.android) debugImplementation(libs.bundles.flipper) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a9ae67c7..fb2b94b2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -78,6 +78,7 @@ dot-indicator = "5.0" kakao = "2.15.0" splash-screen = "1.0.1" javax-inject = "1" +amplitude = "2.39.2" [libraries] @@ -191,6 +192,8 @@ javax-inject = { group = "javax.inject", name = "javax.inject", version.ref = "j sentry = { module = "io.sentry:sentry", version.ref = "sentry-android" } +amplitude-android = { module = "com.amplitude:analytics-android", version.ref = "amplitude" } + [plugins] android-application = { id = "com.android.application", version.ref = "agp" } android-library = { id = "com.android.library", version.ref = "agp" } From af61d6237f917256423ad47df70da137eea88f8c Mon Sep 17 00:00:00 2001 From: HyunWoo Lee Date: Tue, 18 Jul 2023 18:21:08 +0900 Subject: [PATCH 2/3] Add analytics module --- core/analytics/.gitignore | 1 + core/analytics/build.gradle.kts | 12 ++++++++++++ core/analytics/consumer-rules.pro | 0 core/analytics/src/main/AndroidManifest.xml | 2 ++ .../com/teampophory/pophory/analytics/Analytics.kt | 8 ++++++++ settings.gradle.kts | 1 + 6 files changed, 24 insertions(+) create mode 100644 core/analytics/.gitignore create mode 100644 core/analytics/build.gradle.kts create mode 100644 core/analytics/consumer-rules.pro create mode 100644 core/analytics/src/main/AndroidManifest.xml create mode 100644 core/analytics/src/main/java/com/teampophory/pophory/analytics/Analytics.kt diff --git a/core/analytics/.gitignore b/core/analytics/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/core/analytics/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/core/analytics/build.gradle.kts b/core/analytics/build.gradle.kts new file mode 100644 index 00000000..2aec1b46 --- /dev/null +++ b/core/analytics/build.gradle.kts @@ -0,0 +1,12 @@ +@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed +plugins { + pophory("feature") +} + +android { + namespace = "com.teampophory.pophory.analytics" +} + +dependencies { + implementation(libs.amplitude.android) +} diff --git a/core/analytics/consumer-rules.pro b/core/analytics/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/core/analytics/src/main/AndroidManifest.xml b/core/analytics/src/main/AndroidManifest.xml new file mode 100644 index 00000000..b2d3ea12 --- /dev/null +++ b/core/analytics/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/core/analytics/src/main/java/com/teampophory/pophory/analytics/Analytics.kt b/core/analytics/src/main/java/com/teampophory/pophory/analytics/Analytics.kt new file mode 100644 index 00000000..52e99074 --- /dev/null +++ b/core/analytics/src/main/java/com/teampophory/pophory/analytics/Analytics.kt @@ -0,0 +1,8 @@ +package com.teampophory.pophory.analytics + +interface Analytics { + fun trackEvent( + name: String, + args: Map? = null, + ) +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 0573572f..2adaa888 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -22,6 +22,7 @@ rootProject.name = "pophory" include(":app") include(":bottomnavigation") include(":core:common") +include(":core:analytics") include(":core:designsystem") include(":domain:auth") include(":data:auth") From c4158605b18295c9769ce0e59eb98be9ce16e377 Mon Sep 17 00:00:00 2001 From: HyunWoo Lee Date: Tue, 18 Jul 2023 18:47:19 +0900 Subject: [PATCH 3/3] Add amplitude key in secret and properties --- .github/workflows/develop_PR_builder.yml | 2 ++ .../main/kotlin/com/teampophory/pophory/plugin/CommonConfigs.kt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/develop_PR_builder.yml b/.github/workflows/develop_PR_builder.yml index b6da73a8..d3da9196 100644 --- a/.github/workflows/develop_PR_builder.yml +++ b/.github/workflows/develop_PR_builder.yml @@ -44,6 +44,7 @@ jobs: KEY_ALIAS: ${{ secrets.SENTRY_DSN }} KEY_PASSWORD: ${{ secrets.SENTRY_DSN }} STORE_PASSWORD: ${{ secrets.SENTRY_DSN }} + AMPLITUDE_KEY: ${{ secrets.SENTRY_DSN }} run: | echo sentryDsn=\"$SENTRY_DSN\" >> ./local.properties echo kakaoApiKey=$KAKAO_API_KEY >> ./local.properties @@ -51,6 +52,7 @@ jobs: echo keyAlias=$KEY_ALIAS >> ./local.properties echo keyPassword=KEY_PASSWORD >> ./local.properties echo storePassword=$STORE_PASSWORD >> ./local.properties + echo amplitudeKey=$AMPLITUDE_KEY >> ./local.properties - name: Access Firebase Service run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > ./app/google-services.json diff --git a/build-logic/convention/src/main/kotlin/com/teampophory/pophory/plugin/CommonConfigs.kt b/build-logic/convention/src/main/kotlin/com/teampophory/pophory/plugin/CommonConfigs.kt index a29f8e56..b000b192 100644 --- a/build-logic/convention/src/main/kotlin/com/teampophory/pophory/plugin/CommonConfigs.kt +++ b/build-logic/convention/src/main/kotlin/com/teampophory/pophory/plugin/CommonConfigs.kt @@ -25,6 +25,7 @@ internal fun Project.configureAndroidCommonPlugin() { defaultConfig { val kakaoApiKey = properties["kakaoApiKey"] as? String ?: "" val pophoryBaseUrl = properties["pophoryBaseUrl"] as? String ?: "" + val amplitudeKey = properties["amplitudeKey"] as? String ?: "" manifestPlaceholders["sentryDsn"] = properties["sentryDsn"] as String manifestPlaceholders["kakaoApiKey"] = properties["kakaoApiKey"] as String @@ -32,6 +33,7 @@ internal fun Project.configureAndroidCommonPlugin() { buildConfigField("String", "KAKAO_API_KEY", "\"${kakaoApiKey}\"") buildConfigField("String", "POPHORY_BASE_URL", "\"${pophoryBaseUrl}\"") + buildConfigField("String", "AMPLITUDE_KEY", "\"${amplitudeKey}\"") } buildFeatures.apply { viewBinding = true