Skip to content

Commit

Permalink
[ADD/#129] Amplitude dependency 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchbreeze committed Sep 10, 2024
1 parent 67dee4a commit 48b4496
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ dependencies {
implementation(retrofit)
implementation(retrofitJsonConverter)
implementation(timber)
implementation(amplitude)
}

KakaoDependencies.run {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<application
android:name=".MyApp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package co.orange.ddanzi.di.module

import co.orange.core.navigation.NavigationManager
import co.orange.ddanzi.di.navigate.NavigationManagerImpl
import co.orange.ddanzi.navigate.NavigationManagerImpl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand Down
59 changes: 59 additions & 0 deletions app/src/main/java/co/orange/ddanzi/manager/AmplitudeManager.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package co.orange.ddanzi.manager

object AmplitudeManager {
private lateinit var amplitude: Amplitude

fun init(
context: Context,
apiKey: String,
) {
amplitude =
Amplitude(
Configuration(
apiKey = apiKey,
context = context.applicationContext,
),
)
}

fun trackEvent(
eventName: String,
properties1: Map<String, Any>? = null,
properties2: Map<String, Any>? = null,
) {
when {
properties1 == null && properties2 == null -> {
amplitude.track(eventName)
}

properties1 != null && properties2 == null -> {
amplitude.track(eventName, properties1)
}

properties1 != null && properties2 != null -> {
val combinedProperties = mutableMapOf<String, Any?>()
combinedProperties.putAll(properties1)
combinedProperties.putAll(properties2)
amplitude.track(eventName, combinedProperties)
}
}
}

fun updateProperties(
propertyName: String,
values: String,
) {
amplitude.identify(Identify().set(propertyName, values))
}

fun updateIntProperties(
propertyName: String,
intValues: Int,
) {
amplitude.identify(Identify().set(propertyName, intValues))
}

fun plusIntProperties(propertyName: String) {
amplitude.identify(Identify().add(propertyName, 1))
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.orange.ddanzi.di.navigate
package co.orange.ddanzi.navigate

import android.content.Context
import android.content.Intent
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ object ThirdPartyDependencies {
const val timber = "com.jakewharton.timber:timber:${Versions.timberVersion}"
const val coil = "io.coil-kt:coil:${Versions.coilVersion}"
const val lottie = "com.airbnb.android:lottie:${Versions.lottieVersion}"
const val amplitude = "com.amplitude:analytics-android:${Versions.amplitudeVersion}"

const val progressView = "com.github.skydoves:progressview:${Versions.progressViewVersion}"
const val balloon = "com.github.skydoves:balloon:${Versions.balloonVersion}"
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ object Versions {
const val circleIndicatorVersion = "2.1.6"
const val mlkitVersion = "16.0.0"
const val appUpdateVersion = "2.1.0"
const val amplitudeVersion = "1.17.3"

const val iamportVersion = "v1.4.5"

Expand Down

0 comments on commit 48b4496

Please sign in to comment.