From cebc3745a4c0d421805e860bceb999ee7955ae2d Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Wed, 31 Jan 2024 16:50:54 +0900 Subject: [PATCH 01/17] =?UTF-8?q?[chore]=20#218=20=ED=95=84=ED=84=B0?= =?UTF-8?q?=EB=B7=B0=20UX=20Writing=20=EC=88=98=EC=A0=95=20=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=B0=98=EC=98=81=20(strings.xml)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/values/strings.xml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2a9da472..808068f7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -126,24 +126,27 @@ 맞춤 빵집 추천을 위해\n건빵을 찾은 이유를 알려주세요! 건강 · 체질 - 아토피 , 알레르기 , 암 , 당뇨 , 소화문제 + 아토피, 알레르기, 당뇨, 소화불량 등이 있어요. 맛 · 다이어트 - 그냥 맛있어서! 식이 관리를 위해 + 맛있어서 먹거나, 체중조절이 필요해요. 비건 · 채식지향 - 종교 , 환경 , 동물 , 노동권을 위한 비거니즘 + 종교, 환경, 동물, 노동권 문제에 공감해요. 글루텐프리 - NO 글루텐\nLOW 글루텐 + NO 글루텐 비건빵 - NO 동물성재료\n(유제품 , 계란 등) + NO 동물성재료\n(유제품, 계란 등) 넛프리 NO 견과류 대체당 - 알룰로스, 스테비아,\n에리스리톨, 말티톨 등 - - 영양성분까지 꼼꼼히 볼래요! - 어떤 재료가 들어갔는지 볼래요! - 성분 정보는 괜찮아요! + NO 설탕\n(비설탕감미료) + + 영양성분 보기 + 영양성분까지 공개한 건빵집을 볼래요! + 원재료 보기 + 원재료를 공개한 건빵집을 볼래요! + 모든 건빵집 보기 + 일단 더 많은 건빵집을 볼래요! %s님\n건빵에 오신 걸 환영해요! From 532c91bbd04bcc8370c359d1e40c4351eff6e70e Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Wed, 31 Jan 2024 16:51:24 +0900 Subject: [PATCH 02/17] =?UTF-8?q?[chore]=20#218=20=ED=95=84=ED=84=B0?= =?UTF-8?q?=EB=B7=B0=20UX=20Writing=20=EC=88=98=EC=A0=95=20=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=B0=98=EC=98=81=20(Type)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/type/BreadFilterType.kt | 16 ++++++++-------- .../presentation/type/MainPurposeType.kt | 12 ++++++------ .../presentation/type/NutrientFilterType.kt | 14 +++++++++----- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/type/BreadFilterType.kt b/app/src/main/java/com/sopt/geonppang/presentation/type/BreadFilterType.kt index df356fc2..eddfba48 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/type/BreadFilterType.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/type/BreadFilterType.kt @@ -8,19 +8,19 @@ enum class BreadFilterType( @StringRes val desRes: Int, ) { GLUTENFREE( - R.string.bread_type_gluten_free_title, - R.string.bread_type_gluten_free_des + titleRes = R.string.bread_type_gluten_free_title, + desRes = R.string.bread_type_gluten_free_des ), VEGAN( - R.string.bread_type_vegan_title, - R.string.bread_type_vegan_des + titleRes = R.string.bread_type_vegan_title, + desRes = R.string.bread_type_vegan_des ), NUTFREE( - R.string.bread_type_nut_free_title, - R.string.bread_type_nut_free_des + titleRes = R.string.bread_type_nut_free_title, + desRes = R.string.bread_type_nut_free_des ), SUGARFREE( - R.string.bread_type_sugar_free_title, - R.string.bread_type_sugar_free_des, + titleRes = R.string.bread_type_sugar_free_title, + desRes = R.string.bread_type_sugar_free_des, ) } diff --git a/app/src/main/java/com/sopt/geonppang/presentation/type/MainPurposeType.kt b/app/src/main/java/com/sopt/geonppang/presentation/type/MainPurposeType.kt index 163bba7e..63ea945b 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/type/MainPurposeType.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/type/MainPurposeType.kt @@ -8,15 +8,15 @@ enum class MainPurposeType( @StringRes val desRes: Int, ) { HEALTH( - R.string.main_purpose_type_health_title, - R.string.main_purpose_type_health_des + titleRes = R.string.main_purpose_type_health_title, + desRes = R.string.main_purpose_type_health_des ), DIET( - R.string.main_purpose_type_diet_title, - R.string.main_purpose_type_diet_des + titleRes = R.string.main_purpose_type_diet_title, + desRes = R.string.main_purpose_type_diet_des ), VEGAN( - R.string.main_purpose_type_vegan_title, - R.string.main_purpose_type_vegan_des + titleRes = R.string.main_purpose_type_vegan_title, + desRes = R.string.main_purpose_type_vegan_des ) } diff --git a/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt b/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt index 619e18aa..cc5bb2a2 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt @@ -4,15 +4,19 @@ import androidx.annotation.StringRes import com.sopt.geonppang.R enum class NutrientFilterType( - @StringRes val titleRes: Int + @StringRes val titleRes: Int, + @StringRes val desRes: Int ) { NUTRIENT( - R.string.nutrient_type_nutrient_open + titleRes = R.string.nutrient_type_nutrient_open_title, + desRes = R.string.nutrient_type_nutrient_open_des ), INGREDIENT( - R.string.nutrient_type_ingredient_open + titleRes = R.string.nutrient_type_ingredient_open_title, + desRes = R.string.nutrient_type_ingredient_open_des ), - NOT( - R.string.nutrient_type_not_open + ALL( + titleRes = R.string.nutrient_type_all_open_title, + desRes = R.string.nutrient_type_all_open_des ) } From f6c330a8be1a71fcc760e2b37de2a50d387daacc Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Thu, 1 Feb 2024 20:06:38 +0900 Subject: [PATCH 03/17] =?UTF-8?q?[chore]=20#218=20=ED=95=84=ED=84=B0?= =?UTF-8?q?=EB=B7=B0=20UX=20Writing=20=EC=88=98=EC=A0=95=20=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=B0=98=EC=98=81=20(strings.xml)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 808068f7..4229eeb5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -121,7 +121,7 @@ 어떤 빵을 원하시나요? 중복선택이 가능해요! - 어떤 성분을 원하시나요? + 원하시는 성분공개 정도를\n선택해주세요! 시작하기 맞춤 빵집 추천을 위해\n건빵을 찾은 이유를 알려주세요! From 4a04a48540be73d49baa8219cb23e9ed619f6d6d Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Thu, 1 Feb 2024 20:11:56 +0900 Subject: [PATCH 04/17] =?UTF-8?q?[chore]=20#218=20=ED=95=84=ED=84=B0?= =?UTF-8?q?=EB=B7=B0=20xml=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../res/layout/fragment_bread_type_filter.xml | 33 ++++---- .../layout/fragment_main_purpose_filter.xml | 47 ++---------- .../layout/fragment_nutrient_type_filter.xml | 75 +++++++------------ .../res/layout/view_main_purpose_button.xml | 4 +- .../res/layout/view_nutrient_type_button.xml | 46 ++++++++++++ 5 files changed, 94 insertions(+), 111 deletions(-) create mode 100644 app/src/main/res/layout/view_nutrient_type_button.xml diff --git a/app/src/main/res/layout/fragment_bread_type_filter.xml b/app/src/main/res/layout/fragment_bread_type_filter.xml index 1d6ea3d5..f25e106c 100644 --- a/app/src/main/res/layout/fragment_bread_type_filter.xml +++ b/app/src/main/res/layout/fragment_bread_type_filter.xml @@ -45,12 +45,13 @@ @@ -75,21 +76,21 @@ app:layout_constraintTop_toTopOf="@id/tv_bread_type_duplicate_selection" /> + app:layout_constraintEnd_toStartOf="@id/gl_end" + app:layout_constraintStart_toEndOf="@id/view_center" + app:layout_constraintTop_toTopOf="@id/include_bread_type_gluten_free" /> + app:layout_constraintTop_toBottomOf="@+id/include_bread_type_gluten_free" /> + app:layout_constraintEnd_toStartOf="@id/gl_end" + app:layout_constraintStart_toEndOf="@id/view_center" + app:layout_constraintTop_toTopOf="@id/include_bread_type_nut_free" /> diff --git a/app/src/main/res/layout/fragment_main_purpose_filter.xml b/app/src/main/res/layout/fragment_main_purpose_filter.xml index 4511e862..e7351810 100644 --- a/app/src/main/res/layout/fragment_main_purpose_filter.xml +++ b/app/src/main/res/layout/fragment_main_purpose_filter.xml @@ -10,8 +10,6 @@ type="com.sopt.geonppang.presentation.filterSetting.FilterSettingViewModel" /> - - - - - - - - - - diff --git a/app/src/main/res/layout/fragment_nutrient_type_filter.xml b/app/src/main/res/layout/fragment_nutrient_type_filter.xml index 8907863f..62069877 100644 --- a/app/src/main/res/layout/fragment_nutrient_type_filter.xml +++ b/app/src/main/res/layout/fragment_nutrient_type_filter.xml @@ -47,79 +47,54 @@ - - - + app:layout_constraintEnd_toStartOf="@id/gl_end" + app:layout_constraintStart_toStartOf="@id/gl_start" + app:layout_constraintTop_toBottomOf="@id/tv_nutrient_type_filter_title" + app:nutrientType="@{NutrientFilterType.NUTRIENT}" /> - + app:layout_constraintEnd_toStartOf="@id/gl_end" + app:layout_constraintStart_toStartOf="@id/gl_start" + app:layout_constraintTop_toBottomOf="@id/include_nutrient_type_nutrient" + app:nutrientType="@{NutrientFilterType.INGREDIENT}" /> - + android:onClick="@{()->viewModel.setNutrientFilterType(NutrientFilterType.ALL)}" + app:layout_constraintEnd_toStartOf="@id/gl_end" + app:layout_constraintStart_toStartOf="@id/gl_start" + app:layout_constraintTop_toBottomOf="@id/include_nutrient_type_ingredient" + app:nutrientType="@{NutrientFilterType.ALL}" /> diff --git a/app/src/main/res/layout/view_main_purpose_button.xml b/app/src/main/res/layout/view_main_purpose_button.xml index 94a0f2f9..2870706c 100644 --- a/app/src/main/res/layout/view_main_purpose_button.xml +++ b/app/src/main/res/layout/view_main_purpose_button.xml @@ -18,7 +18,7 @@ android:paddingVertical="25dp"> \ No newline at end of file diff --git a/app/src/main/res/layout/view_nutrient_type_button.xml b/app/src/main/res/layout/view_nutrient_type_button.xml new file mode 100644 index 00000000..d7bde420 --- /dev/null +++ b/app/src/main/res/layout/view_nutrient_type_button.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + \ No newline at end of file From 8f5aa8d59ad5ea419d4020b6a7757830e155bd56 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Thu, 1 Feb 2024 20:24:07 +0900 Subject: [PATCH 05/17] =?UTF-8?q?[chore]=20#218=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filterSetting/FilterSettingViewModel.kt | 10 ++--- .../filterSetting/FilterViewPagerAdapter.kt | 2 +- ...nt.kt => MainPurposeTypeFilterFragment.kt} | 6 +-- .../model/AmplitudeFilterSettingInfo.kt | 4 +- .../presentation/myPage/MyPageViewModel.kt | 8 ++-- ...urposeType.kt => MainPurposeFilterType.kt} | 2 +- .../res/layout/fragment_bread_type_filter.xml | 22 +++++----- ... => fragment_main_purpose_type_filter.xml} | 42 +++++++++---------- .../layout/fragment_nutrient_type_filter.xml | 10 ++--- .../res/layout/view_bread_type_button.xml | 2 +- ....xml => view_main_purpose_type_button.xml} | 10 ++--- 11 files changed, 59 insertions(+), 59 deletions(-) rename app/src/main/java/com/sopt/geonppang/presentation/filterSetting/{MainPurposeFilterFragment.kt => MainPurposeTypeFilterFragment.kt} (85%) rename app/src/main/java/com/sopt/geonppang/presentation/type/{MainPurposeType.kt => MainPurposeFilterType.kt} (94%) rename app/src/main/res/layout/{fragment_main_purpose_filter.xml => fragment_main_purpose_type_filter.xml} (78%) rename app/src/main/res/layout/{view_main_purpose_button.xml => view_main_purpose_type_button.xml} (88%) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt index e84c13b7..d2def2f4 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt @@ -8,7 +8,7 @@ import com.sopt.geonppang.domain.repository.FilterSettingRepository import com.sopt.geonppang.presentation.model.AmplitudeFilterSettingInfo import com.sopt.geonppang.presentation.type.BreadFilterType import com.sopt.geonppang.presentation.type.FilterInfoType -import com.sopt.geonppang.presentation.type.MainPurposeType +import com.sopt.geonppang.presentation.type.MainPurposeFilterType import com.sopt.geonppang.presentation.type.NutrientFilterType import com.sopt.geonppang.util.UiState import dagger.hilt.android.lifecycle.HiltViewModel @@ -33,7 +33,7 @@ class FilterSettingViewModel @Inject constructor( val previousActivity get() = _previousActivity.asStateFlow() private val _currentPage = MutableStateFlow(null) val currentPage get() = _currentPage.asStateFlow() - private val _mainPurposeType = MutableStateFlow(null) + private val _mainPurposeType = MutableStateFlow(null) val mainPurposeType get() = _mainPurposeType.asStateFlow() val breadFilterType: MutableStateFlow> = MutableStateFlow( mapOf( @@ -47,7 +47,7 @@ class FilterSettingViewModel @Inject constructor( mapOf( NutrientFilterType.NUTRIENT to false, NutrientFilterType.INGREDIENT to false, - NutrientFilterType.NOT to false + NutrientFilterType.ALL to false ) ) val isFilterBtnEnabled: StateFlow = combine( @@ -74,7 +74,7 @@ class FilterSettingViewModel @Inject constructor( _currentPage.value = position } - fun setMainPurposeType(mainPurposeType: MainPurposeType) { + fun setMainPurposeType(mainPurposeType: MainPurposeFilterType) { _mainPurposeType.value = mainPurposeType } @@ -106,7 +106,7 @@ class FilterSettingViewModel @Inject constructor( RequestSettingFilter.NutrientType( nutrientFilterType.value[NutrientFilterType.NUTRIENT] == true, nutrientFilterType.value[NutrientFilterType.INGREDIENT] == true, - nutrientFilterType.value[NutrientFilterType.NOT] == true, + nutrientFilterType.value[NutrientFilterType.ALL] == true, ) ) }?.let { diff --git a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterViewPagerAdapter.kt b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterViewPagerAdapter.kt index 783f1343..9fa9279a 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterViewPagerAdapter.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterViewPagerAdapter.kt @@ -8,7 +8,7 @@ class FilterViewPagerAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) { private val filterFragments = - listOf(MainPurposeFilterFragment(), BreadTypeFilterFragment(), NutrientTypeFilterFragment()) + listOf(MainPurposeTypeFilterFragment(), BreadTypeFilterFragment(), NutrientTypeFilterFragment()) override fun getItemCount(): Int = filterFragments.size diff --git a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/MainPurposeFilterFragment.kt b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/MainPurposeTypeFilterFragment.kt similarity index 85% rename from app/src/main/java/com/sopt/geonppang/presentation/filterSetting/MainPurposeFilterFragment.kt rename to app/src/main/java/com/sopt/geonppang/presentation/filterSetting/MainPurposeTypeFilterFragment.kt index 1960e062..61cbee07 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/MainPurposeFilterFragment.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/MainPurposeTypeFilterFragment.kt @@ -5,14 +5,14 @@ import android.os.Bundle import android.view.View import androidx.fragment.app.activityViewModels import com.sopt.geonppang.R -import com.sopt.geonppang.databinding.FragmentMainPurposeFilterBinding +import com.sopt.geonppang.databinding.FragmentMainPurposeTypeFilterBinding import com.sopt.geonppang.presentation.MainActivity import com.sopt.geonppang.util.AmplitudeUtils import com.sopt.geonppang.util.binding.BindingFragment import com.sopt.geonppang.util.extension.setOnSingleClickListener -class MainPurposeFilterFragment : - BindingFragment(R.layout.fragment_main_purpose_filter) { +class MainPurposeTypeFilterFragment : + BindingFragment(R.layout.fragment_main_purpose_type_filter) { private val viewModel: FilterSettingViewModel by activityViewModels() override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt b/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt index 42ce4a41..5925a0ba 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt @@ -1,11 +1,11 @@ package com.sopt.geonppang.presentation.model import com.sopt.geonppang.presentation.type.BreadFilterType -import com.sopt.geonppang.presentation.type.MainPurposeType +import com.sopt.geonppang.presentation.type.MainPurposeFilterType import com.sopt.geonppang.presentation.type.NutrientFilterType data class AmplitudeFilterSettingInfo( - val mainPurposeType: MainPurposeType?, + val mainPurposeType: MainPurposeFilterType?, val breadType: Map, val ingredientType: Map ) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/myPage/MyPageViewModel.kt b/app/src/main/java/com/sopt/geonppang/presentation/myPage/MyPageViewModel.kt index 3b923e99..57700a1c 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/myPage/MyPageViewModel.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/myPage/MyPageViewModel.kt @@ -6,7 +6,7 @@ import com.sopt.geonppang.domain.model.Bakery import com.sopt.geonppang.domain.model.MyReview import com.sopt.geonppang.domain.model.Profile import com.sopt.geonppang.domain.repository.MyPageRepository -import com.sopt.geonppang.presentation.type.MainPurposeType +import com.sopt.geonppang.presentation.type.MainPurposeFilterType import com.sopt.geonppang.util.UiState import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow @@ -67,9 +67,9 @@ class MyPageViewModel @Inject constructor( fun setMainPurposeTitle(): Int? { return when (profileInfo.value?.mainPurpose) { - MainPurposeType.DIET.name -> MainPurposeType.DIET.titleRes - MainPurposeType.HEALTH.name -> MainPurposeType.HEALTH.titleRes - MainPurposeType.VEGAN.name -> MainPurposeType.VEGAN.titleRes + MainPurposeFilterType.DIET.name -> MainPurposeFilterType.DIET.titleRes + MainPurposeFilterType.HEALTH.name -> MainPurposeFilterType.HEALTH.titleRes + MainPurposeFilterType.VEGAN.name -> MainPurposeFilterType.VEGAN.titleRes else -> null } } diff --git a/app/src/main/java/com/sopt/geonppang/presentation/type/MainPurposeType.kt b/app/src/main/java/com/sopt/geonppang/presentation/type/MainPurposeFilterType.kt similarity index 94% rename from app/src/main/java/com/sopt/geonppang/presentation/type/MainPurposeType.kt rename to app/src/main/java/com/sopt/geonppang/presentation/type/MainPurposeFilterType.kt index 63ea945b..e2e6b1ee 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/type/MainPurposeType.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/type/MainPurposeFilterType.kt @@ -3,7 +3,7 @@ package com.sopt.geonppang.presentation.type import androidx.annotation.StringRes import com.sopt.geonppang.R -enum class MainPurposeType( +enum class MainPurposeFilterType( @StringRes val titleRes: Int, @StringRes val desRes: Int, ) { diff --git a/app/src/main/res/layout/fragment_bread_type_filter.xml b/app/src/main/res/layout/fragment_bread_type_filter.xml index f25e106c..3f55d6e4 100644 --- a/app/src/main/res/layout/fragment_bread_type_filter.xml +++ b/app/src/main/res/layout/fragment_bread_type_filter.xml @@ -16,7 +16,7 @@ android:layout_height="match_parent"> + app:layout_constraintTop_toTopOf="@id/tv_bread_type_filter_duplicate_selection" /> + app:layout_constraintTop_toBottomOf="@id/tv_bread_type_filter_duplicate_selection" /> + app:layout_constraintTop_toTopOf="@id/include_bread_type_filter_gluten_free" /> + app:layout_constraintTop_toBottomOf="@+id/include_bread_type_filter_gluten_free" /> + app:layout_constraintTop_toTopOf="@id/include_bread_type_filter_nut_free" /> diff --git a/app/src/main/res/layout/fragment_main_purpose_filter.xml b/app/src/main/res/layout/fragment_main_purpose_type_filter.xml similarity index 78% rename from app/src/main/res/layout/fragment_main_purpose_filter.xml rename to app/src/main/res/layout/fragment_main_purpose_type_filter.xml index e7351810..95d98648 100644 --- a/app/src/main/res/layout/fragment_main_purpose_filter.xml +++ b/app/src/main/res/layout/fragment_main_purpose_type_filter.xml @@ -9,7 +9,7 @@ name="viewModel" type="com.sopt.geonppang.presentation.filterSetting.FilterSettingViewModel" /> - + + app:layout_constraintTop_toBottomOf="@id/tv_main_purpose_type_filter_title" + app:mainPurposeType="@{MainPurposeFilterType.HEALTH}" /> + app:layout_constraintTop_toBottomOf="@id/include_main_purpose_type_filter_health" + app:mainPurposeType="@{MainPurposeFilterType.DIET}" /> + app:layout_constraintTop_toBottomOf="@id/include_main_purpose_type_filter_diet" + app:mainPurposeType="@{MainPurposeFilterType.VEGAN}" /> diff --git a/app/src/main/res/layout/fragment_nutrient_type_filter.xml b/app/src/main/res/layout/fragment_nutrient_type_filter.xml index 62069877..748118ff 100644 --- a/app/src/main/res/layout/fragment_nutrient_type_filter.xml +++ b/app/src/main/res/layout/fragment_nutrient_type_filter.xml @@ -58,7 +58,7 @@ app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/view_bread_type_button.xml b/app/src/main/res/layout/view_bread_type_button.xml index 0378b35f..a2f72d49 100644 --- a/app/src/main/res/layout/view_bread_type_button.xml +++ b/app/src/main/res/layout/view_bread_type_button.xml @@ -11,7 +11,7 @@ diff --git a/app/src/main/res/layout/view_main_purpose_button.xml b/app/src/main/res/layout/view_main_purpose_type_button.xml similarity index 88% rename from app/src/main/res/layout/view_main_purpose_button.xml rename to app/src/main/res/layout/view_main_purpose_type_button.xml index 2870706c..8d2b2219 100644 --- a/app/src/main/res/layout/view_main_purpose_button.xml +++ b/app/src/main/res/layout/view_main_purpose_type_button.xml @@ -6,12 +6,12 @@ + name="mainPurposeFilterType" + type="com.sopt.geonppang.presentation.type.MainPurposeFilterType" /> Date: Thu, 1 Feb 2024 21:00:53 +0900 Subject: [PATCH 06/17] =?UTF-8?q?[chore]=20#218=20=EA=B1=B4=EB=84=88?= =?UTF-8?q?=EB=9B=B0=EA=B8=B0=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fragment_main_purpose_type_filter.xml | 50 +++++++++++++++++-- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/layout/fragment_main_purpose_type_filter.xml b/app/src/main/res/layout/fragment_main_purpose_type_filter.xml index 95d98648..f0986c1b 100644 --- a/app/src/main/res/layout/fragment_main_purpose_type_filter.xml +++ b/app/src/main/res/layout/fragment_main_purpose_type_filter.xml @@ -10,6 +10,8 @@ type="com.sopt.geonppang.presentation.filterSetting.FilterSettingViewModel" /> + + + android:layout_height="wrap_content"> + app:mainPurposeFilterType="@{MainPurposeFilterType.HEALTH}" /> + app:mainPurposeFilterType="@{MainPurposeFilterType.DIET}" /> + app:mainPurposeFilterType="@{MainPurposeFilterType.VEGAN}" /> + + + + + + + + From 16e21692148d718edbe76b49507d1a94f2a5fe10 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Fri, 2 Feb 2024 11:18:22 +0900 Subject: [PATCH 07/17] =?UTF-8?q?[chore]=20#218=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filterSetting/MainPurposeTypeFilterFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/MainPurposeTypeFilterFragment.kt b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/MainPurposeTypeFilterFragment.kt index 61cbee07..e4a09ac7 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/MainPurposeTypeFilterFragment.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/MainPurposeTypeFilterFragment.kt @@ -25,11 +25,11 @@ class MainPurposeTypeFilterFragment : } private fun addListeners() { - binding.layoutMainPurposeSkip.setOnClickListener { + binding.layoutMainPurposeTypeFilterSkip.setOnClickListener { moveToMain() } - binding.tvMainPurposeSkip.setOnSingleClickListener { + binding.tvMainPurposeTypeFilterSkip.setOnSingleClickListener { AmplitudeUtils.trackEvent(CLICK_SKIP) } } From a7889dd428b9a98c642e2d085bdaf38420c062b9 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Fri, 2 Feb 2024 11:19:21 +0900 Subject: [PATCH 08/17] =?UTF-8?q?[mod]=20#218=20=EC=84=B1=EB=B6=84?= =?UTF-8?q?=EA=B3=B5=EA=B0=9C=20=ED=95=84=ED=84=B0=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=EC=84=A0=ED=83=9D=20->=20=EB=8B=A8=EC=9D=BC=EC=84=A0=ED=83=9D?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filterSetting/FilterSettingViewModel.kt | 16 ++++------------ .../res/layout/fragment_nutrient_type_filter.xml | 6 +++--- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt index d2def2f4..9c06c34a 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt @@ -43,13 +43,8 @@ class FilterSettingViewModel @Inject constructor( BreadFilterType.SUGARFREE to false ) ) - val nutrientFilterType: MutableStateFlow> = MutableStateFlow( - mapOf( - NutrientFilterType.NUTRIENT to false, - NutrientFilterType.INGREDIENT to false, - NutrientFilterType.ALL to false - ) - ) + private val _nutrientFilterType = MutableStateFlow(null) + val nutrientFilterType get() = _nutrientFilterType.asStateFlow() val isFilterBtnEnabled: StateFlow = combine( currentPage, mainPurposeType, @@ -59,7 +54,7 @@ class FilterSettingViewModel @Inject constructor( when (currentPage) { 0 -> mainPurposeType != null 1 -> breadFilterType.any { it.value } - 2 -> nutrientFilterType.any { it.value } + 2 -> nutrientFilterType != null else -> false } }.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), false) @@ -86,10 +81,7 @@ class FilterSettingViewModel @Inject constructor( } fun setNutrientFilterType(nutrientType: NutrientFilterType) { - val isSelected = nutrientFilterType.value[nutrientType] ?: return - nutrientFilterType.value = nutrientFilterType.value.toMutableMap().apply { - this[nutrientType] = !isSelected - } + _nutrientFilterType.value = nutrientType } fun setUserFilter() { diff --git a/app/src/main/res/layout/fragment_nutrient_type_filter.xml b/app/src/main/res/layout/fragment_nutrient_type_filter.xml index 748118ff..8c735138 100644 --- a/app/src/main/res/layout/fragment_nutrient_type_filter.xml +++ b/app/src/main/res/layout/fragment_nutrient_type_filter.xml @@ -60,7 +60,7 @@ Date: Sat, 3 Feb 2024 17:29:09 +0900 Subject: [PATCH 09/17] =?UTF-8?q?[chore]=20#218=20BreadFilterType=EC=97=90?= =?UTF-8?q?=20id=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/sopt/geonppang/presentation/type/BreadFilterType.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/type/BreadFilterType.kt b/app/src/main/java/com/sopt/geonppang/presentation/type/BreadFilterType.kt index eddfba48..f3e336fc 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/type/BreadFilterType.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/type/BreadFilterType.kt @@ -4,22 +4,27 @@ import androidx.annotation.StringRes import com.sopt.geonppang.R enum class BreadFilterType( + val id: Int, @StringRes val titleRes: Int, @StringRes val desRes: Int, ) { GLUTENFREE( + id = 1, titleRes = R.string.bread_type_gluten_free_title, desRes = R.string.bread_type_gluten_free_des ), VEGAN( + id = 2, titleRes = R.string.bread_type_vegan_title, desRes = R.string.bread_type_vegan_des ), NUTFREE( + id = 3, titleRes = R.string.bread_type_nut_free_title, desRes = R.string.bread_type_nut_free_des ), SUGARFREE( + id = 4, titleRes = R.string.bread_type_sugar_free_title, desRes = R.string.bread_type_sugar_free_des, ) From ed1d8c3d2775bd6843e654c9e3f76f68b2c2f45a Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Sat, 3 Feb 2024 20:41:37 +0900 Subject: [PATCH 10/17] =?UTF-8?q?[chore]=20#218=20NutrientFilterType?= =?UTF-8?q?=EC=97=90=20id=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/geonppang/presentation/type/NutrientFilterType.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt b/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt index cc5bb2a2..2149801f 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt @@ -4,18 +4,22 @@ import androidx.annotation.StringRes import com.sopt.geonppang.R enum class NutrientFilterType( + val id: Int, @StringRes val titleRes: Int, @StringRes val desRes: Int ) { NUTRIENT( + id = 2, titleRes = R.string.nutrient_type_nutrient_open_title, desRes = R.string.nutrient_type_nutrient_open_des ), INGREDIENT( + id = 1, titleRes = R.string.nutrient_type_ingredient_open_title, desRes = R.string.nutrient_type_ingredient_open_des ), ALL( + id = 3, titleRes = R.string.nutrient_type_all_open_title, desRes = R.string.nutrient_type_all_open_des ) From 31488ba0fca0396b8f0a042b2a67892b0b69ebc3 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Sat, 3 Feb 2024 21:53:03 +0900 Subject: [PATCH 11/17] =?UTF-8?q?[chore]=20#218=20breadTypeList=EB=A5=BC?= =?UTF-8?q?=20=EB=82=B4=EB=A0=A4=EC=A3=BC=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filterSetting/FilterSettingViewModel.kt | 20 ++++++------------- .../res/layout/fragment_bread_type_filter.xml | 8 ++++---- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt index 9c06c34a..cb8fbbca 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt @@ -3,7 +3,6 @@ package com.sopt.geonppang.presentation.filterSetting import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.sopt.geonppang.data.datasource.local.GPDataSource -import com.sopt.geonppang.data.model.request.RequestSettingFilter import com.sopt.geonppang.domain.repository.FilterSettingRepository import com.sopt.geonppang.presentation.model.AmplitudeFilterSettingInfo import com.sopt.geonppang.presentation.type.BreadFilterType @@ -35,25 +34,18 @@ class FilterSettingViewModel @Inject constructor( val currentPage get() = _currentPage.asStateFlow() private val _mainPurposeType = MutableStateFlow(null) val mainPurposeType get() = _mainPurposeType.asStateFlow() - val breadFilterType: MutableStateFlow> = MutableStateFlow( - mapOf( - BreadFilterType.GLUTENFREE to false, - BreadFilterType.VEGAN to false, - BreadFilterType.NUTFREE to false, - BreadFilterType.SUGARFREE to false - ) - ) + val breadFilterTypeList: MutableStateFlow> = MutableStateFlow(emptyList()) private val _nutrientFilterType = MutableStateFlow(null) val nutrientFilterType get() = _nutrientFilterType.asStateFlow() val isFilterBtnEnabled: StateFlow = combine( currentPage, mainPurposeType, - breadFilterType, + breadFilterTypeList, nutrientFilterType ) { currentPage, mainPurposeType, breadFilterType, nutrientFilterType -> when (currentPage) { 0 -> mainPurposeType != null - 1 -> breadFilterType.any { it.value } + 1 -> breadFilterType.isNotEmpty() 2 -> nutrientFilterType != null else -> false } @@ -74,9 +66,9 @@ class FilterSettingViewModel @Inject constructor( } fun setBreadFilterType(breadType: BreadFilterType) { - val isSelected = breadFilterType.value[breadType] ?: return - breadFilterType.value = breadFilterType.value.toMutableMap().apply { - this[breadType] = !isSelected + breadFilterTypeList.value = breadFilterTypeList.value.toMutableList().apply { + if (!remove(breadType.id)) add(breadType.id) + sort() } } diff --git a/app/src/main/res/layout/fragment_bread_type_filter.xml b/app/src/main/res/layout/fragment_bread_type_filter.xml index 3f55d6e4..f68428a7 100644 --- a/app/src/main/res/layout/fragment_bread_type_filter.xml +++ b/app/src/main/res/layout/fragment_bread_type_filter.xml @@ -78,7 +78,7 @@ Date: Sat, 3 Feb 2024 21:56:49 +0900 Subject: [PATCH 12/17] =?UTF-8?q?[chore]=20#218=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=20=EC=A0=95=EB=B3=B4=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=ED=95=98=EA=B8=B0=20DTO=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/request/RequestSettingFilter.kt | 21 ++-------- .../model/response/ResponseSettingFilter.kt | 38 ++++++------------- .../geonppang/domain/model/SelectedFilter.kt | 17 +++------ 3 files changed, 21 insertions(+), 55 deletions(-) diff --git a/app/src/main/java/com/sopt/geonppang/data/model/request/RequestSettingFilter.kt b/app/src/main/java/com/sopt/geonppang/data/model/request/RequestSettingFilter.kt index c4e799fa..cf0fa26d 100644 --- a/app/src/main/java/com/sopt/geonppang/data/model/request/RequestSettingFilter.kt +++ b/app/src/main/java/com/sopt/geonppang/data/model/request/RequestSettingFilter.kt @@ -5,21 +5,6 @@ import kotlinx.serialization.Serializable @Serializable data class RequestSettingFilter( val mainPurpose: String, - val breadType: BreadType, - val nutrientType: NutrientType -) { - @Serializable - data class BreadType( - val isGlutenFree: Boolean, - val isVegan: Boolean, - val isNutFree: Boolean, - val isSugarFree: Boolean, - ) - - @Serializable - data class NutrientType( - val isNutrientOpen: Boolean, - val isIngredientOpen: Boolean, - val isNotOpen: Boolean, - ) -} + val breadType: List, + val nutrientType: List +) diff --git a/app/src/main/java/com/sopt/geonppang/data/model/response/ResponseSettingFilter.kt b/app/src/main/java/com/sopt/geonppang/data/model/response/ResponseSettingFilter.kt index 557b8519..d9800662 100644 --- a/app/src/main/java/com/sopt/geonppang/data/model/response/ResponseSettingFilter.kt +++ b/app/src/main/java/com/sopt/geonppang/data/model/response/ResponseSettingFilter.kt @@ -11,44 +11,30 @@ data class ResponseSettingFilter( ) { @Serializable data class Data( - val breadType: BreadType, + val breadTypeList: List, val mainPurpose: String, val memberId: Int, val nickname: String, - val nutrientType: NutrientType + val nutrientTypeList: List ) @Serializable - data class BreadType( - val breadTypeId: Int, - val breadTypeName: String, - val isGlutenFree: Boolean, - val isNutFree: Boolean, - val isSugarFree: Boolean, - val isVegan: Boolean + data class BreadTypeId( + val breadTypeId: Int ) @Serializable - data class NutrientType( - val isIngredientOpen: Boolean, - val isNotOpen: Boolean, - val isNutrientOpen: Boolean, - val nutrientTypeId: Int, - val nutrientTypeName: String + data class NutrientTypeId( + val nutrientTypeId: Int ) fun toSelectedFilter() = SelectedFilter( mainPurpose = data.mainPurpose, - breadType = SelectedFilter.BreadType( - isGlutenFree = data.breadType.isGlutenFree, - isVegan = data.breadType.isVegan, - isNutFree = data.breadType.isNutFree, - isSugarFree = data.breadType.isSugarFree - ), - nutrientType = SelectedFilter.NutrientType( - isIngredientOpen = data.nutrientType.isIngredientOpen, - isNotOpen = data.nutrientType.isNotOpen, - isNutrientOpen = data.nutrientType.isNutrientOpen - ) + breadTypeList = data.breadTypeList.map { breadType -> SelectedFilter.BreadTypeId(breadTypeId = breadType.breadTypeId) }, + nutrientTypeList = data.nutrientTypeList.map { nutrientType -> + SelectedFilter.NutrientTypeId( + nutrientTypeId = nutrientType.nutrientTypeId + ) + } ) } diff --git a/app/src/main/java/com/sopt/geonppang/domain/model/SelectedFilter.kt b/app/src/main/java/com/sopt/geonppang/domain/model/SelectedFilter.kt index 05a61375..394ef77d 100644 --- a/app/src/main/java/com/sopt/geonppang/domain/model/SelectedFilter.kt +++ b/app/src/main/java/com/sopt/geonppang/domain/model/SelectedFilter.kt @@ -2,19 +2,14 @@ package com.sopt.geonppang.domain.model data class SelectedFilter( val mainPurpose: String, - val breadType: BreadType, - val nutrientType: NutrientType + val breadTypeList: List, + val nutrientTypeList: List ) { - data class BreadType( - val isGlutenFree: Boolean, - val isVegan: Boolean, - val isNutFree: Boolean, - val isSugarFree: Boolean, + data class BreadTypeId( + val breadTypeId: Int ) - data class NutrientType( - val isIngredientOpen: Boolean, - val isNotOpen: Boolean, - val isNutrientOpen: Boolean + data class NutrientTypeId( + val nutrientTypeId: Int ) } From c8bcfa874d2752167045284ed50da78ea3a1c3e9 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Sun, 4 Feb 2024 22:19:26 +0900 Subject: [PATCH 13/17] =?UTF-8?q?[chore]=20#218=20NutrientFilterType=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/type/NutrientFilterType.kt | 6 ++-- .../layout/fragment_nutrient_type_filter.xml | 28 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt b/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt index 2149801f..a8bb1a2c 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/type/NutrientFilterType.kt @@ -8,17 +8,17 @@ enum class NutrientFilterType( @StringRes val titleRes: Int, @StringRes val desRes: Int ) { - NUTRIENT( + MATERIALS( id = 2, titleRes = R.string.nutrient_type_nutrient_open_title, desRes = R.string.nutrient_type_nutrient_open_des ), - INGREDIENT( + INGREDIENTS( id = 1, titleRes = R.string.nutrient_type_ingredient_open_title, desRes = R.string.nutrient_type_ingredient_open_des ), - ALL( + PRIVATE( id = 3, titleRes = R.string.nutrient_type_all_open_title, desRes = R.string.nutrient_type_all_open_des diff --git a/app/src/main/res/layout/fragment_nutrient_type_filter.xml b/app/src/main/res/layout/fragment_nutrient_type_filter.xml index 8c735138..bd95c7b8 100644 --- a/app/src/main/res/layout/fragment_nutrient_type_filter.xml +++ b/app/src/main/res/layout/fragment_nutrient_type_filter.xml @@ -58,43 +58,43 @@ app:layout_constraintTop_toTopOf="parent" /> + app:nutrientType="@{NutrientFilterType.MATERIALS}" /> + app:layout_constraintTop_toBottomOf="@id/include_nutrient_type_filter_materials" + app:nutrientType="@{NutrientFilterType.INGREDIENTS}" /> + app:layout_constraintTop_toBottomOf="@id/include_nutrient_type_filter_ingredients" + app:nutrientType="@{NutrientFilterType.PRIVATE}" /> From 58028edad336010991d374ea6d777db0a8d58c9a Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Mon, 5 Feb 2024 16:51:00 +0900 Subject: [PATCH 14/17] =?UTF-8?q?[mod]=20#218=20=ED=95=84=ED=84=B0=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20Amplitude=20=EC=88=98=EC=A0=95=20=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=B0=98=EC=98=81=20=EB=B0=8F=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filterSetting/FilterSettingActivity.kt | 38 ++++++++----------- .../filterSetting/FilterSettingViewModel.kt | 35 ++++++++--------- .../model/AmplitudeFilterSettingInfo.kt | 4 +- 3 files changed, 32 insertions(+), 45 deletions(-) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingActivity.kt b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingActivity.kt index 097b0949..7826b0d7 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingActivity.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingActivity.kt @@ -10,9 +10,7 @@ import com.sopt.geonppang.R import com.sopt.geonppang.databinding.ActivityFilterBinding import com.sopt.geonppang.presentation.MainActivity import com.sopt.geonppang.presentation.model.AmplitudeFilterSettingInfo -import com.sopt.geonppang.presentation.type.BreadFilterType import com.sopt.geonppang.presentation.type.FilterInfoType -import com.sopt.geonppang.presentation.type.NutrientFilterType import com.sopt.geonppang.util.AmplitudeUtils import com.sopt.geonppang.util.UiState import com.sopt.geonppang.util.binding.BindingActivity @@ -44,12 +42,12 @@ class FilterSettingActivity : BindingActivity(R.layout.ac binding.vpFilterContainer.adapter = adapter binding.vpFilterContainer.isUserInputEnabled = false binding.vpFilterContainer.registerOnPageChangeCallback(object : - ViewPager2.OnPageChangeCallback() { - override fun onPageSelected(position: Int) { - super.onPageSelected(position) - viewModel.setCurrentPage(position) - } - }) + ViewPager2.OnPageChangeCallback() { + override fun onPageSelected(position: Int) { + super.onPageSelected(position) + viewModel.setCurrentPage(position) + } + }) setPreviousActivity() } @@ -197,14 +195,16 @@ class FilterSettingActivity : BindingActivity(R.layout.ac property: UiState.Success ) { property.data.mainPurposeType?.let { mainPurposeType -> - AmplitudeUtils.trackEventWithMapProperties( - eventName, - mapOf( - MAIN_PURPOSE to mainPurposeType, - BREAD_TYPE to getStringBreadType(property.data.breadType), - INGREDIENTS_TYPE to getStringIngredientType(property.data.ingredientType) + property.data.ingredientType?.let { ingredientType -> + AmplitudeUtils.trackEventWithMapProperties( + eventName, + mapOf( + MAIN_PURPOSE to mainPurposeType, + BREAD_TYPE to property.data.breadType, + INGREDIENTS_TYPE to ingredientType + ) ) - ) + } } } @@ -226,14 +226,6 @@ class FilterSettingActivity : BindingActivity(R.layout.ac } } - private fun getStringBreadType(breadType: Map): List { - return breadType.entries.filter { it.value }.map { it.key.name } - } - - private fun getStringIngredientType(ingredientType: Map): List { - return ingredientType.entries.filter { it.value }.map { it.key.name } - } - companion object { const val FILTER_INFO = "filterInfo" const val MY_PAGE_FRAGMENT = "MyPageFragment" diff --git a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt index cb8fbbca..71654df1 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt @@ -3,6 +3,7 @@ package com.sopt.geonppang.presentation.filterSetting import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.sopt.geonppang.data.datasource.local.GPDataSource +import com.sopt.geonppang.data.model.request.RequestSettingFilter import com.sopt.geonppang.domain.repository.FilterSettingRepository import com.sopt.geonppang.presentation.model.AmplitudeFilterSettingInfo import com.sopt.geonppang.presentation.type.BreadFilterType @@ -78,31 +79,25 @@ class FilterSettingViewModel @Inject constructor( fun setUserFilter() { viewModelScope.launch { - _mainPurposeType.value?.let { - RequestSettingFilter( - it.name, - RequestSettingFilter.BreadType( - breadFilterType.value[BreadFilterType.GLUTENFREE] == true, - breadFilterType.value[BreadFilterType.VEGAN] == true, - breadFilterType.value[BreadFilterType.NUTFREE] == true, - breadFilterType.value[BreadFilterType.SUGARFREE] == true, - ), - RequestSettingFilter.NutrientType( - nutrientFilterType.value[NutrientFilterType.NUTRIENT] == true, - nutrientFilterType.value[NutrientFilterType.INGREDIENT] == true, - nutrientFilterType.value[NutrientFilterType.ALL] == true, + _mainPurposeType.value?.let { mainPurposeFilterType -> + _nutrientFilterType.value?.let { nutrientFilterType -> + RequestSettingFilter( + mainPurpose = mainPurposeFilterType.name, + breadType = breadFilterTypeList.value, + nutrientType = listOf(nutrientFilterType.id) ) - ) - }?.let { - filterRepository.setUserFilter( - it - ) + } + }?.let { requestSettingFilter -> + filterRepository.setUserFilter(requestSettingFilter) .onSuccess { _selectedFilterState.value = UiState.Success( AmplitudeFilterSettingInfo( mainPurposeType = _mainPurposeType.value, - breadType = breadFilterType.value, - ingredientType = nutrientFilterType.value, + breadType = breadFilterTypeList.value.mapNotNull { breadFilterTypeId -> + BreadFilterType.values() + .find { it.id == breadFilterTypeId }?.name + }, + ingredientType = _nutrientFilterType.value, ) ) } diff --git a/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt b/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt index 5925a0ba..eac841b8 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt @@ -6,6 +6,6 @@ import com.sopt.geonppang.presentation.type.NutrientFilterType data class AmplitudeFilterSettingInfo( val mainPurposeType: MainPurposeFilterType?, - val breadType: Map, - val ingredientType: Map + val breadType: List, + val ingredientType: NutrientFilterType? ) From e06d3c0a8795e3a89c897d48942ac9d4f8747376 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Mon, 5 Feb 2024 17:06:43 +0900 Subject: [PATCH 15/17] =?UTF-8?q?[chore]=20#218=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=EC=B9=A9=20=EC=A1=B0=ED=9A=8C=20API=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81=20(re?= =?UTF-8?q?sponse=20List=20=ED=98=95=ED=83=9C=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/response/ResponseGetUserFilter.kt | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/sopt/geonppang/data/model/response/ResponseGetUserFilter.kt b/app/src/main/java/com/sopt/geonppang/data/model/response/ResponseGetUserFilter.kt index e4dd3aca..1c866461 100644 --- a/app/src/main/java/com/sopt/geonppang/data/model/response/ResponseGetUserFilter.kt +++ b/app/src/main/java/com/sopt/geonppang/data/model/response/ResponseGetUserFilter.kt @@ -11,29 +11,20 @@ data class ResponseGetUserFilter( ) { @Serializable data class Data( - val breadType: BreadType, + val breadTypeList: List, val mainPurpose: String, val memberId: Int, val nickname: String, - val nutrientType: NutrientType + val nutrientTypeList: List ) { @Serializable - data class BreadType( - val breadTypeId: Int, - val breadTypeName: String, - val isGlutenFree: Boolean, - val isNutFree: Boolean, - val isSugarFree: Boolean, - val isVegan: Boolean + data class BreadTypeId( + val breadTypeId: Int ) @Serializable - data class NutrientType( - val isIngredientOpen: Boolean, - val isNotOpen: Boolean, - val isNutrientOpen: Boolean, - val nutrientTypeId: Int, - val nutrientTypeName: String + data class NutrientTypeId( + val nutrientTypeId: Int ) } From ec2f60716a72533096c49ec2bf2d130043ca74f1 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Mon, 5 Feb 2024 18:27:43 +0900 Subject: [PATCH 16/17] =?UTF-8?q?[chore]=20#218=20RequestSettingFilter=20D?= =?UTF-8?q?TO=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/geonppang/data/model/request/RequestSettingFilter.kt | 4 ++-- .../presentation/filterSetting/FilterSettingViewModel.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/sopt/geonppang/data/model/request/RequestSettingFilter.kt b/app/src/main/java/com/sopt/geonppang/data/model/request/RequestSettingFilter.kt index cf0fa26d..f0c5a75b 100644 --- a/app/src/main/java/com/sopt/geonppang/data/model/request/RequestSettingFilter.kt +++ b/app/src/main/java/com/sopt/geonppang/data/model/request/RequestSettingFilter.kt @@ -5,6 +5,6 @@ import kotlinx.serialization.Serializable @Serializable data class RequestSettingFilter( val mainPurpose: String, - val breadType: List, - val nutrientType: List + val breadTypeList: List, + val nutrientTypeList: List ) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt index 71654df1..16c772bf 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingViewModel.kt @@ -83,8 +83,8 @@ class FilterSettingViewModel @Inject constructor( _nutrientFilterType.value?.let { nutrientFilterType -> RequestSettingFilter( mainPurpose = mainPurposeFilterType.name, - breadType = breadFilterTypeList.value, - nutrientType = listOf(nutrientFilterType.id) + breadTypeList = breadFilterTypeList.value, + nutrientTypeList = listOf(nutrientFilterType.id) ) } }?.let { requestSettingFilter -> From 7ce74e0e528a498084874feaefc2707614b70e26 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Mon, 5 Feb 2024 18:56:36 +0900 Subject: [PATCH 17/17] [chore] #218 ktlintFormat --- .../filterSetting/FilterSettingActivity.kt | 12 ++++++------ .../presentation/model/AmplitudeFilterSettingInfo.kt | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingActivity.kt b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingActivity.kt index 7826b0d7..51f9a64e 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingActivity.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/filterSetting/FilterSettingActivity.kt @@ -42,12 +42,12 @@ class FilterSettingActivity : BindingActivity(R.layout.ac binding.vpFilterContainer.adapter = adapter binding.vpFilterContainer.isUserInputEnabled = false binding.vpFilterContainer.registerOnPageChangeCallback(object : - ViewPager2.OnPageChangeCallback() { - override fun onPageSelected(position: Int) { - super.onPageSelected(position) - viewModel.setCurrentPage(position) - } - }) + ViewPager2.OnPageChangeCallback() { + override fun onPageSelected(position: Int) { + super.onPageSelected(position) + viewModel.setCurrentPage(position) + } + }) setPreviousActivity() } diff --git a/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt b/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt index eac841b8..ff6e7ac8 100644 --- a/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt +++ b/app/src/main/java/com/sopt/geonppang/presentation/model/AmplitudeFilterSettingInfo.kt @@ -1,6 +1,5 @@ package com.sopt.geonppang.presentation.model -import com.sopt.geonppang.presentation.type.BreadFilterType import com.sopt.geonppang.presentation.type.MainPurposeFilterType import com.sopt.geonppang.presentation.type.NutrientFilterType