Skip to content

Commit c7cf0a4

Browse files
committed
Merge remote-tracking branch 'origin/release/1.0.2'
2 parents a282791 + 7776526 commit c7cf0a4

File tree

126 files changed

+5459
-12475
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+5459
-12475
lines changed

app/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ android {
4141
versionName = libs.versions.versionName.get()
4242

4343
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
44+
buildConfigField(
45+
"String",
46+
"AMPLITUDE_API_KEY",
47+
"\"${properties.getProperty("amplitudeKey")}\""
48+
)
4449
}
4550

4651
signingConfigs {
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2025 The Hilingual Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.hilingual.analytics
17+
18+
import android.content.Context
19+
import com.amplitude.android.Amplitude
20+
import com.amplitude.android.Configuration
21+
import com.hilingual.BuildConfig
22+
import com.hilingual.core.common.analytics.Page
23+
import com.hilingual.core.common.analytics.Tracker
24+
import com.hilingual.core.common.analytics.TriggerType
25+
import dagger.hilt.android.qualifiers.ApplicationContext
26+
import javax.inject.Inject
27+
import javax.inject.Singleton
28+
import timber.log.Timber
29+
30+
@Singleton
31+
class AmplitudeTracker @Inject constructor(
32+
@ApplicationContext private val context: Context
33+
) : Tracker {
34+
35+
private val amplitude = Amplitude(
36+
Configuration(
37+
apiKey = BuildConfig.AMPLITUDE_API_KEY,
38+
context = context
39+
)
40+
)
41+
42+
override fun logEvent(trigger: TriggerType, page: Page, event: String) {
43+
val eventName = "${trigger.value}_${page.pageName}.$event"
44+
Timber.tag("AmplitudeTracker").d("Tracking event: $eventName, properties: None")
45+
amplitude.track(eventName)
46+
}
47+
48+
override fun logEvent(
49+
trigger: TriggerType,
50+
page: Page,
51+
event: String,
52+
properties: Map<String, Any>
53+
) {
54+
val eventName = "${trigger.value}_${page.pageName}.$event"
55+
Timber.tag("AmplitudeTracker").d("Tracking event: $eventName, properties: $properties")
56+
amplitude.track(eventName, properties.toMutableMap())
57+
}
58+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2025 The Hilingual Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.hilingual.di
17+
18+
import com.hilingual.analytics.AmplitudeTracker
19+
import com.hilingual.core.common.analytics.Tracker
20+
import dagger.Binds
21+
import dagger.Module
22+
import dagger.hilt.InstallIn
23+
import dagger.hilt.components.SingletonComponent
24+
25+
@Module
26+
@InstallIn(SingletonComponent::class)
27+
abstract class TrackerModule {
28+
29+
@Binds
30+
abstract fun bindTracker(
31+
amplitudeTracker: AmplitudeTracker
32+
): Tracker
33+
}

app/src/release/generated/baselineProfiles/baseline-prof.txt

Lines changed: 1747 additions & 5785 deletions
Large diffs are not rendered by default.

app/src/release/generated/baselineProfiles/startup-prof.txt

Lines changed: 1747 additions & 5785 deletions
Large diffs are not rendered by default.

build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
2626
}
2727

2828
DependencyManager.addAndroidLibraryDependencies(this)
29+
DependencyManager.addTrackerDependency(this)
2930
}
3031
}
3132
}

build-logic/convention/src/main/kotlin/AndroidPresentationConventionPlugin.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class AndroidPresentationConventionPlugin : Plugin<Project> {
2424

2525
// presentation 모듈에 공통적으로 필요한 의존성들을 추가합니다.
2626
DependencyManager.addPresentationDependencies(this)
27+
DependencyManager.addTrackerDependency(this)
2728
}
2829
}
2930
}

build-logic/convention/src/main/kotlin/com/hilingual/buildlogic/DependencyManager.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ object DependencyManager {
4646
// 모듈
4747
add("implementation", project.project(":core:common"))
4848
add("implementation", project.project(":core:designsystem"))
49+
add("implementation", project.project(":core:ui"))
4950
add("implementation", project.project(":core:navigation"))
5051

5152
// AndroidX
@@ -63,6 +64,12 @@ object DependencyManager {
6364
}
6465
}
6566

67+
fun addTrackerDependency(project: Project) {
68+
project.dependencies {
69+
add("implementation", project.libs.findLibrary("amplitude-analytics-android").get())
70+
}
71+
}
72+
6673
fun addDataDependencies(project: Project) {
6774
project.dependencies {
6875
// 모듈
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright 2025 The Hilingual Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.hilingual.core.common.analytics
17+
18+
class FakeTracker : Tracker {
19+
override fun logEvent(trigger: TriggerType, page: Page, event: String) {}
20+
override fun logEvent(trigger: TriggerType, page: Page, event: String, properties: Map<String, Any>) {}
21+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2025 The Hilingual Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.hilingual.core.common.analytics
17+
18+
enum class Page(val pageName: String) {
19+
//
20+
HOME("home"),
21+
22+
// 일기 작성
23+
WRITE_DIARY("write_diary"),
24+
25+
// 피드백
26+
FEEDBACK("feedback"),
27+
28+
// 단어장
29+
VOCABULARY("vocabulary"),
30+
31+
// 피드
32+
FEED("feed"),
33+
POSTED_DIARY("posted_diary"),
34+
MY_FEED("my_feed")
35+
}

0 commit comments

Comments
 (0)