From 3b7e0f80b914df64a282c844d14f31e25b2232ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=B5=E1=86=AB?= =?UTF-8?q?=E1=84=8B=E1=85=AE?= Date: Wed, 21 Aug 2024 17:12:20 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=ED=81=B4=EB=9F=BD=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../happy/friendogly/analytics/ParamKeys.kt | 4 + .../com/happy/friendogly/analytics/Types.kt | 13 +++ .../presentation/ui/MainActivity.kt | 2 + .../ui/club/add/ClubAddActivity.kt | 1 + .../ui/club/add/ClubAddViewModel.kt | 10 +++ .../ui/club/detail/ClubDetailActivity.kt | 1 + .../ui/club/detail/ClubDetailViewModel.kt | 6 ++ .../ui/club/filter/ClubFilterViewModel.kt | 21 ++++- .../filter/bottom/ClubFilterBottomSheet.kt | 7 +- .../bottom/ParticipationFilterBottomSheet.kt | 7 +- .../ui/club/list/ClubListFragment.kt | 1 + .../ui/club/list/ClubListViewModel.kt | 10 +++ .../ui/club/menu/ClubMenuBottomSheet.kt | 1 + .../ui/club/menu/ClubMenuViewModel.kt | 12 ++- .../presentation/ui/club/my/MyClubActivity.kt | 10 ++- .../utils/AnalyticsHelperExtensions.kt | 82 +++++++++++++++++++ 16 files changed, 182 insertions(+), 6 deletions(-) diff --git a/android/app/src/main/java/com/happy/friendogly/analytics/ParamKeys.kt b/android/app/src/main/java/com/happy/friendogly/analytics/ParamKeys.kt index 7c755aedb..d219abd91 100644 --- a/android/app/src/main/java/com/happy/friendogly/analytics/ParamKeys.kt +++ b/android/app/src/main/java/com/happy/friendogly/analytics/ParamKeys.kt @@ -5,4 +5,8 @@ object ParamKeys { const val NEAR_FOOTPRINTS_SIZE = "near_footprints_size" const val FOOTPRINT_MARK_BTN_HAS_PET = "footprint_mark_btn_has_pet" const val FOOTPRINT_MARK_BTN_REMAINING_TIME = "footprint_mark_btn_remaining_time" + const val CLUB_PARTICIPATION_FILTER ="club_participation_filter" + const val CLUB_CLUB_FILTER ="club_club_filter" + const val CLUB_ADD_UN_SELECT_FILTER ="club_add_un_filter" + const val CLUB_MEMBER_COUNT ="club_member_count" } diff --git a/android/app/src/main/java/com/happy/friendogly/analytics/Types.kt b/android/app/src/main/java/com/happy/friendogly/analytics/Types.kt index 75d7d04e4..7cd4fb8ef 100644 --- a/android/app/src/main/java/com/happy/friendogly/analytics/Types.kt +++ b/android/app/src/main/java/com/happy/friendogly/analytics/Types.kt @@ -45,4 +45,17 @@ object Types { const val CLOSE_BTN_CLICKED = "close_btn_clicked" const val FOOTPRINT_CLICKED = "footprint_clicked" const val FOOTPRINT_MEMBER_NAME_CLICKED = "footprint_member_name_clicked" + const val CLUB_SELECT_PARTICIPATION_FILTER = "club_select_participation_filter" + const val CLUB_SELECT_CLUB_FILTER = "club_select_club_filter" + const val CLUB_ADD_UN_SELECT_FILTER = "club_add_un_select_filter" + const val CLUB_ADD_MEMBER_COUNT = "club_select_member_count" + const val CLUB_ADD_CLICKED = "club_add_clicked" + const val CLUB_DELETE_CLICKED = "club_delete_clicked" + const val CLUB_PARTICIPATE_CLICKED = "club_participate_clicked" + const val CLUB_UPDATE_CLICKED = "club_update_clicked" + const val CLUB_UPDATE_LOCATION_CLICKED ="club_update_location_clicked" + const val CLUB_CLUB_DETAIL_CLICKED ="club_detail_clicked" + const val CLUB_MY_CLICKED ="club_detail_clicked" + const val CLUB_MY_ADD_BTN_CLICKED ="club_my_add_btn_clicked" + const val CLUB_LIST_ADD_BTN_CLICKED ="club_list_add_btn_clicked" } diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/MainActivity.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/MainActivity.kt index d3dca710d..343b3dd2f 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/MainActivity.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/MainActivity.kt @@ -26,6 +26,7 @@ import com.happy.friendogly.presentation.ui.setting.SettingActivity import com.happy.friendogly.presentation.ui.woof.WoofFragment import com.happy.friendogly.presentation.utils.logChatListFragmentSwitched import com.happy.friendogly.presentation.utils.logClubListFragmentSwitched +import com.happy.friendogly.presentation.utils.logMyClubClick import com.happy.friendogly.presentation.utils.logMyPageFragmentSwitched import com.happy.friendogly.presentation.utils.logWoofFragmentSwitched @@ -157,6 +158,7 @@ class MainActivity : } override fun navigateToMyClub(isMyHead: Boolean) { + analyticsHelper.logMyClubClick() startActivity(MyClubActivity.getIntent(this, isMyHead)) } diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/add/ClubAddActivity.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/add/ClubAddActivity.kt index f89cffb8b..75cc2cf92 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/add/ClubAddActivity.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/add/ClubAddActivity.kt @@ -30,6 +30,7 @@ import okhttp3.MultipartBody class ClubAddActivity : BaseActivity(R.layout.activity_club_add) { private val viewModel: ClubAddViewModel by viewModels { ClubAddViewModel.factory( + analyticsHelper = AppModule.getInstance().analyticsHelper, getAddressUseCase = AppModule.getInstance().getAddressUseCase, postClubUseCase = AppModule.getInstance().postClubUseCase, ) diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/add/ClubAddViewModel.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/add/ClubAddViewModel.kt index 4e2dd315e..19ba90b01 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/add/ClubAddViewModel.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/add/ClubAddViewModel.kt @@ -6,6 +6,7 @@ import androidx.lifecycle.MediatorLiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.viewModelScope +import com.happy.friendogly.analytics.AnalyticsHelper import com.happy.friendogly.domain.model.UserAddress import com.happy.friendogly.domain.usecase.GetAddressUseCase import com.happy.friendogly.domain.usecase.PostClubUseCase @@ -23,10 +24,14 @@ import com.happy.friendogly.presentation.ui.club.common.model.ClubFilterSelector import com.happy.friendogly.presentation.ui.club.common.model.clubfilter.ClubFilter import com.happy.friendogly.presentation.ui.club.filter.ClubFilterItemActionHandler import com.happy.friendogly.presentation.utils.addSourceList +import com.happy.friendogly.presentation.utils.logAddClubClick +import com.happy.friendogly.presentation.utils.logSelectClubMemberCount +import com.happy.friendogly.presentation.utils.logUnSelectAddClubFilter import kotlinx.coroutines.launch import okhttp3.MultipartBody class ClubAddViewModel( + private val analyticsHelper: AnalyticsHelper, private val getAddressUseCase: GetAddressUseCase, private val postClubUseCase: PostClubUseCase, ) : BaseViewModel(), ClubAddActionHandler, ClubFilterItemActionHandler { @@ -81,6 +86,7 @@ class ClubAddViewModel( } fun settingClubCounter(count: Int) { + analyticsHelper.logSelectClubMemberCount(count) _clubCounter.value = ClubCounter(count) } @@ -149,6 +155,7 @@ class ClubAddViewModel( if (isSelected) { clubFilterSelector.addClubFilter(clubFilter) } else { + analyticsHelper.logUnSelectAddClubFilter(filterName) clubFilterSelector.removeClubFilter(clubFilter) } } @@ -161,6 +168,7 @@ class ClubAddViewModel( dogs: List, file: MultipartBody.Part?, ) = viewModelScope.launch { + analyticsHelper.logAddClubClick() postClubUseCase( title = clubTitle.value ?: return@launch, content = clubContent.value ?: return@launch, @@ -214,11 +222,13 @@ class ClubAddViewModel( private const val MAX_CONTENT_LENGTH = 1000 fun factory( + analyticsHelper: AnalyticsHelper, getAddressUseCase: GetAddressUseCase, postClubUseCase: PostClubUseCase, ): ViewModelProvider.Factory { return BaseViewModelFactory { ClubAddViewModel( + analyticsHelper = analyticsHelper, getAddressUseCase = getAddressUseCase, postClubUseCase = postClubUseCase, ) diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/detail/ClubDetailActivity.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/detail/ClubDetailActivity.kt index 310ea8035..157733e53 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/detail/ClubDetailActivity.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/detail/ClubDetailActivity.kt @@ -34,6 +34,7 @@ class ClubDetailActivity : private val viewModel: ClubDetailViewModel by viewModels { ClubDetailViewModel.factory( + analyticsHelper = AppModule.getInstance().analyticsHelper, getClubUseCase = AppModule.getInstance().getClubUseCase, postClubMemberUseCase = AppModule.getInstance().postClubMemberUseCase, ) diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/detail/ClubDetailViewModel.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/detail/ClubDetailViewModel.kt index 0a93654eb..350fcf0c8 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/detail/ClubDetailViewModel.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/detail/ClubDetailViewModel.kt @@ -4,6 +4,7 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.viewModelScope +import com.happy.friendogly.analytics.AnalyticsHelper import com.happy.friendogly.domain.usecase.GetClubUseCase import com.happy.friendogly.domain.usecase.PostClubMemberUseCase import com.happy.friendogly.presentation.base.BaseViewModel @@ -13,9 +14,11 @@ import com.happy.friendogly.presentation.base.emit import com.happy.friendogly.presentation.ui.club.common.mapper.toPresentation import com.happy.friendogly.presentation.ui.club.detail.model.ClubDetailViewType import com.happy.friendogly.presentation.ui.club.modify.ClubModifyUiModel +import com.happy.friendogly.presentation.utils.logParticipateClick import kotlinx.coroutines.launch class ClubDetailViewModel( + private val analyticsHelper: AnalyticsHelper, private val getClubUseCase: GetClubUseCase, private val postClubMemberUseCase: PostClubMemberUseCase, ) : BaseViewModel(), ClubDetailActionHandler { @@ -64,6 +67,7 @@ class ClubDetailViewModel( fun joinClub(dogs: List) = viewModelScope.launch { + analyticsHelper.logParticipateClick() val clubDetailId = club.value?.clubId ?: return@launch postClubMemberUseCase( id = clubDetailId, @@ -87,11 +91,13 @@ class ClubDetailViewModel( companion object { fun factory( + analyticsHelper: AnalyticsHelper, getClubUseCase: GetClubUseCase, postClubMemberUseCase: PostClubMemberUseCase, ): ViewModelProvider.Factory { return BaseViewModelFactory { ClubDetailViewModel( + analyticsHelper = analyticsHelper, getClubUseCase = getClubUseCase, postClubMemberUseCase = postClubMemberUseCase, ) diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/ClubFilterViewModel.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/ClubFilterViewModel.kt index e32669163..a036e8593 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/ClubFilterViewModel.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/ClubFilterViewModel.kt @@ -2,14 +2,21 @@ package com.happy.friendogly.presentation.ui.club.filter import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewmodel.viewModelFactory +import com.happy.friendogly.analytics.AnalyticsHelper import com.happy.friendogly.presentation.base.BaseViewModel import com.happy.friendogly.presentation.base.Event import com.happy.friendogly.presentation.base.emit import com.happy.friendogly.presentation.ui.club.common.model.ClubFilterSelector import com.happy.friendogly.presentation.ui.club.common.model.clubfilter.ClubFilter import com.happy.friendogly.presentation.ui.club.common.model.clubfilter.ParticipationFilter +import com.happy.friendogly.presentation.utils.logSelectClubFilter +import com.happy.friendogly.presentation.utils.logSelectParticipationFilter -class ClubFilterViewModel : BaseViewModel(), ClubFilterItemActionHandler, ClubFilterActionHandler { +class ClubFilterViewModel( + private val analyticsHelper: AnalyticsHelper, +) : BaseViewModel(), ClubFilterItemActionHandler, ClubFilterActionHandler { private val _clubFilterEvent: MutableLiveData> = MutableLiveData() val clubFilterEvent: LiveData> get() = _clubFilterEvent @@ -18,6 +25,7 @@ class ClubFilterViewModel : BaseViewModel(), ClubFilterItemActionHandler, ClubFi private val clubFilterSelector = ClubFilterSelector() fun updateParticipationFilter(participationFilter: ParticipationFilter) { + analyticsHelper.logSelectParticipationFilter(participationFilter.filterName) this.participationFilter = participationFilter } @@ -49,9 +57,20 @@ class ClubFilterViewModel : BaseViewModel(), ClubFilterItemActionHandler, ClubFi ) { val clubFilter = ClubFilter.findClubFilter(filterName) ?: return if (isSelected) { + analyticsHelper.logSelectClubFilter(filterName) clubFilterSelector.addClubFilter(clubFilter) } else { clubFilterSelector.removeClubFilter(clubFilter) } } + + companion object{ + fun factory(analyticsHelper: AnalyticsHelper): ViewModelProvider.Factory{ + return viewModelFactory { + ClubFilterViewModel( + analyticsHelper = analyticsHelper, + ) + } + } + } } diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ClubFilterBottomSheet.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ClubFilterBottomSheet.kt index 1ef11ae21..7a0d7f19b 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ClubFilterBottomSheet.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ClubFilterBottomSheet.kt @@ -6,6 +6,7 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.viewModels import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.happy.friendogly.application.di.AppModule import com.happy.friendogly.databinding.BottomSheetFilterSizeSelectorBinding import com.happy.friendogly.databinding.BottomSheetGenderFilterSelectorBinding import com.happy.friendogly.presentation.base.observeEvent @@ -26,7 +27,11 @@ class ClubFilterBottomSheet( private val genderBinding: BottomSheetGenderFilterSelectorBinding get() = _genderBinding!! - private val viewModel: ClubFilterViewModel by viewModels() + private val viewModel: ClubFilterViewModel by viewModels{ + ClubFilterViewModel.factory( + analyticsHelper = AppModule.getInstance().analyticsHelper, + ) + } override fun onCreateView( inflater: LayoutInflater, diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ParticipationFilterBottomSheet.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ParticipationFilterBottomSheet.kt index 0d343b0c1..6f5c384a2 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ParticipationFilterBottomSheet.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ParticipationFilterBottomSheet.kt @@ -7,6 +7,7 @@ import android.view.ViewGroup import androidx.fragment.app.viewModels import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.happy.friendogly.R +import com.happy.friendogly.application.di.AppModule import com.happy.friendogly.databinding.BottomSheetParticipationFilterSelectorBinding import com.happy.friendogly.presentation.base.observeEvent import com.happy.friendogly.presentation.ui.club.common.model.clubfilter.ParticipationFilter @@ -21,7 +22,11 @@ class ParticipationFilterBottomSheet( val binding: BottomSheetParticipationFilterSelectorBinding get() = _binding!! - private val viewModel: ClubFilterViewModel by viewModels() + private val viewModel: ClubFilterViewModel by viewModels{ + ClubFilterViewModel.factory( + analyticsHelper = AppModule.getInstance().analyticsHelper, + ) + } override fun onCreateView( inflater: LayoutInflater, diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/list/ClubListFragment.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/list/ClubListFragment.kt index 646627274..edc06a8eb 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/list/ClubListFragment.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/list/ClubListFragment.kt @@ -26,6 +26,7 @@ class ClubListFragment : BaseFragment(R.layout.fragment private val viewModel: ClubListViewModel by viewModels { ClubListViewModel.factory( + analyticsHelper = AppModule.getInstance().analyticsHelper, getPetsMineUseCase = AppModule.getInstance().getPetsMineUseCase, getAddressUseCase = AppModule.getInstance().getAddressUseCase, searchingClubsUseCase = AppModule.getInstance().getSearchingClubsUseCase, diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/list/ClubListViewModel.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/list/ClubListViewModel.kt index e86132c25..9020dccea 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/list/ClubListViewModel.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/list/ClubListViewModel.kt @@ -4,6 +4,7 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.viewModelScope +import com.happy.friendogly.analytics.AnalyticsHelper import com.happy.friendogly.domain.fold import com.happy.friendogly.domain.model.Pet import com.happy.friendogly.domain.model.UserAddress @@ -23,9 +24,13 @@ import com.happy.friendogly.presentation.ui.club.common.model.ClubFilterSelector import com.happy.friendogly.presentation.ui.club.common.model.ClubItemUiModel import com.happy.friendogly.presentation.ui.club.common.model.clubfilter.ClubFilter import com.happy.friendogly.presentation.ui.club.common.model.clubfilter.ParticipationFilter +import com.happy.friendogly.presentation.utils.logClubDetailClick +import com.happy.friendogly.presentation.utils.logListAddClubClick +import com.happy.friendogly.presentation.utils.logUpdateUserLocation import kotlinx.coroutines.launch class ClubListViewModel( + private val analyticsHelper: AnalyticsHelper, private val getPetsMineUseCase: GetPetsMineUseCase, private val getAddressUseCase: GetAddressUseCase, private val searchingClubsUseCase: GetSearchingClubsUseCase, @@ -114,10 +119,12 @@ class ClubListViewModel( } override fun loadClub(clubId: Long) { + analyticsHelper.logClubDetailClick() _clubListEvent.emit(ClubListEvent.OpenClub(clubId)) } override fun addClub() { + analyticsHelper.logListAddClubClick() applyAddClubState() } @@ -170,6 +177,7 @@ class ClubListViewModel( } override fun addMyLocation() { + analyticsHelper.logUpdateUserLocation() _clubListEvent.emit( ClubListEvent.Navigation.NavigateToAddress, ) @@ -179,12 +187,14 @@ class ClubListViewModel( companion object { fun factory( + analyticsHelper: AnalyticsHelper, getPetsMineUseCase: GetPetsMineUseCase, getAddressUseCase: GetAddressUseCase, searchingClubsUseCase: GetSearchingClubsUseCase, ): ViewModelProvider.Factory { return BaseViewModelFactory { ClubListViewModel( + analyticsHelper = analyticsHelper, getPetsMineUseCase = getPetsMineUseCase, getAddressUseCase = getAddressUseCase, searchingClubsUseCase = searchingClubsUseCase, diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/menu/ClubMenuBottomSheet.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/menu/ClubMenuBottomSheet.kt index 7d499a366..c9510af17 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/menu/ClubMenuBottomSheet.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/menu/ClubMenuBottomSheet.kt @@ -30,6 +30,7 @@ class ClubMenuBottomSheet( private val viewModel: ClubMenuViewModel by viewModels { ClubMenuViewModel.factory( + analyticsHelper = AppModule.getInstance().analyticsHelper, deleteClubMemberUseCase = AppModule.getInstance().deleteClubMemberUseCase, ) } diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/menu/ClubMenuViewModel.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/menu/ClubMenuViewModel.kt index a47889f0c..a999d5163 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/menu/ClubMenuViewModel.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/menu/ClubMenuViewModel.kt @@ -4,15 +4,19 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.viewModelScope +import com.happy.friendogly.analytics.AnalyticsHelper import com.happy.friendogly.domain.usecase.DeleteClubMemberUseCase import com.happy.friendogly.presentation.base.BaseViewModel import com.happy.friendogly.presentation.base.BaseViewModelFactory import com.happy.friendogly.presentation.base.Event import com.happy.friendogly.presentation.base.emit import com.happy.friendogly.presentation.ui.club.detail.model.ClubDetailViewType +import com.happy.friendogly.presentation.utils.logDeleteMemberClick +import com.happy.friendogly.presentation.utils.logUpdateClubClick import kotlinx.coroutines.launch class ClubMenuViewModel( + private val analyticsHelper: AnalyticsHelper, private val deleteClubMemberUseCase: DeleteClubMemberUseCase, ) : BaseViewModel(), ClubMenuActionHandler { private val _clubMenuEvent: MutableLiveData> = MutableLiveData() @@ -42,10 +46,12 @@ class ClubMenuViewModel( } override fun selectModify() { + analyticsHelper.logUpdateClubClick() _clubMenuEvent.emit(ClubMenuEvent.Modify) } override fun selectDelete() { + analyticsHelper.logDeleteMemberClick() _clubMenuEvent.emit(ClubMenuEvent.Delete) } @@ -58,9 +64,13 @@ class ClubMenuViewModel( } companion object { - fun factory(deleteClubMemberUseCase: DeleteClubMemberUseCase): ViewModelProvider.Factory { + fun factory( + analyticsHelper: AnalyticsHelper, + deleteClubMemberUseCase: DeleteClubMemberUseCase, + ): ViewModelProvider.Factory { return BaseViewModelFactory { ClubMenuViewModel( + analyticsHelper = analyticsHelper, deleteClubMemberUseCase = deleteClubMemberUseCase, ) } diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/my/MyClubActivity.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/my/MyClubActivity.kt index cf6c34a56..c5b6514a0 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/my/MyClubActivity.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/my/MyClubActivity.kt @@ -14,9 +14,14 @@ import com.happy.friendogly.presentation.ui.club.add.ClubAddActivity import com.happy.friendogly.presentation.ui.club.detail.ClubDetailActivity import com.happy.friendogly.presentation.ui.club.my.adapter.MyClubAdapter import com.happy.friendogly.presentation.ui.registerpet.RegisterPetActivity +import com.happy.friendogly.presentation.utils.logClubDetailClick +import com.happy.friendogly.presentation.utils.logMyAddClubClick class MyClubActivity : BaseActivity(R.layout.activity_my_club), MyClubActionHandler { + + private val analyticsHelper = AppModule.getInstance().analyticsHelper + private val viewModel: MyClubViewModel by viewModels { MyClubViewModel.factory( getPetsMineUseCase = AppModule.getInstance().getPetsMineUseCase, @@ -57,8 +62,7 @@ class MyClubActivity : private fun initObserver() { viewModel.myClubEvent.observeEvent(this) { event -> when (event) { - MyClubEvent.AddPet.OpenAddClub -> - startActivity(ClubAddActivity.getIntent(this)) + MyClubEvent.AddPet.OpenAddClub -> startActivity(ClubAddActivity.getIntent(this)) MyClubEvent.AddPet.OpenAddPet -> openRegisterPetDialog() } @@ -95,10 +99,12 @@ class MyClubActivity : } override fun addClub() { + analyticsHelper.logMyAddClubClick() viewModel.loadPetState() } override fun openClub(clubId: Long) { + analyticsHelper.logClubDetailClick() startActivity(ClubDetailActivity.getIntent(this, clubId)) } diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/utils/AnalyticsHelperExtensions.kt b/android/app/src/main/java/com/happy/friendogly/presentation/utils/AnalyticsHelperExtensions.kt index e72c6b6f7..6a23e2b46 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/utils/AnalyticsHelperExtensions.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/utils/AnalyticsHelperExtensions.kt @@ -80,3 +80,85 @@ fun AnalyticsHelper.logFootprintMarkBtnInfo( ParamKeys.FOOTPRINT_MARK_BTN_REMAINING_TIME to remainingTime, ) } + +fun AnalyticsHelper.logSelectParticipationFilter(filterName: String) { + logEvent( + type = Types.CLUB_SELECT_PARTICIPATION_FILTER, + ParamKeys.CLUB_PARTICIPATION_FILTER to filterName, + ) +} + +fun AnalyticsHelper.logSelectClubFilter(filterName: String) { + logEvent( + type = Types.CLUB_SELECT_CLUB_FILTER, + ParamKeys.CLUB_CLUB_FILTER to filterName + ) +} + +fun AnalyticsHelper.logUnSelectAddClubFilter(filterName: String) { + logEvent( + type = Types.CLUB_ADD_UN_SELECT_FILTER, + ParamKeys.CLUB_ADD_UN_SELECT_FILTER to filterName + ) +} + +fun AnalyticsHelper.logAddClubClick() { + logEvent( + type = Types.CLUB_ADD_CLICKED, + ) +} + +fun AnalyticsHelper.logSelectClubMemberCount(count: Int) { + logEvent( + type = Types.CLUB_ADD_MEMBER_COUNT, + ParamKeys.CLUB_MEMBER_COUNT to count + ) +} + +fun AnalyticsHelper.logDeleteMemberClick() { + logEvent( + type = Types.CLUB_DELETE_CLICKED + ) +} + +fun AnalyticsHelper.logParticipateClick() { + logEvent( + type = Types.CLUB_PARTICIPATE_CLICKED, + ) +} + +fun AnalyticsHelper.logUpdateClubClick() { + logEvent( + type = Types.CLUB_UPDATE_CLICKED + ) +} + +fun AnalyticsHelper.logUpdateUserLocation() { + logEvent( + type = Types.CLUB_UPDATE_LOCATION_CLICKED, + ) +} + +fun AnalyticsHelper.logClubDetailClick(){ + logEvent( + type = Types.CLUB_CLUB_DETAIL_CLICKED, + ) +} + +fun AnalyticsHelper.logMyClubClick(){ + logEvent( + type = Types.CLUB_MY_CLICKED, + ) +} + +fun AnalyticsHelper.logMyAddClubClick(){ + logEvent( + type = Types.CLUB_MY_ADD_BTN_CLICKED, + ) +} + +fun AnalyticsHelper.logListAddClubClick(){ + logEvent( + type = Types.CLUB_LIST_ADD_BTN_CLICKED + ) +} From d8fcc590ea277532875ed73e19ad966275e24ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=B5=E1=86=AB?= =?UTF-8?q?=E1=84=8B=E1=85=AE?= Date: Wed, 21 Aug 2024 17:13:05 +0900 Subject: [PATCH 2/2] =?UTF-8?q?style:=20=EC=BD=94=EB=93=9C=20=ED=8F=AC?= =?UTF-8?q?=EB=A7=B7=20=EC=88=98=EC=A0=95=20&=20=EB=A6=B0=ED=8A=B8=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../happy/friendogly/analytics/ParamKeys.kt | 8 ++++---- .../com/happy/friendogly/analytics/Types.kt | 10 +++++----- .../ui/club/filter/ClubFilterViewModel.kt | 4 ++-- .../filter/bottom/ClubFilterBottomSheet.kt | 2 +- .../bottom/ParticipationFilterBottomSheet.kt | 2 +- .../presentation/ui/club/my/MyClubActivity.kt | 1 - .../utils/AnalyticsHelperExtensions.kt | 20 +++++++++---------- 7 files changed, 23 insertions(+), 24 deletions(-) diff --git a/android/app/src/main/java/com/happy/friendogly/analytics/ParamKeys.kt b/android/app/src/main/java/com/happy/friendogly/analytics/ParamKeys.kt index d219abd91..07bbe5719 100644 --- a/android/app/src/main/java/com/happy/friendogly/analytics/ParamKeys.kt +++ b/android/app/src/main/java/com/happy/friendogly/analytics/ParamKeys.kt @@ -5,8 +5,8 @@ object ParamKeys { const val NEAR_FOOTPRINTS_SIZE = "near_footprints_size" const val FOOTPRINT_MARK_BTN_HAS_PET = "footprint_mark_btn_has_pet" const val FOOTPRINT_MARK_BTN_REMAINING_TIME = "footprint_mark_btn_remaining_time" - const val CLUB_PARTICIPATION_FILTER ="club_participation_filter" - const val CLUB_CLUB_FILTER ="club_club_filter" - const val CLUB_ADD_UN_SELECT_FILTER ="club_add_un_filter" - const val CLUB_MEMBER_COUNT ="club_member_count" + const val CLUB_PARTICIPATION_FILTER = "club_participation_filter" + const val CLUB_CLUB_FILTER = "club_club_filter" + const val CLUB_ADD_UN_SELECT_FILTER = "club_add_un_filter" + const val CLUB_MEMBER_COUNT = "club_member_count" } diff --git a/android/app/src/main/java/com/happy/friendogly/analytics/Types.kt b/android/app/src/main/java/com/happy/friendogly/analytics/Types.kt index 7cd4fb8ef..a93c39957 100644 --- a/android/app/src/main/java/com/happy/friendogly/analytics/Types.kt +++ b/android/app/src/main/java/com/happy/friendogly/analytics/Types.kt @@ -53,9 +53,9 @@ object Types { const val CLUB_DELETE_CLICKED = "club_delete_clicked" const val CLUB_PARTICIPATE_CLICKED = "club_participate_clicked" const val CLUB_UPDATE_CLICKED = "club_update_clicked" - const val CLUB_UPDATE_LOCATION_CLICKED ="club_update_location_clicked" - const val CLUB_CLUB_DETAIL_CLICKED ="club_detail_clicked" - const val CLUB_MY_CLICKED ="club_detail_clicked" - const val CLUB_MY_ADD_BTN_CLICKED ="club_my_add_btn_clicked" - const val CLUB_LIST_ADD_BTN_CLICKED ="club_list_add_btn_clicked" + const val CLUB_UPDATE_LOCATION_CLICKED = "club_update_location_clicked" + const val CLUB_CLUB_DETAIL_CLICKED = "club_detail_clicked" + const val CLUB_MY_CLICKED = "club_detail_clicked" + const val CLUB_MY_ADD_BTN_CLICKED = "club_my_add_btn_clicked" + const val CLUB_LIST_ADD_BTN_CLICKED = "club_list_add_btn_clicked" } diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/ClubFilterViewModel.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/ClubFilterViewModel.kt index a036e8593..ca4285fc9 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/ClubFilterViewModel.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/ClubFilterViewModel.kt @@ -64,8 +64,8 @@ class ClubFilterViewModel( } } - companion object{ - fun factory(analyticsHelper: AnalyticsHelper): ViewModelProvider.Factory{ + companion object { + fun factory(analyticsHelper: AnalyticsHelper): ViewModelProvider.Factory { return viewModelFactory { ClubFilterViewModel( analyticsHelper = analyticsHelper, diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ClubFilterBottomSheet.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ClubFilterBottomSheet.kt index 7a0d7f19b..edf607c40 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ClubFilterBottomSheet.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ClubFilterBottomSheet.kt @@ -27,7 +27,7 @@ class ClubFilterBottomSheet( private val genderBinding: BottomSheetGenderFilterSelectorBinding get() = _genderBinding!! - private val viewModel: ClubFilterViewModel by viewModels{ + private val viewModel: ClubFilterViewModel by viewModels { ClubFilterViewModel.factory( analyticsHelper = AppModule.getInstance().analyticsHelper, ) diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ParticipationFilterBottomSheet.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ParticipationFilterBottomSheet.kt index 6f5c384a2..20858bac3 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ParticipationFilterBottomSheet.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/filter/bottom/ParticipationFilterBottomSheet.kt @@ -22,7 +22,7 @@ class ParticipationFilterBottomSheet( val binding: BottomSheetParticipationFilterSelectorBinding get() = _binding!! - private val viewModel: ClubFilterViewModel by viewModels{ + private val viewModel: ClubFilterViewModel by viewModels { ClubFilterViewModel.factory( analyticsHelper = AppModule.getInstance().analyticsHelper, ) diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/my/MyClubActivity.kt b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/my/MyClubActivity.kt index c5b6514a0..54fa21dce 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/my/MyClubActivity.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/ui/club/my/MyClubActivity.kt @@ -19,7 +19,6 @@ import com.happy.friendogly.presentation.utils.logMyAddClubClick class MyClubActivity : BaseActivity(R.layout.activity_my_club), MyClubActionHandler { - private val analyticsHelper = AppModule.getInstance().analyticsHelper private val viewModel: MyClubViewModel by viewModels { diff --git a/android/app/src/main/java/com/happy/friendogly/presentation/utils/AnalyticsHelperExtensions.kt b/android/app/src/main/java/com/happy/friendogly/presentation/utils/AnalyticsHelperExtensions.kt index 6a23e2b46..e1904de7e 100644 --- a/android/app/src/main/java/com/happy/friendogly/presentation/utils/AnalyticsHelperExtensions.kt +++ b/android/app/src/main/java/com/happy/friendogly/presentation/utils/AnalyticsHelperExtensions.kt @@ -91,14 +91,14 @@ fun AnalyticsHelper.logSelectParticipationFilter(filterName: String) { fun AnalyticsHelper.logSelectClubFilter(filterName: String) { logEvent( type = Types.CLUB_SELECT_CLUB_FILTER, - ParamKeys.CLUB_CLUB_FILTER to filterName + ParamKeys.CLUB_CLUB_FILTER to filterName, ) } fun AnalyticsHelper.logUnSelectAddClubFilter(filterName: String) { logEvent( type = Types.CLUB_ADD_UN_SELECT_FILTER, - ParamKeys.CLUB_ADD_UN_SELECT_FILTER to filterName + ParamKeys.CLUB_ADD_UN_SELECT_FILTER to filterName, ) } @@ -111,13 +111,13 @@ fun AnalyticsHelper.logAddClubClick() { fun AnalyticsHelper.logSelectClubMemberCount(count: Int) { logEvent( type = Types.CLUB_ADD_MEMBER_COUNT, - ParamKeys.CLUB_MEMBER_COUNT to count + ParamKeys.CLUB_MEMBER_COUNT to count, ) } fun AnalyticsHelper.logDeleteMemberClick() { logEvent( - type = Types.CLUB_DELETE_CLICKED + type = Types.CLUB_DELETE_CLICKED, ) } @@ -129,7 +129,7 @@ fun AnalyticsHelper.logParticipateClick() { fun AnalyticsHelper.logUpdateClubClick() { logEvent( - type = Types.CLUB_UPDATE_CLICKED + type = Types.CLUB_UPDATE_CLICKED, ) } @@ -139,26 +139,26 @@ fun AnalyticsHelper.logUpdateUserLocation() { ) } -fun AnalyticsHelper.logClubDetailClick(){ +fun AnalyticsHelper.logClubDetailClick() { logEvent( type = Types.CLUB_CLUB_DETAIL_CLICKED, ) } -fun AnalyticsHelper.logMyClubClick(){ +fun AnalyticsHelper.logMyClubClick() { logEvent( type = Types.CLUB_MY_CLICKED, ) } -fun AnalyticsHelper.logMyAddClubClick(){ +fun AnalyticsHelper.logMyAddClubClick() { logEvent( type = Types.CLUB_MY_ADD_BTN_CLICKED, ) } -fun AnalyticsHelper.logListAddClubClick(){ +fun AnalyticsHelper.logListAddClubClick() { logEvent( - type = Types.CLUB_LIST_ADD_BTN_CLICKED + type = Types.CLUB_LIST_ADD_BTN_CLICKED, ) }