-
Notifications
You must be signed in to change notification settings - Fork 1
[Feature/#230] Meta App Events(Facebook SDK) 연동 #231
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8d938df
Feat: Meta App Events SDK 연동 및 표준 이벤트 자동 수집 설정 추가
wjdrjs00 dbf911f
Feat: 온보딩 완료 시 Meta App Events 온보딩 완료 이벤트 기록
wjdrjs00 c1ef5f3
Chore: Gradle 병렬 sync 옵션 활성화
wjdrjs00 6fecb13
Refactor: local.properties 조회 로직을 build-logic 확장 함수로 통합
wjdrjs00 8c8539a
Refactor: 분석 로직을 core:analytics 모듈로 분리
wjdrjs00 f557ad6
Feat: 온보딩 완료를 Meta 튜토리얼 완료 표준 이벤트로 기록
wjdrjs00 fa46d65
Fix: CI 워크플로에 Meta 자격증명 전달 추가
wjdrjs00 c3d5fdb
Feat: 최초 루틴 달성 여부를 기록하는 로컬 저장소 추가
wjdrjs00 84edfcf
Feat: Meta 최초 루틴 달성 이벤트 추가
wjdrjs00 274702f
Feat: 최초 루틴 달성 시 Meta 이벤트 기록
wjdrjs00 b6cee87
Feat: 회원가입 완료 시 Meta 이벤트 기록
wjdrjs00 8e4ee0f
Fix: 분석 이벤트 예외를 호출자로부터 격리
wjdrjs00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/threegap/bitnagil/di/core/AnalyticsModule.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package com.threegap.bitnagil.di.core | ||
|
|
||
| import android.content.Context | ||
| import com.threegap.bitnagil.analytics.AnalyticsLogger | ||
| import com.threegap.bitnagil.analytics.meta.MetaAnalyticsLogger | ||
| import dagger.Module | ||
| import dagger.Provides | ||
| import dagger.hilt.InstallIn | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import dagger.hilt.components.SingletonComponent | ||
| import javax.inject.Singleton | ||
|
|
||
| @Module | ||
| @InstallIn(SingletonComponent::class) | ||
| object AnalyticsModule { | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideAnalyticsLogger(@ApplicationContext context: Context): AnalyticsLogger = | ||
| MetaAnalyticsLogger(context) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ic/convention/src/main/java/com/threegap/bitnagil/convention/extension/LocalProperties.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package com.threegap.bitnagil.convention.extension | ||
|
|
||
| import java.util.Properties | ||
| import org.gradle.api.GradleException | ||
| import org.gradle.api.Project | ||
|
|
||
| private const val LOCAL_PROPERTIES_FILE_NAME = "local.properties" | ||
| private const val LOCAL_PROPERTIES_EXTRA_KEY = "bitnagilLocalProperties" | ||
|
|
||
| private fun Project.loadLocalProperties(): Properties = | ||
| Properties().apply { | ||
| val localPropertiesFile = rootProject.file(LOCAL_PROPERTIES_FILE_NAME) | ||
| if (localPropertiesFile.exists()) { | ||
| localPropertiesFile.inputStream().use(::load) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * 모듈마다 한 번만 읽고 해당 프로젝트의 extra 에 담아둔다. | ||
| * 데몬이 아니라 빌드마다 새로 만들어지는 저장소이므로 local.properties 를 수정하면 다음 빌드에 반영된다. | ||
| */ | ||
| private val Project.localProperties: Properties | ||
| get() { | ||
| val extra = extensions.extraProperties | ||
| if (!extra.has(LOCAL_PROPERTIES_EXTRA_KEY)) { | ||
| extra.set(LOCAL_PROPERTIES_EXTRA_KEY, loadLocalProperties()) | ||
| } | ||
| return extra.get(LOCAL_PROPERTIES_EXTRA_KEY) as Properties | ||
| } | ||
|
|
||
| /** | ||
| * local.properties 값을 읽고, 없으면 환경 변수를 사용한다. 둘 다 없으면 null 을 반환한다. | ||
| */ | ||
| fun Project.propertyOrNull(propertyKey: String, environmentKey: String): String? = | ||
| localProperties.getProperty(propertyKey) ?: System.getenv(environmentKey) | ||
|
|
||
| /** | ||
| * [propertyOrNull] 과 동일하되, 값이 없거나 비어 있으면 설정 단계에서 실패한다. | ||
| */ | ||
| fun Project.requireProperty(propertyKey: String, environmentKey: String): String = | ||
| propertyOrNull(propertyKey, environmentKey)?.takeIf(String::isNotBlank) | ||
| ?: throw GradleException("$propertyKey 값이 없습니다.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import com.threegap.bitnagil.convention.extension.requireProperty | ||
|
|
||
| plugins { | ||
| alias(libs.plugins.bitnagil.android.library) | ||
| } | ||
|
|
||
| android { | ||
| buildTypes { | ||
| debug { | ||
| resValue( | ||
| type = "string", | ||
| name = "facebook_app_id", | ||
| value = requireProperty("facebook.debug.app.id", "FACEBOOK_DEBUG_APP_ID"), | ||
|
wjdrjs00 marked this conversation as resolved.
|
||
| ) | ||
| resValue( | ||
| type = "string", | ||
| name = "facebook_client_token", | ||
| value = requireProperty("facebook.debug.client.token", "FACEBOOK_DEBUG_CLIENT_TOKEN"), | ||
| ) | ||
| } | ||
|
|
||
| release { | ||
| resValue( | ||
| type = "string", | ||
| name = "facebook_app_id", | ||
| value = requireProperty("facebook.app.id", "FACEBOOK_APP_ID"), | ||
| ) | ||
| resValue( | ||
| type = "string", | ||
| name = "facebook_client_token", | ||
| value = requireProperty("facebook.client.token", "FACEBOOK_CLIENT_TOKEN"), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| buildFeatures { | ||
| resValues = true | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation(libs.facebook.core) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
|
||
| <application> | ||
| <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id" /> | ||
| <meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token" /> | ||
| </application> | ||
| </manifest> |
18 changes: 18 additions & 0 deletions
18
core/analytics/src/main/java/com/threegap/bitnagil/analytics/AnalyticsLogger.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.threegap.bitnagil.analytics | ||
|
|
||
| interface AnalyticsLogger { | ||
| /** | ||
| * 회원가입 완료를 기록한다. 약관 동의가 서버에 확정된 시점에 호출된다. | ||
| */ | ||
| fun logSignUpCompleted() | ||
|
|
||
| /** | ||
| * 온보딩 완료를 기록한다. 추천 루틴을 등록했든 건너뛰었든 동일하게 기록한다. | ||
| */ | ||
| fun logOnBoardingCompleted() | ||
|
|
||
| /** | ||
| * 생애 최초 루틴 완료를 기록한다. 앱 설치 기준으로 1회만 호출된다. | ||
| */ | ||
| fun logFirstRoutineCompleted() | ||
| } |
13 changes: 13 additions & 0 deletions
13
.../analytics/src/main/java/com/threegap/bitnagil/analytics/meta/MetaAnalyticsInitializer.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.threegap.bitnagil.analytics.meta | ||
|
|
||
| import com.facebook.FacebookSdk | ||
| import com.facebook.LoggingBehavior | ||
|
|
||
| object MetaAnalyticsInitializer { | ||
| fun initialize(isDebugBuild: Boolean) { | ||
| if (!isDebugBuild) return | ||
|
|
||
| FacebookSdk.setIsDebugEnabled(true) | ||
| FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS) | ||
| } | ||
| } |
32 changes: 32 additions & 0 deletions
32
core/analytics/src/main/java/com/threegap/bitnagil/analytics/meta/MetaAnalyticsLogger.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package com.threegap.bitnagil.analytics.meta | ||
|
|
||
| import android.content.Context | ||
| import android.os.Bundle | ||
| import com.facebook.appevents.AppEventsConstants | ||
| import com.facebook.appevents.AppEventsLogger | ||
| import com.threegap.bitnagil.analytics.AnalyticsLogger | ||
|
|
||
| class MetaAnalyticsLogger(private val context: Context) : AnalyticsLogger { | ||
|
|
||
| private val logger by lazy { AppEventsLogger.newLogger(context) } | ||
|
|
||
| override fun logSignUpCompleted() { | ||
| logger.logEvent(AppEventsConstants.EVENT_NAME_COMPLETED_REGISTRATION) | ||
| } | ||
|
|
||
| override fun logOnBoardingCompleted() { | ||
| logger.logEvent(AppEventsConstants.EVENT_NAME_COMPLETED_TUTORIAL) | ||
| } | ||
|
|
||
| override fun logFirstRoutineCompleted() { | ||
| val parameters = Bundle().apply { | ||
| putString(AppEventsConstants.EVENT_PARAM_LEVEL, LEVEL_FIRST_ROUTINE_COMPLETED) | ||
| } | ||
|
|
||
| logger.logEvent(AppEventsConstants.EVENT_NAME_ACHIEVED_LEVEL, parameters) | ||
| } | ||
|
|
||
| private companion object { | ||
| const val LEVEL_FIRST_ROUTINE_COMPLETED = "first_routine_completed" | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
...tastore/src/main/java/com/threegap/bitnagil/datastore/routine/model/RoutineAchievement.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.threegap.bitnagil.datastore.routine.model | ||
|
|
||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class RoutineAchievement( | ||
| val firstCompletionLogged: Boolean = false, | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.