diff --git a/app/src/main/java/com/el/yello/presentation/onboarding/activity/GetAlarmActivity.kt b/app/src/main/java/com/el/yello/presentation/onboarding/activity/GetAlarmActivity.kt index b424e8b12..e547a602c 100644 --- a/app/src/main/java/com/el/yello/presentation/onboarding/activity/GetAlarmActivity.kt +++ b/app/src/main/java/com/el/yello/presentation/onboarding/activity/GetAlarmActivity.kt @@ -28,10 +28,10 @@ class GetAlarmActivity : private val requestPermissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted: Boolean -> if (isGranted) { - AmplitudeUtils.updateUserProperties("user_pushnotification", "enabled") + AmplitudeUtils.updateUserProperties(EVENT_PUSH_NOTIFICATION, VALUE_ENABLED) startTutorialActivity() } else { - AmplitudeUtils.updateUserProperties("user_pushnotification", "disabled") + AmplitudeUtils.updateUserProperties(EVENT_PUSH_NOTIFICATION, VALUE_DISABLED) startTutorialActivity() } } @@ -50,7 +50,7 @@ class GetAlarmActivity : private fun askNotificationPermission() { binding.btnStartYello.setOnSingleClickListener { - AmplitudeUtils.trackEventWithProperties("click_onboarding_notification") + AmplitudeUtils.trackEventWithProperties(EVENT_CLICK_ONBOARDING_NOTIFICATION) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { if (ContextCompat.checkSelfPermission( this, @@ -81,5 +81,9 @@ class GetAlarmActivity : putExtra("isFromOnBoarding", isFromOnBoarding) } private const val NONE_ANIMATION = 0 + private const val EVENT_PUSH_NOTIFICATION = "user_pushnotification" + private const val VALUE_ENABLED = "enabled" + private const val VALUE_DISABLED = "disabled" + private const val EVENT_CLICK_ONBOARDING_NOTIFICATION = "click_onboarding_notification" } } diff --git a/app/src/main/java/com/el/yello/presentation/onboarding/activity/OnBoardingViewModel.kt b/app/src/main/java/com/el/yello/presentation/onboarding/activity/OnBoardingViewModel.kt index bd2dbae62..150260e77 100644 --- a/app/src/main/java/com/el/yello/presentation/onboarding/activity/OnBoardingViewModel.kt +++ b/app/src/main/java/com/el/yello/presentation/onboarding/activity/OnBoardingViewModel.kt @@ -50,7 +50,7 @@ class OnBoardingViewModel @Inject constructor( val studentType = MutableLiveData("") val university: String get() = universityText.value?.trim() ?: "" val universityText = MutableLiveData("") - private val highSchool: String get() = highSchoolText.value?.trim() ?: "" + val highSchool: String get() = highSchoolText.value?.trim() ?: "" val highSchoolText = MutableLiveData("") val departmentText = MutableLiveData("") diff --git a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/addfriend/AddFriendFragment.kt b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/addfriend/AddFriendFragment.kt index 60c67b3a3..a6defcabd 100644 --- a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/addfriend/AddFriendFragment.kt +++ b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/addfriend/AddFriendFragment.kt @@ -62,8 +62,8 @@ class AddFriendFragment : BindingFragment(R.layout.fra private fun setConfirmBtnClickListener() { binding.btnAddFriendNext.setOnSingleClickListener { AmplitudeUtils.trackEventWithProperties( - "click_onboarding_next", - JSONObject().put("onboard_view", "friends"), + EVENT_CLICK_ONBOARDING_NEXT, + JSONObject().put(NAME_ONBOARD_VIEW, VALUE_FRIENDS), ) val activity = requireActivity() as OnBoardingActivity activity.progressBarPlus() @@ -78,6 +78,7 @@ class AddFriendFragment : BindingFragment(R.layout.fra viewModel.initFriendPagingVariable() viewModel.addListWithKakaoIdList() } + private fun setInfinityScroll() { binding.rvFriendList.addOnScrollListener(object : RecyclerView.OnScrollListener() { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { @@ -108,13 +109,16 @@ class AddFriendFragment : BindingFragment(R.layout.fra selectedItemIdList.addAll(friendsList.map { friend -> friend.id }) viewModel.selectedFriendCount.value = friendsList.size } + is UiState.Failure -> { stopShimmerView() yelloSnackbar(binding.root, getString(R.string.onboarding_add_friend_error)) } + is UiState.Loading -> { startShimmerView() } + is UiState.Empty -> {} } } @@ -141,4 +145,10 @@ class AddFriendFragment : BindingFragment(R.layout.fra super.onDestroyView() _adapter = null } + + companion object { + private const val EVENT_CLICK_ONBOARDING_NEXT = "click_onboarding_next" + private const val NAME_ONBOARD_VIEW = "onboard_view" + private const val VALUE_FRIENDS = "friends" + } } diff --git a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/code/CodeFragment.kt b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/code/CodeFragment.kt index 9c616efb1..4b74b221d 100644 --- a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/code/CodeFragment.kt +++ b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/code/CodeFragment.kt @@ -74,7 +74,7 @@ class CodeFragment : BindingFragment(R.layout.fragment_code viewModel.postSignupState.observe(viewLifecycleOwner) { state -> when (state) { is UiState.Success -> { - AmplitudeUtils.setUserDataProperties("user_signup_date") + AmplitudeUtils.setUserDataProperties(PROPERTY_USER_SIGHUP_DATE) val intent = Intent(activity, GetAlarmActivity::class.java) startActivity(intent) (activity as? OnBoardingActivity)?.endTutorialActivity() @@ -107,24 +107,39 @@ class CodeFragment : BindingFragment(R.layout.fragment_code } private fun amplitudeCodeSkipInfo() { - AmplitudeUtils.trackEventWithProperties("complete_onboarding_finish") + AmplitudeUtils.trackEventWithProperties(EVENT_COMPLETE_ONBOARDING_FINISH) AmplitudeUtils.trackEventWithProperties( - "click_onboarding_recommend", - JSONObject().put("rec_exist", "pass"), + EVENT_CLICK_ONBOARDING_RECOMMEND, + JSONObject().put(NAME_REC_EXIST, VALUE_PASS), ) - AmplitudeUtils.updateUserProperties("user_recommend", "no") - AmplitudeUtils.updateUserProperties("user_name", viewModel.name) - AmplitudeUtils.updateUserProperties("user_sex", viewModel.gender) + AmplitudeUtils.updateUserProperties(PROPERTY_USER_RECOMMEND, VALUE_NO) + AmplitudeUtils.updateUserProperties(PROPERTY_USER_NAME, viewModel.name) + AmplitudeUtils.updateUserProperties(PROPERTY_USER_SEX, viewModel.gender) } private fun amplitudeCodeNextInfo() { - AmplitudeUtils.trackEventWithProperties("complete_onboarding_finish") + AmplitudeUtils.trackEventWithProperties(EVENT_COMPLETE_ONBOARDING_FINISH) AmplitudeUtils.trackEventWithProperties( - "click_onboarding_recommend", - JSONObject().put("rec_exist", "next"), + EVENT_CLICK_ONBOARDING_RECOMMEND, + JSONObject().put(NAME_REC_EXIST,VALUE_NEXT), ) - AmplitudeUtils.updateUserProperties("user_recommend", "yes") - AmplitudeUtils.updateUserProperties("user_sex", viewModel.gender) - AmplitudeUtils.updateUserProperties("user_name", viewModel.name) + AmplitudeUtils.updateUserProperties(PROPERTY_USER_RECOMMEND, VALUE_YES) + AmplitudeUtils.updateUserProperties(PROPERTY_USER_NAME, viewModel.name) + AmplitudeUtils.updateUserProperties(PROPERTY_USER_SEX, viewModel.gender) + } + + companion object { + private const val PROPERTY_USER_SIGHUP_DATE = "user_signup_date" + private const val EVENT_COMPLETE_ONBOARDING_FINISH = "complete_onboarding_finish" + private const val EVENT_CLICK_ONBOARDING_RECOMMEND = "click_onboarding_recommend" + private const val NAME_REC_EXIST = "rec_exist" + private const val VALUE_PASS = "pass" + private const val VALUE_NEXT = "next" + private const val PROPERTY_USER_RECOMMEND = "user_recommend" + private const val VALUE_NO = "no" + private const val VALUE_YES = "yes" + private const val PROPERTY_USER_NAME = "user_name" + private const val PROPERTY_USER_SEX = "user_sex" + } } diff --git a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/highschoolinfo/HighSchoolInfoFragment.kt b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/highschoolinfo/HighSchoolInfoFragment.kt index 3385bedaf..9bf9defe6 100644 --- a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/highschoolinfo/HighSchoolInfoFragment.kt +++ b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/highschoolinfo/HighSchoolInfoFragment.kt @@ -10,10 +10,12 @@ import com.el.yello.presentation.onboarding.activity.OnBoardingActivity import com.el.yello.presentation.onboarding.activity.OnBoardingViewModel import com.el.yello.presentation.onboarding.fragment.highschoolinfo.group.GroupDialogFragment import com.el.yello.presentation.onboarding.fragment.highschoolinfo.school.SearchDialogHighSchoolFragment +import com.el.yello.util.amplitude.AmplitudeUtils import com.el.yello.util.context.yelloSnackbar import com.example.domain.enum.GradeEnum import com.example.ui.base.BindingFragment import com.example.ui.view.setOnSingleClickListener +import org.json.JSONObject class HighSchoolInfoFragment : BindingFragment(R.layout.fragment_highschool) { @@ -98,8 +100,31 @@ class HighSchoolInfoFragment : private fun setConfirmBtnClickListener() { binding.btnHighschoolinfoNextBtn.setOnSingleClickListener { findNavController().navigate(R.id.action_highschoolInfoFragment_to_yelIoIdFragment) + amplitudeHighSchoolInfo() val activity = requireActivity() as OnBoardingActivity activity.progressBarPlus() } } + + private fun amplitudeHighSchoolInfo() { + AmplitudeUtils.trackEventWithProperties( + EVENT_CLICK_ONBOARDING_NEXT, + JSONObject().put(NAME_ONBOARD_VIEW, VALUE_SCHOOL), + ) + AmplitudeUtils.updateUserProperties(PROPERTY_USER_SCHOOL, viewModel.highSchool) + AmplitudeUtils.updateUserProperties( + PROPERTY_USER_DEPARTMENT, + viewModel.highSchoolGroupText.value.toString(), + ) + AmplitudeUtils.updateUserIntProperties(PROPERTY_USER_GRADE, viewModel.studentId) + } + + companion object { + private const val EVENT_CLICK_ONBOARDING_NEXT = "click_onboarding_next" + private const val NAME_ONBOARD_VIEW = "onboard_view" + private const val VALUE_SCHOOL = "school" + private const val PROPERTY_USER_SCHOOL = "user_school" + private const val PROPERTY_USER_DEPARTMENT = "user_department" + private const val PROPERTY_USER_GRADE = "user_grade" + } } diff --git a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/highschoolinfo/school/SearchDialogHighSchoolFragment.kt b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/highschoolinfo/school/SearchDialogHighSchoolFragment.kt index 58b91fc87..36bffac47 100644 --- a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/highschoolinfo/school/SearchDialogHighSchoolFragment.kt +++ b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/highschoolinfo/school/SearchDialogHighSchoolFragment.kt @@ -9,6 +9,7 @@ import android.view.View import android.view.WindowManager import androidx.core.widget.doAfterTextChanged import androidx.fragment.app.activityViewModels +import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.viewModelScope import androidx.recyclerview.widget.LinearLayoutManager @@ -25,7 +26,8 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog import kotlinx.coroutines.Job import kotlinx.coroutines.delay -import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch class SearchDialogHighSchoolFragment : @@ -78,20 +80,21 @@ class SearchDialogHighSchoolFragment : } private fun setupHighSchoolData() { - lifecycleScope.launch { - viewModel.highSchoolState.collectLatest { state -> + viewModel.highSchoolState.flowWithLifecycle(viewLifecycleOwner.lifecycle) + .onEach { state -> when (state) { is UiState.Success -> { adapter?.submitList(state.data.groupNameList) } + is UiState.Failure -> { yelloSnackbar(binding.root, getString(R.string.msg_error)) } - is UiState.Loading -> {} - is UiState.Empty -> {} + + is UiState.Loading -> return@onEach + is UiState.Empty -> return@onEach } - } - } + }.launchIn(viewLifecycleOwner.lifecycleScope) } private fun storeHighSchool(school: String) { diff --git a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/studenttype/SelectStudentFragment.kt b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/studenttype/SelectStudentFragment.kt index 4c3de9da9..cf7b7e035 100644 --- a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/studenttype/SelectStudentFragment.kt +++ b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/studenttype/SelectStudentFragment.kt @@ -8,9 +8,11 @@ import com.el.yello.R import com.el.yello.databinding.FragmentSelectStudentTypeBinding import com.el.yello.presentation.onboarding.activity.OnBoardingActivity import com.el.yello.presentation.onboarding.activity.OnBoardingViewModel +import com.el.yello.util.amplitude.AmplitudeUtils import com.example.domain.enum.StudentTypeEnum import com.example.ui.base.BindingFragment import com.example.ui.view.setOnSingleClickListener +import org.json.JSONObject class SelectStudentFragment : BindingFragment(R.layout.fragment_select_student_type) { @@ -40,6 +42,8 @@ class SelectStudentFragment : binding.tvStudentUniversity.setTextColor(resources.getColor(R.color.grayscales_700)) binding.btnSelectTypeNext.setOnSingleClickListener { findNavController().navigate(R.id.action_selectStudentFragment_to_highschoolInfoFragment) + amplitudeSelectStudent() + AmplitudeUtils.updateUserProperties(EVENT_STUDENT_TYPE, VALUE_HIGH_SCHOOL) val activity = requireActivity() as OnBoardingActivity activity.progressBarPlus() } @@ -53,6 +57,8 @@ class SelectStudentFragment : binding.tvStudentHighschool.setTextColor(resources.getColor(R.color.grayscales_700)) binding.btnSelectTypeNext.setOnSingleClickListener { findNavController().navigate(R.id.action_selectStudentFragment_to_universityInfoFragment) + amplitudeSelectStudent() + AmplitudeUtils.updateUserProperties(EVENT_STUDENT_TYPE, VALUE_UNIVERSITY) val activity = requireActivity() as OnBoardingActivity activity.progressBarPlus() } @@ -60,4 +66,17 @@ class SelectStudentFragment : } } } + + private fun amplitudeSelectStudent() { + AmplitudeUtils.trackEventWithProperties( + "click_onboarding_next", + JSONObject().put("onboard_view", "student_type"), + ) + } + + companion object { + private const val EVENT_STUDENT_TYPE = "user_student_type" + private const val VALUE_HIGH_SCHOOL = "highschool" + private const val VALUE_UNIVERSITY = "university" + } } diff --git a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/UniversityInfoFragment.kt b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/UniversityInfoFragment.kt index bd92966f5..f59a67847 100644 --- a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/UniversityInfoFragment.kt +++ b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/UniversityInfoFragment.kt @@ -89,15 +89,21 @@ class UniversityInfoFragment : private fun amplitudeUniversityInfo() { AmplitudeUtils.trackEventWithProperties( - "click_onboarding_next", - JSONObject().put("onboard_view", "school"), + EVENT_CLICK_ONBOARDING_NEXT, + JSONObject().put(NAME_ONBOARD_VIEW, VALUE_SCHOOL), ) - AmplitudeUtils.updateUserProperties("user_school", viewModel.university) - AmplitudeUtils.updateUserProperties("user_department", viewModel.departmentState.toString()) - AmplitudeUtils.updateUserIntProperties("user_grade", viewModel.studentId) + AmplitudeUtils.updateUserProperties(PROPERTY_USER_SCHOOL, viewModel.university) + AmplitudeUtils.updateUserProperties(PROPERTY_USER_DEPARTMENT, viewModel.departmentText.value.toString()) + AmplitudeUtils.updateUserIntProperties(PROPERTY_USER_GRADE, viewModel.studentId) } companion object { - const val OVERLAP_MIN_ID = 1 - const val OVERLAP_MAX_ID = 3 + private const val OVERLAP_MIN_ID = 1 + private const val OVERLAP_MAX_ID = 3 + private const val EVENT_CLICK_ONBOARDING_NEXT = "click_onboarding_next" + private const val NAME_ONBOARD_VIEW = "onboard_view" + private const val VALUE_SCHOOL = "school" + private const val PROPERTY_USER_SCHOOL = "user_school" + private const val PROPERTY_USER_DEPARTMENT = "user_department" + private const val PROPERTY_USER_GRADE = "user_grade" } } diff --git a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/department/SearchDialogDepartmentFragment.kt b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/department/SearchDialogDepartmentFragment.kt index 92a4cc32c..5c070fed3 100644 --- a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/department/SearchDialogDepartmentFragment.kt +++ b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/department/SearchDialogDepartmentFragment.kt @@ -9,6 +9,7 @@ import android.view.View import android.view.WindowManager import androidx.core.widget.doAfterTextChanged import androidx.fragment.app.activityViewModels +import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.viewModelScope import androidx.recyclerview.widget.LinearLayoutManager @@ -25,7 +26,8 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog import kotlinx.coroutines.Job import kotlinx.coroutines.delay -import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch import timber.log.Timber @@ -80,21 +82,22 @@ class SearchDialogDepartmentFragment : } private fun setupDepartmentData() { - lifecycleScope.launch { - viewModel.departmentState.collectLatest { state -> + viewModel.departmentState.flowWithLifecycle(viewLifecycleOwner.lifecycle) + .onEach { state -> Timber.d("GET GROUP LIST OBSERVE : $state") when (state) { is UiState.Success -> { adapter?.submitList(state.data.groupList) } + is UiState.Failure -> { yelloSnackbar(binding.root, getString(R.string.msg_error)) } - is UiState.Loading -> {} - is UiState.Empty -> {} + + is UiState.Loading -> return@onEach + is UiState.Empty -> return@onEach } - } - } + }.launchIn(viewLifecycleOwner.lifecycleScope) } private fun storeUniversityGroup(department: String, groupId: Long) { @@ -144,14 +147,18 @@ class SearchDialogDepartmentFragment : } private fun recyclerviewScroll() { - binding.rvDepartmentList.setOnTouchListener { view, motionEvent -> - when (motionEvent.action) { - MotionEvent.ACTION_MOVE -> { - binding.layoutDepartmentDialog.requestDisallowInterceptTouchEvent(true) + binding.rvDepartmentList.addOnItemTouchListener(object : RecyclerView.OnItemTouchListener { + override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean { + when (e.action) { + MotionEvent.ACTION_MOVE -> { + binding.layoutDepartmentDialog.requestDisallowInterceptTouchEvent(true) + } } + return false } - return@setOnTouchListener false - } + override fun onTouchEvent(rv: RecyclerView, e: MotionEvent) {} + override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {} + }) } override fun onDestroyView() { diff --git a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/university/SearchDialogUniversityFragment.kt b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/university/SearchDialogUniversityFragment.kt index d2c927ddd..5f4d3cdf9 100644 --- a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/university/SearchDialogUniversityFragment.kt +++ b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/universityinfo/university/SearchDialogUniversityFragment.kt @@ -9,6 +9,7 @@ import android.view.View import android.view.WindowManager import androidx.core.widget.doAfterTextChanged import androidx.fragment.app.activityViewModels +import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.viewModelScope import androidx.recyclerview.widget.LinearLayoutManager @@ -25,7 +26,8 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog import kotlinx.coroutines.Job import kotlinx.coroutines.delay -import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch class SearchDialogUniversityFragment : @@ -78,8 +80,8 @@ class SearchDialogUniversityFragment : } private fun setupUniversityData() { - lifecycleScope.launch { - viewModel.universityState.collectLatest { state -> + viewModel.universityState.flowWithLifecycle(viewLifecycleOwner.lifecycle) + .onEach { state -> when (state) { is UiState.Success -> { adapter?.submitList(state.data.schoolList) @@ -87,11 +89,10 @@ class SearchDialogUniversityFragment : is UiState.Failure -> { yelloSnackbar(binding.root, getString(R.string.msg_error)) } - is UiState.Loading -> {} - is UiState.Empty -> {} + is UiState.Loading -> return@onEach + is UiState.Empty -> return@onEach } - } - } + }.launchIn(viewLifecycleOwner.lifecycleScope) } private fun storeUniversity(school: String) { diff --git a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/yelloid/YelIoIdFragment.kt b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/yelloid/YelIoIdFragment.kt index c8f490f58..2c31f26a5 100644 --- a/app/src/main/java/com/el/yello/presentation/onboarding/fragment/yelloid/YelIoIdFragment.kt +++ b/app/src/main/java/com/el/yello/presentation/onboarding/fragment/yelloid/YelIoIdFragment.kt @@ -80,9 +80,16 @@ class YelIoIdFragment : BindingFragment(R.layout.fragmen private fun amplitudeYelloIdInfo() { AmplitudeUtils.trackEventWithProperties( - "click_onboarding_next", - JSONObject().put("onboard_view", "id"), + EVENT_CLICK_ONBOARDING_NEXT, + JSONObject().put(NAME_ONBOARD_VIEW, VALUE_ID), ) - AmplitudeUtils.updateUserProperties("user_id", viewModel.id) + AmplitudeUtils.updateUserProperties(PROPERTY_USER_ID, viewModel.id) + } + + companion object { + private const val EVENT_CLICK_ONBOARDING_NEXT = "click_onboarding_next" + private const val NAME_ONBOARD_VIEW = "onboard_view" + private const val VALUE_ID = "id" + private const val PROPERTY_USER_ID = "user_id" } } diff --git a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialAActivity.kt b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialAActivity.kt index 9adabffb1..7875e93cb 100644 --- a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialAActivity.kt +++ b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialAActivity.kt @@ -20,8 +20,8 @@ class TutorialAActivity : BindingActivity(R.layout.act super.onCreate(savedInstanceState) AmplitudeUtils.trackEventWithProperties( - "view_onboarding_tutorial", - JSONObject().put("tutorial_step", "1"), + EVENT_VIEW_ONBOARDING_TUTORIAL, + JSONObject().put(NAME_TUTORIAL_STEP, VALUE_TUTORIAL_ONE), ) setClickListener() } @@ -51,5 +51,8 @@ class TutorialAActivity : BindingActivity(R.layout.act } const val EXTRA_FROM_ONBOARDING = "isFromOnBoarding" private const val NONE_ANIMATION = 0 + private const val EVENT_VIEW_ONBOARDING_TUTORIAL = "view_onboarding_tutorial" + private const val NAME_TUTORIAL_STEP = "tutorial_step" + private const val VALUE_TUTORIAL_ONE = "1" } } diff --git a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialBActivity.kt b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialBActivity.kt index 74edfb934..a4837d84d 100644 --- a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialBActivity.kt +++ b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialBActivity.kt @@ -17,8 +17,8 @@ class TutorialBActivity : BindingActivity(R.layout.act super.onCreate(savedInstanceState) AmplitudeUtils.trackEventWithProperties( - "view_onboarding_tutorial", - JSONObject().put("tutorial_step", "2"), + EVENT_VIEW_ONBOARDING_TUTORIAL, + JSONObject().put(NAME_TUTORIAL_STEP, VALUE_TUTORIAL_TWO), ) setClickListener() } @@ -44,5 +44,8 @@ class TutorialBActivity : BindingActivity(R.layout.act companion object { private const val NONE_ANIMATION = 0 + private const val EVENT_VIEW_ONBOARDING_TUTORIAL = "view_onboarding_tutorial" + private const val NAME_TUTORIAL_STEP = "tutorial_step" + private const val VALUE_TUTORIAL_TWO = "2" } } diff --git a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialCActivity.kt b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialCActivity.kt index 93417e2ea..22e999902 100644 --- a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialCActivity.kt +++ b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialCActivity.kt @@ -15,8 +15,8 @@ class TutorialCActivity : BindingActivity(R.layout.act super.onCreate(savedInstanceState) AmplitudeUtils.trackEventWithProperties( - "view_onboarding_tutorial", - JSONObject().put("tutorial_step", "3"), + EVENT_VIEW_ONBOARDING_TUTORIAL, + JSONObject().put(NAME_TUTORIAL_STEP, VALUE_TUTORIAL_THREE), ) setClickListener() } @@ -42,5 +42,8 @@ class TutorialCActivity : BindingActivity(R.layout.act companion object { private const val NONE_ANIMATION = 0 + private const val EVENT_VIEW_ONBOARDING_TUTORIAL = "view_onboarding_tutorial" + private const val NAME_TUTORIAL_STEP = "tutorial_step" + private const val VALUE_TUTORIAL_THREE = "3" } } diff --git a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialDActivity.kt b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialDActivity.kt index 5275dec71..6577b2b25 100644 --- a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialDActivity.kt +++ b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialDActivity.kt @@ -17,8 +17,8 @@ class TutorialDActivity : BindingActivity(R.layout.act super.onCreate(savedInstanceState) AmplitudeUtils.trackEventWithProperties( - "view_onboarding_tutorial", - JSONObject().put("tutorial_step", "4"), + EVENT_VIEW_ONBOARDING_TUTORIAL, + JSONObject().put(NAME_TUTORIAL_STEP, VALUE_TUTORIAL_FOUR), ) setClickListener() } @@ -52,5 +52,8 @@ class TutorialDActivity : BindingActivity(R.layout.act companion object { private const val NONE_ANIMATION = 0 + private const val EVENT_VIEW_ONBOARDING_TUTORIAL = "view_onboarding_tutorial" + private const val NAME_TUTORIAL_STEP = "tutorial_step" + private const val VALUE_TUTORIAL_FOUR = "4" } } diff --git a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialEndActivity.kt b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialEndActivity.kt index 39ae1dc59..10822ad03 100644 --- a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialEndActivity.kt +++ b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialEndActivity.kt @@ -15,7 +15,7 @@ class TutorialEndActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding.btnEndTutorial.setOnSingleClickListener { - AmplitudeUtils.trackEventWithProperties("click_onboarding_yellostart") + AmplitudeUtils.trackEventWithProperties(EVENT_CLICK_ONBOARDING_YELLO_START) val intent = Intent(this, MainActivity::class.java) startActivity(intent) } @@ -27,5 +27,6 @@ class TutorialEndActivity : companion object { private const val NONE_ANIMATION = 0 + private const val EVENT_CLICK_ONBOARDING_YELLO_START = "click_onboarding_yellostart" } } diff --git a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialEndPlusActivity.kt b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialEndPlusActivity.kt index 63b9db260..6116bb512 100644 --- a/app/src/main/java/com/el/yello/presentation/tutorial/TutorialEndPlusActivity.kt +++ b/app/src/main/java/com/el/yello/presentation/tutorial/TutorialEndPlusActivity.kt @@ -15,7 +15,7 @@ class TutorialEndPlusActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding.btnEndTutorial.setOnSingleClickListener { - AmplitudeUtils.trackEventWithProperties("click_onboarding_yellostart") + AmplitudeUtils.trackEventWithProperties(EVENT_CLICK_ONBOARDING_YELLO_START) val intent = Intent(this, MainActivity::class.java) startActivity(intent) } @@ -27,5 +27,6 @@ class TutorialEndPlusActivity : companion object { private const val NONE_ANIMATION = 0 + private const val EVENT_CLICK_ONBOARDING_YELLO_START = "click_onboarding_yellostart" } }