From 5b2965d136ee9a41ce9338c474282c63f537c838 Mon Sep 17 00:00:00 2001 From: Strone Date: Thu, 25 Apr 2024 19:15:38 +0900 Subject: [PATCH 01/31] Add Activity analytics event log function --- .../koin/core/activity/ActivityBase.kt | 34 +++++++++++++++++++ .../koin/core/constant/AnalyticsConstant.kt | 19 +++++++++++ 2 files changed, 53 insertions(+) create mode 100644 core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt diff --git a/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt b/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt index a8e928ad9..d997a5446 100644 --- a/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt +++ b/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt @@ -10,6 +10,7 @@ import com.google.firebase.analytics.FirebaseAnalytics import com.google.firebase.analytics.ktx.analytics import com.google.firebase.analytics.ktx.logEvent import com.google.firebase.ktx.Firebase +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.progressdialog.CustomProgressDialog import `in`.koreatech.koin.core.progressdialog.IProgressDialog @@ -58,6 +59,39 @@ abstract class ActivityBase : AppCompatActivity, IProgressDialog { } } + /** + * @param action: 이벤트 발생 도메인(BUSINESS, CAMPUS, USER) + * @param label: 이벤트 소분류 + * @param value: 이벤트 값 + */ + protected fun logClickEvent(action: String, label: String, value: String) { + logEvent(action, AnalyticsConstant.Category.CLICK, label, value) + } + + /** + * @param action: 이벤트 발생 도메인(BUSINESS, CAMPUS, USER) + * @param label: 이벤트 소분류 + * @param value: 이벤트 값 + */ + protected fun logScrollEvent(action: String, label: String, value: String) { + logEvent(action, AnalyticsConstant.Category.SCROLL, label, value) + } + + /** + * @param action: 이벤트 발생 도메인(BUSINESS, CAMPUS, USER) + * @param category: 이벤트 종류(click, scroll, ...) + * @param label: 이벤트 소분류 + * @param value: 이벤트 값 + * @sample logEvent("BUSINESS", "click", "main_store_categories", "전체보기") + */ + private fun logEvent(action: String, category: String, label: String, value: String) { + Firebase.analytics.logEvent(action) { + param("event_category", category) + param("event_label", label) + param("value", value) + } + } + companion object { const val INPUT_METHOD_SERVICE: String = Context.INPUT_METHOD_SERVICE const val PAGE_TITLE = "page_title" diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt new file mode 100644 index 000000000..83c7d0007 --- /dev/null +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -0,0 +1,19 @@ +package `in`.koreatech.koin.core.constant + +object AnalyticsConstant { + + object Domain { + const val BUSINESS = "BUSINESS" + const val CAMPUS = "CAMPUS" + const val USER = "USER" + } + + object Category { + const val CLICK = "click" + const val SCROLL = "scroll" + } + + object Label { + + } +} \ No newline at end of file From 1398d58ac7261dd126f36bafbd394a5be3f3efb0 Mon Sep 17 00:00:00 2001 From: Strone Date: Thu, 25 Apr 2024 19:53:37 +0900 Subject: [PATCH 02/31] Add main page store click event analytics --- .../in/koreatech/koin/core/constant/AnalyticsConstant.kt | 3 ++- .../in/koreatech/koin/ui/main/activity/MainActivity.kt | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index 83c7d0007..ea5bdd5dc 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -14,6 +14,7 @@ object AnalyticsConstant { } object Label { - + const val MAIN_STORE_CATEGORIES = "main_store_categories" } + } \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt index 1650c7086..dfe9687d3 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt @@ -2,6 +2,7 @@ package `in`.koreatech.koin.ui.main.activity import android.os.Bundle import android.view.View +import android.widget.TextView import androidx.activity.viewModels import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -9,6 +10,7 @@ import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayoutMediator import dagger.hilt.android.AndroidEntryPoint import `in`.koreatech.koin.R +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.recyclerview.RecyclerViewClickListener import `in`.koreatech.koin.core.util.dataBinding import `in`.koreatech.koin.core.viewpager.HorizontalMarginItemDecoration @@ -42,6 +44,11 @@ class MainActivity : KoinNavigationDrawerActivity() { setRecyclerViewClickListener(object : RecyclerViewClickListener { override fun onClick(view: View?, position: Int) { gotoStoreActivity(position) + logClickEvent( + AnalyticsConstant.Domain.BUSINESS, + AnalyticsConstant.Label.MAIN_STORE_CATEGORIES, + view?.findViewById(R.id.text_view_store_category)?.text.toString() + ) } override fun onLongClick(view: View?, position: Int) { From d06b6cbf769ca5e5086e9ab6cd2b7713fda6743d Mon Sep 17 00:00:00 2001 From: Strone Date: Thu, 25 Apr 2024 19:57:51 +0900 Subject: [PATCH 03/31] Add StoreActivity category click event analytics --- .../koin/core/constant/AnalyticsConstant.kt | 1 + .../koin/ui/store/activity/StoreActivity.kt | 21 +++++++++++++++++++ koin/src/main/res/values/strings.xml | 10 +++++++++ 3 files changed, 32 insertions(+) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index ea5bdd5dc..984c53c38 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -15,6 +15,7 @@ object AnalyticsConstant { object Label { const val MAIN_STORE_CATEGORIES = "main_store_categories" + const val STORE_CATEGORIES = "store_categories" } } \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt index 832669f91..aaa359842 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt @@ -15,6 +15,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import dagger.hilt.android.AndroidEntryPoint import `in`.koreatech.koin.R import `in`.koreatech.koin.core.appbar.AppBarBase +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.util.dataBinding import `in`.koreatech.koin.databinding.StoreActivityMainBinding import `in`.koreatech.koin.domain.model.store.StoreCategory @@ -197,6 +198,26 @@ class StoreActivity : KoinNavigationDrawerActivity() { private fun View.setCategoryOnClick(category: StoreCategory) { setOnClickListener { + var eventValue = when(category) { + StoreCategory.Chicken -> getString(R.string.chicken) + StoreCategory.Pizza -> getString(R.string.pizza) + StoreCategory.DOSIRAK -> getString(R.string.dorisak) + StoreCategory.PorkFeet -> getString(R.string.pork_feet) + StoreCategory.Chinese -> getString(R.string.chinese) + StoreCategory.NormalFood -> getString(R.string.normal_food) + StoreCategory.Cafe -> getString(R.string.cafe) + StoreCategory.BeautySalon -> getString(R.string.beauty_salon) + StoreCategory.Etc -> getString(R.string.etc) + else -> "" + } + if(viewModel.category.value == category) + eventValue = getString(R.string.unselect_see_all) + + logClickEvent( + AnalyticsConstant.Domain.BUSINESS, + AnalyticsConstant.Label.STORE_CATEGORIES, + eventValue) + binding.searchEditText.clearFocus() viewModel.setCategory(category) } diff --git a/koin/src/main/res/values/strings.xml b/koin/src/main/res/values/strings.xml index 3239f24c4..ecec68477 100644 --- a/koin/src/main/res/values/strings.xml +++ b/koin/src/main/res/values/strings.xml @@ -371,4 +371,14 @@ 품절 변경됨 %1$s원 + 치킨 + 피자 + 도시락 + 족발 + 중국집 + 일반음식 + 카페 + 미용실 + 기타 + 미지정(전체보기) From 48eb8fd42ed20cea35bc84eaf0fa839b97c5da26 Mon Sep 17 00:00:00 2001 From: Strone Date: Thu, 25 Apr 2024 20:00:11 +0900 Subject: [PATCH 04/31] Add Store click event analytics --- .../java/in/koreatech/koin/ui/store/activity/StoreActivity.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt index aaa359842..e3d9cc979 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt @@ -47,6 +47,10 @@ class StoreActivity : KoinNavigationDrawerActivity() { private val storeAdapter = StoreRecyclerAdapter().apply { setOnItemClickListener { storeDetailContract.launch(it.uid) + logClickEvent( + AnalyticsConstant.Domain.BUSINESS, + "store_${it.name}_click", + it.name) } } From bd58a08ca0908d7fd474b85798cf8ae384cfa11d Mon Sep 17 00:00:00 2001 From: Strone Date: Thu, 25 Apr 2024 20:02:27 +0900 Subject: [PATCH 05/31] Add StoreDetail call click event analytics --- .../koreatech/koin/ui/store/activity/StoreDetailActivity.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt index 785386cb9..8a2358e9a 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt @@ -8,6 +8,7 @@ import androidx.appcompat.app.AlertDialog import androidx.core.view.isVisible import androidx.recyclerview.widget.LinearLayoutManager import `in`.koreatech.koin.R +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.toast.ToastUtil import `in`.koreatech.koin.core.util.dataBinding import `in`.koreatech.koin.databinding.StoreActivityDetailBinding @@ -120,6 +121,10 @@ class StoreDetailActivity : KoinNavigationDrawerActivity() { binding.storeDetailCallButton.setOnClickListener { showCallDialog() + logClickEvent( + AnalyticsConstant.Domain.BUSINESS, + "store_${viewModel.store.value?.name ?: "Unknown"}_call", + viewModel.store.value?.name ?: "Unknown") } binding.menuSpreadTextView.setOnClickListener { From 6f8efdab6c177be41df7a5ebb7717e4ab5354f6a Mon Sep 17 00:00:00 2001 From: Strone Date: Thu, 25 Apr 2024 20:03:21 +0900 Subject: [PATCH 06/31] Add StoreDetail picture click event analytics --- .../koreatech/koin/ui/store/activity/StoreDetailActivity.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt index 8a2358e9a..87a060cc3 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt @@ -85,6 +85,10 @@ class StoreDetailActivity : KoinNavigationDrawerActivity() { flyerDialogFragment = StoreFlyerDialogFragment() flyerDialogFragment?.initialPosition = position flyerDialogFragment?.show(supportFragmentManager, DIALOG_TAG) + logClickEvent( + AnalyticsConstant.Domain.BUSINESS, + "store_${viewModel.store.value?.name ?: "Unknown"}_picture", + viewModel.store.value?.name ?: "Unknown") } } From 506d28c691e53cd01beae041effb53cf6f9972e7 Mon Sep 17 00:00:00 2001 From: Strone Date: Thu, 25 Apr 2024 20:58:57 +0900 Subject: [PATCH 07/31] Create EventLogger, move activity logging logic to EventLogger --- .../koin/core/activity/ActivityBase.kt | 34 +-------------- .../koin/core/analytics/EventLogger.kt | 42 +++++++++++++++++++ .../koin/ui/main/activity/MainActivity.kt | 3 +- .../koin/ui/store/activity/StoreActivity.kt | 5 ++- .../ui/store/activity/StoreDetailActivity.kt | 5 ++- 5 files changed, 51 insertions(+), 38 deletions(-) create mode 100644 core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt diff --git a/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt b/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt index d997a5446..59a95cc32 100644 --- a/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt +++ b/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt @@ -10,6 +10,7 @@ import com.google.firebase.analytics.FirebaseAnalytics import com.google.firebase.analytics.ktx.analytics import com.google.firebase.analytics.ktx.logEvent import com.google.firebase.ktx.Firebase +import `in`.koreatech.koin.core.analytics.EventLogger import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.progressdialog.CustomProgressDialog import `in`.koreatech.koin.core.progressdialog.IProgressDialog @@ -59,39 +60,6 @@ abstract class ActivityBase : AppCompatActivity, IProgressDialog { } } - /** - * @param action: 이벤트 발생 도메인(BUSINESS, CAMPUS, USER) - * @param label: 이벤트 소분류 - * @param value: 이벤트 값 - */ - protected fun logClickEvent(action: String, label: String, value: String) { - logEvent(action, AnalyticsConstant.Category.CLICK, label, value) - } - - /** - * @param action: 이벤트 발생 도메인(BUSINESS, CAMPUS, USER) - * @param label: 이벤트 소분류 - * @param value: 이벤트 값 - */ - protected fun logScrollEvent(action: String, label: String, value: String) { - logEvent(action, AnalyticsConstant.Category.SCROLL, label, value) - } - - /** - * @param action: 이벤트 발생 도메인(BUSINESS, CAMPUS, USER) - * @param category: 이벤트 종류(click, scroll, ...) - * @param label: 이벤트 소분류 - * @param value: 이벤트 값 - * @sample logEvent("BUSINESS", "click", "main_store_categories", "전체보기") - */ - private fun logEvent(action: String, category: String, label: String, value: String) { - Firebase.analytics.logEvent(action) { - param("event_category", category) - param("event_label", label) - param("value", value) - } - } - companion object { const val INPUT_METHOD_SERVICE: String = Context.INPUT_METHOD_SERVICE const val PAGE_TITLE = "page_title" diff --git a/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt b/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt new file mode 100644 index 000000000..2b04e53eb --- /dev/null +++ b/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt @@ -0,0 +1,42 @@ +package `in`.koreatech.koin.core.analytics + +import com.google.firebase.analytics.ktx.analytics +import com.google.firebase.analytics.ktx.logEvent +import com.google.firebase.ktx.Firebase +import `in`.koreatech.koin.core.constant.AnalyticsConstant + +object EventLogger { + + /** + * @param action: 이벤트 발생 도메인(BUSINESS, CAMPUS, USER) + * @param label: 이벤트 소분류 + * @param value: 이벤트 값 + */ + fun logClickEvent(action: String, label: String, value: String) { + logEvent(action, AnalyticsConstant.Category.CLICK, label, value) + } + + /** + * @param action: 이벤트 발생 도메인(BUSINESS, CAMPUS, USER) + * @param label: 이벤트 소분류 + * @param value: 이벤트 값 + */ + fun logScrollEvent(action: String, label: String, value: String) { + logEvent(action, AnalyticsConstant.Category.SCROLL, label, value) + } + + /** + * @param action: 이벤트 발생 도메인(BUSINESS, CAMPUS, USER) + * @param category: 이벤트 종류(click, scroll, ...) + * @param label: 이벤트 소분류 + * @param value: 이벤트 값 + * @sample logEvent("BUSINESS", "click", "main_store_categories", "전체보기") + */ + private fun logEvent(action: String, category: String, label: String, value: String) { + Firebase.analytics.logEvent(action) { + param("event_category", category) + param("event_label", label) + param("value", value) + } + } +} \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt index dfe9687d3..f75b85df4 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt @@ -10,6 +10,7 @@ import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayoutMediator import dagger.hilt.android.AndroidEntryPoint import `in`.koreatech.koin.R +import `in`.koreatech.koin.core.analytics.EventLogger import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.recyclerview.RecyclerViewClickListener import `in`.koreatech.koin.core.util.dataBinding @@ -44,7 +45,7 @@ class MainActivity : KoinNavigationDrawerActivity() { setRecyclerViewClickListener(object : RecyclerViewClickListener { override fun onClick(view: View?, position: Int) { gotoStoreActivity(position) - logClickEvent( + EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, AnalyticsConstant.Label.MAIN_STORE_CATEGORIES, view?.findViewById(R.id.text_view_store_category)?.text.toString() diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt index e3d9cc979..7ed9f01df 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt @@ -14,6 +14,7 @@ import androidx.lifecycle.repeatOnLifecycle import androidx.recyclerview.widget.LinearLayoutManager import dagger.hilt.android.AndroidEntryPoint import `in`.koreatech.koin.R +import `in`.koreatech.koin.core.analytics.EventLogger import `in`.koreatech.koin.core.appbar.AppBarBase import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.util.dataBinding @@ -47,7 +48,7 @@ class StoreActivity : KoinNavigationDrawerActivity() { private val storeAdapter = StoreRecyclerAdapter().apply { setOnItemClickListener { storeDetailContract.launch(it.uid) - logClickEvent( + EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, "store_${it.name}_click", it.name) @@ -217,7 +218,7 @@ class StoreActivity : KoinNavigationDrawerActivity() { if(viewModel.category.value == category) eventValue = getString(R.string.unselect_see_all) - logClickEvent( + EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, AnalyticsConstant.Label.STORE_CATEGORIES, eventValue) diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt index 87a060cc3..17d567e65 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt @@ -8,6 +8,7 @@ import androidx.appcompat.app.AlertDialog import androidx.core.view.isVisible import androidx.recyclerview.widget.LinearLayoutManager import `in`.koreatech.koin.R +import `in`.koreatech.koin.core.analytics.EventLogger import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.toast.ToastUtil import `in`.koreatech.koin.core.util.dataBinding @@ -85,7 +86,7 @@ class StoreDetailActivity : KoinNavigationDrawerActivity() { flyerDialogFragment = StoreFlyerDialogFragment() flyerDialogFragment?.initialPosition = position flyerDialogFragment?.show(supportFragmentManager, DIALOG_TAG) - logClickEvent( + EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, "store_${viewModel.store.value?.name ?: "Unknown"}_picture", viewModel.store.value?.name ?: "Unknown") @@ -125,7 +126,7 @@ class StoreDetailActivity : KoinNavigationDrawerActivity() { binding.storeDetailCallButton.setOnClickListener { showCallDialog() - logClickEvent( + EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, "store_${viewModel.store.value?.name ?: "Unknown"}_call", viewModel.store.value?.name ?: "Unknown") From bf0ff79783056d6b5af8836d283e2dc542510aa6 Mon Sep 17 00:00:00 2001 From: Strone Date: Thu, 25 Apr 2024 21:13:58 +0900 Subject: [PATCH 08/31] Add Hamburger click event analytics --- .../koin/core/appbar/AppBarBase.java | 11 +++++- .../koin/core/constant/AnalyticsConstant.kt | 7 ++++ core/src/main/res/values/strings.xml | 1 + .../koin/ui/main/activity/MainActivity.kt | 5 +++ .../KoinNavigationDrawerActivity.kt | 38 +++++++++++++++++-- koin/src/main/res/values/strings.xml | 2 + 6 files changed, 59 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/in/koreatech/koin/core/appbar/AppBarBase.java b/core/src/main/java/in/koreatech/koin/core/appbar/AppBarBase.java index 9408291f0..e07a4b085 100644 --- a/core/src/main/java/in/koreatech/koin/core/appbar/AppBarBase.java +++ b/core/src/main/java/in/koreatech/koin/core/appbar/AppBarBase.java @@ -17,6 +17,8 @@ import in.koreatech.koin.core.R; +import in.koreatech.koin.core.analytics.EventLogger; +import in.koreatech.koin.core.constant.AnalyticsConstant; public class AppBarBase extends AppBarLayout { @@ -50,7 +52,14 @@ public void setOnClickListener(OnClickListener onClickListener) { this.onClickListener = onClickListener; background.setOnClickListener(onClickListener); leftButton.setOnClickListener(onClickListener); - rightButton.setOnClickListener(onClickListener); + rightButton.setOnClickListener(v -> { + onClickListener.onClick(v); + EventLogger.INSTANCE.logClickEvent( + AnalyticsConstant.Domain.USER, + AnalyticsConstant.Label.HAMBURGER, + getContext().getString(R.string.hamburger) + ); + }); title.setOnClickListener(onClickListener); } diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index 984c53c38..2c8ecfd78 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -16,6 +16,13 @@ object AnalyticsConstant { object Label { const val MAIN_STORE_CATEGORIES = "main_store_categories" const val STORE_CATEGORIES = "store_categories" + const val HAMBURGER = "hamburger" + const val HAMBURGER_STORE = "${HAMBURGER}_store" + const val HAMBURGER_DINING = "${HAMBURGER}_dining" + const val HAMBURGER_MY_INFO_WITHOUT_LOGIN = "${HAMBURGER}_my_info_without_login" + const val HAMBURGER_MY_INFO_WITH_LOGIN = "${HAMBURGER}_my_info_with_login" + const val HAMBURGER_BUS = "${HAMBURGER}_bus" + const val USER_ONLY_OK = "user_only_ok" } } \ No newline at end of file diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index f6bee74e2..e97e247f1 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -76,4 +76,5 @@ 문의하기 님, 안녕하세요! 내 정보 + 햄버거 diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt index f75b85df4..61f31ee4c 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt @@ -74,6 +74,11 @@ class MainActivity : KoinNavigationDrawerActivity() { private fun initView() = with(binding) { buttonCategory.setOnClickListener { toggleNavigationDrawer() + EventLogger.logClickEvent( + AnalyticsConstant.Domain.USER, + AnalyticsConstant.Label.HAMBURGER, + getString(R.string.hamburger) + ) } busViewPager.apply { diff --git a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt index cc422db7c..27343f2d9 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt @@ -19,6 +19,8 @@ import `in`.koreatech.koin.BuildConfig import `in`.koreatech.koin.R import `in`.koreatech.koin.core.activity.ActivityBase import `in`.koreatech.koin.core.activity.WebViewActivity +import `in`.koreatech.koin.core.analytics.EventLogger +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.toast.ToastUtil import `in`.koreatech.koin.data.constant.URLConstant import `in`.koreatech.koin.domain.model.user.User @@ -203,12 +205,31 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), } observeLiveData(menuEvent) { menuState -> + var action = "" + var label = "" + var value = "" when (menuState) { - MenuState.Bus -> goToBusActivity() - MenuState.Dining -> goToDiningActivity() + MenuState.Bus -> { + action = AnalyticsConstant.Domain.CAMPUS + label = AnalyticsConstant.Label.HAMBURGER_BUS + value = getString(R.string.navigation_item_bus) + goToBusActivity() + } + MenuState.Dining -> { + action = AnalyticsConstant.Domain.CAMPUS + label = AnalyticsConstant.Label.HAMBURGER_DINING + value = getString(R.string.navigation_item_dining) + goToDiningActivity() + } MenuState.Land -> goToLandActivity() MenuState.Main -> goToMainActivity() - MenuState.Store -> goToStoreActivity() + MenuState.Store -> { + action = AnalyticsConstant.Domain.BUSINESS + label = AnalyticsConstant.Label.HAMBURGER_STORE + value = getString(R.string.nearby_stores) + goToStoreActivity() + } + MenuState.Timetable -> { if (userState.value == null || userState.value?.isAnonymous == true) { goToAnonymousTimeTableActivity() @@ -218,15 +239,19 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), } MenuState.UserInfo -> { + action = AnalyticsConstant.Domain.USER + value = getString(R.string.navigation_drawer_right_myinfo) if (userState.value == null || userState.value?.isAnonymous == true) { + label = AnalyticsConstant.Label.HAMBURGER_MY_INFO_WITHOUT_LOGIN showLoginRequestDialog() } else { + label = AnalyticsConstant.Label.HAMBURGER_MY_INFO_WITH_LOGIN goToUserInfoActivity() } } - else -> Unit } + EventLogger.logClickEvent(action, label, value) drawerLayout.closeDrawer() } } @@ -379,6 +404,11 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), ) intent.putExtra("FIRST_LOGIN", false) startActivity(intent) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.USER, + AnalyticsConstant.Label.USER_ONLY_OK, + getString(R.string.user_only_ok) + ) overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.fade_out) } .setNegativeButton(getString(R.string.navigation_cancel)) { dialog, _ -> diff --git a/koin/src/main/res/values/strings.xml b/koin/src/main/res/values/strings.xml index ecec68477..c9e10f5c8 100644 --- a/koin/src/main/res/values/strings.xml +++ b/koin/src/main/res/values/strings.xml @@ -381,4 +381,6 @@ 미용실 기타 미지정(전체보기) + 주변상점 + 회원전용 확인 From 9b2b890d6cb79b7a68681e056dfc7120657a3802 Mon Sep 17 00:00:00 2001 From: Strone Date: Thu, 25 Apr 2024 23:57:52 +0900 Subject: [PATCH 09/31] Add MainActivity dining click event analytics --- .../koin/core/constant/AnalyticsConstant.kt | 2 ++ .../koin/ui/main/activity/MainActivity.kt | 4 ++++ .../ui/main/fragment/DiningContainerFragment.kt | 14 ++++++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index 2c8ecfd78..432417662 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -23,6 +23,8 @@ object AnalyticsConstant { const val HAMBURGER_MY_INFO_WITH_LOGIN = "${HAMBURGER}_my_info_with_login" const val HAMBURGER_BUS = "${HAMBURGER}_bus" const val USER_ONLY_OK = "user_only_ok" + const val MAIN_MENU_MOVEDETAILVIEW = "main_menu_moveDetailView" + const val MAIN_MENU_CORNER = "main_menu_corner" } } \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt index 61f31ee4c..d7af60792 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt @@ -120,6 +120,10 @@ class MainActivity : KoinNavigationDrawerActivity() { tabDining.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { override fun onTabSelected(tab: TabLayout.Tab) { viewModel.setSelectedPosition(tab.position) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.MAIN_MENU_CORNER, + tab.text.toString()) } override fun onTabUnselected(tab: TabLayout.Tab) {} diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt b/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt index d040cdc44..1865d4d2d 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt @@ -1,5 +1,6 @@ package `in`.koreatech.koin.ui.main.fragment +import android.content.Intent import android.os.Bundle import android.view.View import androidx.core.content.ContextCompat @@ -8,6 +9,8 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import dagger.hilt.android.AndroidEntryPoint import `in`.koreatech.koin.R +import `in`.koreatech.koin.core.analytics.EventLogger +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.util.dataBinding import `in`.koreatech.koin.data.util.localized import `in`.koreatech.koin.databinding.FragmentDiningContainerBinding @@ -15,6 +18,7 @@ import `in`.koreatech.koin.domain.model.dining.Dining import `in`.koreatech.koin.domain.util.DiningUtil import `in`.koreatech.koin.domain.util.ext.arrange import `in`.koreatech.koin.domain.util.ext.typeFilter +import `in`.koreatech.koin.ui.dining.DiningActivity import `in`.koreatech.koin.ui.main.activity.MainActivity import `in`.koreatech.koin.ui.main.viewmodel.MainActivityViewModel import `in`.koreatech.koin.util.ext.observeLiveData @@ -34,10 +38,12 @@ class DiningContainerFragment : Fragment(R.layout.fragment_dining_container) { private fun initView() = with(binding) { diningContainer.setOnClickListener { - if (activity is MainActivity) { - val mainActivity = activity as MainActivity - mainActivity.callDrawerItem(R.id.navi_item_dining) - } + startActivity(Intent(requireContext(), DiningActivity::class.java)) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.MAIN_MENU_MOVEDETAILVIEW, + requireContext().getString(R.string.navigation_item_dining) + ) } } From a545e9fdadd69b82e75f06be35048df2ebcd7f6a Mon Sep 17 00:00:00 2001 From: Strone Date: Fri, 26 Apr 2024 00:50:31 +0900 Subject: [PATCH 10/31] Add dining time click/scroll event analytics --- .../koin/core/constant/AnalyticsConstant.kt | 1 + .../koin/ui/dining/DiningActivity.kt | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index 432417662..d7f3f8c82 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -25,6 +25,7 @@ object AnalyticsConstant { const val USER_ONLY_OK = "user_only_ok" const val MAIN_MENU_MOVEDETAILVIEW = "main_menu_moveDetailView" const val MAIN_MENU_CORNER = "main_menu_corner" + const val MENU_TIME = "menu_time" } } \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/dining/DiningActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/dining/DiningActivity.kt index 555128f34..23b884bb5 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/dining/DiningActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/dining/DiningActivity.kt @@ -6,10 +6,13 @@ import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle import androidx.recyclerview.widget.LinearLayoutManager +import androidx.viewpager2.widget.ViewPager2 import com.google.android.material.tabs.TabLayoutMediator import dagger.hilt.android.AndroidEntryPoint import `in`.koreatech.koin.R +import `in`.koreatech.koin.core.analytics.EventLogger import `in`.koreatech.koin.core.appbar.AppBarBase +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.util.dataBinding import `in`.koreatech.koin.databinding.ActivityDiningBinding import `in`.koreatech.koin.domain.model.dining.DiningType @@ -35,11 +38,14 @@ class DiningActivity : KoinNavigationDrawerActivity() { private val diningDateAdapter by lazy { DiningDateAdapter { viewModel.setSelectedDate(it) } } + private lateinit var diningViewPagerScrollCallback: ViewPager2.OnPageChangeCallback + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(binding.root) + initDiningViewPagerScrollCallback() initCalendar() initViewPager() @@ -67,6 +73,7 @@ class DiningActivity : KoinNavigationDrawerActivity() { diningViewPager.apply { offscreenPageLimit = 3 adapter = DiningItemsViewPager2Adapter(this@DiningActivity) + registerOnPageChangeCallback(diningViewPagerScrollCallback) } TabLayoutMediator(tabsDiningTime, diningViewPager) { tab, position -> tab.text = when (position) { @@ -85,6 +92,17 @@ class DiningActivity : KoinNavigationDrawerActivity() { diningDateAdapter.setSelectedPosition(dates.size / 2 + 1) } } + // 스크롤이 아닌 탭 선택 이벤트만 받기 위한 구현 + repeat(binding.tabsDiningTime.tabCount) { + val tab = binding.tabsDiningTime.getTabAt(it) + tab?.view?.setOnClickListener { + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.MENU_TIME, + tab.text.toString() + ) + } + } } } @@ -116,4 +134,30 @@ class DiningActivity : KoinNavigationDrawerActivity() { layoutManager?.scrollToPositionWithOffset(todayPosition, offset) } } + + private fun initDiningViewPagerScrollCallback() { + // 탭 선택이 아닌 스크롤 이벤트만 받기 위한 구현 + diningViewPagerScrollCallback = object : ViewPager2.OnPageChangeCallback() { + var isUserScrolling = false + override fun onPageScrollStateChanged(state: Int) { + super.onPageScrollStateChanged(state) + if(state == ViewPager2.SCROLL_STATE_DRAGGING){ + isUserScrolling = true + } else if(state == ViewPager2.SCROLL_STATE_IDLE){ + if(isUserScrolling){ + EventLogger.logScrollEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.MENU_TIME, + binding.tabsDiningTime.getTabAt(binding.tabsDiningTime.selectedTabPosition)?.text.toString() + ) + } + isUserScrolling = false + } + } + } + } + override fun onDestroy() { + super.onDestroy() + binding.diningViewPager.unregisterOnPageChangeCallback(diningViewPagerScrollCallback) + } } \ No newline at end of file From 047afefe1fddc10361347357db695560ae8951ce Mon Sep 17 00:00:00 2001 From: Strone Date: Fri, 26 Apr 2024 01:30:20 +0900 Subject: [PATCH 11/31] Add MainActivity bus card click event analytics --- .../koin/core/constant/AnalyticsConstant.kt | 2 ++ .../koin/ui/main/activity/MainActivity.kt | 21 +++++++++++++++++-- .../koin/ui/main/adapter/BusPagerAdapter.kt | 10 ++++----- .../main/viewmodel/MainActivityViewModel.kt | 1 + .../KoinNavigationDrawerActivity.kt | 2 +- koin/src/main/res/values/strings.xml | 1 + 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index d7f3f8c82..67a51b407 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -26,6 +26,8 @@ object AnalyticsConstant { const val MAIN_MENU_MOVEDETAILVIEW = "main_menu_moveDetailView" const val MAIN_MENU_CORNER = "main_menu_corner" const val MENU_TIME = "menu_time" + const val MAIN_BUS = "main_bus" + const val MAIN_BUS_CHANGETOFROM = "main_bus_changeToFrom" } } \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt index d7af60792..151eebb02 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt @@ -1,5 +1,6 @@ package `in`.koreatech.koin.ui.main.activity +import android.content.Intent import android.os.Bundle import android.view.View import android.widget.TextView @@ -16,9 +17,11 @@ import `in`.koreatech.koin.core.recyclerview.RecyclerViewClickListener import `in`.koreatech.koin.core.util.dataBinding import `in`.koreatech.koin.core.viewpager.HorizontalMarginItemDecoration import `in`.koreatech.koin.core.viewpager.ScaledViewPager2Transformation +import `in`.koreatech.koin.data.util.localized import `in`.koreatech.koin.data.util.todayOrTomorrow import `in`.koreatech.koin.databinding.ActivityMainBinding import `in`.koreatech.koin.domain.model.dining.DiningPlace +import `in`.koreatech.koin.ui.bus.BusActivity import `in`.koreatech.koin.ui.main.StoreCategoryRecyclerAdapter import `in`.koreatech.koin.ui.main.adapter.BusPagerAdapter import `in`.koreatech.koin.ui.main.adapter.DiningContainerViewPager2Adapter @@ -36,8 +39,22 @@ class MainActivity : KoinNavigationDrawerActivity() { private val viewModel by viewModels() private val busPagerAdapter = BusPagerAdapter().apply { - setOnCardClickListener { callDrawerItem(R.id.navi_item_bus, Bundle()) } - setOnSwitchClickListener { viewModel.switchBusNode() } + setOnCardClickListener { + startActivity(Intent(this@MainActivity, BusActivity::class.java)) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.MAIN_BUS, + getString(R.string.bus) + ) + } + setOnSwitchClickListener { + viewModel.switchBusNode() + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.MAIN_BUS_CHANGETOFROM, + it.localized(this@MainActivity) + ) + } } private val diningContainerAdapter by lazy { DiningContainerViewPager2Adapter(this) } diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/adapter/BusPagerAdapter.kt b/koin/src/main/java/in/koreatech/koin/ui/main/adapter/BusPagerAdapter.kt index 65f7624cd..2f5df7004 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/adapter/BusPagerAdapter.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/adapter/BusPagerAdapter.kt @@ -30,7 +30,7 @@ class BusPagerAdapter : RecyclerView.Adapter Unit) { + inline fun setOnSwitchClickListener(crossinline onSwitchClick: (BusArrivalInfo) -> Unit) { onSwitchClickListener = object : OnSwitchClickListener { - override fun onSwitchClick() { - onSwitchClick() + override fun onSwitchClick(busArrivalInfo: BusArrivalInfo) { + onSwitchClick(busArrivalInfo) } } } @@ -111,7 +111,7 @@ class BusPagerAdapter : RecyclerView.Adapter>(BusNode.Koreatech to BusNode.Terminal) + val busNode: LiveData> get() = _busNode private val _selectedPosition = MutableLiveData(0) val selectedPosition : LiveData get() = _selectedPosition diff --git a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt index 27343f2d9..1efc50af4 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt @@ -212,7 +212,7 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), MenuState.Bus -> { action = AnalyticsConstant.Domain.CAMPUS label = AnalyticsConstant.Label.HAMBURGER_BUS - value = getString(R.string.navigation_item_bus) + value = getString(R.string.bus) goToBusActivity() } MenuState.Dining -> { diff --git a/koin/src/main/res/values/strings.xml b/koin/src/main/res/values/strings.xml index c9e10f5c8..192e30aa5 100644 --- a/koin/src/main/res/values/strings.xml +++ b/koin/src/main/res/values/strings.xml @@ -383,4 +383,5 @@ 미지정(전체보기) 주변상점 회원전용 확인 + 버스 From 174b67d2c2bf991471a3164d9409b2d17e90aab4 Mon Sep 17 00:00:00 2001 From: Strone Date: Fri, 26 Apr 2024 14:35:20 +0900 Subject: [PATCH 12/31] Add MainActivity bus card scroll event analytics --- .../koin/core/constant/AnalyticsConstant.kt | 1 + .../koin/ui/main/activity/MainActivity.kt | 30 ++++++++++++++++++- .../main/viewmodel/MainActivityViewModel.kt | 1 - 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index 67a51b407..3796d406d 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -28,6 +28,7 @@ object AnalyticsConstant { const val MENU_TIME = "menu_time" const val MAIN_BUS = "main_bus" const val MAIN_BUS_CHANGETOFROM = "main_bus_changeToFrom" + const val MAIN_BUS_SCROLL = "main_bus_scroll" } } \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt index 151eebb02..6ddfb85c4 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt @@ -7,6 +7,7 @@ import android.widget.TextView import androidx.activity.viewModels import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import androidx.viewpager2.widget.ViewPager2 import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayoutMediator import dagger.hilt.android.AndroidEntryPoint @@ -16,10 +17,10 @@ import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.recyclerview.RecyclerViewClickListener import `in`.koreatech.koin.core.util.dataBinding import `in`.koreatech.koin.core.viewpager.HorizontalMarginItemDecoration -import `in`.koreatech.koin.core.viewpager.ScaledViewPager2Transformation import `in`.koreatech.koin.data.util.localized import `in`.koreatech.koin.data.util.todayOrTomorrow import `in`.koreatech.koin.databinding.ActivityMainBinding +import `in`.koreatech.koin.domain.model.bus.timer.BusArrivalInfo import `in`.koreatech.koin.domain.model.dining.DiningPlace import `in`.koreatech.koin.ui.bus.BusActivity import `in`.koreatech.koin.ui.main.StoreCategoryRecyclerAdapter @@ -56,6 +57,9 @@ class MainActivity : KoinNavigationDrawerActivity() { ) } } + private lateinit var busViewPagerScrollCallback: ViewPager2.OnPageChangeCallback + private var isBusScrollCallbackInitialized = false + private val diningContainerAdapter by lazy { DiningContainerViewPager2Adapter(this) } private val storeCategoryRecyclerAdapter = StoreCategoryRecyclerAdapter().apply { @@ -160,12 +164,36 @@ class MainActivity : KoinNavigationDrawerActivity() { observeLiveData(busTimer) { busPagerAdapter.setBusTimerItems(it) + if (!isBusScrollCallbackInitialized) { + initBusViewPagerScrollCallback(it) + isBusScrollCallbackInitialized = true + } } } + private fun initBusViewPagerScrollCallback(busArrivalInfos: List) { + busViewPagerScrollCallback = object : ViewPager2.OnPageChangeCallback() { + var prev = 0 + override fun onPageSelected(position: Int) { + super.onPageSelected(position) + EventLogger.logScrollEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.MAIN_BUS_SCROLL, + busArrivalInfos[prev % 3].localized(this@MainActivity) + ">" + busArrivalInfos[position % 3].localized(this@MainActivity) + ) + prev = position + } + }.also { binding.busViewPager.registerOnPageChangeCallback(it) } + } + private fun gotoStoreActivity(position: Int) { val bundle = Bundle() bundle.putInt(StoreActivityContract.STORE_CATEGORY, position) callDrawerItem(R.id.navi_item_store, bundle) } + + override fun onDestroy() { + super.onDestroy() + binding.busViewPager.unregisterOnPageChangeCallback(busViewPagerScrollCallback) + } } diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/viewmodel/MainActivityViewModel.kt b/koin/src/main/java/in/koreatech/koin/ui/main/viewmodel/MainActivityViewModel.kt index a90b81115..549e71f07 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/viewmodel/MainActivityViewModel.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/viewmodel/MainActivityViewModel.kt @@ -25,7 +25,6 @@ class MainActivityViewModel @Inject constructor( ) : BaseViewModel() { private val _busNode = MutableLiveData>(BusNode.Koreatech to BusNode.Terminal) - val busNode: LiveData> get() = _busNode private val _selectedPosition = MutableLiveData(0) val selectedPosition : LiveData get() = _selectedPosition From 661e3b41a2991399775bd0cecefafac135c14b98 Mon Sep 17 00:00:00 2001 From: Strone Date: Fri, 26 Apr 2024 14:57:56 +0900 Subject: [PATCH 13/31] Add BusMainFragment spinner click event analytics --- .../koin/core/constant/AnalyticsConstant.kt | 2 ++ .../koin/ui/bus/fragment/BusMainFragment.kt | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index 3796d406d..89d4b6b49 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -29,6 +29,8 @@ object AnalyticsConstant { const val MAIN_BUS = "main_bus" const val MAIN_BUS_CHANGETOFROM = "main_bus_changeToFrom" const val MAIN_BUS_SCROLL = "main_bus_scroll" + const val BUS_DEPARTURE = "bus_departure" + const val BUS_ARRIVAL = "bus_arrival" } } \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusMainFragment.kt b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusMainFragment.kt index e75bf77b1..183c84676 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusMainFragment.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusMainFragment.kt @@ -24,6 +24,8 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import androidx.recyclerview.widget.LinearLayoutManager import dagger.hilt.android.AndroidEntryPoint +import `in`.koreatech.koin.core.analytics.EventLogger +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.util.dataBinding @AndroidEntryPoint @@ -41,14 +43,40 @@ class BusMainFragment : Fragment(R.layout.bus_main_fragment) { initViewModel() } + private var isUserSelection = false private fun initView() = with(binding) { busDepartureSpinner.setSelection(BusNode.Koreatech.spinnerSelection) busArrivalSpinner.setSelection(BusNode.Terminal.spinnerSelection) + busDepartureSpinner.setOnTouchListener { _, _ -> + isUserSelection = true + busDepartureSpinner.performClick() + } busDepartureSpinner.setOnItemSelectedListener { _, _, position, _ -> viewModel.setDeparture(position.busNodeSelection) + if(isUserSelection) { + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.BUS_DEPARTURE, + resources.getStringArray(R.array.bus_place)[position] + ) + isUserSelection = false + } + } + + busArrivalSpinner.setOnTouchListener { _, _ -> + isUserSelection = true + busArrivalSpinner.performClick() } busArrivalSpinner.setOnItemSelectedListener { _, _, position, _ -> viewModel.setArrival(position.busNodeSelection) + if(isUserSelection) { + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.BUS_ARRIVAL, + resources.getStringArray(R.array.bus_place)[position] + ) + isUserSelection = false + } } recyclerView.apply { layoutManager = LinearLayoutManager(requireContext()) From 3f6121371c01e9c28e55ddf5e1d3a8ada70a81b9 Mon Sep 17 00:00:00 2001 From: Strone Date: Fri, 26 Apr 2024 15:14:00 +0900 Subject: [PATCH 14/31] Add BusTimetableFragment click event analytics --- .../koin/core/constant/AnalyticsConstant.kt | 4 ++++ data/src/main/res/values/strings.xml | 1 + .../ui/bus/fragment/BusTimetableFragment.kt | 17 +++++++++++++++++ .../bus/fragment/ExpressBusTimetableFragment.kt | 7 +++++++ .../bus/fragment/ShuttleBusTimetableFragment.kt | 12 ++++++++++++ 5 files changed, 41 insertions(+) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index 89d4b6b49..f09a96a41 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -31,6 +31,10 @@ object AnalyticsConstant { const val MAIN_BUS_SCROLL = "main_bus_scroll" const val BUS_DEPARTURE = "bus_departure" const val BUS_ARRIVAL = "bus_arrival" + const val BUS_TIMETABLE = "bus_timetable" + const val BUS_TIMETABLE_AREA = "bus_timetable_area" + const val BUS_TIMETABLE_TIME = "bus_timetable_time" + const val BUS_TIMETABLE_EXPRESS = "bus_timetable_express" } } \ No newline at end of file diff --git a/data/src/main/res/values/strings.xml b/data/src/main/res/values/strings.xml index 919578216..d59d863ed 100644 --- a/data/src/main/res/values/strings.xml +++ b/data/src/main/res/values/strings.xml @@ -41,6 +41,7 @@ 통학버스 대성고속 셔틀버스 + 학교셔틀 %1$d번 버스 기계공학부 diff --git a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusTimetableFragment.kt b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusTimetableFragment.kt index 317bc0eab..f23636b97 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusTimetableFragment.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusTimetableFragment.kt @@ -12,6 +12,8 @@ import android.view.View import androidx.fragment.app.commit import androidx.fragment.app.viewModels import dagger.hilt.android.AndroidEntryPoint +import `in`.koreatech.koin.core.analytics.EventLogger +import `in`.koreatech.koin.core.constant.AnalyticsConstant @AndroidEntryPoint class BusTimetableFragment : DataBindingFragment() { @@ -39,12 +41,27 @@ class BusTimetableFragment : DataBindingFragment() binding.busTimetableBustypeShuttle.setOnClickListener { busTimetableViewModel.setBusType(BusType.Shuttle) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.BUS_TIMETABLE, + getString(R.string.bus_name_school_shuttle) + ) } binding.busTimetableBustypeDaesung.setOnClickListener { busTimetableViewModel.setBusType(BusType.Express) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.BUS_TIMETABLE, + getString(R.string.bus_name_express) + ) } binding.busTimetableBustypeCity.setOnClickListener { busTimetableViewModel.setBusType(BusType.City) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.BUS_TIMETABLE, + getString(R.string.bus_name_city) + ) } } diff --git a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ExpressBusTimetableFragment.kt b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ExpressBusTimetableFragment.kt index 094bdf497..70231199f 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ExpressBusTimetableFragment.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ExpressBusTimetableFragment.kt @@ -23,6 +23,8 @@ import androidx.core.view.isVisible import androidx.fragment.app.viewModels import androidx.recyclerview.widget.LinearLayoutManager import dagger.hilt.android.AndroidEntryPoint +import `in`.koreatech.koin.core.analytics.EventLogger +import `in`.koreatech.koin.core.constant.AnalyticsConstant @AndroidEntryPoint class ExpressBusTimetableFragment : DataBindingFragment() { @@ -47,6 +49,11 @@ class ExpressBusTimetableFragment : DataBindingFragment expressBusTimetableViewModel.setCoursePosition(position) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.BUS_TIMETABLE_EXPRESS, + busTimetableCoursesSpinner.selectedItem.toString() + ) } } diff --git a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ShuttleBusTimetableFragment.kt b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ShuttleBusTimetableFragment.kt index b88eda563..6cc9538ed 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ShuttleBusTimetableFragment.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ShuttleBusTimetableFragment.kt @@ -8,6 +8,8 @@ import androidx.fragment.app.viewModels import androidx.recyclerview.widget.LinearLayoutManager import dagger.hilt.android.AndroidEntryPoint import `in`.koreatech.koin.R +import `in`.koreatech.koin.core.analytics.EventLogger +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.fragment.DataBindingFragment import `in`.koreatech.koin.core.progressdialog.IProgressDialog import `in`.koreatech.koin.databinding.LayoutShuttleBusTimetableBinding @@ -42,10 +44,20 @@ class ShuttleBusTimetableFragment : DataBindingFragment shuttleBusTimetableViewModel.setCoursePosition(position) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.BUS_TIMETABLE_AREA, + busTimetableCoursesSpinner.selectedItem.toString() + ) } busTimetableRoutesSpinner.setOnItemSelectedListener { _, _, position, _ -> shuttleBusTimetableViewModel.setRoutePosition(position) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.BUS_TIMETABLE_TIME, + busTimetableRoutesSpinner.selectedItem.toString() + ) } } From 05d14a7df122e27291f91e7e7ce877a29ef8f855 Mon Sep 17 00:00:00 2001 From: Strone Date: Fri, 26 Apr 2024 16:25:48 +0900 Subject: [PATCH 15/31] Add Dining menu image click event analytics --- .../koin/core/constant/AnalyticsConstant.kt | 1 + .../in/koreatech/koin/domain/util/DiningUtil.kt | 10 ++++++++++ .../koin/ui/dining/adapter/DiningAdapter.kt | 16 ++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index f09a96a41..7e85ae1a8 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -35,6 +35,7 @@ object AnalyticsConstant { const val BUS_TIMETABLE_AREA = "bus_timetable_area" const val BUS_TIMETABLE_TIME = "bus_timetable_time" const val BUS_TIMETABLE_EXPRESS = "bus_timetable_express" + const val MENU_IMAGE = "menu_image" } } \ No newline at end of file diff --git a/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt b/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt index bdda26a05..bfb433115 100644 --- a/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt +++ b/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt @@ -40,4 +40,14 @@ object DiningUtil { } return null } + + fun getKoreanName(type: String): String { + return when (type) { + DiningType.Breakfast.typeEnglish -> DiningType.Breakfast.typeKorean + DiningType.Lunch.typeEnglish -> DiningType.Lunch.typeKorean + DiningType.Dinner.typeEnglish -> DiningType.Dinner.typeKorean + DiningType.NextBreakfast.typeEnglish -> DiningType.NextBreakfast.typeKorean + else -> "" + } + } } \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/dining/adapter/DiningAdapter.kt b/koin/src/main/java/in/koreatech/koin/ui/dining/adapter/DiningAdapter.kt index 3d56b696a..02713b93b 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/dining/adapter/DiningAdapter.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/dining/adapter/DiningAdapter.kt @@ -13,8 +13,11 @@ import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide import `in`.koreatech.koin.R +import `in`.koreatech.koin.core.analytics.EventLogger +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.databinding.ItemDiningBinding import `in`.koreatech.koin.domain.model.dining.Dining +import `in`.koreatech.koin.domain.util.DiningUtil class DiningAdapter : ListAdapter(diffCallback) { @@ -85,6 +88,19 @@ class DiningAdapter : ListAdapter(diffCallback) .load(dining.imageUrl) .into(imageView) dialog.show() + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.MENU_IMAGE, + DiningUtil.getKoreanName(dining.type) + "_" + dining.place + ) + } + } else { + cardViewDining.setOnClickListener { + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.MENU_IMAGE, + DiningUtil.getKoreanName(dining.type) + "_" + dining.place + ) } } From be3a4c8c1d46a1d34f476e703ced16ba34bacb2f Mon Sep 17 00:00:00 2001 From: Strone Date: Fri, 26 Apr 2024 17:46:32 +0900 Subject: [PATCH 16/31] Add Store search click event analytics, Modify get name logic --- .../koin/core/constant/AnalyticsConstant.kt | 1 + .../koin/ui/store/activity/StoreActivity.kt | 53 ++++++++++++------- koin/src/main/res/values/strings.xml | 2 +- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index 7e85ae1a8..50ee928a6 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -16,6 +16,7 @@ object AnalyticsConstant { object Label { const val MAIN_STORE_CATEGORIES = "main_store_categories" const val STORE_CATEGORIES = "store_categories" + const val STORE_CATEGORIES_SEARCH = "store_categories_search" const val HAMBURGER = "hamburger" const val HAMBURGER_STORE = "${HAMBURGER}_store" const val HAMBURGER_DINING = "${HAMBURGER}_dining" diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt index 7ed9f01df..215de808f 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt @@ -2,6 +2,7 @@ package `in`.koreatech.koin.ui.store.activity import android.os.Bundle import android.util.Log +import android.view.MotionEvent import android.view.View import android.widget.TextView import androidx.activity.viewModels @@ -107,6 +108,18 @@ class StoreActivity : KoinNavigationDrawerActivity() { isSearchMode = hasFocus } + binding.searchEditText.setOnTouchListener { v, event -> + if(event.action == MotionEvent.ACTION_DOWN) { + EventLogger.logClickEvent( + AnalyticsConstant.Domain.BUSINESS, + AnalyticsConstant.Label.STORE_CATEGORIES_SEARCH, + "search in " + getStoreCategoryName(viewModel.category.value) + ) + } + v.performClick() + } + + binding.storeRecyclerview.apply { layoutManager = LinearLayoutManager(this@StoreActivity) adapter = storeAdapter @@ -201,30 +214,34 @@ class StoreActivity : KoinNavigationDrawerActivity() { binding.storeCategoryEtcTextview.setCategorySelected(category == StoreCategory.Etc) } + private fun getStoreCategoryName(category: StoreCategory?): String { + return when(category) { + StoreCategory.Chicken -> getString(R.string.chicken) + StoreCategory.Pizza -> getString(R.string.pizza) + StoreCategory.DOSIRAK -> getString(R.string.dorisak) + StoreCategory.PorkFeet -> getString(R.string.pork_feet) + StoreCategory.Chinese -> getString(R.string.chinese) + StoreCategory.NormalFood -> getString(R.string.normal_food) + StoreCategory.Cafe -> getString(R.string.cafe) + StoreCategory.BeautySalon -> getString(R.string.beauty_salon) + StoreCategory.Etc -> getString(R.string.etc) + null -> getString(R.string.see_all) + else -> "" + } + } + private fun View.setCategoryOnClick(category: StoreCategory) { setOnClickListener { - var eventValue = when(category) { - StoreCategory.Chicken -> getString(R.string.chicken) - StoreCategory.Pizza -> getString(R.string.pizza) - StoreCategory.DOSIRAK -> getString(R.string.dorisak) - StoreCategory.PorkFeet -> getString(R.string.pork_feet) - StoreCategory.Chinese -> getString(R.string.chinese) - StoreCategory.NormalFood -> getString(R.string.normal_food) - StoreCategory.Cafe -> getString(R.string.cafe) - StoreCategory.BeautySalon -> getString(R.string.beauty_salon) - StoreCategory.Etc -> getString(R.string.etc) - else -> "" - } - if(viewModel.category.value == category) - eventValue = getString(R.string.unselect_see_all) + binding.searchEditText.clearFocus() + viewModel.setCategory(category) + + val eventValue = getStoreCategoryName(viewModel.category.value) EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, AnalyticsConstant.Label.STORE_CATEGORIES, - eventValue) - - binding.searchEditText.clearFocus() - viewModel.setCategory(category) + eventValue + ) } } diff --git a/koin/src/main/res/values/strings.xml b/koin/src/main/res/values/strings.xml index 192e30aa5..10e6e578c 100644 --- a/koin/src/main/res/values/strings.xml +++ b/koin/src/main/res/values/strings.xml @@ -380,8 +380,8 @@ 카페 미용실 기타 - 미지정(전체보기) 주변상점 회원전용 확인 버스 + 전체보기 From 538991306c43a374f726954a26adcf4767cdb4e3 Mon Sep 17 00:00:00 2001 From: Strone Date: Fri, 26 Apr 2024 18:48:14 +0900 Subject: [PATCH 17/31] Add Sign up click event analytics --- .../koreatech/koin/core/constant/AnalyticsConstant.kt | 2 ++ .../java/in/koreatech/koin/ui/login/LoginActivity.kt | 11 +++++++---- .../koin/ui/signup/SignUpWithDetailInfoActivity.kt | 7 +++++++ koin/src/main/res/layout/activity_login.xml | 2 +- koin/src/main/res/values/strings.xml | 3 ++- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index 50ee928a6..9971b5f70 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -37,6 +37,8 @@ object AnalyticsConstant { const val BUS_TIMETABLE_TIME = "bus_timetable_time" const val BUS_TIMETABLE_EXPRESS = "bus_timetable_express" const val MENU_IMAGE = "menu_image" + const val START_SIGN_UP = "start_sign_up" + const val COMPLETE_SIGN_UP = "complete_sign_up" } } \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/login/LoginActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/login/LoginActivity.kt index 912fb3a42..d763ae43e 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/login/LoginActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/login/LoginActivity.kt @@ -2,17 +2,17 @@ package `in`.koreatech.koin.ui.login import android.content.Intent import android.os.Bundle -import android.util.Log import android.view.MotionEvent import androidx.activity.viewModels import androidx.lifecycle.Lifecycle -import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle import dagger.hilt.android.AndroidEntryPoint import `in`.koreatech.koin.R import `in`.koreatech.koin.common.UiStatus import `in`.koreatech.koin.core.activity.ActivityBase +import `in`.koreatech.koin.core.analytics.EventLogger +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.util.dataBinding import `in`.koreatech.koin.databinding.ActivityLoginBinding import `in`.koreatech.koin.ui.businesslogin.BusinessLoginActivity @@ -24,8 +24,6 @@ import `in`.koreatech.koin.util.SnackbarUtil import `in`.koreatech.koin.util.ext.hideKeyboard import `in`.koreatech.koin.util.ext.textString import `in`.koreatech.koin.util.ext.withLoading -import kotlinx.coroutines.flow.launchIn -import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch @AndroidEntryPoint @@ -99,6 +97,11 @@ class LoginActivity : ActivityBase(R.layout.activity_login) { loginButtonSignup.setOnClickListener { startActivity(Intent(this@LoginActivity, SignupActivity::class.java)) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.USER, + AnalyticsConstant.Label.START_SIGN_UP, + getString(R.string.sign_up) + ) } forgotPasswordLinearLayout.setOnClickListener { diff --git a/koin/src/main/java/in/koreatech/koin/ui/signup/SignUpWithDetailInfoActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/signup/SignUpWithDetailInfoActivity.kt index e4391b0cc..87bb5509a 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/signup/SignUpWithDetailInfoActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/signup/SignUpWithDetailInfoActivity.kt @@ -11,6 +11,8 @@ import androidx.lifecycle.lifecycleScope import dagger.hilt.android.AndroidEntryPoint import `in`.koreatech.koin.R import `in`.koreatech.koin.core.activity.ActivityBase +import `in`.koreatech.koin.core.analytics.EventLogger +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.databinding.ActivitySignUpWithDetailInfoBinding import `in`.koreatech.koin.domain.error.signup.SignupAlreadySentEmailException import `in`.koreatech.koin.domain.model.user.Gender @@ -93,6 +95,11 @@ class SignupWithDetailInfoActivity : ActivityBase() { studentNumber = signupUserEdittextStudentId.text.toString(), isCheckNickname = signupViewModel.isCheckedNickname ) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.USER, + AnalyticsConstant.Label.COMPLETE_SIGN_UP, + getString(R.string.complete_sign_up) + ) } } } diff --git a/koin/src/main/res/layout/activity_login.xml b/koin/src/main/res/layout/activity_login.xml index cde0243ad..44b311600 100644 --- a/koin/src/main/res/layout/activity_login.xml +++ b/koin/src/main/res/layout/activity_login.xml @@ -265,7 +265,7 @@ android:layout_width="0dp" android:layout_height="0dp" android:background="@color/colorPrimary" - android:text="회원가입" + android:text="@string/sign_up" android:textColor="@color/white" android:textSize="15sp" app:fontName="Normal" diff --git a/koin/src/main/res/values/strings.xml b/koin/src/main/res/values/strings.xml index 10e6e578c..7ae14d479 100644 --- a/koin/src/main/res/values/strings.xml +++ b/koin/src/main/res/values/strings.xml @@ -1,7 +1,7 @@ 코인\n커뮤니티 - 회원 가입 + 회원가입 @@ -384,4 +384,5 @@ 회원전용 확인 버스 전체보기 + 회원가입 완료 From dbfb8413f13092d4570f3196901f502874116e9a Mon Sep 17 00:00:00 2001 From: Strone Date: Fri, 26 Apr 2024 18:52:38 +0900 Subject: [PATCH 18/31] Add Login click event analytics --- .../in/koreatech/koin/core/constant/AnalyticsConstant.kt | 1 + .../main/java/in/koreatech/koin/ui/login/LoginActivity.kt | 5 +++++ koin/src/main/res/values/strings.xml | 1 + 3 files changed, 7 insertions(+) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index 9971b5f70..ddc4ae8fe 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -37,6 +37,7 @@ object AnalyticsConstant { const val BUS_TIMETABLE_TIME = "bus_timetable_time" const val BUS_TIMETABLE_EXPRESS = "bus_timetable_express" const val MENU_IMAGE = "menu_image" + const val LOGIN = "login" const val START_SIGN_UP = "start_sign_up" const val COMPLETE_SIGN_UP = "complete_sign_up" } diff --git a/koin/src/main/java/in/koreatech/koin/ui/login/LoginActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/login/LoginActivity.kt index d763ae43e..4d51877ab 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/login/LoginActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/login/LoginActivity.kt @@ -93,6 +93,11 @@ class LoginActivity : ActivityBase(R.layout.activity_login) { password = loginEdittextPw.text.toString().trim() ) } + EventLogger.logClickEvent( + AnalyticsConstant.Domain.USER, + AnalyticsConstant.Label.LOGIN, + getString(R.string.login) + ) } loginButtonSignup.setOnClickListener { diff --git a/koin/src/main/res/values/strings.xml b/koin/src/main/res/values/strings.xml index 7ae14d479..181e402e5 100644 --- a/koin/src/main/res/values/strings.xml +++ b/koin/src/main/res/values/strings.xml @@ -2,6 +2,7 @@ 코인\n커뮤니티 회원가입 + 로그인 From 501bf3cd31136582b8a4cf61c816bb7df0b72393 Mon Sep 17 00:00:00 2001 From: Strone Date: Mon, 29 Apr 2024 14:32:24 +0900 Subject: [PATCH 19/31] Change store label --- .../java/in/koreatech/koin/core/constant/AnalyticsConstant.kt | 3 +++ .../java/in/koreatech/koin/ui/store/activity/StoreActivity.kt | 2 +- .../koreatech/koin/ui/store/activity/StoreDetailActivity.kt | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index ddc4ae8fe..8b712ddb3 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -40,6 +40,9 @@ object AnalyticsConstant { const val LOGIN = "login" const val START_SIGN_UP = "start_sign_up" const val COMPLETE_SIGN_UP = "complete_sign_up" + const val STORE_PICTURE = "store_picture" + const val STORE_CALL = "store_call" + const val STORE_CLICK = "store_click" } } \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt index 215de808f..a0a193bd1 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt @@ -51,7 +51,7 @@ class StoreActivity : KoinNavigationDrawerActivity() { storeDetailContract.launch(it.uid) EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, - "store_${it.name}_click", + AnalyticsConstant.Label.STORE_CLICK, it.name) } } diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt index 17d567e65..0169d181b 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt @@ -88,7 +88,7 @@ class StoreDetailActivity : KoinNavigationDrawerActivity() { flyerDialogFragment?.show(supportFragmentManager, DIALOG_TAG) EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, - "store_${viewModel.store.value?.name ?: "Unknown"}_picture", + AnalyticsConstant.Label.STORE_PICTURE, viewModel.store.value?.name ?: "Unknown") } } @@ -128,7 +128,7 @@ class StoreDetailActivity : KoinNavigationDrawerActivity() { showCallDialog() EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, - "store_${viewModel.store.value?.name ?: "Unknown"}_call", + AnalyticsConstant.Label.STORE_CALL, viewModel.store.value?.name ?: "Unknown") } From 86341b205454d1f5ea16b882449e294935d3b819 Mon Sep 17 00:00:00 2001 From: Strone Date: Mon, 29 Apr 2024 14:40:50 +0900 Subject: [PATCH 20/31] Change description store -> shop --- .../koin/core/constant/AnalyticsConstant.kt | 14 +++++++------- .../koin/ui/main/activity/MainActivity.kt | 2 +- .../ui/navigation/KoinNavigationDrawerActivity.kt | 2 +- .../koin/ui/store/activity/StoreActivity.kt | 7 +++---- .../koin/ui/store/activity/StoreDetailActivity.kt | 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt index 8b712ddb3..6871441fa 100644 --- a/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt +++ b/core/src/main/java/in/koreatech/koin/core/constant/AnalyticsConstant.kt @@ -14,11 +14,11 @@ object AnalyticsConstant { } object Label { - const val MAIN_STORE_CATEGORIES = "main_store_categories" - const val STORE_CATEGORIES = "store_categories" - const val STORE_CATEGORIES_SEARCH = "store_categories_search" + const val MAIN_SHOP_CATEGORIES = "main_shop_categories" + const val SHOP_CATEGORIES = "shop_categories" + const val SHOP_CATEGORIES_SEARCH = "shop_categories_search" const val HAMBURGER = "hamburger" - const val HAMBURGER_STORE = "${HAMBURGER}_store" + const val HAMBURGER_SHOP = "${HAMBURGER}_shop" const val HAMBURGER_DINING = "${HAMBURGER}_dining" const val HAMBURGER_MY_INFO_WITHOUT_LOGIN = "${HAMBURGER}_my_info_without_login" const val HAMBURGER_MY_INFO_WITH_LOGIN = "${HAMBURGER}_my_info_with_login" @@ -40,9 +40,9 @@ object AnalyticsConstant { const val LOGIN = "login" const val START_SIGN_UP = "start_sign_up" const val COMPLETE_SIGN_UP = "complete_sign_up" - const val STORE_PICTURE = "store_picture" - const val STORE_CALL = "store_call" - const val STORE_CLICK = "store_click" + const val SHOP_PICTURE = "shop_picture" + const val SHOP_CALL = "shop_call" + const val SHOP_CLICK = "shop_click" } } \ No newline at end of file diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt index 6ddfb85c4..f68fc21a2 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt @@ -68,7 +68,7 @@ class MainActivity : KoinNavigationDrawerActivity() { gotoStoreActivity(position) EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, - AnalyticsConstant.Label.MAIN_STORE_CATEGORIES, + AnalyticsConstant.Label.MAIN_SHOP_CATEGORIES, view?.findViewById(R.id.text_view_store_category)?.text.toString() ) } diff --git a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt index 1efc50af4..2d9841393 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt @@ -225,7 +225,7 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), MenuState.Main -> goToMainActivity() MenuState.Store -> { action = AnalyticsConstant.Domain.BUSINESS - label = AnalyticsConstant.Label.HAMBURGER_STORE + label = AnalyticsConstant.Label.HAMBURGER_SHOP value = getString(R.string.nearby_stores) goToStoreActivity() } diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt index a0a193bd1..0a4cee26a 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt @@ -1,7 +1,6 @@ package `in`.koreatech.koin.ui.store.activity import android.os.Bundle -import android.util.Log import android.view.MotionEvent import android.view.View import android.widget.TextView @@ -51,7 +50,7 @@ class StoreActivity : KoinNavigationDrawerActivity() { storeDetailContract.launch(it.uid) EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, - AnalyticsConstant.Label.STORE_CLICK, + AnalyticsConstant.Label.SHOP_CLICK, it.name) } } @@ -112,7 +111,7 @@ class StoreActivity : KoinNavigationDrawerActivity() { if(event.action == MotionEvent.ACTION_DOWN) { EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, - AnalyticsConstant.Label.STORE_CATEGORIES_SEARCH, + AnalyticsConstant.Label.SHOP_CATEGORIES_SEARCH, "search in " + getStoreCategoryName(viewModel.category.value) ) } @@ -239,7 +238,7 @@ class StoreActivity : KoinNavigationDrawerActivity() { EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, - AnalyticsConstant.Label.STORE_CATEGORIES, + AnalyticsConstant.Label.SHOP_CATEGORIES, eventValue ) } diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt index 0169d181b..652e08cbd 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreDetailActivity.kt @@ -88,7 +88,7 @@ class StoreDetailActivity : KoinNavigationDrawerActivity() { flyerDialogFragment?.show(supportFragmentManager, DIALOG_TAG) EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, - AnalyticsConstant.Label.STORE_PICTURE, + AnalyticsConstant.Label.SHOP_PICTURE, viewModel.store.value?.name ?: "Unknown") } } @@ -128,7 +128,7 @@ class StoreDetailActivity : KoinNavigationDrawerActivity() { showCallDialog() EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, - AnalyticsConstant.Label.STORE_CALL, + AnalyticsConstant.Label.SHOP_CALL, viewModel.store.value?.name ?: "Unknown") } From ce639040f54a94eff0164ca4d11fe59173c2a84a Mon Sep 17 00:00:00 2001 From: Strone Date: Tue, 30 Apr 2024 11:22:26 +0900 Subject: [PATCH 21/31] Use Reflection isInitialized --- .../java/in/koreatech/koin/ui/main/activity/MainActivity.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt index f68fc21a2..1203cfe18 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt @@ -58,7 +58,6 @@ class MainActivity : KoinNavigationDrawerActivity() { } } private lateinit var busViewPagerScrollCallback: ViewPager2.OnPageChangeCallback - private var isBusScrollCallbackInitialized = false private val diningContainerAdapter by lazy { DiningContainerViewPager2Adapter(this) } @@ -164,9 +163,8 @@ class MainActivity : KoinNavigationDrawerActivity() { observeLiveData(busTimer) { busPagerAdapter.setBusTimerItems(it) - if (!isBusScrollCallbackInitialized) { + if (this@MainActivity::busViewPagerScrollCallback.isInitialized.not()) { initBusViewPagerScrollCallback(it) - isBusScrollCallbackInitialized = true } } } From 2ccb7a3810636d35b64ff74eaf393d51e8c4b6d6 Mon Sep 17 00:00:00 2001 From: Strone Date: Tue, 30 Apr 2024 11:37:00 +0900 Subject: [PATCH 22/31] Change navi item analytics click event logic --- .../main/fragment/DiningContainerFragment.kt | 5 +- .../KoinNavigationDrawerActivity.kt | 68 +++++++++++-------- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt b/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt index 1865d4d2d..e88ca4053 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt @@ -38,7 +38,10 @@ class DiningContainerFragment : Fragment(R.layout.fragment_dining_container) { private fun initView() = with(binding) { diningContainer.setOnClickListener { - startActivity(Intent(requireContext(), DiningActivity::class.java)) + if (activity is MainActivity) { + val mainActivity = activity as MainActivity + mainActivity.callDrawerItem(R.id.navi_item_dining) + } EventLogger.logClickEvent( AnalyticsConstant.Domain.CAMPUS, AnalyticsConstant.Label.MAIN_MENU_MOVEDETAILVIEW, diff --git a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt index 2d9841393..4e08d8494 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt @@ -132,6 +132,43 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), else -> { koinNavigationDrawerViewModel.selectMenu(state) + var action = "" + var label = "" + var value = "" + when(state) { + MenuState.Store -> { + action = AnalyticsConstant.Domain.BUSINESS + label = AnalyticsConstant.Label.HAMBURGER_SHOP + value = getString(R.string.nearby_stores) + } + MenuState.Bus -> { + action = AnalyticsConstant.Domain.CAMPUS + label = AnalyticsConstant.Label.HAMBURGER_BUS + value = getString(R.string.bus) + } + MenuState.Dining -> { + action = AnalyticsConstant.Domain.CAMPUS + label = AnalyticsConstant.Label.HAMBURGER_DINING + value = getString(R.string.navigation_item_dining) + } + MenuState.UserInfo -> { + action = AnalyticsConstant.Domain.USER + value = getString(R.string.navigation_drawer_right_myinfo) + if (koinNavigationDrawerViewModel.userState.value == null || koinNavigationDrawerViewModel.userState.value?.isAnonymous == true) { + label = AnalyticsConstant.Label.HAMBURGER_MY_INFO_WITHOUT_LOGIN + showLoginRequestDialog() + } else { + label = AnalyticsConstant.Label.HAMBURGER_MY_INFO_WITH_LOGIN + goToUserInfoActivity() + } + } + else -> Unit + } + EventLogger.logClickEvent( + action, + label, + value + ) } } } @@ -139,6 +176,7 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), findViewById(R.id.navi_item_myinfo).setOnClickListener { koinNavigationDrawerViewModel.selectMenu(MenuState.UserInfo) + } val leftArrowButton = findViewById(R.id.drawer_left_arrow_button) @@ -205,31 +243,12 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), } observeLiveData(menuEvent) { menuState -> - var action = "" - var label = "" - var value = "" when (menuState) { - MenuState.Bus -> { - action = AnalyticsConstant.Domain.CAMPUS - label = AnalyticsConstant.Label.HAMBURGER_BUS - value = getString(R.string.bus) - goToBusActivity() - } - MenuState.Dining -> { - action = AnalyticsConstant.Domain.CAMPUS - label = AnalyticsConstant.Label.HAMBURGER_DINING - value = getString(R.string.navigation_item_dining) - goToDiningActivity() - } + MenuState.Bus -> goToBusActivity() + MenuState.Dining -> goToDiningActivity() MenuState.Land -> goToLandActivity() MenuState.Main -> goToMainActivity() - MenuState.Store -> { - action = AnalyticsConstant.Domain.BUSINESS - label = AnalyticsConstant.Label.HAMBURGER_SHOP - value = getString(R.string.nearby_stores) - goToStoreActivity() - } - + MenuState.Store -> goToStoreActivity() MenuState.Timetable -> { if (userState.value == null || userState.value?.isAnonymous == true) { goToAnonymousTimeTableActivity() @@ -239,19 +258,14 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), } MenuState.UserInfo -> { - action = AnalyticsConstant.Domain.USER - value = getString(R.string.navigation_drawer_right_myinfo) if (userState.value == null || userState.value?.isAnonymous == true) { - label = AnalyticsConstant.Label.HAMBURGER_MY_INFO_WITHOUT_LOGIN showLoginRequestDialog() } else { - label = AnalyticsConstant.Label.HAMBURGER_MY_INFO_WITH_LOGIN goToUserInfoActivity() } } else -> Unit } - EventLogger.logClickEvent(action, label, value) drawerLayout.closeDrawer() } } From 88a12f98254000201d2854ff096ad1c014d977f9 Mon Sep 17 00:00:00 2001 From: Strone Date: Tue, 30 Apr 2024 12:59:27 +0900 Subject: [PATCH 23/31] Consider configuration change, use viewmodel --- .../koin/ui/bus/fragment/BusMainFragment.kt | 13 ++++---- .../fragment/ExpressBusTimetableFragment.kt | 30 +++++++++---------- .../fragment/ShuttleBusTimetableFragment.kt | 17 +++++++++-- .../bus/viewmodel/BusMainFragmentViewModel.kt | 1 + 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusMainFragment.kt b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusMainFragment.kt index 183c84676..c5613c3cc 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusMainFragment.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/BusMainFragment.kt @@ -43,39 +43,38 @@ class BusMainFragment : Fragment(R.layout.bus_main_fragment) { initViewModel() } - private var isUserSelection = false private fun initView() = with(binding) { busDepartureSpinner.setSelection(BusNode.Koreatech.spinnerSelection) busArrivalSpinner.setSelection(BusNode.Terminal.spinnerSelection) busDepartureSpinner.setOnTouchListener { _, _ -> - isUserSelection = true + viewModel.isUserSelection = true busDepartureSpinner.performClick() } busDepartureSpinner.setOnItemSelectedListener { _, _, position, _ -> viewModel.setDeparture(position.busNodeSelection) - if(isUserSelection) { + if(viewModel.isUserSelection) { EventLogger.logClickEvent( AnalyticsConstant.Domain.CAMPUS, AnalyticsConstant.Label.BUS_DEPARTURE, resources.getStringArray(R.array.bus_place)[position] ) - isUserSelection = false + viewModel.isUserSelection = false } } busArrivalSpinner.setOnTouchListener { _, _ -> - isUserSelection = true + viewModel.isUserSelection = true busArrivalSpinner.performClick() } busArrivalSpinner.setOnItemSelectedListener { _, _, position, _ -> viewModel.setArrival(position.busNodeSelection) - if(isUserSelection) { + if(viewModel.isUserSelection) { EventLogger.logClickEvent( AnalyticsConstant.Domain.CAMPUS, AnalyticsConstant.Label.BUS_ARRIVAL, resources.getStringArray(R.array.bus_place)[position] ) - isUserSelection = false + viewModel.isUserSelection = false } } recyclerView.apply { diff --git a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ExpressBusTimetableFragment.kt b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ExpressBusTimetableFragment.kt index 70231199f..6f6863f57 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ExpressBusTimetableFragment.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ExpressBusTimetableFragment.kt @@ -1,30 +1,25 @@ package `in`.koreatech.koin.ui.bus.fragment +import android.os.Bundle +import android.view.View +import android.widget.ArrayAdapter +import androidx.core.view.isVisible +import androidx.fragment.app.viewModels +import androidx.recyclerview.widget.LinearLayoutManager +import dagger.hilt.android.AndroidEntryPoint import `in`.koreatech.koin.R +import `in`.koreatech.koin.core.analytics.EventLogger +import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.fragment.DataBindingFragment import `in`.koreatech.koin.core.progressdialog.IProgressDialog import `in`.koreatech.koin.databinding.LayoutExpressBusTimetableBinding -import `in`.koreatech.koin.databinding.LayoutShuttleBusTimetableBinding import `in`.koreatech.koin.ui.bus.adpater.timetable.ExpressBusTimetableAdapter -import `in`.koreatech.koin.ui.bus.adpater.timetable.ShuttleBusTimetableAdapter import `in`.koreatech.koin.ui.bus.state.toExpressBusTimetableUiItem -import `in`.koreatech.koin.ui.bus.state.toShuttleBusTimetableUiItem import `in`.koreatech.koin.ui.bus.viewmodel.ExpressBusTimetableViewModel -import `in`.koreatech.koin.ui.bus.viewmodel.ShuttleBusTimetableViewModel -import `in`.koreatech.koin.util.SnackbarUtil import `in`.koreatech.koin.util.ext.observeLiveData import `in`.koreatech.koin.util.ext.setOnItemSelectedListener import `in`.koreatech.koin.util.ext.withLoading import `in`.koreatech.koin.util.ext.withToastError -import android.os.Bundle -import android.view.View -import android.widget.ArrayAdapter -import androidx.core.view.isVisible -import androidx.fragment.app.viewModels -import androidx.recyclerview.widget.LinearLayoutManager -import dagger.hilt.android.AndroidEntryPoint -import `in`.koreatech.koin.core.analytics.EventLogger -import `in`.koreatech.koin.core.constant.AnalyticsConstant @AndroidEntryPoint class ExpressBusTimetableFragment : DataBindingFragment() { @@ -32,6 +27,7 @@ class ExpressBusTimetableFragment : DataBindingFragment() private val expressBusTimetableAdapter = ExpressBusTimetableAdapter() + private var isInitialization = true override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -49,6 +45,10 @@ class ExpressBusTimetableFragment : DataBindingFragment expressBusTimetableViewModel.setCoursePosition(position) + if (isInitialization) { + isInitialization = false + return@setOnItemSelectedListener + } EventLogger.logClickEvent( AnalyticsConstant.Domain.CAMPUS, AnalyticsConstant.Label.BUS_TIMETABLE_EXPRESS, @@ -63,7 +63,7 @@ class ExpressBusTimetableFragment : DataBindingFragment - if(courses.isNullOrEmpty()) { + if (courses.isNullOrEmpty()) { binding.busTimetableCoursesSpinner.isVisible = false } else { binding.busTimetableCoursesSpinner.isVisible = true diff --git a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ShuttleBusTimetableFragment.kt b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ShuttleBusTimetableFragment.kt index 6cc9538ed..d1757558c 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ShuttleBusTimetableFragment.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/bus/fragment/ShuttleBusTimetableFragment.kt @@ -27,6 +27,8 @@ class ShuttleBusTimetableFragment : DataBindingFragment() private val shuttleBusTimetableAdapter = ShuttleBusTimetableAdapter() + private var isCourseInitialization = true + private var isRouteInitialization = true override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -44,6 +46,10 @@ class ShuttleBusTimetableFragment : DataBindingFragment shuttleBusTimetableViewModel.setCoursePosition(position) + if (isCourseInitialization) { + isCourseInitialization = false + return@setOnItemSelectedListener + } EventLogger.logClickEvent( AnalyticsConstant.Domain.CAMPUS, AnalyticsConstant.Label.BUS_TIMETABLE_AREA, @@ -53,6 +59,10 @@ class ShuttleBusTimetableFragment : DataBindingFragment shuttleBusTimetableViewModel.setRoutePosition(position) + if (isRouteInitialization) { + isRouteInitialization = false + return@setOnItemSelectedListener + } EventLogger.logClickEvent( AnalyticsConstant.Domain.CAMPUS, AnalyticsConstant.Label.BUS_TIMETABLE_TIME, @@ -67,7 +77,7 @@ class ShuttleBusTimetableFragment : DataBindingFragment - if(courses.isNullOrEmpty()) { + if (courses.isNullOrEmpty()) { binding.busTimetableCoursesSpinner.isVisible = false } else { binding.busTimetableCoursesSpinner.isVisible = true @@ -93,7 +103,7 @@ class ShuttleBusTimetableFragment : DataBindingFragment(BusNode.Koreatech) private val _arrival = MutableLiveData(BusNode.Terminal) + var isUserSelection = false val departure: LiveData get() = _departure val arrival: LiveData get() = _arrival From 2fbe342fbd0ed1ed46230c0a93bfa8eaccf8dbb4 Mon Sep 17 00:00:00 2001 From: Strone Date: Tue, 30 Apr 2024 13:23:37 +0900 Subject: [PATCH 24/31] Set not to log if is debug --- .../java/in/koreatech/koin/core/analytics/EventLogger.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt b/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt index 2b04e53eb..2d89f5390 100644 --- a/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt +++ b/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt @@ -1,8 +1,10 @@ package `in`.koreatech.koin.core.analytics +import android.os.Build import com.google.firebase.analytics.ktx.analytics import com.google.firebase.analytics.ktx.logEvent import com.google.firebase.ktx.Firebase +import `in`.koreatech.koin.core.BuildConfig import `in`.koreatech.koin.core.constant.AnalyticsConstant object EventLogger { @@ -30,9 +32,10 @@ object EventLogger { * @param category: 이벤트 종류(click, scroll, ...) * @param label: 이벤트 소분류 * @param value: 이벤트 값 - * @sample logEvent("BUSINESS", "click", "main_store_categories", "전체보기") + * @sample logEvent("BUSINESS", "click", "main_shop_categories", "전체보기") */ private fun logEvent(action: String, category: String, label: String, value: String) { + if(BuildConfig.IS_DEBUG) return Firebase.analytics.logEvent(action) { param("event_category", category) param("event_label", label) From 1251c4bb593e6ce4f31b6d69e446fcdb9cab0308 Mon Sep 17 00:00:00 2001 From: Strone Date: Wed, 1 May 2024 02:14:13 +0900 Subject: [PATCH 25/31] Remove unnecessary import --- .../main/java/in/koreatech/koin/core/analytics/EventLogger.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt b/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt index 2d89f5390..cf464e56a 100644 --- a/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt +++ b/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt @@ -1,6 +1,5 @@ package `in`.koreatech.koin.core.analytics -import android.os.Build import com.google.firebase.analytics.ktx.analytics import com.google.firebase.analytics.ktx.logEvent import com.google.firebase.ktx.Firebase From da2266846a2c45d42f965a458e40129fe4cff503 Mon Sep 17 00:00:00 2001 From: Strone Date: Wed, 1 May 2024 02:27:03 +0900 Subject: [PATCH 26/31] Remove use of startActivty -> use callDrawerItem --- .../java/in/koreatech/koin/core/activity/ActivityBase.kt | 2 -- .../in/koreatech/koin/ui/main/activity/MainActivity.kt | 4 +--- .../koin/ui/main/fragment/DiningContainerFragment.kt | 2 -- .../koin/ui/navigation/KoinNavigationDrawerActivity.kt | 7 +------ 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt b/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt index 59a95cc32..a8e928ad9 100644 --- a/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt +++ b/core/src/main/java/in/koreatech/koin/core/activity/ActivityBase.kt @@ -10,8 +10,6 @@ import com.google.firebase.analytics.FirebaseAnalytics import com.google.firebase.analytics.ktx.analytics import com.google.firebase.analytics.ktx.logEvent import com.google.firebase.ktx.Firebase -import `in`.koreatech.koin.core.analytics.EventLogger -import `in`.koreatech.koin.core.constant.AnalyticsConstant import `in`.koreatech.koin.core.progressdialog.CustomProgressDialog import `in`.koreatech.koin.core.progressdialog.IProgressDialog diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt index 1203cfe18..bb21637aa 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt @@ -1,6 +1,5 @@ package `in`.koreatech.koin.ui.main.activity -import android.content.Intent import android.os.Bundle import android.view.View import android.widget.TextView @@ -22,7 +21,6 @@ import `in`.koreatech.koin.data.util.todayOrTomorrow import `in`.koreatech.koin.databinding.ActivityMainBinding import `in`.koreatech.koin.domain.model.bus.timer.BusArrivalInfo import `in`.koreatech.koin.domain.model.dining.DiningPlace -import `in`.koreatech.koin.ui.bus.BusActivity import `in`.koreatech.koin.ui.main.StoreCategoryRecyclerAdapter import `in`.koreatech.koin.ui.main.adapter.BusPagerAdapter import `in`.koreatech.koin.ui.main.adapter.DiningContainerViewPager2Adapter @@ -41,7 +39,7 @@ class MainActivity : KoinNavigationDrawerActivity() { private val busPagerAdapter = BusPagerAdapter().apply { setOnCardClickListener { - startActivity(Intent(this@MainActivity, BusActivity::class.java)) + callDrawerItem(R.id.navi_item_bus, Bundle()) EventLogger.logClickEvent( AnalyticsConstant.Domain.CAMPUS, AnalyticsConstant.Label.MAIN_BUS, diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt b/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt index e88ca4053..12124ff86 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/fragment/DiningContainerFragment.kt @@ -1,6 +1,5 @@ package `in`.koreatech.koin.ui.main.fragment -import android.content.Intent import android.os.Bundle import android.view.View import androidx.core.content.ContextCompat @@ -18,7 +17,6 @@ import `in`.koreatech.koin.domain.model.dining.Dining import `in`.koreatech.koin.domain.util.DiningUtil import `in`.koreatech.koin.domain.util.ext.arrange import `in`.koreatech.koin.domain.util.ext.typeFilter -import `in`.koreatech.koin.ui.dining.DiningActivity import `in`.koreatech.koin.ui.main.activity.MainActivity import `in`.koreatech.koin.ui.main.viewmodel.MainActivityViewModel import `in`.koreatech.koin.util.ext.observeLiveData diff --git a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt index 4e08d8494..d861c66a4 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt @@ -164,11 +164,7 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), } else -> Unit } - EventLogger.logClickEvent( - action, - label, - value - ) + EventLogger.logClickEvent(action, label, value) } } } @@ -176,7 +172,6 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), findViewById(R.id.navi_item_myinfo).setOnClickListener { koinNavigationDrawerViewModel.selectMenu(MenuState.UserInfo) - } val leftArrowButton = findViewById(R.id.drawer_left_arrow_button) From e91519eec1aef3fe616a8e8a8e0be3e32ea57dc7 Mon Sep 17 00:00:00 2001 From: Strone Date: Wed, 1 May 2024 17:54:47 +0900 Subject: [PATCH 27/31] Set untranslatable type description --- .../src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt b/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt index bfb433115..5dfa1fea5 100644 --- a/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt +++ b/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt @@ -47,7 +47,7 @@ object DiningUtil { DiningType.Lunch.typeEnglish -> DiningType.Lunch.typeKorean DiningType.Dinner.typeEnglish -> DiningType.Dinner.typeKorean DiningType.NextBreakfast.typeEnglish -> DiningType.NextBreakfast.typeKorean - else -> "" + else -> "Unknown type" } } } \ No newline at end of file From a04c386d06e69773eefa30a6bc6ca2fe6a1fd1e5 Mon Sep 17 00:00:00 2001 From: Strone Date: Wed, 1 May 2024 17:57:13 +0900 Subject: [PATCH 28/31] Make parameters constant --- .../in/koreatech/koin/core/analytics/EventLogger.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt b/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt index cf464e56a..8b868881f 100644 --- a/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt +++ b/core/src/main/java/in/koreatech/koin/core/analytics/EventLogger.kt @@ -8,6 +8,10 @@ import `in`.koreatech.koin.core.constant.AnalyticsConstant object EventLogger { + private const val EVENT_CATEGORY = "event_category" + private const val EVENT_LABEL = "event_label" + private const val VALUE = "value" + /** * @param action: 이벤트 발생 도메인(BUSINESS, CAMPUS, USER) * @param label: 이벤트 소분류 @@ -34,11 +38,11 @@ object EventLogger { * @sample logEvent("BUSINESS", "click", "main_shop_categories", "전체보기") */ private fun logEvent(action: String, category: String, label: String, value: String) { - if(BuildConfig.IS_DEBUG) return + if (BuildConfig.IS_DEBUG) return Firebase.analytics.logEvent(action) { - param("event_category", category) - param("event_label", label) - param("value", value) + param(EVENT_CATEGORY, category) + param(EVENT_LABEL, label) + param(VALUE, value) } } } \ No newline at end of file From 824ae39e09dd4e0da89bcc3d6791d9df6511c00f Mon Sep 17 00:00:00 2001 From: Strone Date: Wed, 1 May 2024 18:08:43 +0900 Subject: [PATCH 29/31] Remove unnecassary variable usage --- .../KoinNavigationDrawerActivity.kt | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt index d861c66a4..fd2494137 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/navigation/KoinNavigationDrawerActivity.kt @@ -132,39 +132,51 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), else -> { koinNavigationDrawerViewModel.selectMenu(state) - var action = "" - var label = "" - var value = "" - when(state) { + when (state) { MenuState.Store -> { - action = AnalyticsConstant.Domain.BUSINESS - label = AnalyticsConstant.Label.HAMBURGER_SHOP - value = getString(R.string.nearby_stores) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.BUSINESS, + AnalyticsConstant.Label.HAMBURGER_SHOP, + getString(R.string.nearby_stores) + ) } + MenuState.Bus -> { - action = AnalyticsConstant.Domain.CAMPUS - label = AnalyticsConstant.Label.HAMBURGER_BUS - value = getString(R.string.bus) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.HAMBURGER_BUS, + getString(R.string.bus) + ) } + MenuState.Dining -> { - action = AnalyticsConstant.Domain.CAMPUS - label = AnalyticsConstant.Label.HAMBURGER_DINING - value = getString(R.string.navigation_item_dining) + EventLogger.logClickEvent( + AnalyticsConstant.Domain.CAMPUS, + AnalyticsConstant.Label.HAMBURGER_DINING, + getString(R.string.navigation_item_dining) + ) } + MenuState.UserInfo -> { - action = AnalyticsConstant.Domain.USER - value = getString(R.string.navigation_drawer_right_myinfo) if (koinNavigationDrawerViewModel.userState.value == null || koinNavigationDrawerViewModel.userState.value?.isAnonymous == true) { - label = AnalyticsConstant.Label.HAMBURGER_MY_INFO_WITHOUT_LOGIN + EventLogger.logClickEvent( + AnalyticsConstant.Domain.USER, + AnalyticsConstant.Label.HAMBURGER_MY_INFO_WITHOUT_LOGIN, + getString(R.string.navigation_drawer_right_myinfo) + ) showLoginRequestDialog() } else { - label = AnalyticsConstant.Label.HAMBURGER_MY_INFO_WITH_LOGIN + EventLogger.logClickEvent( + AnalyticsConstant.Domain.USER, + AnalyticsConstant.Label.HAMBURGER_MY_INFO_WITH_LOGIN, + getString(R.string.navigation_drawer_right_myinfo) + ) goToUserInfoActivity() } } + else -> Unit } - EventLogger.logClickEvent(action, label, value) } } } @@ -259,6 +271,7 @@ abstract class KoinNavigationDrawerActivity : ActivityBase(), goToUserInfoActivity() } } + else -> Unit } drawerLayout.closeDrawer() From 2cc5f5bcacc7541dff46606f7da8e85d1239f7dd Mon Sep 17 00:00:00 2001 From: Strone Date: Wed, 1 May 2024 18:13:06 +0900 Subject: [PATCH 30/31] Use StoreCategory.All --- .../java/in/koreatech/koin/ui/store/activity/StoreActivity.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt index 0a4cee26a..0fd0bf444 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt @@ -224,8 +224,7 @@ class StoreActivity : KoinNavigationDrawerActivity() { StoreCategory.Cafe -> getString(R.string.cafe) StoreCategory.BeautySalon -> getString(R.string.beauty_salon) StoreCategory.Etc -> getString(R.string.etc) - null -> getString(R.string.see_all) - else -> "" + StoreCategory.All, null -> getString(R.string.see_all) } } From be16867d0afb1913028e464cf1f1e2fde6957068 Mon Sep 17 00:00:00 2001 From: Strone Date: Wed, 1 May 2024 18:14:28 +0900 Subject: [PATCH 31/31] Apply lint --- .../koin/core/appbar/AppBarBase.java | 6 +-- .../koin/ui/store/activity/StoreActivity.kt | 51 ++++++++++--------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/core/src/main/java/in/koreatech/koin/core/appbar/AppBarBase.java b/core/src/main/java/in/koreatech/koin/core/appbar/AppBarBase.java index e07a4b085..206541414 100644 --- a/core/src/main/java/in/koreatech/koin/core/appbar/AppBarBase.java +++ b/core/src/main/java/in/koreatech/koin/core/appbar/AppBarBase.java @@ -52,7 +52,7 @@ public void setOnClickListener(OnClickListener onClickListener) { this.onClickListener = onClickListener; background.setOnClickListener(onClickListener); leftButton.setOnClickListener(onClickListener); - rightButton.setOnClickListener(v -> { + rightButton.setOnClickListener( v -> { onClickListener.onClick(v); EventLogger.INSTANCE.logClickEvent( AnalyticsConstant.Domain.USER, @@ -116,7 +116,7 @@ private void setTypeArray(TypedArray typedArray) { leftButton.setBackground(leftButtonBackground); leftButton.setText(leftButtonString); leftButton.setVisibility(leftButtonVisibility); - if(leftButtonHeight!= -1 || leftButtonWidth != -1){ + if (leftButtonHeight != -1 || leftButtonWidth != -1) { leftButton.setHeight(leftButtonHeight); leftButton.setWidth(leftButtonWidth); } @@ -125,7 +125,7 @@ private void setTypeArray(TypedArray typedArray) { rightButton.setBackground(rightButtonBackground); rightButton.setText(rightButtonString); rightButton.setVisibility(rightButtonVisibility); - if(leftButtonHeight!= -1 || leftButtonWidth != -1){ + if (leftButtonHeight != -1 || leftButtonWidth != -1) { rightButton.setHeight(rightButtonHeight); rightButton.setWidth(rightButtonWidth); } diff --git a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt index 0fd0bf444..c10f847b2 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/store/activity/StoreActivity.kt @@ -51,7 +51,8 @@ class StoreActivity : KoinNavigationDrawerActivity() { EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, AnalyticsConstant.Label.SHOP_CLICK, - it.name) + it.name + ) } } @@ -63,29 +64,29 @@ class StoreActivity : KoinNavigationDrawerActivity() { field = value } - private var showRemoveQueryButton : Boolean = false - set(value) { - if (!value) { - binding.searchImageView.background = ContextCompat.getDrawable( - this, - R.drawable.ic_search - ) - binding.searchImageView.layoutParams.apply { - width = dpToPx(24) - height = dpToPx(24) - } - } else { - binding.searchImageView.background = ContextCompat.getDrawable( - this, - R.drawable.ic_search_close - ) - binding.searchImageView.layoutParams.apply { - width = dpToPx(16) - height = dpToPx(16) + private var showRemoveQueryButton: Boolean = false + set(value) { + if (!value) { + binding.searchImageView.background = ContextCompat.getDrawable( + this, + R.drawable.ic_search + ) + binding.searchImageView.layoutParams.apply { + width = dpToPx(24) + height = dpToPx(24) + } + } else { + binding.searchImageView.background = ContextCompat.getDrawable( + this, + R.drawable.ic_search_close + ) + binding.searchImageView.layoutParams.apply { + width = dpToPx(16) + height = dpToPx(16) + } } + field = value } - field = value - } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -108,7 +109,7 @@ class StoreActivity : KoinNavigationDrawerActivity() { } binding.searchEditText.setOnTouchListener { v, event -> - if(event.action == MotionEvent.ACTION_DOWN) { + if (event.action == MotionEvent.ACTION_DOWN) { EventLogger.logClickEvent( AnalyticsConstant.Domain.BUSINESS, AnalyticsConstant.Label.SHOP_CATEGORIES_SEARCH, @@ -129,7 +130,7 @@ class StoreActivity : KoinNavigationDrawerActivity() { } binding.searchImageView.setOnClickListener { - if(showRemoveQueryButton) binding.searchEditText.setText("") + if (showRemoveQueryButton) binding.searchEditText.setText("") } handleCategoryClickEvent() @@ -214,7 +215,7 @@ class StoreActivity : KoinNavigationDrawerActivity() { } private fun getStoreCategoryName(category: StoreCategory?): String { - return when(category) { + return when (category) { StoreCategory.Chicken -> getString(R.string.chicken) StoreCategory.Pizza -> getString(R.string.pizza) StoreCategory.DOSIRAK -> getString(R.string.dorisak)