From 799e885c9b75962e0f17d12bd91353d50da0ce8b Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Wed, 31 Jan 2024 03:20:31 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[ADD]=20#321=20=EC=A7=84=EC=9E=85=20?= =?UTF-8?q?=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=ED=83=9C=EA=B9=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/runnect/runnect/presentation/MainActivity.kt | 4 ++++ .../com/runnect/runnect/presentation/login/LoginActivity.kt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/src/main/java/com/runnect/runnect/presentation/MainActivity.kt b/app/src/main/java/com/runnect/runnect/presentation/MainActivity.kt index 8a3805378..2bbade0d1 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/MainActivity.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/MainActivity.kt @@ -20,6 +20,8 @@ import com.runnect.runnect.presentation.discover.DiscoverFragment import com.runnect.runnect.presentation.mypage.MyPageFragment import com.runnect.runnect.presentation.storage.StorageMainFragment import com.runnect.runnect.presentation.storage.StorageScrapFragment +import com.runnect.runnect.util.analytics.Analytics +import com.runnect.runnect.util.analytics.EventName.EVENT_VIEW_HOME import dagger.hilt.android.AndroidEntryPoint import timber.log.Timber @@ -31,6 +33,8 @@ class MainActivity : BindingActivity(R.layout.activity_main override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + + Analytics.logClickedItemEvent(EVENT_VIEW_HOME) initRemoteConfig() checkVisitorMode() checkIntentValue() diff --git a/app/src/main/java/com/runnect/runnect/presentation/login/LoginActivity.kt b/app/src/main/java/com/runnect/runnect/presentation/login/LoginActivity.kt index 1234ae32a..d2e0a2c2d 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/login/LoginActivity.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/login/LoginActivity.kt @@ -11,6 +11,8 @@ import com.runnect.runnect.binding.BindingActivity import com.runnect.runnect.databinding.ActivityLoginBinding import com.runnect.runnect.presentation.MainActivity import com.runnect.runnect.presentation.state.UiState +import com.runnect.runnect.util.analytics.Analytics +import com.runnect.runnect.util.analytics.EventName.EVENT_VIEW_SOCIAL_LOGIN import dagger.hilt.android.AndroidEntryPoint import timber.log.Timber @@ -34,6 +36,8 @@ class LoginActivity : BindingActivity(com.runnect.runnect. override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + + Analytics.logClickedItemEvent(EVENT_VIEW_SOCIAL_LOGIN) googleLogin = GoogleLogin( activity = this@LoginActivity, viewModel = viewModel From 6cee8d90659d3be17731fa716c0da13c64b79ca6 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Wed, 31 Jan 2024 03:22:09 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[ADD]=20#321=20=EB=A1=9C=EA=B7=B8=EC=9D=B8?= =?UTF-8?q?=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=ED=83=9C=EA=B9=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/runnect/runnect/presentation/login/GoogleLogin.kt | 6 +++++- .../com/runnect/runnect/presentation/login/KakaoLogin.kt | 6 +++++- .../com/runnect/runnect/presentation/login/LoginActivity.kt | 5 +++++ .../runnect/runnect/presentation/login/LoginViewModel.kt | 3 ++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/presentation/login/GoogleLogin.kt b/app/src/main/java/com/runnect/runnect/presentation/login/GoogleLogin.kt index 197170a6b..e08841f47 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/login/GoogleLogin.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/login/GoogleLogin.kt @@ -12,6 +12,8 @@ import com.google.android.gms.common.api.ApiException import com.google.android.gms.tasks.Task import com.runnect.runnect.BuildConfig import com.runnect.runnect.data.dto.request.RequestPostLogin +import com.runnect.runnect.util.analytics.Analytics +import com.runnect.runnect.util.analytics.EventName.EVENT_CLICK_GOOGLE_LOGIN import timber.log.Timber import java.lang.ref.WeakReference @@ -60,7 +62,9 @@ class GoogleLogin(activity: LoginActivity, viewModel: LoginViewModel) : SocialLo token = socialToken, provider = LoginActivity.GOOGLE_SIGN ) - ) + ) { + Analytics.logClickedItemEvent(EVENT_CLICK_GOOGLE_LOGIN) + } } catch (e: ApiException) { Timber.tag("failed").w("signInResult:failed code=%s", e.statusCode) } diff --git a/app/src/main/java/com/runnect/runnect/presentation/login/KakaoLogin.kt b/app/src/main/java/com/runnect/runnect/presentation/login/KakaoLogin.kt index e4911e881..4a68311ee 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/login/KakaoLogin.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/login/KakaoLogin.kt @@ -7,6 +7,8 @@ import com.kakao.sdk.common.model.ClientError import com.kakao.sdk.common.model.ClientErrorCause import com.kakao.sdk.user.UserApiClient.Companion.instance import com.runnect.runnect.data.dto.request.RequestPostLogin +import com.runnect.runnect.util.analytics.Analytics +import com.runnect.runnect.util.analytics.EventName.EVENT_CLICK_KAKAO_LOGIN import timber.log.Timber import java.lang.ref.WeakReference @@ -23,7 +25,9 @@ class KakaoLogin(context: Context, viewModel: LoginViewModel) : SocialLogin { RequestPostLogin( token.accessToken, LoginActivity.KAKAO_SIGN ) - ) + ) { + Analytics.logClickedItemEvent(EVENT_CLICK_KAKAO_LOGIN) + } } } diff --git a/app/src/main/java/com/runnect/runnect/presentation/login/LoginActivity.kt b/app/src/main/java/com/runnect/runnect/presentation/login/LoginActivity.kt index d2e0a2c2d..e44468fef 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/login/LoginActivity.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/login/LoginActivity.kt @@ -12,6 +12,10 @@ import com.runnect.runnect.databinding.ActivityLoginBinding import com.runnect.runnect.presentation.MainActivity import com.runnect.runnect.presentation.state.UiState import com.runnect.runnect.util.analytics.Analytics +import com.runnect.runnect.util.analytics.EventName +import com.runnect.runnect.util.analytics.EventName.EVENT_CLICK_GOOGLE_LOGIN +import com.runnect.runnect.util.analytics.EventName.EVENT_CLICK_KAKAO_LOGIN +import com.runnect.runnect.util.analytics.EventName.EVENT_CLICK_VISITOR import com.runnect.runnect.util.analytics.EventName.EVENT_VIEW_SOCIAL_LOGIN import dagger.hilt.android.AndroidEntryPoint import timber.log.Timber @@ -61,6 +65,7 @@ class LoginActivity : BindingActivity(com.runnect.runnect. socialLogin.signIn() } btnVisitorMode.setOnClickListener { + Analytics.logClickedItemEvent(EVENT_CLICK_VISITOR) PreferenceManager.setString( context = applicationContext, key = TOKEN_KEY_ACCESS, diff --git a/app/src/main/java/com/runnect/runnect/presentation/login/LoginViewModel.kt b/app/src/main/java/com/runnect/runnect/presentation/login/LoginViewModel.kt index 547cf0ca1..986360b1a 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/login/LoginViewModel.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/login/LoginViewModel.kt @@ -25,7 +25,7 @@ class LoginViewModel @Inject constructor(private val loginRepository: LoginRepos get() = _loginState - fun postLogin(request: RequestPostLogin) { + fun postLogin(request: RequestPostLogin, logEvent: (() -> Unit)? = null) { viewModelScope.launch { runCatching { _loginState.value = UiState.Loading @@ -37,6 +37,7 @@ class LoginViewModel @Inject constructor(private val loginRepository: LoginRepos }.onSuccess { loginResult.value = it _loginState.value = UiState.Success + logEvent?.invoke() }.onFailure { errorMessage.value = it.message _loginState.value = UiState.Failure From d1c4ef1733965dfe56db06b7d5f66675941d6429 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Wed, 31 Jan 2024 03:23:02 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[ADD]=20#321=20=EC=BD=94=EC=8A=A4=20?= =?UTF-8?q?=EA=B7=B8=EB=A6=AC=EA=B8=B0=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=83=9C=EA=B9=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runnect/presentation/coursemain/CourseMainFragment.kt | 3 +++ .../com/runnect/runnect/presentation/draw/DrawActivity.kt | 4 ++++ .../runnect/runnect/presentation/search/SearchActivity.kt | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/app/src/main/java/com/runnect/runnect/presentation/coursemain/CourseMainFragment.kt b/app/src/main/java/com/runnect/runnect/presentation/coursemain/CourseMainFragment.kt index 12b398503..47a8d3329 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/coursemain/CourseMainFragment.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/coursemain/CourseMainFragment.kt @@ -21,6 +21,8 @@ import com.runnect.runnect.R import com.runnect.runnect.binding.BindingFragment import com.runnect.runnect.databinding.FragmentCourseMainBinding import com.runnect.runnect.presentation.search.SearchActivity +import com.runnect.runnect.util.analytics.Analytics +import com.runnect.runnect.util.analytics.EventName.EVENT_CLICK_COURSE_DRAWING import com.runnect.runnect.util.extension.PermissionUtil import com.runnect.runnect.util.extension.showToast @@ -95,6 +97,7 @@ class CourseMainFragment : private fun initDrawCourseButtonClickListener() { binding.btnDraw.setOnClickListener { + Analytics.logClickedItemEvent(EVENT_CLICK_COURSE_DRAWING) val intent = Intent(activity, SearchActivity::class.java) intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION) startActivity(intent) diff --git a/app/src/main/java/com/runnect/runnect/presentation/draw/DrawActivity.kt b/app/src/main/java/com/runnect/runnect/presentation/draw/DrawActivity.kt index 64742a410..b6073af93 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/draw/DrawActivity.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/draw/DrawActivity.kt @@ -45,6 +45,8 @@ import com.runnect.runnect.presentation.MainActivity import com.runnect.runnect.presentation.countdown.CountDownActivity import com.runnect.runnect.presentation.state.UiState import com.runnect.runnect.util.DepartureSetMode +import com.runnect.runnect.util.analytics.Analytics +import com.runnect.runnect.util.analytics.EventName import com.runnect.runnect.util.custom.dialog.RequireLoginDialogFragment import com.runnect.runnect.util.extension.PermissionUtil import com.runnect.runnect.util.extension.hideKeyboard @@ -464,6 +466,7 @@ class DrawActivity : BindingActivity(R.layout.activity_draw with(dialogLayout) { this.btn_run.setOnClickListener { + Analytics.logClickedItemEvent(EventName.EVENT_CLICK_RUN_AFTER_COURSE_COMPLETE) val courseData = CourseData( courseId = viewModel.uploadResult.value?.data?.id, publicCourseId = null, @@ -490,6 +493,7 @@ class DrawActivity : BindingActivity(R.layout.activity_draw } this.btn_storage.setOnClickListener { + Analytics.logClickedItemEvent(EventName.EVENT_CLICK_STORED_AFTER_COURSE_COMPLETE) val intent = Intent(this@DrawActivity, MainActivity::class.java).apply { putExtra(EXTRA_FRAGMENT_REPLACEMENT_DIRECTION, "fromDrawCourse") addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) diff --git a/app/src/main/java/com/runnect/runnect/presentation/search/SearchActivity.kt b/app/src/main/java/com/runnect/runnect/presentation/search/SearchActivity.kt index 7b00996db..6c86e7914 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/search/SearchActivity.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/search/SearchActivity.kt @@ -20,6 +20,9 @@ import com.runnect.runnect.databinding.ActivitySearchBinding import com.runnect.runnect.presentation.draw.DrawActivity import com.runnect.runnect.presentation.search.adapter.SearchAdapter import com.runnect.runnect.presentation.state.UiState +import com.runnect.runnect.util.analytics.Analytics +import com.runnect.runnect.util.analytics.EventName.EVENT_CLICK_CURRENT_LOCATE +import com.runnect.runnect.util.analytics.EventName.EVENT_CLICK_MAP_LOCATE import com.runnect.runnect.util.callback.listener.OnSearchItemClick import com.runnect.runnect.util.extension.PermissionUtil import com.runnect.runnect.util.extension.hideKeyboard @@ -171,6 +174,7 @@ class SearchActivity : BindingActivity(R.layout.activity_ }) binding.cvStartCurrentLocation.setOnClickListener { + Analytics.logClickedItemEvent(EVENT_CLICK_CURRENT_LOCATE) this.let { PermissionUtil.requestLocationPermission( context = it, @@ -182,6 +186,7 @@ class SearchActivity : BindingActivity(R.layout.activity_ } binding.cvStartCustomLocation.setOnClickListener { + Analytics.logClickedItemEvent(EVENT_CLICK_MAP_LOCATE) startCustomLocation() } } From 88ac2c87f46114d48a6c7c05b6bbacf36f55ea95 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Wed, 31 Jan 2024 03:23:17 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[ADD]=20#321=20=EB=B0=A9=EB=AC=B8=EC=9E=90?= =?UTF-8?q?=20=EB=AA=A8=EB=93=9C/=EB=84=A4=EB=B9=84=EA=B2=8C=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=ED=83=9C=EA=B9=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runnect/runnect/presentation/MainActivity.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/main/java/com/runnect/runnect/presentation/MainActivity.kt b/app/src/main/java/com/runnect/runnect/presentation/MainActivity.kt index 2bbade0d1..34c31c0ae 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/MainActivity.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/MainActivity.kt @@ -21,6 +21,7 @@ import com.runnect.runnect.presentation.mypage.MyPageFragment import com.runnect.runnect.presentation.storage.StorageMainFragment import com.runnect.runnect.presentation.storage.StorageScrapFragment import com.runnect.runnect.util.analytics.Analytics +import com.runnect.runnect.util.analytics.EventName import com.runnect.runnect.util.analytics.EventName.EVENT_VIEW_HOME import dagger.hilt.android.AndroidEntryPoint import timber.log.Timber @@ -67,6 +68,7 @@ class MainActivity : BindingActivity(R.layout.activity_main } private fun changeFragment(menuItemId: Int) { + logClickEvent(menuItemId) supportFragmentManager.commit { replace( R.id.fl_main, when (menuItemId) { @@ -80,6 +82,18 @@ class MainActivity : BindingActivity(R.layout.activity_main } } + private fun logClickEvent(menuItemId: Int) { + with(EventName) { + when (menuItemId) { + R.id.menu_main_drawing -> if(isVisitorMode) EVENT_CLICK_JOIN_IN_COURSE_DRAWING else EVENT_CLICK_NAV_COURSE_DRAWING + R.id.menu_main_storage -> if(isVisitorMode) EVENT_CLICK_JOIN_IN_STORAGE else EVENT_CLICK_NAV_STORAGE + R.id.menu_main_discover -> if(isVisitorMode) EVENT_CLICK_JOIN_IN_COURSE_DISCOVERY else EVENT_CLICK_NAV_COURSE_DISCOVERY + R.id.menu_main_my_page -> if(isVisitorMode) EVENT_CLICK_JOIN_IN_MY_PAGE else EVENT_CLICK_NAV_MY_PAGE + else -> "" + }.let(Analytics::logClickedItemEvent) + } + } + private fun addListener() { binding.btmNaviMain.setOnItemSelectedListener { changeFragment(it.itemId) From e519e8ec462bfee51278f37ffb886681b2ce396f Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Wed, 31 Jan 2024 03:23:28 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[ADD]=20#321=20=EB=9F=AC=EB=8B=9D=20?= =?UTF-8?q?=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=ED=83=9C=EA=B9=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runnect/runnect/presentation/endrun/EndRunActivity.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunActivity.kt b/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunActivity.kt index 7386b02bc..d5ab7b3c7 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunActivity.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunActivity.kt @@ -18,6 +18,9 @@ import com.runnect.runnect.data.dto.request.RequestPostRunningHistory import com.runnect.runnect.databinding.ActivityEndRunBinding import com.runnect.runnect.presentation.MainActivity import com.runnect.runnect.presentation.state.UiState +import com.runnect.runnect.util.analytics.Analytics +import com.runnect.runnect.util.analytics.EventName.EVENT_CLICK_BACK_RUNNING_TRACKING +import com.runnect.runnect.util.analytics.EventName.EVENT_CLICK_STORE_RUNNING_TRACKING import com.runnect.runnect.util.custom.toast.RunnectToast import com.runnect.runnect.util.extension.hideKeyboard import com.runnect.runnect.util.extension.round @@ -67,6 +70,7 @@ class EndRunActivity: BindingActivity(R.layout.activity_e private fun backBtn() { binding.imgBtnBack.setOnClickListener { + Analytics.logClickedItemEvent(EVENT_CLICK_BACK_RUNNING_TRACKING) val intent = Intent(this, MainActivity::class.java).apply { putExtra(EXTRA_FRAGMENT_REPLACEMENT_DIRECTION, viewModel.dataFrom.value) addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) @@ -152,6 +156,7 @@ class EndRunActivity: BindingActivity(R.layout.activity_e private fun saveRecord() { binding.btnEndRunSave.setOnClickListener { + Analytics.logClickedItemEvent(EVENT_CLICK_STORE_RUNNING_TRACKING) viewModel.postRecord( RequestPostRunningHistory( courseId = viewModel.courseId.value!!, From bfca3e4800866184f9114ef391ea24ab460ffada Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Wed, 31 Jan 2024 03:23:35 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[ADD]=20#321=20=EC=9D=B4=EB=B2=A4=ED=8A=B8?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runnect/util/analytics/EventName.kt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/app/src/main/java/com/runnect/runnect/util/analytics/EventName.kt b/app/src/main/java/com/runnect/runnect/util/analytics/EventName.kt index 485e3be8b..c849c7dee 100644 --- a/app/src/main/java/com/runnect/runnect/util/analytics/EventName.kt +++ b/app/src/main/java/com/runnect/runnect/util/analytics/EventName.kt @@ -1,6 +1,39 @@ package com.runnect.runnect.util.analytics object EventName { + + // App + const val EVENT_VIEW_HOME = "view_home" // 앱 실행 + const val EVENT_VIEW_SOCIAL_LOGIN = "view_social_login" + + // Login + const val EVENT_CLICK_GOOGLE_LOGIN = "click_google_login" + const val EVENT_CLICK_KAKAO_LOGIN = "click_kakao_login" + const val EVENT_CLICK_VISITOR = "click_visitor" + + // Running Tracking + const val EVENT_CLICK_BACK_RUNNING_TRACKING = "click_back_running_tracking" + const val EVENT_CLICK_STORE_RUNNING_TRACKING = "click_store_running_tracking" + + // Draw Course + const val EVENT_CLICK_COURSE_DRAWING = "click_course_drawing" + const val EVENT_CLICK_CURRENT_LOCATE = "click_current_locate" + const val EVENT_CLICK_MAP_LOCATE = "click_map_locate" + const val EVENT_CLICK_STORED_AFTER_COURSE_COMPLETE = "click_stored_after_course_complete" + const val EVENT_CLICK_RUN_AFTER_COURSE_COMPLETE = "click_run_after_course_complete" + + // Navigation Menu + const val EVENT_CLICK_NAV_COURSE_DRAWING = "click_nav_course_drawing" + const val EVENT_CLICK_NAV_COURSE_DISCOVERY = "click_nav_course_discovery" + const val EVENT_CLICK_NAV_STORAGE = "click_nav_storage" + const val EVENT_CLICK_NAV_MY_PAGE = "click_nav_my_page" + + // Visitor Mode + const val EVENT_CLICK_JOIN_IN_COURSE_DRAWING = "click_join_in_course_drawing" + const val EVENT_CLICK_JOIN_IN_COURSE_DISCOVERY = "click_join_in_course_discovery" + const val EVENT_CLICK_JOIN_IN_STORAGE = "click_join_in_storage" + const val EVENT_CLICK_JOIN_IN_MY_PAGE = "click_join_in_my_page" + // Discover const val EVENT_CLICK_UPLOAD_BUTTON = "click_upload_button" const val EVENT_CLICK_TRY_SEARCH_COURSE = "click_try_search_course"