From c2bd55b037c7215eb46dc37d3f43657d7b9bc4e2 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Thu, 12 Feb 2026 20:48:41 +0900 Subject: [PATCH 01/31] =?UTF-8?q?Refactor:=20mypage=20state,=20sideeffect?= =?UTF-8?q?=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bitnagil/presentation/mypage/MyPageScreen.kt | 2 +- .../bitnagil/presentation/mypage/MyPageViewModel.kt | 6 +++--- .../mypage/contract/MyPageSideEffect.kt | 3 +++ .../presentation/mypage/contract/MyPageState.kt | 13 +++++++++++++ .../presentation/mypage/model/MyPageSideEffect.kt | 3 --- .../presentation/mypage/model/MyPageState.kt | 10 ---------- 6 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageSideEffect.kt create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageState.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageSideEffect.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageState.kt diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/MyPageScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/MyPageScreen.kt index dbab8ac1..0111e740 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/MyPageScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/MyPageScreen.kt @@ -28,7 +28,7 @@ import com.threegap.bitnagil.designsystem.R import com.threegap.bitnagil.designsystem.component.atom.BitnagilIconButton import com.threegap.bitnagil.designsystem.component.block.BitnagilOptionButton import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar -import com.threegap.bitnagil.presentation.mypage.model.MyPageState +import com.threegap.bitnagil.presentation.mypage.contract.MyPageState import org.orbitmvi.orbit.compose.collectAsState @Composable diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/MyPageViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/MyPageViewModel.kt index d9b591d1..3ab9725a 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/MyPageViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/MyPageViewModel.kt @@ -2,8 +2,8 @@ package com.threegap.bitnagil.presentation.mypage import androidx.lifecycle.ViewModel import com.threegap.bitnagil.domain.user.usecase.FetchUserProfileUseCase -import com.threegap.bitnagil.presentation.mypage.model.MyPageSideEffect -import com.threegap.bitnagil.presentation.mypage.model.MyPageState +import com.threegap.bitnagil.presentation.mypage.contract.MyPageSideEffect +import com.threegap.bitnagil.presentation.mypage.contract.MyPageState import dagger.hilt.android.lifecycle.HiltViewModel import org.orbitmvi.orbit.Container import org.orbitmvi.orbit.ContainerHost @@ -14,7 +14,7 @@ import javax.inject.Inject class MyPageViewModel @Inject constructor( private val fetchUserProfileUseCase: FetchUserProfileUseCase, ) : ContainerHost, ViewModel() { - override val container: Container = container(initialState = MyPageState.Init) + override val container: Container = container(initialState = MyPageState.INIT) init { loadMyPageInfo() diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageSideEffect.kt new file mode 100644 index 00000000..196446a0 --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageSideEffect.kt @@ -0,0 +1,3 @@ +package com.threegap.bitnagil.presentation.mypage.contract + +sealed interface MyPageSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageState.kt new file mode 100644 index 00000000..a386507b --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageState.kt @@ -0,0 +1,13 @@ +package com.threegap.bitnagil.presentation.mypage.contract + +data class MyPageState( + val name: String, + val profileUrl: String, +) { + companion object { + val INIT = MyPageState( + name = "", + profileUrl = "" + ) + } +} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageSideEffect.kt deleted file mode 100644 index a11e85c2..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageSideEffect.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.threegap.bitnagil.presentation.mypage.model - -sealed class MyPageSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageState.kt deleted file mode 100644 index 0c17af7c..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageState.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.threegap.bitnagil.presentation.mypage.model - -data class MyPageState( - val name: String, - val profileUrl: String, -) { - companion object { - val Init = MyPageState(name = "", profileUrl = "") - } -} From ffeafbff0ad37c4657f0667c4168ce9f08d45062 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 00:32:12 +0900 Subject: [PATCH 02/31] =?UTF-8?q?Refactor:=20login=20state,=20sideeffect?= =?UTF-8?q?=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/threegap/bitnagil/presentation/login/LoginScreen.kt | 2 +- .../threegap/bitnagil/presentation/login/LoginViewModel.kt | 4 ++-- .../presentation/login/{model => contract}/LoginSideEffect.kt | 2 +- .../presentation/login/{model => contract}/LoginState.kt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename presentation/src/main/java/com/threegap/bitnagil/presentation/login/{model => contract}/LoginSideEffect.kt (71%) rename presentation/src/main/java/com/threegap/bitnagil/presentation/login/{model => contract}/LoginState.kt (78%) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt index ef41e7ba..7d1c10a1 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt @@ -32,7 +32,7 @@ import com.threegap.bitnagil.designsystem.R import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple import com.threegap.bitnagil.presentation.login.kakao.KakaoLoginHandlerImpl -import com.threegap.bitnagil.presentation.login.model.LoginSideEffect +import com.threegap.bitnagil.presentation.login.contract.LoginSideEffect import org.orbitmvi.orbit.compose.collectSideEffect @Composable diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt index a331890b..686f7d37 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt @@ -5,8 +5,8 @@ import androidx.lifecycle.ViewModel import com.kakao.sdk.auth.model.OAuthToken import com.threegap.bitnagil.domain.auth.model.UserRole import com.threegap.bitnagil.domain.auth.usecase.LoginUseCase -import com.threegap.bitnagil.presentation.login.model.LoginSideEffect -import com.threegap.bitnagil.presentation.login.model.LoginState +import com.threegap.bitnagil.presentation.login.contract.LoginSideEffect +import com.threegap.bitnagil.presentation.login.contract.LoginState import dagger.hilt.android.lifecycle.HiltViewModel import org.orbitmvi.orbit.Container import org.orbitmvi.orbit.ContainerHost diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/contract/LoginSideEffect.kt similarity index 71% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginSideEffect.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/login/contract/LoginSideEffect.kt index 3876c792..ba5f64ef 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginSideEffect.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/contract/LoginSideEffect.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.login.model +package com.threegap.bitnagil.presentation.login.contract sealed interface LoginSideEffect { data object NavigateToHome : LoginSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/contract/LoginState.kt similarity index 78% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/login/contract/LoginState.kt index e84d295b..13d451c4 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/contract/LoginState.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.login.model +package com.threegap.bitnagil.presentation.login.contract data class LoginState( val isLoading: Boolean, From ce4dc59514bfafa325ab1cb19fa2ea3dbd8dee1b Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 00:34:09 +0900 Subject: [PATCH 03/31] =?UTF-8?q?Refactor:=20guide=20state,=20sideEffect?= =?UTF-8?q?=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/threegap/bitnagil/presentation/guide/GuideScreen.kt | 2 +- .../threegap/bitnagil/presentation/guide/GuideViewModel.kt | 4 ++-- .../presentation/guide/{model => contract}/GuideSideEffect.kt | 2 +- .../presentation/guide/{model => contract}/GuideState.kt | 4 +++- 4 files changed, 7 insertions(+), 5 deletions(-) rename presentation/src/main/java/com/threegap/bitnagil/presentation/guide/{model => contract}/GuideSideEffect.kt (60%) rename presentation/src/main/java/com/threegap/bitnagil/presentation/guide/{model => contract}/GuideState.kt (66%) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/GuideScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/GuideScreen.kt index 2e7512c2..aab98164 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/GuideScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/GuideScreen.kt @@ -16,7 +16,7 @@ import androidx.hilt.navigation.compose.hiltViewModel import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar import com.threegap.bitnagil.presentation.guide.component.atom.GuideButton import com.threegap.bitnagil.presentation.guide.component.template.GuideBottomSheet -import com.threegap.bitnagil.presentation.guide.model.GuideSideEffect +import com.threegap.bitnagil.presentation.guide.contract.GuideSideEffect import com.threegap.bitnagil.presentation.guide.model.GuideType import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/GuideViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/GuideViewModel.kt index ca1a64ca..f12a3ecd 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/GuideViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/GuideViewModel.kt @@ -1,8 +1,8 @@ package com.threegap.bitnagil.presentation.guide import androidx.lifecycle.ViewModel -import com.threegap.bitnagil.presentation.guide.model.GuideSideEffect -import com.threegap.bitnagil.presentation.guide.model.GuideState +import com.threegap.bitnagil.presentation.guide.contract.GuideSideEffect +import com.threegap.bitnagil.presentation.guide.contract.GuideState import com.threegap.bitnagil.presentation.guide.model.GuideType import dagger.hilt.android.lifecycle.HiltViewModel import org.orbitmvi.orbit.Container diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/model/GuideSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/contract/GuideSideEffect.kt similarity index 60% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/guide/model/GuideSideEffect.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/guide/contract/GuideSideEffect.kt index 8c9e9d3a..b174c955 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/model/GuideSideEffect.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/contract/GuideSideEffect.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.guide.model +package com.threegap.bitnagil.presentation.guide.contract sealed interface GuideSideEffect { data object NavigateToBack : GuideSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/model/GuideState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/contract/GuideState.kt similarity index 66% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/guide/model/GuideState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/guide/contract/GuideState.kt index 0375371a..2a26eb37 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/model/GuideState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/guide/contract/GuideState.kt @@ -1,4 +1,6 @@ -package com.threegap.bitnagil.presentation.guide.model +package com.threegap.bitnagil.presentation.guide.contract + +import com.threegap.bitnagil.presentation.guide.model.GuideType data class GuideState( val guideType: GuideType?, From 38cacccea5485af26724ce4b0510dcf6f0d5194e Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 00:36:08 +0900 Subject: [PATCH 04/31] =?UTF-8?q?Refactor:=20emotion=20state,=20sideEffect?= =?UTF-8?q?=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../threegap/bitnagil/presentation/emotion/EmotionScreen.kt | 2 +- .../bitnagil/presentation/emotion/EmotionViewModel.kt | 4 ++-- .../component/template/EmotionRecommendRoutineScreen.kt | 2 +- .../component/template/SimpleEmotionSelectionScreen.kt | 2 +- .../component/template/SwipeEmotionSelectionScreen.kt | 2 +- .../presentation/emotion/contract/EmotionSideEffect.kt | 6 ++++++ .../emotion/{model/mvi => contract}/EmotionState.kt | 2 +- .../presentation/emotion/model/mvi/EmotionSideEffect.kt | 6 ------ 8 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/contract/EmotionSideEffect.kt rename presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/{model/mvi => contract}/EmotionState.kt (94%) delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionSideEffect.kt diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt index f3e64706..3868be06 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt @@ -15,7 +15,7 @@ import com.threegap.bitnagil.presentation.emotion.component.template.EmotionReco import com.threegap.bitnagil.presentation.emotion.component.template.SimpleEmotionSelectionScreen import com.threegap.bitnagil.presentation.emotion.component.template.SwipeEmotionSelectionScreen import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep -import com.threegap.bitnagil.presentation.emotion.model.mvi.EmotionSideEffect +import com.threegap.bitnagil.presentation.emotion.contract.EmotionSideEffect import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt index 042607e1..f2a41085 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt @@ -9,8 +9,8 @@ import com.threegap.bitnagil.domain.onboarding.usecase.RegisterRecommendOnBoardi import com.threegap.bitnagil.presentation.emotion.model.EmotionRecommendRoutineUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel -import com.threegap.bitnagil.presentation.emotion.model.mvi.EmotionSideEffect -import com.threegap.bitnagil.presentation.emotion.model.mvi.EmotionState +import com.threegap.bitnagil.presentation.emotion.contract.EmotionSideEffect +import com.threegap.bitnagil.presentation.emotion.contract.EmotionState import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.delay import kotlinx.coroutines.launch diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/EmotionRecommendRoutineScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/EmotionRecommendRoutineScreen.kt index 538383e3..f85d4781 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/EmotionRecommendRoutineScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/EmotionRecommendRoutineScreen.kt @@ -25,7 +25,7 @@ import com.threegap.bitnagil.presentation.emotion.model.EmotionImageUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionRecommendRoutineUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel -import com.threegap.bitnagil.presentation.emotion.model.mvi.EmotionState +import com.threegap.bitnagil.presentation.emotion.contract.EmotionState @Composable fun EmotionRecommendRoutineScreen( diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SimpleEmotionSelectionScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SimpleEmotionSelectionScreen.kt index 95e14dfd..552df9c1 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SimpleEmotionSelectionScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SimpleEmotionSelectionScreen.kt @@ -25,7 +25,7 @@ import com.threegap.bitnagil.presentation.emotion.component.atom.EmotionMarbleIm import com.threegap.bitnagil.presentation.emotion.model.EmotionImageUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel -import com.threegap.bitnagil.presentation.emotion.model.mvi.EmotionState +import com.threegap.bitnagil.presentation.emotion.contract.EmotionState @Composable fun SimpleEmotionSelectionScreen( diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SwipeEmotionSelectionScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SwipeEmotionSelectionScreen.kt index 7398231b..7296d24f 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SwipeEmotionSelectionScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SwipeEmotionSelectionScreen.kt @@ -65,7 +65,7 @@ import com.threegap.bitnagil.presentation.emotion.component.atom.EmotionMarbleIm import com.threegap.bitnagil.presentation.emotion.model.EmotionImageUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel -import com.threegap.bitnagil.presentation.emotion.model.mvi.EmotionState +import com.threegap.bitnagil.presentation.emotion.contract.EmotionState import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlin.math.absoluteValue diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/contract/EmotionSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/contract/EmotionSideEffect.kt new file mode 100644 index 00000000..4f5c6e3f --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/contract/EmotionSideEffect.kt @@ -0,0 +1,6 @@ +package com.threegap.bitnagil.presentation.emotion.contract + +sealed interface EmotionSideEffect { + data object NavigateToBack : EmotionSideEffect + data class ShowToast(val message: String) : EmotionSideEffect +} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/contract/EmotionState.kt similarity index 94% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/contract/EmotionState.kt index b4607781..e780d16d 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/contract/EmotionState.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.emotion.model.mvi +package com.threegap.bitnagil.presentation.emotion.contract import android.os.Parcelable import androidx.compose.runtime.Immutable diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionSideEffect.kt deleted file mode 100644 index ce643e75..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionSideEffect.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.threegap.bitnagil.presentation.emotion.model.mvi - -sealed class EmotionSideEffect { - data object NavigateToBack : EmotionSideEffect() - data class ShowToast(val message: String) : EmotionSideEffect() -} From 1fd7a33a9af86d2946a0cd5967aaabb8814de51a Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 00:37:36 +0900 Subject: [PATCH 05/31] =?UTF-8?q?Refactor:=20home=20state,=20sideEffect?= =?UTF-8?q?=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/threegap/bitnagil/presentation/home/HomeScreen.kt | 4 ++-- .../com/threegap/bitnagil/presentation/home/HomeViewModel.kt | 4 ++-- .../presentation/home/{model => contract}/HomeSideEffect.kt | 2 +- .../presentation/home/{model => contract}/HomeState.kt | 5 ++++- 4 files changed, 9 insertions(+), 6 deletions(-) rename presentation/src/main/java/com/threegap/bitnagil/presentation/home/{model => contract}/HomeSideEffect.kt (82%) rename presentation/src/main/java/com/threegap/bitnagil/presentation/home/{model => contract}/HomeState.kt (76%) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeScreen.kt index 8a8639b9..c7392508 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeScreen.kt @@ -28,8 +28,8 @@ import com.threegap.bitnagil.presentation.home.component.template.CollapsibleHom import com.threegap.bitnagil.presentation.home.component.template.EmptyRoutineView import com.threegap.bitnagil.presentation.home.component.template.RoutineSection import com.threegap.bitnagil.presentation.home.component.template.WeeklyDatePicker -import com.threegap.bitnagil.presentation.home.model.HomeSideEffect -import com.threegap.bitnagil.presentation.home.model.HomeState +import com.threegap.bitnagil.presentation.home.contract.HomeSideEffect +import com.threegap.bitnagil.presentation.home.contract.HomeState import com.threegap.bitnagil.presentation.home.util.rememberCollapsibleHeaderState import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt index ea9a12f8..6404f749 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt @@ -12,8 +12,8 @@ import com.threegap.bitnagil.domain.routine.usecase.RoutineCompletionUseCase import com.threegap.bitnagil.domain.routine.usecase.ToggleRoutineUseCase import com.threegap.bitnagil.domain.user.usecase.FetchUserProfileUseCase import com.threegap.bitnagil.domain.writeroutine.usecase.GetWriteRoutineEventFlowUseCase -import com.threegap.bitnagil.presentation.home.model.HomeSideEffect -import com.threegap.bitnagil.presentation.home.model.HomeState +import com.threegap.bitnagil.presentation.home.contract.HomeSideEffect +import com.threegap.bitnagil.presentation.home.contract.HomeState import com.threegap.bitnagil.presentation.home.model.ToggleStrategy import com.threegap.bitnagil.presentation.home.model.toUiModel import com.threegap.bitnagil.presentation.home.util.getCurrentWeekDays diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/HomeSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeSideEffect.kt similarity index 82% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/HomeSideEffect.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeSideEffect.kt index 9f55ba02..0d0682c4 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/HomeSideEffect.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeSideEffect.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.home.model +package com.threegap.bitnagil.presentation.home.contract sealed interface HomeSideEffect { data object NavigateToGuide : HomeSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/HomeState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeState.kt similarity index 76% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/HomeState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeState.kt index a54c49a4..c91b3c29 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/HomeState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeState.kt @@ -1,5 +1,8 @@ -package com.threegap.bitnagil.presentation.home.model +package com.threegap.bitnagil.presentation.home.contract +import com.threegap.bitnagil.presentation.home.model.RoutineScheduleUiModel +import com.threegap.bitnagil.presentation.home.model.RoutineUiModel +import com.threegap.bitnagil.presentation.home.model.TodayEmotionUiModel import com.threegap.bitnagil.presentation.home.util.getCurrentWeekDays import java.time.LocalDate From c90c8c6fc7695614329a5d40895bf24a1236713e Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 01:24:02 +0900 Subject: [PATCH 06/31] =?UTF-8?q?Refactor:=20onBoarding=20state,=20sideEff?= =?UTF-8?q?ect=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bitnagil/presentation/onboarding/OnBoardingScreen.kt | 4 ++-- .../presentation/onboarding/OnBoardingViewModel.kt | 4 ++-- .../onboarding/contract/OnBoardingSideEffect.kt | 7 +++++++ .../onboarding/{model/mvi => contract}/OnBoardingState.kt | 2 +- .../onboarding/model/mvi/OnBoardingSideEffect.kt | 7 ------- 5 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/contract/OnBoardingSideEffect.kt rename presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/{model/mvi => contract}/OnBoardingState.kt (93%) delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/mvi/OnBoardingSideEffect.kt diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt index b781d995..5a58f5ce 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt @@ -18,8 +18,8 @@ import com.threegap.bitnagil.presentation.onboarding.component.template.OnBoardi import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItem import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingPageInfo import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingSetType -import com.threegap.bitnagil.presentation.onboarding.model.mvi.OnBoardingSideEffect -import com.threegap.bitnagil.presentation.onboarding.model.mvi.OnBoardingState +import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingSideEffect +import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingState import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt index 7723bc1f..0fa79313 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt @@ -13,8 +13,8 @@ import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingAbstractTex import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItem import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingPageInfo import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingSetType -import com.threegap.bitnagil.presentation.onboarding.model.mvi.OnBoardingSideEffect -import com.threegap.bitnagil.presentation.onboarding.model.mvi.OnBoardingState +import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingSideEffect +import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingState import com.threegap.bitnagil.presentation.onboarding.model.navarg.OnBoardingScreenArg import dagger.assisted.Assisted import dagger.assisted.AssistedFactory diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/contract/OnBoardingSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/contract/OnBoardingSideEffect.kt new file mode 100644 index 00000000..6f17298d --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/contract/OnBoardingSideEffect.kt @@ -0,0 +1,7 @@ +package com.threegap.bitnagil.presentation.onboarding.contract + +sealed interface OnBoardingSideEffect { + data object MoveToPreviousScreen : OnBoardingSideEffect + data object NavigateToHomeScreen : OnBoardingSideEffect + data class ShowToast(val message: String) : OnBoardingSideEffect +} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/mvi/OnBoardingState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/contract/OnBoardingState.kt similarity index 93% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/mvi/OnBoardingState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/contract/OnBoardingState.kt index 99932577..7f8f76b4 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/mvi/OnBoardingState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/contract/OnBoardingState.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.onboarding.model.mvi +package com.threegap.bitnagil.presentation.onboarding.contract import android.os.Parcelable import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingPageInfo diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/mvi/OnBoardingSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/mvi/OnBoardingSideEffect.kt deleted file mode 100644 index e02b5efe..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/mvi/OnBoardingSideEffect.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.threegap.bitnagil.presentation.onboarding.model.mvi - -sealed class OnBoardingSideEffect { - data object MoveToPreviousScreen : OnBoardingSideEffect() - data object NavigateToHomeScreen : OnBoardingSideEffect() - data class ShowToast(val message: String) : OnBoardingSideEffect() -} From c57397f6cd34f1e8d776c5620f7e43f2be465958 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 01:25:02 +0900 Subject: [PATCH 07/31] =?UTF-8?q?Refactor:=20=20RecommendRoutine=20state,?= =?UTF-8?q?=20sideEffect=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/recommendroutine/RecommendRoutineScreen.kt | 4 ++-- .../recommendroutine/RecommendRoutineViewModel.kt | 4 ++-- .../{model => contract}/RecommendRoutineSideEffect.kt | 2 +- .../{model => contract}/RecommendRoutineState.kt | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) rename presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/{model => contract}/RecommendRoutineSideEffect.kt (74%) rename presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/{model => contract}/RecommendRoutineState.kt (86%) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineScreen.kt index b5370056..68323038 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineScreen.kt @@ -40,8 +40,8 @@ import com.threegap.bitnagil.presentation.recommendroutine.component.block.Emoti import com.threegap.bitnagil.presentation.recommendroutine.component.block.RecommendRoutineItem import com.threegap.bitnagil.presentation.recommendroutine.component.template.EmptyRecommendRoutineView import com.threegap.bitnagil.presentation.recommendroutine.component.template.RecommendLevelBottomSheet -import com.threegap.bitnagil.presentation.recommendroutine.model.RecommendRoutineSideEffect -import com.threegap.bitnagil.presentation.recommendroutine.model.RecommendRoutineState +import com.threegap.bitnagil.presentation.recommendroutine.contract.RecommendRoutineSideEffect +import com.threegap.bitnagil.presentation.recommendroutine.contract.RecommendRoutineState import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineViewModel.kt index 00a5b072..aaca7825 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineViewModel.kt @@ -6,8 +6,8 @@ import com.threegap.bitnagil.domain.emotion.usecase.GetEmotionChangeEventFlowUse import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.recommendroutine.model.RecommendLevel import com.threegap.bitnagil.domain.recommendroutine.usecase.FetchRecommendRoutinesUseCase -import com.threegap.bitnagil.presentation.recommendroutine.model.RecommendRoutineSideEffect -import com.threegap.bitnagil.presentation.recommendroutine.model.RecommendRoutineState +import com.threegap.bitnagil.presentation.recommendroutine.contract.RecommendRoutineSideEffect +import com.threegap.bitnagil.presentation.recommendroutine.contract.RecommendRoutineState import com.threegap.bitnagil.presentation.recommendroutine.model.RecommendRoutineUiModel import com.threegap.bitnagil.presentation.recommendroutine.model.RecommendRoutinesUiModel import com.threegap.bitnagil.presentation.recommendroutine.model.toUiModel diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/contract/RecommendRoutineSideEffect.kt similarity index 74% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineSideEffect.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/contract/RecommendRoutineSideEffect.kt index 61c49a4c..2b170381 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineSideEffect.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/contract/RecommendRoutineSideEffect.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.recommendroutine.model +package com.threegap.bitnagil.presentation.recommendroutine.contract sealed interface RecommendRoutineSideEffect { data object NavigateToEmotion : RecommendRoutineSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/contract/RecommendRoutineState.kt similarity index 86% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/contract/RecommendRoutineState.kt index 6b9e95b9..2800b3a5 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/contract/RecommendRoutineState.kt @@ -1,8 +1,9 @@ -package com.threegap.bitnagil.presentation.recommendroutine.model +package com.threegap.bitnagil.presentation.recommendroutine.contract import com.threegap.bitnagil.domain.recommendroutine.model.EmotionMarbleType import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.recommendroutine.model.RecommendLevel +import com.threegap.bitnagil.presentation.recommendroutine.model.RecommendRoutineUiModel data class RecommendRoutineState( val isLoading: Boolean, From 76e26e3652d10bd704626aa9f46f46a83ab9d672 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 01:25:57 +0900 Subject: [PATCH 08/31] =?UTF-8?q?Refactor:=20Report=20state,=20sideEffect?= =?UTF-8?q?=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../threegap/bitnagil/presentation/report/ReportScreen.kt | 6 +++--- .../bitnagil/presentation/report/ReportViewModel.kt | 6 +++--- .../report/component/template/CompleteReportContent.kt | 2 +- .../report/{model => contract}/ReportSideEffect.kt | 2 +- .../presentation/report/{model => contract}/ReportState.kt | 3 ++- 5 files changed, 10 insertions(+), 9 deletions(-) rename presentation/src/main/java/com/threegap/bitnagil/presentation/report/{model => contract}/ReportSideEffect.kt (70%) rename presentation/src/main/java/com/threegap/bitnagil/presentation/report/{model => contract}/ReportState.kt (92%) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportScreen.kt index cec60de3..2964b236 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportScreen.kt @@ -64,9 +64,9 @@ import com.threegap.bitnagil.presentation.report.component.ReportCategorySelecto import com.threegap.bitnagil.presentation.report.component.ReportField import com.threegap.bitnagil.presentation.report.component.template.CompleteReportContent import com.threegap.bitnagil.presentation.report.component.template.SubmittingReportContent -import com.threegap.bitnagil.presentation.report.model.ReportSideEffect -import com.threegap.bitnagil.presentation.report.model.ReportState -import com.threegap.bitnagil.presentation.report.model.ReportState.Companion.MAX_IMAGE_COUNT +import com.threegap.bitnagil.presentation.report.contract.ReportSideEffect +import com.threegap.bitnagil.presentation.report.contract.ReportState +import com.threegap.bitnagil.presentation.report.contract.ReportState.Companion.MAX_IMAGE_COUNT import com.threegap.bitnagil.presentation.report.model.SubmitState import com.threegap.bitnagil.presentation.report.model.uiTitle import kotlinx.coroutines.delay diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportViewModel.kt index 761dff11..fc653fad 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportViewModel.kt @@ -9,9 +9,9 @@ import com.threegap.bitnagil.domain.report.model.Report import com.threegap.bitnagil.domain.report.model.ReportCategory import com.threegap.bitnagil.domain.report.usecase.SubmitReportUseCase import com.threegap.bitnagil.presentation.common.file.convertUriToImageFile -import com.threegap.bitnagil.presentation.report.model.ReportSideEffect -import com.threegap.bitnagil.presentation.report.model.ReportState -import com.threegap.bitnagil.presentation.report.model.ReportState.Companion.MAX_IMAGE_COUNT +import com.threegap.bitnagil.presentation.report.contract.ReportSideEffect +import com.threegap.bitnagil.presentation.report.contract.ReportState +import com.threegap.bitnagil.presentation.report.contract.ReportState.Companion.MAX_IMAGE_COUNT import com.threegap.bitnagil.presentation.report.model.SubmitState import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.qualifiers.ApplicationContext diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/template/CompleteReportContent.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/template/CompleteReportContent.kt index 8a819ebb..c1bcad01 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/template/CompleteReportContent.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/template/CompleteReportContent.kt @@ -25,7 +25,7 @@ import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButton import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButtonColor import com.threegap.bitnagil.presentation.report.component.CompleteReportCard -import com.threegap.bitnagil.presentation.report.model.ReportState +import com.threegap.bitnagil.presentation.report.contract.ReportState @Composable fun CompleteReportContent( diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/model/ReportSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/contract/ReportSideEffect.kt similarity index 70% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/report/model/ReportSideEffect.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/report/contract/ReportSideEffect.kt index c3374c47..348a6d5a 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/model/ReportSideEffect.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/contract/ReportSideEffect.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.report.model +package com.threegap.bitnagil.presentation.report.contract sealed interface ReportSideEffect { data object NavigateToBack : ReportSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/model/ReportState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/contract/ReportState.kt similarity index 92% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/report/model/ReportState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/report/contract/ReportState.kt index 4676d8b0..cf39b3d9 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/model/ReportState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/contract/ReportState.kt @@ -1,7 +1,8 @@ -package com.threegap.bitnagil.presentation.report.model +package com.threegap.bitnagil.presentation.report.contract import android.net.Uri import com.threegap.bitnagil.domain.report.model.ReportCategory +import com.threegap.bitnagil.presentation.report.model.SubmitState data class ReportState( val reportImages: List, From 00a21064afb057bd673bac027a3377322da5f167 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 01:26:55 +0900 Subject: [PATCH 09/31] =?UTF-8?q?Refactor:=20=20ReportDetail=20state,=20si?= =?UTF-8?q?deEffect=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bitnagil/presentation/reportdetail/ReportDetailScreen.kt | 2 +- .../presentation/reportdetail/ReportDetailViewModel.kt | 4 ++-- .../reportdetail/contract/ReportDetailSideEffect.kt | 3 +++ .../reportdetail/{model/mvi => contract}/ReportDetailState.kt | 2 +- .../reportdetail/model/mvi/ReportDetailSideEffect.kt | 3 --- 5 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/contract/ReportDetailSideEffect.kt rename presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/{model/mvi => contract}/ReportDetailState.kt (92%) delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/mvi/ReportDetailSideEffect.kt diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailScreen.kt index 96ed075e..a833dfe4 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailScreen.kt @@ -29,7 +29,7 @@ import com.threegap.bitnagil.designsystem.BitnagilTheme import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar import com.threegap.bitnagil.presentation.reportdetail.component.atom.ReportProcessBadge import com.threegap.bitnagil.presentation.reportdetail.component.block.ReportDetailLabeledContent -import com.threegap.bitnagil.presentation.reportdetail.model.mvi.ReportDetailState +import com.threegap.bitnagil.presentation.reportdetail.contract.ReportDetailState import com.threegap.bitnagil.presentation.reportdetail.util.toPresentationFormatInReportDetail import org.orbitmvi.orbit.compose.collectAsState diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt index d28ddc4d..7213eee6 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt @@ -4,8 +4,8 @@ import androidx.lifecycle.ViewModel import com.threegap.bitnagil.domain.report.usecase.GetReportUseCase import com.threegap.bitnagil.presentation.reportdetail.model.ReportCategory import com.threegap.bitnagil.presentation.reportdetail.model.ReportProcess -import com.threegap.bitnagil.presentation.reportdetail.model.mvi.ReportDetailSideEffect -import com.threegap.bitnagil.presentation.reportdetail.model.mvi.ReportDetailState +import com.threegap.bitnagil.presentation.reportdetail.contract.ReportDetailSideEffect +import com.threegap.bitnagil.presentation.reportdetail.contract.ReportDetailState import com.threegap.bitnagil.presentation.reportdetail.model.navarg.ReportDetailScreenArg import dagger.assisted.Assisted import dagger.assisted.AssistedFactory diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/contract/ReportDetailSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/contract/ReportDetailSideEffect.kt new file mode 100644 index 00000000..6cdb8a22 --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/contract/ReportDetailSideEffect.kt @@ -0,0 +1,3 @@ +package com.threegap.bitnagil.presentation.reportdetail.contract + +interface ReportDetailSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/mvi/ReportDetailState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/contract/ReportDetailState.kt similarity index 92% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/mvi/ReportDetailState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/contract/ReportDetailState.kt index 834a5a9f..e3ac8114 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/mvi/ReportDetailState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/contract/ReportDetailState.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.reportdetail.model.mvi +package com.threegap.bitnagil.presentation.reportdetail.contract import com.threegap.bitnagil.presentation.reportdetail.model.ReportCategory import com.threegap.bitnagil.presentation.reportdetail.model.ReportProcess diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/mvi/ReportDetailSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/mvi/ReportDetailSideEffect.kt deleted file mode 100644 index 40bdd9b7..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/mvi/ReportDetailSideEffect.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.threegap.bitnagil.presentation.reportdetail.model.mvi - -interface ReportDetailSideEffect From 74edfa1111427d405de0142e886a0106ded0da70 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 01:33:17 +0900 Subject: [PATCH 10/31] =?UTF-8?q?Refactor:=20=20ReportHistory=20state,=20s?= =?UTF-8?q?ideEffect=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/reporthistory/ReportHistoryScreen.kt | 5 +++-- .../reporthistory/ReportHistoryViewModel.kt | 4 ++-- .../reporthistory/contract/ReportHistorySideEffect.kt | 3 +++ .../{model => contract}/ReportHistoryState.kt | 11 +++++++++-- .../reporthistory/model/ReportHistorySideEffect.kt | 3 --- 5 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistorySideEffect.kt rename presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/{model => contract}/ReportHistoryState.kt (83%) delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportHistorySideEffect.kt diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt index a9280669..9f5efaaf 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt @@ -36,11 +36,12 @@ import com.threegap.bitnagil.presentation.reporthistory.component.block.ReportHi import com.threegap.bitnagil.presentation.reporthistory.component.template.ReportCategoryBottomSheet import com.threegap.bitnagil.presentation.reporthistory.model.ReportCategory import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoriesPerDayUiModel -import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoryState +import com.threegap.bitnagil.presentation.reporthistory.contract.ReportHistoryState import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoryUiModel import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcess import com.threegap.bitnagil.presentation.reporthistory.util.toPresentationFormat import org.orbitmvi.orbit.compose.collectAsState +import java.time.LocalDate @Composable fun ReportHistoryScreenContainer( @@ -198,7 +199,7 @@ private fun ReportHistoryScreenPreview() { state = ReportHistoryState.Init.copy( reportHistoriesPerDays = List(10) { ReportHistoriesPerDayUiModel( - date = java.time.LocalDate.now(), + date = LocalDate.now(), reports = listOf( ReportHistoryUiModel( id = "1", diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt index 28028bae..66d2f8ab 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt @@ -4,8 +4,8 @@ import androidx.lifecycle.ViewModel import com.threegap.bitnagil.domain.report.usecase.GetReportHistoriesUseCase import com.threegap.bitnagil.presentation.reporthistory.model.ReportCategory import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoriesPerDayUiModel -import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistorySideEffect -import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoryState +import com.threegap.bitnagil.presentation.reporthistory.contract.ReportHistorySideEffect +import com.threegap.bitnagil.presentation.reporthistory.contract.ReportHistoryState import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoryUiModel import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcess import dagger.hilt.android.lifecycle.HiltViewModel diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistorySideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistorySideEffect.kt new file mode 100644 index 00000000..5a0b6908 --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistorySideEffect.kt @@ -0,0 +1,3 @@ +package com.threegap.bitnagil.presentation.reporthistory.contract + +sealed interface ReportHistorySideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportHistoryState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistoryState.kt similarity index 83% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportHistoryState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistoryState.kt index 80de9be4..f6a2524b 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportHistoryState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistoryState.kt @@ -1,4 +1,9 @@ -package com.threegap.bitnagil.presentation.reporthistory.model +package com.threegap.bitnagil.presentation.reporthistory.contract + +import com.threegap.bitnagil.presentation.reporthistory.model.ReportCategory +import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoriesPerDayUiModel +import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcess +import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcessWithCount data class ReportHistoryState( val selectedReportCategory: ReportCategory?, @@ -34,7 +39,9 @@ data class ReportHistoryState( } val reportProcessWithCounts: List = listOf( - ReportProcessWithCount(ReportProcess.Total, reportHistoriesPerDays.sumOf { it.reports.size }), + ReportProcessWithCount( + ReportProcess.Total, + reportHistoriesPerDays.sumOf { it.reports.size }), ReportProcessWithCount( ReportProcess.Reported, reportHistoriesPerDays.sumOf { it.reports.filter { report -> report.process == ReportProcess.Reported }.size }, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportHistorySideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportHistorySideEffect.kt deleted file mode 100644 index 9bf7b78a..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportHistorySideEffect.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.threegap.bitnagil.presentation.reporthistory.model - -sealed interface ReportHistorySideEffect From 127ab4eb755a5755f63bf45fa88feca2bb0afafb Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 01:34:04 +0900 Subject: [PATCH 11/31] =?UTF-8?q?Refactor:=20RoutineList=20state,=20sideEf?= =?UTF-8?q?fect=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bitnagil/presentation/routinelist/RoutineListScreen.kt | 4 ++-- .../bitnagil/presentation/routinelist/RoutineListViewModel.kt | 4 ++-- .../routinelist/{model => contract}/RoutineListSideEffect.kt | 2 +- .../routinelist/{model => contract}/RoutineListState.kt | 4 +++- 4 files changed, 8 insertions(+), 6 deletions(-) rename presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/{model => contract}/RoutineListSideEffect.kt (84%) rename presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/{model => contract}/RoutineListState.kt (81%) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/RoutineListScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/RoutineListScreen.kt index 29408e92..bae62ca1 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/RoutineListScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/RoutineListScreen.kt @@ -26,8 +26,8 @@ import com.threegap.bitnagil.presentation.routinelist.component.template.EditCon import com.threegap.bitnagil.presentation.routinelist.component.template.EmptyRoutineListView import com.threegap.bitnagil.presentation.routinelist.component.template.RoutineDetailsCard import com.threegap.bitnagil.presentation.routinelist.component.template.WeeklyDatePicker -import com.threegap.bitnagil.presentation.routinelist.model.RoutineListSideEffect -import com.threegap.bitnagil.presentation.routinelist.model.RoutineListState +import com.threegap.bitnagil.presentation.routinelist.contract.RoutineListSideEffect +import com.threegap.bitnagil.presentation.routinelist.contract.RoutineListState import com.threegap.bitnagil.presentation.routinelist.model.RoutineUiModel import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/RoutineListViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/RoutineListViewModel.kt index 34df31ef..b2a780d4 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/RoutineListViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/RoutineListViewModel.kt @@ -9,8 +9,8 @@ import com.threegap.bitnagil.domain.routine.usecase.DeleteRoutineUseCase import com.threegap.bitnagil.domain.routine.usecase.FetchWeeklyRoutinesUseCase import com.threegap.bitnagil.domain.writeroutine.usecase.GetWriteRoutineEventFlowUseCase import com.threegap.bitnagil.presentation.home.util.getCurrentWeekDays -import com.threegap.bitnagil.presentation.routinelist.model.RoutineListSideEffect -import com.threegap.bitnagil.presentation.routinelist.model.RoutineListState +import com.threegap.bitnagil.presentation.routinelist.contract.RoutineListSideEffect +import com.threegap.bitnagil.presentation.routinelist.contract.RoutineListState import com.threegap.bitnagil.presentation.routinelist.model.RoutineUiModel import com.threegap.bitnagil.presentation.routinelist.model.toUiModel import dagger.hilt.android.lifecycle.HiltViewModel diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineListSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/contract/RoutineListSideEffect.kt similarity index 84% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineListSideEffect.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/contract/RoutineListSideEffect.kt index 0d4d2e91..417a3465 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineListSideEffect.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/contract/RoutineListSideEffect.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.routinelist.model +package com.threegap.bitnagil.presentation.routinelist.contract sealed interface RoutineListSideEffect { data object NavigateToBack : RoutineListSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineListState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/contract/RoutineListState.kt similarity index 81% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineListState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/contract/RoutineListState.kt index aa0b9947..03c712b2 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineListState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/contract/RoutineListState.kt @@ -1,6 +1,8 @@ -package com.threegap.bitnagil.presentation.routinelist.model +package com.threegap.bitnagil.presentation.routinelist.contract import com.threegap.bitnagil.presentation.home.util.getCurrentWeekDays +import com.threegap.bitnagil.presentation.routinelist.model.RoutineUiModel +import com.threegap.bitnagil.presentation.routinelist.model.RoutinesUiModel import java.time.LocalDate data class RoutineListState( From e72a779f6bccb93512cd09bbb25201af61005086 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 01:34:58 +0900 Subject: [PATCH 12/31] =?UTF-8?q?Refactor:=20Setting=20state,=20sideEffect?= =?UTF-8?q?=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../threegap/bitnagil/presentation/setting/SettingScreen.kt | 4 ++-- .../bitnagil/presentation/setting/SettingViewModel.kt | 4 ++-- .../presentation/setting/contract/SettingSideEffect.kt | 6 ++++++ .../setting/{model/mvi => contract}/SettingState.kt | 2 +- .../presentation/setting/model/mvi/SettingSideEffect.kt | 6 ------ 5 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/setting/contract/SettingSideEffect.kt rename presentation/src/main/java/com/threegap/bitnagil/presentation/setting/{model/mvi => contract}/SettingState.kt (89%) delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/setting/model/mvi/SettingSideEffect.kt diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/SettingScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/SettingScreen.kt index 5b69cd58..56c69db0 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/SettingScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/SettingScreen.kt @@ -33,8 +33,8 @@ import com.threegap.bitnagil.presentation.common.playstore.UpdateAvailableState import com.threegap.bitnagil.presentation.common.playstore.openAppInPlayStore import com.threegap.bitnagil.presentation.common.playstore.updateAvailable import com.threegap.bitnagil.presentation.setting.component.atom.settingtitle.SettingTitle -import com.threegap.bitnagil.presentation.setting.model.mvi.SettingSideEffect -import com.threegap.bitnagil.presentation.setting.model.mvi.SettingState +import com.threegap.bitnagil.presentation.setting.contract.SettingSideEffect +import com.threegap.bitnagil.presentation.setting.contract.SettingState import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/SettingViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/SettingViewModel.kt index 7c4e91e2..602f23cf 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/SettingViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/SettingViewModel.kt @@ -5,8 +5,8 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.threegap.bitnagil.domain.auth.usecase.LogoutUseCase import com.threegap.bitnagil.presentation.common.version.VersionNameProvider -import com.threegap.bitnagil.presentation.setting.model.mvi.SettingSideEffect -import com.threegap.bitnagil.presentation.setting.model.mvi.SettingState +import com.threegap.bitnagil.presentation.setting.contract.SettingSideEffect +import com.threegap.bitnagil.presentation.setting.contract.SettingState import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Job import kotlinx.coroutines.delay diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/contract/SettingSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/contract/SettingSideEffect.kt new file mode 100644 index 00000000..3376354b --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/contract/SettingSideEffect.kt @@ -0,0 +1,6 @@ +package com.threegap.bitnagil.presentation.setting.contract + +sealed interface SettingSideEffect { + data object NavigateToLogin : SettingSideEffect + data object NavigateToWithdrawal : SettingSideEffect +} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/model/mvi/SettingState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/contract/SettingState.kt similarity index 89% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/setting/model/mvi/SettingState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/setting/contract/SettingState.kt index aa29a342..87f9da67 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/model/mvi/SettingState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/contract/SettingState.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.setting.model.mvi +package com.threegap.bitnagil.presentation.setting.contract import android.os.Parcelable import kotlinx.parcelize.Parcelize diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/model/mvi/SettingSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/model/mvi/SettingSideEffect.kt deleted file mode 100644 index e25e6a48..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/setting/model/mvi/SettingSideEffect.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.threegap.bitnagil.presentation.setting.model.mvi - -sealed class SettingSideEffect { - data object NavigateToLogin : SettingSideEffect() - data object NavigateToWithdrawal : SettingSideEffect() -} From 3408fae9de4ea940c6e2453e04743ca0d5cba21c Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 01:35:32 +0900 Subject: [PATCH 13/31] =?UTF-8?q?Refactor:=20splash=20state,=20sideEffect?= =?UTF-8?q?=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/threegap/bitnagil/presentation/splash/SplashScreen.kt | 2 +- .../threegap/bitnagil/presentation/splash/SplashViewModel.kt | 4 ++-- .../splash/{model => contract}/SplashSideEffect.kt | 2 +- .../presentation/splash/{model => contract}/SplashState.kt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename presentation/src/main/java/com/threegap/bitnagil/presentation/splash/{model => contract}/SplashSideEffect.kt (81%) rename presentation/src/main/java/com/threegap/bitnagil/presentation/splash/{model => contract}/SplashState.kt (88%) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashScreen.kt index 0f9aed5b..600f9601 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashScreen.kt @@ -25,7 +25,7 @@ import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon import com.threegap.bitnagil.presentation.common.playstore.openAppInPlayStore import com.threegap.bitnagil.presentation.splash.component.template.BitnagilLottieAnimation import com.threegap.bitnagil.presentation.splash.component.template.ForceUpdateDialog -import com.threegap.bitnagil.presentation.splash.model.SplashSideEffect +import com.threegap.bitnagil.presentation.splash.contract.SplashSideEffect import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect import kotlin.system.exitProcess diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt index d9c037fe..e209167a 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt @@ -5,8 +5,8 @@ import androidx.lifecycle.viewModelScope import com.threegap.bitnagil.domain.auth.model.UserRole import com.threegap.bitnagil.domain.auth.usecase.AutoLoginUseCase import com.threegap.bitnagil.domain.version.usecase.CheckUpdateRequirementUseCase -import com.threegap.bitnagil.presentation.splash.model.SplashSideEffect -import com.threegap.bitnagil.presentation.splash.model.SplashState +import com.threegap.bitnagil.presentation.splash.contract.SplashSideEffect +import com.threegap.bitnagil.presentation.splash.contract.SplashState import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.delay import kotlinx.coroutines.launch diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/contract/SplashSideEffect.kt similarity index 81% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashSideEffect.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/splash/contract/SplashSideEffect.kt index f55f3d68..0f4472a6 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashSideEffect.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/contract/SplashSideEffect.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.splash.model +package com.threegap.bitnagil.presentation.splash.contract sealed interface SplashSideEffect { data object NavigateToLogin : SplashSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/contract/SplashState.kt similarity index 88% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/splash/contract/SplashState.kt index 6368c7ee..3ec4d88f 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/splash/contract/SplashState.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.splash.model +package com.threegap.bitnagil.presentation.splash.contract import com.threegap.bitnagil.domain.auth.model.UserRole From e616c63da8638bc301c6c166ee43cf35fe441ad8 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 01:36:14 +0900 Subject: [PATCH 14/31] =?UTF-8?q?Refactor:=20=20TermsAgreement=20state,=20?= =?UTF-8?q?sideEffect=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bitnagil/presentation/terms/TermsAgreementScreen.kt | 4 ++-- .../bitnagil/presentation/terms/TermsAgreementViewModel.kt | 4 ++-- .../terms/{model => contract}/TermsAgreementSideEffect.kt | 2 +- .../terms/{model => contract}/TermsAgreementState.kt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename presentation/src/main/java/com/threegap/bitnagil/presentation/terms/{model => contract}/TermsAgreementSideEffect.kt (83%) rename presentation/src/main/java/com/threegap/bitnagil/presentation/terms/{model => contract}/TermsAgreementState.kt (91%) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/TermsAgreementScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/TermsAgreementScreen.kt index bd6ede7c..bfd273f7 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/TermsAgreementScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/TermsAgreementScreen.kt @@ -19,8 +19,8 @@ import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButton import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar import com.threegap.bitnagil.presentation.terms.component.TermsAgreementItem import com.threegap.bitnagil.presentation.terms.component.ToggleAllAgreementsItem -import com.threegap.bitnagil.presentation.terms.model.TermsAgreementSideEffect -import com.threegap.bitnagil.presentation.terms.model.TermsAgreementState +import com.threegap.bitnagil.presentation.terms.contract.TermsAgreementSideEffect +import com.threegap.bitnagil.presentation.terms.contract.TermsAgreementState import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/TermsAgreementViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/TermsAgreementViewModel.kt index eb73bd82..837857ab 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/TermsAgreementViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/TermsAgreementViewModel.kt @@ -4,8 +4,8 @@ import android.util.Log import androidx.lifecycle.ViewModel import com.threegap.bitnagil.domain.auth.model.TermsAgreement import com.threegap.bitnagil.domain.auth.usecase.SubmitTermsAgreementUseCase -import com.threegap.bitnagil.presentation.terms.model.TermsAgreementSideEffect -import com.threegap.bitnagil.presentation.terms.model.TermsAgreementState +import com.threegap.bitnagil.presentation.terms.contract.TermsAgreementSideEffect +import com.threegap.bitnagil.presentation.terms.contract.TermsAgreementState import dagger.hilt.android.lifecycle.HiltViewModel import org.orbitmvi.orbit.Container import org.orbitmvi.orbit.ContainerHost diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/model/TermsAgreementSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/contract/TermsAgreementSideEffect.kt similarity index 83% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/terms/model/TermsAgreementSideEffect.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/terms/contract/TermsAgreementSideEffect.kt index 9e3e210f..1e2dac89 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/model/TermsAgreementSideEffect.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/contract/TermsAgreementSideEffect.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.terms.model +package com.threegap.bitnagil.presentation.terms.contract sealed interface TermsAgreementSideEffect { data object NavigateToTermsOfService : TermsAgreementSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/model/TermsAgreementState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/contract/TermsAgreementState.kt similarity index 91% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/terms/model/TermsAgreementState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/terms/contract/TermsAgreementState.kt index 2cc904f6..40db7bae 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/model/TermsAgreementState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/terms/contract/TermsAgreementState.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.terms.model +package com.threegap.bitnagil.presentation.terms.contract data class TermsAgreementState( val isLoading: Boolean, From c849e00af0e574cc74e4998e941f9553f7f92939 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 01:36:51 +0900 Subject: [PATCH 15/31] =?UTF-8?q?Refactor:=20=20withdrawal=20state,=20side?= =?UTF-8?q?Effect=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bitnagil/presentation/withdrawal/WithdrawalScreen.kt | 4 ++-- .../bitnagil/presentation/withdrawal/WithdrawalViewModel.kt | 4 ++-- .../withdrawal/{model => contract}/WithdrawalSideEffect.kt | 2 +- .../withdrawal/{model => contract}/WithdrawalState.kt | 4 +++- 4 files changed, 8 insertions(+), 6 deletions(-) rename presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/{model => contract}/WithdrawalSideEffect.kt (70%) rename presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/{model => contract}/WithdrawalState.kt (83%) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalScreen.kt index 0c62953f..a9b1f10f 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalScreen.kt @@ -41,8 +41,8 @@ import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple import com.threegap.bitnagil.presentation.withdrawal.component.WithdrawalConfirmDialog import com.threegap.bitnagil.presentation.withdrawal.model.WithdrawalReason -import com.threegap.bitnagil.presentation.withdrawal.model.WithdrawalSideEffect -import com.threegap.bitnagil.presentation.withdrawal.model.WithdrawalState +import com.threegap.bitnagil.presentation.withdrawal.contract.WithdrawalSideEffect +import com.threegap.bitnagil.presentation.withdrawal.contract.WithdrawalState import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalViewModel.kt index e71b6328..00badb7c 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalViewModel.kt @@ -3,8 +3,8 @@ package com.threegap.bitnagil.presentation.withdrawal import androidx.lifecycle.ViewModel import com.threegap.bitnagil.domain.auth.usecase.WithdrawalUseCase import com.threegap.bitnagil.presentation.withdrawal.model.WithdrawalReason -import com.threegap.bitnagil.presentation.withdrawal.model.WithdrawalSideEffect -import com.threegap.bitnagil.presentation.withdrawal.model.WithdrawalState +import com.threegap.bitnagil.presentation.withdrawal.contract.WithdrawalSideEffect +import com.threegap.bitnagil.presentation.withdrawal.contract.WithdrawalState import dagger.hilt.android.lifecycle.HiltViewModel import org.orbitmvi.orbit.Container import org.orbitmvi.orbit.ContainerHost diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/model/WithdrawalSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/contract/WithdrawalSideEffect.kt similarity index 70% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/model/WithdrawalSideEffect.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/contract/WithdrawalSideEffect.kt index 76ab1d4b..928b95e8 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/model/WithdrawalSideEffect.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/contract/WithdrawalSideEffect.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.withdrawal.model +package com.threegap.bitnagil.presentation.withdrawal.contract sealed interface WithdrawalSideEffect { data object NavigateToBack : WithdrawalSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/model/WithdrawalState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/contract/WithdrawalState.kt similarity index 83% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/model/WithdrawalState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/contract/WithdrawalState.kt index d1cfdf56..9f95c42d 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/model/WithdrawalState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/contract/WithdrawalState.kt @@ -1,4 +1,6 @@ -package com.threegap.bitnagil.presentation.withdrawal.model +package com.threegap.bitnagil.presentation.withdrawal.contract + +import com.threegap.bitnagil.presentation.withdrawal.model.WithdrawalReason data class WithdrawalState( val isLoading: Boolean, From 9cc1a4062fa06ba141dda0aad61a1266c8486f42 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 01:37:47 +0900 Subject: [PATCH 16/31] =?UTF-8?q?Refactor:=20writeRoutine=20state,=20sideE?= =?UTF-8?q?ffect=EB=A5=BC=20contract=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/writeroutine/WriteRoutineScreen.kt | 6 +++--- .../presentation/writeroutine/WriteRoutineViewModel.kt | 6 +++--- .../writeroutine/contract/WriteRoutineSideEffect.kt | 6 ++++++ .../{model/mvi => contract}/WriteRoutineState.kt | 4 ++-- .../writeroutine/model/mvi/WriteRoutineSideEffect.kt | 6 ------ 5 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineSideEffect.kt rename presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/{model/mvi => contract}/WriteRoutineState.kt (97%) delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/mvi/WriteRoutineSideEffect.kt diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineScreen.kt index 98741027..35fedcb5 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineScreen.kt @@ -41,8 +41,8 @@ import com.threegap.bitnagil.presentation.writeroutine.model.Day import com.threegap.bitnagil.presentation.writeroutine.model.RepeatType import com.threegap.bitnagil.presentation.writeroutine.model.Time import com.threegap.bitnagil.presentation.writeroutine.model.WriteRoutineType -import com.threegap.bitnagil.presentation.writeroutine.model.mvi.WriteRoutineSideEffect -import com.threegap.bitnagil.presentation.writeroutine.model.mvi.WriteRoutineState +import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineSideEffect +import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineState import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect @@ -359,7 +359,7 @@ private fun getSubRoutinePlaceHolder(index: Int): String { fun WriteRoutineScreenPreview() { BitnagilTheme { WriteRoutineScreen( - state = WriteRoutineState.Init.copy(periodUiExpanded = true, startTimeUiExpanded = true), + state = WriteRoutineState.INIT.copy(periodUiExpanded = true, startTimeUiExpanded = true), setRoutineName = {}, setSubRoutineName = { _, _ -> }, selectRepeatTime = {}, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt index bd32df3d..13f8e77d 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt @@ -16,8 +16,8 @@ import com.threegap.bitnagil.presentation.writeroutine.model.SelectableDay import com.threegap.bitnagil.presentation.writeroutine.model.SubRoutine import com.threegap.bitnagil.presentation.writeroutine.model.Time import com.threegap.bitnagil.presentation.writeroutine.model.WriteRoutineType -import com.threegap.bitnagil.presentation.writeroutine.model.mvi.WriteRoutineSideEffect -import com.threegap.bitnagil.presentation.writeroutine.model.mvi.WriteRoutineState +import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineSideEffect +import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineState import com.threegap.bitnagil.presentation.writeroutine.model.navarg.WriteRoutineScreenArg import dagger.assisted.Assisted import dagger.assisted.AssistedFactory @@ -42,7 +42,7 @@ class WriteRoutineViewModel @AssistedInject constructor( override val container: Container = container( savedStateHandle = savedStateHandle, - initialState = WriteRoutineState.Init, + initialState = WriteRoutineState.INIT, ) private var routineId: String? = null diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineSideEffect.kt new file mode 100644 index 00000000..cbf9497a --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineSideEffect.kt @@ -0,0 +1,6 @@ +package com.threegap.bitnagil.presentation.writeroutine.contract + +sealed interface WriteRoutineSideEffect { + data object MoveToPreviousScreen : WriteRoutineSideEffect + data class ShowToast(val message: String) : WriteRoutineSideEffect +} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/mvi/WriteRoutineState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineState.kt similarity index 97% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/mvi/WriteRoutineState.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineState.kt index 5f67d6fe..44ac5d74 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/mvi/WriteRoutineState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineState.kt @@ -1,4 +1,4 @@ -package com.threegap.bitnagil.presentation.writeroutine.model.mvi +package com.threegap.bitnagil.presentation.writeroutine.contract import android.os.Parcelable import com.threegap.bitnagil.presentation.writeroutine.model.Date @@ -32,7 +32,7 @@ data class WriteRoutineState( val recommendedRoutineType: String?, ) : Parcelable { companion object { - val Init = WriteRoutineState( + val INIT = WriteRoutineState( routineName = "", subRoutineNames = listOf("", "", ""), selectNotUseSubRoutines = false, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/mvi/WriteRoutineSideEffect.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/mvi/WriteRoutineSideEffect.kt deleted file mode 100644 index c9e52bd6..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/mvi/WriteRoutineSideEffect.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.threegap.bitnagil.presentation.writeroutine.model.mvi - -sealed class WriteRoutineSideEffect { - data object MoveToPreviousScreen : WriteRoutineSideEffect() - data class ShowToast(val message: String) : WriteRoutineSideEffect() -} From 0dc58edf50a4ecbbfccced92e26e4aad220795b5 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Fri, 13 Feb 2026 02:29:28 +0900 Subject: [PATCH 17/31] =?UTF-8?q?Chore:=20=EB=A6=B0=ED=8A=B8=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 --- .../threegap/bitnagil/presentation/emotion/EmotionScreen.kt | 2 +- .../bitnagil/presentation/emotion/EmotionViewModel.kt | 4 ++-- .../component/template/EmotionRecommendRoutineScreen.kt | 2 +- .../component/template/SimpleEmotionSelectionScreen.kt | 2 +- .../emotion/component/template/SwipeEmotionSelectionScreen.kt | 2 +- .../com/threegap/bitnagil/presentation/login/LoginScreen.kt | 2 +- .../bitnagil/presentation/mypage/contract/MyPageState.kt | 2 +- .../bitnagil/presentation/onboarding/OnBoardingScreen.kt | 4 ++-- .../bitnagil/presentation/onboarding/OnBoardingViewModel.kt | 4 ++-- .../presentation/reportdetail/ReportDetailViewModel.kt | 4 ++-- .../presentation/reporthistory/ReportHistoryScreen.kt | 2 +- .../presentation/reporthistory/ReportHistoryViewModel.kt | 4 ++-- .../presentation/reporthistory/contract/ReportHistoryState.kt | 3 ++- .../bitnagil/presentation/withdrawal/WithdrawalScreen.kt | 2 +- .../bitnagil/presentation/withdrawal/WithdrawalViewModel.kt | 2 +- .../bitnagil/presentation/writeroutine/WriteRoutineScreen.kt | 4 ++-- .../presentation/writeroutine/WriteRoutineViewModel.kt | 4 ++-- 17 files changed, 25 insertions(+), 24 deletions(-) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt index 3868be06..dc4c67a1 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt @@ -14,8 +14,8 @@ import com.threegap.bitnagil.presentation.common.toast.GlobalBitnagilToast import com.threegap.bitnagil.presentation.emotion.component.template.EmotionRecommendRoutineScreen import com.threegap.bitnagil.presentation.emotion.component.template.SimpleEmotionSelectionScreen import com.threegap.bitnagil.presentation.emotion.component.template.SwipeEmotionSelectionScreen -import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep import com.threegap.bitnagil.presentation.emotion.contract.EmotionSideEffect +import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt index f2a41085..59b5ccbc 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt @@ -6,11 +6,11 @@ import androidx.lifecycle.viewModelScope import com.threegap.bitnagil.domain.emotion.usecase.GetEmotionsUseCase import com.threegap.bitnagil.domain.emotion.usecase.RegisterEmotionUseCase import com.threegap.bitnagil.domain.onboarding.usecase.RegisterRecommendOnBoardingRoutinesUseCase +import com.threegap.bitnagil.presentation.emotion.contract.EmotionSideEffect +import com.threegap.bitnagil.presentation.emotion.contract.EmotionState import com.threegap.bitnagil.presentation.emotion.model.EmotionRecommendRoutineUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel -import com.threegap.bitnagil.presentation.emotion.contract.EmotionSideEffect -import com.threegap.bitnagil.presentation.emotion.contract.EmotionState import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.delay import kotlinx.coroutines.launch diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/EmotionRecommendRoutineScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/EmotionRecommendRoutineScreen.kt index f85d4781..748cc01a 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/EmotionRecommendRoutineScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/EmotionRecommendRoutineScreen.kt @@ -21,11 +21,11 @@ import com.threegap.bitnagil.designsystem.BitnagilTheme import com.threegap.bitnagil.designsystem.component.atom.BitnagilSelectButton import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButton import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButtonColor +import com.threegap.bitnagil.presentation.emotion.contract.EmotionState import com.threegap.bitnagil.presentation.emotion.model.EmotionImageUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionRecommendRoutineUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel -import com.threegap.bitnagil.presentation.emotion.contract.EmotionState @Composable fun EmotionRecommendRoutineScreen( diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SimpleEmotionSelectionScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SimpleEmotionSelectionScreen.kt index 552df9c1..ef890ee5 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SimpleEmotionSelectionScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SimpleEmotionSelectionScreen.kt @@ -22,10 +22,10 @@ import com.threegap.bitnagil.designsystem.BitnagilTheme import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple import com.threegap.bitnagil.presentation.emotion.component.atom.EmotionMarbleImage +import com.threegap.bitnagil.presentation.emotion.contract.EmotionState import com.threegap.bitnagil.presentation.emotion.model.EmotionImageUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel -import com.threegap.bitnagil.presentation.emotion.contract.EmotionState @Composable fun SimpleEmotionSelectionScreen( diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SwipeEmotionSelectionScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SwipeEmotionSelectionScreen.kt index 7296d24f..f9feab73 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SwipeEmotionSelectionScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/component/template/SwipeEmotionSelectionScreen.kt @@ -62,10 +62,10 @@ import com.threegap.bitnagil.designsystem.R import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar import com.threegap.bitnagil.presentation.common.dimension.dpToPx import com.threegap.bitnagil.presentation.emotion.component.atom.EmotionMarbleImage +import com.threegap.bitnagil.presentation.emotion.contract.EmotionState import com.threegap.bitnagil.presentation.emotion.model.EmotionImageUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel -import com.threegap.bitnagil.presentation.emotion.contract.EmotionState import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlin.math.absoluteValue diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt index 7d1c10a1..f753ee89 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt @@ -31,8 +31,8 @@ import com.threegap.bitnagil.designsystem.BitnagilTheme import com.threegap.bitnagil.designsystem.R import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple -import com.threegap.bitnagil.presentation.login.kakao.KakaoLoginHandlerImpl import com.threegap.bitnagil.presentation.login.contract.LoginSideEffect +import com.threegap.bitnagil.presentation.login.kakao.KakaoLoginHandlerImpl import org.orbitmvi.orbit.compose.collectSideEffect @Composable diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageState.kt index a386507b..76e68dfe 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/contract/MyPageState.kt @@ -7,7 +7,7 @@ data class MyPageState( companion object { val INIT = MyPageState( name = "", - profileUrl = "" + profileUrl = "", ) } } diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt index 5a58f5ce..c9217408 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt @@ -15,11 +15,11 @@ import com.threegap.bitnagil.presentation.common.toast.GlobalBitnagilToast import com.threegap.bitnagil.presentation.onboarding.component.template.OnBoardingAbstractTemplate import com.threegap.bitnagil.presentation.onboarding.component.template.OnBoardingIntroTemplate import com.threegap.bitnagil.presentation.onboarding.component.template.OnBoardingSelectTemplate +import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingSideEffect +import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingState import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItem import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingPageInfo import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingSetType -import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingSideEffect -import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingState import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt index 0fa79313..20ac5f8d 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt @@ -9,12 +9,12 @@ import com.threegap.bitnagil.domain.onboarding.usecase.GetRecommendOnBoardingRou import com.threegap.bitnagil.domain.onboarding.usecase.GetUserOnBoardingUseCase import com.threegap.bitnagil.domain.onboarding.usecase.RegisterRecommendOnBoardingRoutinesUseCase import com.threegap.bitnagil.domain.user.usecase.FetchUserProfileUseCase +import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingSideEffect +import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingState import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingAbstractTextItem import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItem import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingPageInfo import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingSetType -import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingSideEffect -import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingState import com.threegap.bitnagil.presentation.onboarding.model.navarg.OnBoardingScreenArg import dagger.assisted.Assisted import dagger.assisted.AssistedFactory diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt index 7213eee6..b3d3b79c 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt @@ -2,10 +2,10 @@ package com.threegap.bitnagil.presentation.reportdetail import androidx.lifecycle.ViewModel import com.threegap.bitnagil.domain.report.usecase.GetReportUseCase -import com.threegap.bitnagil.presentation.reportdetail.model.ReportCategory -import com.threegap.bitnagil.presentation.reportdetail.model.ReportProcess import com.threegap.bitnagil.presentation.reportdetail.contract.ReportDetailSideEffect import com.threegap.bitnagil.presentation.reportdetail.contract.ReportDetailState +import com.threegap.bitnagil.presentation.reportdetail.model.ReportCategory +import com.threegap.bitnagil.presentation.reportdetail.model.ReportProcess import com.threegap.bitnagil.presentation.reportdetail.model.navarg.ReportDetailScreenArg import dagger.assisted.Assisted import dagger.assisted.AssistedFactory diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt index 9f5efaaf..721c2f77 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt @@ -34,9 +34,9 @@ import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple import com.threegap.bitnagil.presentation.reporthistory.component.block.ReportHistoryItem import com.threegap.bitnagil.presentation.reporthistory.component.template.ReportCategoryBottomSheet +import com.threegap.bitnagil.presentation.reporthistory.contract.ReportHistoryState import com.threegap.bitnagil.presentation.reporthistory.model.ReportCategory import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoriesPerDayUiModel -import com.threegap.bitnagil.presentation.reporthistory.contract.ReportHistoryState import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoryUiModel import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcess import com.threegap.bitnagil.presentation.reporthistory.util.toPresentationFormat diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt index 66d2f8ab..2a7edcd4 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt @@ -2,10 +2,10 @@ package com.threegap.bitnagil.presentation.reporthistory import androidx.lifecycle.ViewModel import com.threegap.bitnagil.domain.report.usecase.GetReportHistoriesUseCase -import com.threegap.bitnagil.presentation.reporthistory.model.ReportCategory -import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoriesPerDayUiModel import com.threegap.bitnagil.presentation.reporthistory.contract.ReportHistorySideEffect import com.threegap.bitnagil.presentation.reporthistory.contract.ReportHistoryState +import com.threegap.bitnagil.presentation.reporthistory.model.ReportCategory +import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoriesPerDayUiModel import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoryUiModel import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcess import dagger.hilt.android.lifecycle.HiltViewModel diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistoryState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistoryState.kt index f6a2524b..fe2e5a57 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistoryState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistoryState.kt @@ -41,7 +41,8 @@ data class ReportHistoryState( val reportProcessWithCounts: List = listOf( ReportProcessWithCount( ReportProcess.Total, - reportHistoriesPerDays.sumOf { it.reports.size }), + reportHistoriesPerDays.sumOf { it.reports.size }, + ), ReportProcessWithCount( ReportProcess.Reported, reportHistoriesPerDays.sumOf { it.reports.filter { report -> report.process == ReportProcess.Reported }.size }, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalScreen.kt index a9b1f10f..5ba4d6f2 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalScreen.kt @@ -40,9 +40,9 @@ import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButton import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple import com.threegap.bitnagil.presentation.withdrawal.component.WithdrawalConfirmDialog -import com.threegap.bitnagil.presentation.withdrawal.model.WithdrawalReason import com.threegap.bitnagil.presentation.withdrawal.contract.WithdrawalSideEffect import com.threegap.bitnagil.presentation.withdrawal.contract.WithdrawalState +import com.threegap.bitnagil.presentation.withdrawal.model.WithdrawalReason import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalViewModel.kt index 00badb7c..ff6a0d62 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/withdrawal/WithdrawalViewModel.kt @@ -2,9 +2,9 @@ package com.threegap.bitnagil.presentation.withdrawal import androidx.lifecycle.ViewModel import com.threegap.bitnagil.domain.auth.usecase.WithdrawalUseCase -import com.threegap.bitnagil.presentation.withdrawal.model.WithdrawalReason import com.threegap.bitnagil.presentation.withdrawal.contract.WithdrawalSideEffect import com.threegap.bitnagil.presentation.withdrawal.contract.WithdrawalState +import com.threegap.bitnagil.presentation.withdrawal.model.WithdrawalReason import dagger.hilt.android.lifecycle.HiltViewModel import org.orbitmvi.orbit.Container import org.orbitmvi.orbit.ContainerHost diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineScreen.kt index 35fedcb5..9beff2cc 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineScreen.kt @@ -37,12 +37,12 @@ import com.threegap.bitnagil.presentation.writeroutine.component.block.routinede import com.threegap.bitnagil.presentation.writeroutine.component.block.subroutinefield.SubRoutineField import com.threegap.bitnagil.presentation.writeroutine.component.template.datepickerbottomsheet.DatePickerBottomSheet import com.threegap.bitnagil.presentation.writeroutine.component.template.timepickerbottomsheet.TimePickerBottomSheet +import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineSideEffect +import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineState import com.threegap.bitnagil.presentation.writeroutine.model.Day import com.threegap.bitnagil.presentation.writeroutine.model.RepeatType import com.threegap.bitnagil.presentation.writeroutine.model.Time import com.threegap.bitnagil.presentation.writeroutine.model.WriteRoutineType -import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineSideEffect -import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineState import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt index 13f8e77d..d349bf1f 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt @@ -9,6 +9,8 @@ import com.threegap.bitnagil.domain.writeroutine.model.RoutineUpdateType import com.threegap.bitnagil.domain.writeroutine.usecase.EditRoutineUseCase import com.threegap.bitnagil.domain.writeroutine.usecase.RegisterRoutineUseCase import com.threegap.bitnagil.presentation.common.extension.displayTitle +import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineSideEffect +import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineState import com.threegap.bitnagil.presentation.writeroutine.model.Date import com.threegap.bitnagil.presentation.writeroutine.model.Day import com.threegap.bitnagil.presentation.writeroutine.model.RepeatType @@ -16,8 +18,6 @@ import com.threegap.bitnagil.presentation.writeroutine.model.SelectableDay import com.threegap.bitnagil.presentation.writeroutine.model.SubRoutine import com.threegap.bitnagil.presentation.writeroutine.model.Time import com.threegap.bitnagil.presentation.writeroutine.model.WriteRoutineType -import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineSideEffect -import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineState import com.threegap.bitnagil.presentation.writeroutine.model.navarg.WriteRoutineScreenArg import dagger.assisted.Assisted import dagger.assisted.AssistedFactory From 27c557ce6b822af846d76645fb48299b5f84ff93 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sat, 14 Feb 2026 17:58:06 +0900 Subject: [PATCH 18/31] =?UTF-8?q?Chore:=20=EB=A3=A8=ED=8B=B4=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20Response=20=EB=84=A4=EC=9D=B4=EB=B0=8D=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 --- .../data/routine/datasource/RoutineRemoteDataSource.kt | 8 ++++---- .../datasourceImpl/RoutineRemoteDataSourceImpl.kt | 10 +++++----- .../{DayRoutinesDto.kt => DailyRoutinesResponse.kt} | 8 ++++---- .../response/{RoutineDto.kt => RoutineResponse.kt} | 4 ++-- ...utinesResponseDto.kt => RoutineScheduleResponse.kt} | 10 ++++------ .../bitnagil/data/routine/service/RoutineService.kt | 10 +++++----- 6 files changed, 24 insertions(+), 26 deletions(-) rename data/src/main/java/com/threegap/bitnagil/data/routine/model/response/{DayRoutinesDto.kt => DailyRoutinesResponse.kt} (67%) rename data/src/main/java/com/threegap/bitnagil/data/routine/model/response/{RoutineDto.kt => RoutineResponse.kt} (96%) rename data/src/main/java/com/threegap/bitnagil/data/routine/model/response/{RoutinesResponseDto.kt => RoutineScheduleResponse.kt} (50%) diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/datasource/RoutineRemoteDataSource.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/datasource/RoutineRemoteDataSource.kt index f325afcf..6b3e2cb9 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/datasource/RoutineRemoteDataSource.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/datasource/RoutineRemoteDataSource.kt @@ -1,13 +1,13 @@ package com.threegap.bitnagil.data.routine.datasource import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequestDto -import com.threegap.bitnagil.data.routine.model.response.RoutineDto -import com.threegap.bitnagil.data.routine.model.response.RoutinesResponseDto +import com.threegap.bitnagil.data.routine.model.response.RoutineResponse +import com.threegap.bitnagil.data.routine.model.response.RoutineScheduleResponse interface RoutineRemoteDataSource { - suspend fun fetchWeeklyRoutines(startDate: String, endDate: String): Result + suspend fun fetchWeeklyRoutines(startDate: String, endDate: String): Result suspend fun syncRoutineCompletion(routineCompletionRequestDto: RoutineCompletionRequestDto): Result - suspend fun getRoutine(routineId: String): Result + suspend fun getRoutine(routineId: String): Result suspend fun deleteRoutine(routineId: String): Result suspend fun deleteRoutineForDay(routineId: String): Result } diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/datasourceImpl/RoutineRemoteDataSourceImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/datasourceImpl/RoutineRemoteDataSourceImpl.kt index 799d3a75..59218f88 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/datasourceImpl/RoutineRemoteDataSourceImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/datasourceImpl/RoutineRemoteDataSourceImpl.kt @@ -4,17 +4,17 @@ import com.threegap.bitnagil.data.common.safeApiCall import com.threegap.bitnagil.data.common.safeUnitApiCall import com.threegap.bitnagil.data.routine.datasource.RoutineRemoteDataSource import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequestDto -import com.threegap.bitnagil.data.routine.model.response.RoutineDto -import com.threegap.bitnagil.data.routine.model.response.RoutinesResponseDto +import com.threegap.bitnagil.data.routine.model.response.RoutineResponse +import com.threegap.bitnagil.data.routine.model.response.RoutineScheduleResponse import com.threegap.bitnagil.data.routine.service.RoutineService import javax.inject.Inject class RoutineRemoteDataSourceImpl @Inject constructor( private val routineService: RoutineService, ) : RoutineRemoteDataSource { - override suspend fun fetchWeeklyRoutines(startDate: String, endDate: String): Result = + override suspend fun fetchWeeklyRoutines(startDate: String, endDate: String): Result = safeApiCall { - routineService.fetchRoutines(startDate, endDate) + routineService.fetchRoutineSchedule(startDate, endDate) } override suspend fun syncRoutineCompletion(routineCompletionRequestDto: RoutineCompletionRequestDto): Result = @@ -22,7 +22,7 @@ class RoutineRemoteDataSourceImpl @Inject constructor( routineService.routineCompletion(routineCompletionRequestDto) } - override suspend fun getRoutine(routineId: String): Result = + override suspend fun getRoutine(routineId: String): Result = safeApiCall { routineService.getRoutine(routineId) } diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/DayRoutinesDto.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/DailyRoutinesResponse.kt similarity index 67% rename from data/src/main/java/com/threegap/bitnagil/data/routine/model/response/DayRoutinesDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/routine/model/response/DailyRoutinesResponse.kt index 28bbdfcb..ee06f1e6 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/DayRoutinesDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/DailyRoutinesResponse.kt @@ -5,15 +5,15 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class DayRoutinesDto( +data class DailyRoutinesResponse( @SerialName("routineList") - val routineList: List, + val routines: List, @SerialName("allCompleted") val allCompleted: Boolean, ) -fun DayRoutinesDto.toDomain(): DailyRoutines = +fun DailyRoutinesResponse.toDomain(): DailyRoutines = DailyRoutines( - routines = routineList.map { it.toDomain() }, + routines = routines.map { it.toDomain() }, isAllCompleted = allCompleted, ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineDto.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineResponse.kt similarity index 96% rename from data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineResponse.kt index 87d782e0..36a4466d 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineResponse.kt @@ -7,7 +7,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class RoutineDto( +data class RoutineResponse( @SerialName("routineId") val routineId: String, @SerialName("routineName") @@ -34,7 +34,7 @@ data class RoutineDto( val routineEndDate: String, ) -fun RoutineDto.toDomain(): Routine = +fun RoutineResponse.toDomain(): Routine = Routine( id = this.routineId, name = this.routineName, diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutinesResponseDto.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineScheduleResponse.kt similarity index 50% rename from data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutinesResponseDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineScheduleResponse.kt index 5f9fd500..14d6b6bc 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutinesResponseDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineScheduleResponse.kt @@ -5,14 +5,12 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class RoutinesResponseDto( +data class RoutineScheduleResponse( @SerialName("routines") - val routines: Map, + val dailyRoutines: Map, ) -fun RoutinesResponseDto.toDomain() = +fun RoutineScheduleResponse.toDomain(): RoutineSchedule = RoutineSchedule( - dailyRoutines = this.routines.mapValues { (_, dayRoutinesDto) -> - dayRoutinesDto.toDomain() - }, + dailyRoutines = this.dailyRoutines.mapValues { (_, dailyRoutinesResponse) -> dailyRoutinesResponse.toDomain() } ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/service/RoutineService.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/service/RoutineService.kt index 23b6c35e..dcfd98de 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/service/RoutineService.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/service/RoutineService.kt @@ -1,8 +1,8 @@ package com.threegap.bitnagil.data.routine.service import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequestDto -import com.threegap.bitnagil.data.routine.model.response.RoutineDto -import com.threegap.bitnagil.data.routine.model.response.RoutinesResponseDto +import com.threegap.bitnagil.data.routine.model.response.RoutineResponse +import com.threegap.bitnagil.data.routine.model.response.RoutineScheduleResponse import com.threegap.bitnagil.network.model.BaseResponse import retrofit2.http.Body import retrofit2.http.DELETE @@ -13,15 +13,15 @@ import retrofit2.http.Query interface RoutineService { @GET("/api/v2/routines") - suspend fun fetchRoutines( + suspend fun fetchRoutineSchedule( @Query("startDate") startDate: String, @Query("endDate") endDate: String, - ): BaseResponse + ): BaseResponse @GET("/api/v2/routines/{routineId}") suspend fun getRoutine( @Path("routineId") routineId: String, - ): BaseResponse + ): BaseResponse @PUT("/api/v2/routines/completions") suspend fun routineCompletion( From 258078dc222693909e60a75302a924cca1f4ef2f Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sat, 14 Feb 2026 18:53:22 +0900 Subject: [PATCH 19/31] =?UTF-8?q?Chore:=20Home=20Routine=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20UiModel=20=EC=B4=88=EA=B8=B0=ED=99=94=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20Parcelize=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/component/template/WeeklyDatePicker.kt | 2 +- .../presentation/home/contract/HomeState.kt | 2 +- .../home/model/DailyRoutinesUiModel.kt | 11 ++++------- .../home/model/RoutineScheduleUiModel.kt | 17 ++++++++--------- .../presentation/home/model/RoutineUiModel.kt | 7 ++----- 5 files changed, 16 insertions(+), 23 deletions(-) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/component/template/WeeklyDatePicker.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/component/template/WeeklyDatePicker.kt index 0ee23625..c1c9d83a 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/component/template/WeeklyDatePicker.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/component/template/WeeklyDatePicker.kt @@ -197,7 +197,7 @@ private fun WeeklyDatePickerPreview() { WeeklyDatePicker( selectedDate = selectedDate, weeklyDates = selectedDate.getCurrentWeekDays(), - routines = RoutineScheduleUiModel(), + routines = RoutineScheduleUiModel.INIT, onDateSelect = { selectedDate = it }, onPreviousWeekClick = { selectedDate = selectedDate.minusWeeks(1) }, onNextWeekClick = { selectedDate = selectedDate.plusWeeks(1) }, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeState.kt index c91b3c29..dc839217 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeState.kt @@ -27,7 +27,7 @@ data class HomeState( todayEmotion = null, selectedDate = LocalDate.now(), currentWeeks = LocalDate.now().getCurrentWeekDays(), - routineSchedule = RoutineScheduleUiModel(), + routineSchedule = RoutineScheduleUiModel.INIT, ) } } diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/DailyRoutinesUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/DailyRoutinesUiModel.kt index 295415b8..5099a92a 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/DailyRoutinesUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/DailyRoutinesUiModel.kt @@ -1,16 +1,13 @@ package com.threegap.bitnagil.presentation.home.model -import android.os.Parcelable import com.threegap.bitnagil.domain.routine.model.DailyRoutines -import kotlinx.parcelize.Parcelize -@Parcelize data class DailyRoutinesUiModel( - val routines: List = emptyList(), - val isAllCompleted: Boolean = false, -) : Parcelable + val routines: List, + val isAllCompleted: Boolean, +) -fun DailyRoutines.toUiModel(): DailyRoutinesUiModel = +internal fun DailyRoutines.toUiModel(): DailyRoutinesUiModel = DailyRoutinesUiModel( routines = routines.map { it.toUiModel() }, isAllCompleted = isAllCompleted, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineScheduleUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineScheduleUiModel.kt index 3304cfda..9966a0a6 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineScheduleUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineScheduleUiModel.kt @@ -1,17 +1,16 @@ package com.threegap.bitnagil.presentation.home.model -import android.os.Parcelable import com.threegap.bitnagil.domain.routine.model.RoutineSchedule -import kotlinx.parcelize.Parcelize -@Parcelize data class RoutineScheduleUiModel( - val dailyRoutines: Map = emptyMap(), -) : Parcelable + val dailyRoutines: Map, +) { + companion object { + val INIT = RoutineScheduleUiModel(dailyRoutines = emptyMap()) + } +} -fun RoutineSchedule.toUiModel(): RoutineScheduleUiModel = +internal fun RoutineSchedule.toUiModel(): RoutineScheduleUiModel = RoutineScheduleUiModel( - dailyRoutines = this.dailyRoutines.mapValues { (_, dayRoutines) -> - dayRoutines.toUiModel() - }, + dailyRoutines = this.dailyRoutines.mapValues { (_, dayRoutines) -> dayRoutines.toUiModel() }, ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineUiModel.kt index 6b8e73c4..dfdf8ce6 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineUiModel.kt @@ -1,12 +1,9 @@ package com.threegap.bitnagil.presentation.home.model -import android.os.Parcelable import com.threegap.bitnagil.domain.routine.model.DayOfWeek import com.threegap.bitnagil.domain.routine.model.RecommendedRoutineType import com.threegap.bitnagil.domain.routine.model.Routine -import kotlinx.parcelize.Parcelize -@Parcelize data class RoutineUiModel( val id: String, val name: String, @@ -17,9 +14,9 @@ data class RoutineUiModel( val subRoutineNames: List, val subRoutineCompletionStates: List, val recommendedRoutineType: RecommendedRoutineType?, -) : Parcelable +) -fun Routine.toUiModel(): RoutineUiModel = +internal fun Routine.toUiModel(): RoutineUiModel = RoutineUiModel( id = this.id, name = this.name, From 9018b82d8e07fc09c16e4beb277e4edc06da87fb Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sat, 14 Feb 2026 22:00:37 +0900 Subject: [PATCH 20/31] =?UTF-8?q?Refactor:=20TodayEmotion=EC=9D=84=20Daily?= =?UTF-8?q?Emotion=EC=9C=BC=EB=A1=9C=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EB=A6=AC=ED=8C=A9=ED=86=A0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - nullable이던 TodayEmotion을 non-null인 DailyEmotion으로 변경하고, 감정 등록 여부를 나타내는 `hasEmotion` 프로퍼티를 추가했습니다. - `emotionMarbleType`을 String에서 `EmotionMarbleType` enum 클래스로 변경하여 타입 안정성을 강화했습니다. - 관련 클래스 및 변수명을 `TodayEmotion`에서 `DailyEmotion`으로 일괄 변경했습니다. (`fetchTodayEmotion` -> `fetchDailyEmotion`) --- .../emotion/datasource/EmotionDataSource.kt | 4 +-- .../datasourceImpl/EmotionDataSourceImpl.kt | 6 ++-- .../model/response/DailyEmotionResponse.kt | 26 ++++++++++++++++ .../model/response/TodayEmotionResponseDto.kt | 30 ------------------- .../repositoryImpl/EmotionRepositoryImpl.kt | 6 ++-- .../data/emotion/service/EmotionService.kt | 6 ++-- .../domain/emotion/model/DailyEmotion.kt | 8 +++++ .../domain/emotion/model/EmotionMarbleType.kt | 16 ++++++++++ .../domain/emotion/model/TodayEmotion.kt | 8 ----- .../emotion/repository/EmotionRepository.kt | 4 +-- ...UseCase.kt => FetchDailyEmotionUseCase.kt} | 8 ++--- .../bitnagil/presentation/home/HomeScreen.kt | 4 +-- .../presentation/home/HomeViewModel.kt | 14 ++++----- .../template/CollapsibleHomeHeader.kt | 20 +++++-------- .../presentation/home/contract/HomeState.kt | 6 ++-- .../home/model/DailyEmotionUiModel.kt | 28 +++++++++++++++++ .../home/model/TodayEmotionUiModel.kt | 16 ---------- 17 files changed, 114 insertions(+), 96 deletions(-) create mode 100644 data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/DailyEmotionResponse.kt delete mode 100644 data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/TodayEmotionResponseDto.kt create mode 100644 domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/DailyEmotion.kt create mode 100644 domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/EmotionMarbleType.kt delete mode 100644 domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/TodayEmotion.kt rename domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/{FetchTodayEmotionUseCase.kt => FetchDailyEmotionUseCase.kt} (55%) create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/DailyEmotionUiModel.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/TodayEmotionUiModel.kt diff --git a/data/src/main/java/com/threegap/bitnagil/data/emotion/datasource/EmotionDataSource.kt b/data/src/main/java/com/threegap/bitnagil/data/emotion/datasource/EmotionDataSource.kt index 634b984c..c3f81e30 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/emotion/datasource/EmotionDataSource.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/emotion/datasource/EmotionDataSource.kt @@ -1,11 +1,11 @@ package com.threegap.bitnagil.data.emotion.datasource import com.threegap.bitnagil.data.emotion.model.dto.EmotionDto +import com.threegap.bitnagil.data.emotion.model.response.DailyEmotionResponse import com.threegap.bitnagil.data.emotion.model.response.RegisterEmotionResponse -import com.threegap.bitnagil.data.emotion.model.response.TodayEmotionResponseDto interface EmotionDataSource { suspend fun getEmotions(): Result> suspend fun registerEmotion(emotion: String): Result - suspend fun fetchTodayEmotion(currentDate: String): Result + suspend fun fetchDailyEmotion(currentDate: String): Result } diff --git a/data/src/main/java/com/threegap/bitnagil/data/emotion/datasourceImpl/EmotionDataSourceImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/emotion/datasourceImpl/EmotionDataSourceImpl.kt index cb49e964..20035b56 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/emotion/datasourceImpl/EmotionDataSourceImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/emotion/datasourceImpl/EmotionDataSourceImpl.kt @@ -4,8 +4,8 @@ import com.threegap.bitnagil.data.common.safeApiCall import com.threegap.bitnagil.data.emotion.datasource.EmotionDataSource import com.threegap.bitnagil.data.emotion.model.dto.EmotionDto import com.threegap.bitnagil.data.emotion.model.request.RegisterEmotionRequest +import com.threegap.bitnagil.data.emotion.model.response.DailyEmotionResponse import com.threegap.bitnagil.data.emotion.model.response.RegisterEmotionResponse -import com.threegap.bitnagil.data.emotion.model.response.TodayEmotionResponseDto import com.threegap.bitnagil.data.emotion.service.EmotionService import javax.inject.Inject @@ -25,8 +25,8 @@ class EmotionDataSourceImpl @Inject constructor( } } - override suspend fun fetchTodayEmotion(currentDate: String): Result = + override suspend fun fetchDailyEmotion(currentDate: String): Result = safeApiCall { - emotionService.fetchTodayEmotion(currentDate) + emotionService.fetchDailyEmotion(currentDate) } } diff --git a/data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/DailyEmotionResponse.kt b/data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/DailyEmotionResponse.kt new file mode 100644 index 00000000..7dbebbc7 --- /dev/null +++ b/data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/DailyEmotionResponse.kt @@ -0,0 +1,26 @@ +package com.threegap.bitnagil.data.emotion.model.response + +import com.threegap.bitnagil.domain.emotion.model.DailyEmotion +import com.threegap.bitnagil.domain.emotion.model.EmotionMarbleType +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class DailyEmotionResponse( + @SerialName("emotionMarbleType") + val emotionMarbleType: EmotionMarbleType?, + @SerialName("emotionMarbleName") + val emotionMarbleName: String?, + @SerialName("imageUrl") + val imageUrl: String?, + @SerialName("emotionMarbleHomeMessage") + val emotionMarbleHomeMessage: String?, +) + +fun DailyEmotionResponse.toDomain(): DailyEmotion = + DailyEmotion( + type = emotionMarbleType, + name = emotionMarbleName, + imageUrl = imageUrl, + homeMessage = emotionMarbleHomeMessage, + ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/TodayEmotionResponseDto.kt b/data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/TodayEmotionResponseDto.kt deleted file mode 100644 index 07d33a83..00000000 --- a/data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/TodayEmotionResponseDto.kt +++ /dev/null @@ -1,30 +0,0 @@ -package com.threegap.bitnagil.data.emotion.model.response - -import com.threegap.bitnagil.domain.emotion.model.TodayEmotion -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -@Serializable -data class TodayEmotionResponseDto( - @SerialName("emotionMarbleType") - val emotionMarbleType: String?, - @SerialName("emotionMarbleName") - val emotionMarbleName: String?, - @SerialName("imageUrl") - val imageUrl: String?, - @SerialName("emotionMarbleHomeMessage") - val emotionMarbleHomeMessage: String?, -) - -fun TodayEmotionResponseDto.toDomain(): TodayEmotion? { - return if (emotionMarbleType != null && emotionMarbleName != null && imageUrl != null && emotionMarbleHomeMessage != null) { - TodayEmotion( - type = emotionMarbleType, - name = emotionMarbleName, - imageUrl = imageUrl, - homeMessage = emotionMarbleHomeMessage, - ) - } else { - null - } -} diff --git a/data/src/main/java/com/threegap/bitnagil/data/emotion/repositoryImpl/EmotionRepositoryImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/emotion/repositoryImpl/EmotionRepositoryImpl.kt index f2f69abd..811209dc 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/emotion/repositoryImpl/EmotionRepositoryImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/emotion/repositoryImpl/EmotionRepositoryImpl.kt @@ -2,10 +2,10 @@ package com.threegap.bitnagil.data.emotion.repositoryImpl import com.threegap.bitnagil.data.emotion.datasource.EmotionDataSource import com.threegap.bitnagil.data.emotion.model.response.toDomain +import com.threegap.bitnagil.domain.emotion.model.DailyEmotion import com.threegap.bitnagil.domain.emotion.model.Emotion import com.threegap.bitnagil.domain.emotion.model.EmotionChangeEvent import com.threegap.bitnagil.domain.emotion.model.EmotionRecommendRoutine -import com.threegap.bitnagil.domain.emotion.model.TodayEmotion import com.threegap.bitnagil.domain.emotion.repository.EmotionRepository import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow @@ -34,8 +34,8 @@ class EmotionRepositoryImpl @Inject constructor( } } - override suspend fun fetchTodayEmotion(currentDate: String): Result = - emotionDataSource.fetchTodayEmotion(currentDate).map { it.toDomain() } + override suspend fun fetchDailyEmotion(currentDate: String): Result = + emotionDataSource.fetchDailyEmotion(currentDate).map { it.toDomain() } private val _emotionChangeEventFlow = MutableSharedFlow() override suspend fun getEmotionChangeEventFlow(): Flow = _emotionChangeEventFlow.asSharedFlow() diff --git a/data/src/main/java/com/threegap/bitnagil/data/emotion/service/EmotionService.kt b/data/src/main/java/com/threegap/bitnagil/data/emotion/service/EmotionService.kt index 15abfeac..1d715fbb 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/emotion/service/EmotionService.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/emotion/service/EmotionService.kt @@ -2,8 +2,8 @@ package com.threegap.bitnagil.data.emotion.service import com.threegap.bitnagil.data.emotion.model.dto.EmotionDto import com.threegap.bitnagil.data.emotion.model.request.RegisterEmotionRequest +import com.threegap.bitnagil.data.emotion.model.response.DailyEmotionResponse import com.threegap.bitnagil.data.emotion.model.response.RegisterEmotionResponse -import com.threegap.bitnagil.data.emotion.model.response.TodayEmotionResponseDto import com.threegap.bitnagil.network.model.BaseResponse import retrofit2.http.Body import retrofit2.http.GET @@ -20,7 +20,7 @@ interface EmotionService { ): BaseResponse @GET("/api/v2/emotion-marbles/{searchDate}") - suspend fun fetchTodayEmotion( + suspend fun fetchDailyEmotion( @Path("searchDate") date: String, - ): BaseResponse + ): BaseResponse } diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/DailyEmotion.kt b/domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/DailyEmotion.kt new file mode 100644 index 00000000..ab27dd52 --- /dev/null +++ b/domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/DailyEmotion.kt @@ -0,0 +1,8 @@ +package com.threegap.bitnagil.domain.emotion.model + +data class DailyEmotion( + val type: EmotionMarbleType?, + val name: String?, + val imageUrl: String?, + val homeMessage: String?, +) diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/EmotionMarbleType.kt b/domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/EmotionMarbleType.kt new file mode 100644 index 00000000..36d62daf --- /dev/null +++ b/domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/EmotionMarbleType.kt @@ -0,0 +1,16 @@ +package com.threegap.bitnagil.domain.emotion.model + +import kotlinx.serialization.Serializable + +/** + * 감정구슬 타입 + * + * @property CALM 평온함 + * @property VITALITY 활기참 + * @property LETHARGY 무기력함 + * @property ANXIETY 활기참 + * @property SATISFACTION 만족함 + * @property FATIGUE 피곤함 + */ +@Serializable +enum class EmotionMarbleType { CALM, VITALITY, LETHARGY, ANXIETY, SATISFACTION, FATIGUE } diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/TodayEmotion.kt b/domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/TodayEmotion.kt deleted file mode 100644 index bbcddc64..00000000 --- a/domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/TodayEmotion.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.threegap.bitnagil.domain.emotion.model - -data class TodayEmotion( - val type: String, - val name: String, - val imageUrl: String, - val homeMessage: String, -) diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/emotion/repository/EmotionRepository.kt b/domain/src/main/java/com/threegap/bitnagil/domain/emotion/repository/EmotionRepository.kt index 526e1ec1..d2a1df80 100644 --- a/domain/src/main/java/com/threegap/bitnagil/domain/emotion/repository/EmotionRepository.kt +++ b/domain/src/main/java/com/threegap/bitnagil/domain/emotion/repository/EmotionRepository.kt @@ -1,14 +1,14 @@ package com.threegap.bitnagil.domain.emotion.repository +import com.threegap.bitnagil.domain.emotion.model.DailyEmotion import com.threegap.bitnagil.domain.emotion.model.Emotion import com.threegap.bitnagil.domain.emotion.model.EmotionChangeEvent import com.threegap.bitnagil.domain.emotion.model.EmotionRecommendRoutine -import com.threegap.bitnagil.domain.emotion.model.TodayEmotion import kotlinx.coroutines.flow.Flow interface EmotionRepository { suspend fun getEmotions(): Result> suspend fun registerEmotion(emotionMarbleType: String): Result> - suspend fun fetchTodayEmotion(currentDate: String): Result + suspend fun fetchDailyEmotion(currentDate: String): Result suspend fun getEmotionChangeEventFlow(): Flow } diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/FetchTodayEmotionUseCase.kt b/domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/FetchDailyEmotionUseCase.kt similarity index 55% rename from domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/FetchTodayEmotionUseCase.kt rename to domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/FetchDailyEmotionUseCase.kt index b98453e4..0b5d5bdb 100644 --- a/domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/FetchTodayEmotionUseCase.kt +++ b/domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/FetchDailyEmotionUseCase.kt @@ -1,15 +1,15 @@ package com.threegap.bitnagil.domain.emotion.usecase -import com.threegap.bitnagil.domain.emotion.model.TodayEmotion +import com.threegap.bitnagil.domain.emotion.model.DailyEmotion import com.threegap.bitnagil.domain.emotion.repository.EmotionRepository import java.time.LocalDate import javax.inject.Inject -class FetchTodayEmotionUseCase @Inject constructor( +class FetchDailyEmotionUseCase @Inject constructor( private val emotionRepository: EmotionRepository, ) { - suspend operator fun invoke(): Result { + suspend operator fun invoke(): Result { val currentDate = LocalDate.now().toString() - return emotionRepository.fetchTodayEmotion(currentDate) + return emotionRepository.fetchDailyEmotion(currentDate) } } diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeScreen.kt index c7392508..0db4f45f 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeScreen.kt @@ -37,11 +37,11 @@ import java.time.LocalDate @Composable fun HomeScreenContainer( + viewModel: HomeViewModel = hiltViewModel(), navigateToGuide: () -> Unit, navigateToRegisterRoutine: () -> Unit, navigateToEmotion: () -> Unit, navigateToRoutineList: (String) -> Unit, - viewModel: HomeViewModel = hiltViewModel(), ) { val uiState by viewModel.collectAsState() @@ -169,7 +169,7 @@ private fun HomeScreen( CollapsibleHomeHeader( userName = uiState.userNickname, - todayEmotion = uiState.todayEmotion, + dailyEmotion = uiState.dailyEmotion, collapsibleHeaderState = collapsibleHeaderState, onHelpClick = onHelpClick, onRegisterEmotion = onRegisterEmotionClick, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt index 6404f749..c4a9d347 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt @@ -2,7 +2,7 @@ package com.threegap.bitnagil.presentation.home import android.util.Log import androidx.lifecycle.ViewModel -import com.threegap.bitnagil.domain.emotion.usecase.FetchTodayEmotionUseCase +import com.threegap.bitnagil.domain.emotion.usecase.FetchDailyEmotionUseCase import com.threegap.bitnagil.domain.emotion.usecase.GetEmotionChangeEventFlowUseCase import com.threegap.bitnagil.domain.onboarding.usecase.GetOnBoardingRecommendRoutineEventFlowUseCase import com.threegap.bitnagil.domain.routine.model.RoutineCompletionInfo @@ -36,7 +36,7 @@ import javax.inject.Inject class HomeViewModel @Inject constructor( private val fetchWeeklyRoutinesUseCase: FetchWeeklyRoutinesUseCase, private val fetchUserProfileUseCase: FetchUserProfileUseCase, - private val fetchTodayEmotionUseCase: FetchTodayEmotionUseCase, + private val fetchDailyEmotionUseCase: FetchDailyEmotionUseCase, private val routineCompletionUseCase: RoutineCompletionUseCase, private val getWriteRoutineEventFlowUseCase: GetWriteRoutineEventFlowUseCase, private val getEmotionChangeEventFlowUseCase: GetEmotionChangeEventFlowUseCase, @@ -186,7 +186,7 @@ class HomeViewModel @Inject constructor( intent { coroutineScope { launch { fetchUserProfile() } - launch { fetchTodayEmotion() } + launch { fetchDailyEmotion() } launch { fetchWeeklyRoutines(state.currentWeeks) } launch { observeWriteRoutineEvent() } launch { observeEmotionChangeEvent() } @@ -208,7 +208,7 @@ class HomeViewModel @Inject constructor( private suspend fun observeEmotionChangeEvent() { subIntent { getEmotionChangeEventFlowUseCase().collect { - fetchTodayEmotion() + fetchDailyEmotion() } } } @@ -278,12 +278,12 @@ class HomeViewModel @Inject constructor( } } - private suspend fun fetchTodayEmotion() { + private suspend fun fetchDailyEmotion() { subIntent { reduce { state.copy(loadingCount = state.loadingCount + 1) } - fetchTodayEmotionUseCase().fold( + fetchDailyEmotionUseCase().fold( onSuccess = { - reduce { state.copy(todayEmotion = it?.toUiModel(), loadingCount = state.loadingCount - 1) } + reduce { state.copy(dailyEmotion = it.toUiModel(), loadingCount = state.loadingCount - 1) } }, onFailure = { Log.e("HomeViewModel", "나의 감정 실패: ${it.message}") diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/component/template/CollapsibleHomeHeader.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/component/template/CollapsibleHomeHeader.kt index f15b8e12..260fffe5 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/component/template/CollapsibleHomeHeader.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/component/template/CollapsibleHomeHeader.kt @@ -34,14 +34,14 @@ import com.threegap.bitnagil.designsystem.R import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon import com.threegap.bitnagil.designsystem.component.atom.BitnagilIconButton import com.threegap.bitnagil.presentation.home.component.atom.EmotionRegisterButton -import com.threegap.bitnagil.presentation.home.model.TodayEmotionUiModel +import com.threegap.bitnagil.presentation.home.model.DailyEmotionUiModel import com.threegap.bitnagil.presentation.home.util.CollapsibleHeaderState import com.threegap.bitnagil.presentation.home.util.rememberCollapsibleHeaderState @Composable fun CollapsibleHomeHeader( userName: String, - todayEmotion: TodayEmotionUiModel?, + dailyEmotion: DailyEmotionUiModel, collapsibleHeaderState: CollapsibleHeaderState, onHelpClick: () -> Unit, onRegisterEmotion: () -> Unit, @@ -53,12 +53,6 @@ fun CollapsibleHomeHeader( animationSpec = tween(durationMillis = 300), label = "header_alpha", ) - val hasEmotion = todayEmotion != null - val welcomeMessage = if (hasEmotion) { - "${userName}님,\n${todayEmotion?.homeMessage}" - } else { - "${userName}님, 오셨군요!\n오늘 기분은 어떤가요?" - } Column( modifier = modifier @@ -102,7 +96,7 @@ fun CollapsibleHomeHeader( verticalArrangement = Arrangement.spacedBy(20.dp), ) { Text( - text = welcomeMessage, + text = "$userName${dailyEmotion.homeMessage}", style = BitnagilTheme.typography.cafe24SsurroundAir, color = BitnagilTheme.colors.white, fontWeight = FontWeight.SemiBold, @@ -110,14 +104,14 @@ fun CollapsibleHomeHeader( EmotionRegisterButton( onClick = onRegisterEmotion, - enabled = !hasEmotion, + enabled = !dailyEmotion.hasEmotion, ) } AsyncImage( - model = remember(todayEmotion?.imageUrl) { + model = remember(dailyEmotion.imageUrl) { ImageRequest.Builder(context) - .data(todayEmotion?.imageUrl) + .data(dailyEmotion.imageUrl) .crossfade(true) .build() }, @@ -140,7 +134,7 @@ fun CollapsibleHomeHeader( private fun CollapsibleHomeHeaderPreview() { CollapsibleHomeHeader( userName = "대현", - todayEmotion = null, + dailyEmotion = DailyEmotionUiModel.INIT, collapsibleHeaderState = rememberCollapsibleHeaderState(), onHelpClick = {}, onRegisterEmotion = {}, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeState.kt index dc839217..5baa825e 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/contract/HomeState.kt @@ -1,15 +1,15 @@ package com.threegap.bitnagil.presentation.home.contract +import com.threegap.bitnagil.presentation.home.model.DailyEmotionUiModel import com.threegap.bitnagil.presentation.home.model.RoutineScheduleUiModel import com.threegap.bitnagil.presentation.home.model.RoutineUiModel -import com.threegap.bitnagil.presentation.home.model.TodayEmotionUiModel import com.threegap.bitnagil.presentation.home.util.getCurrentWeekDays import java.time.LocalDate data class HomeState( val loadingCount: Int, val userNickname: String, - val todayEmotion: TodayEmotionUiModel?, + val dailyEmotion: DailyEmotionUiModel, val selectedDate: LocalDate, val currentWeeks: List, val routineSchedule: RoutineScheduleUiModel, @@ -24,7 +24,7 @@ data class HomeState( val INIT = HomeState( loadingCount = 0, userNickname = "", - todayEmotion = null, + dailyEmotion = DailyEmotionUiModel.INIT, selectedDate = LocalDate.now(), currentWeeks = LocalDate.now().getCurrentWeekDays(), routineSchedule = RoutineScheduleUiModel.INIT, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/DailyEmotionUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/DailyEmotionUiModel.kt new file mode 100644 index 00000000..c6cd5121 --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/DailyEmotionUiModel.kt @@ -0,0 +1,28 @@ +package com.threegap.bitnagil.presentation.home.model + +import com.threegap.bitnagil.domain.emotion.model.DailyEmotion +import com.threegap.bitnagil.domain.emotion.model.EmotionMarbleType + +data class DailyEmotionUiModel( + val type: EmotionMarbleType?, + val imageUrl: String, + val homeMessage: String, +) { + val hasEmotion: Boolean + get() = type != null + + companion object { + val INIT = DailyEmotionUiModel( + type = null, + imageUrl = "", + homeMessage = "", + ) + } +} + +internal fun DailyEmotion.toUiModel() = + DailyEmotionUiModel( + type = this.type, + imageUrl = this.imageUrl ?: "", + homeMessage = this.homeMessage?.let { "님,\n$it" } ?: "님, 오셨군요!\n오늘 기분은 어떤가요?", + ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/TodayEmotionUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/TodayEmotionUiModel.kt deleted file mode 100644 index eaa9e79e..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/TodayEmotionUiModel.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.threegap.bitnagil.presentation.home.model - -import android.os.Parcelable -import com.threegap.bitnagil.domain.emotion.model.TodayEmotion -import kotlinx.parcelize.Parcelize - -@Parcelize -data class TodayEmotionUiModel( - val imageUrl: String, - val homeMessage: String, -) : Parcelable - -fun TodayEmotion.toUiModel() = TodayEmotionUiModel( - imageUrl = this.imageUrl, - homeMessage = this.homeMessage, -) From 89508e15820488e94d9a293bd8e90ac1e6f0fe04 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sat, 14 Feb 2026 23:26:54 +0900 Subject: [PATCH 21/31] =?UTF-8?q?Fix:=20=EC=B6=94=EC=B2=9C=20=EB=A3=A8?= =?UTF-8?q?=ED=8B=B4=20=EA=B4=80=EB=A0=A8=20ID=20=ED=83=80=EC=9E=85?= =?UTF-8?q?=EC=9D=84=20Int=EC=97=90=EC=84=9C=20Long=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recommendroutine/datasource/RecommendRoutineDataSource.kt | 2 +- .../datasourceImpl/RecommendRoutineDataSourceImpl.kt | 2 +- .../recommendroutine/model/response/RecommendedRoutineDto.kt | 2 +- .../recommendroutine/model/response/RecommendedSubRoutineDto.kt | 2 +- .../repositoryImpl/RecommendRoutineRepositoryImpl.kt | 2 +- .../data/recommendroutine/service/RecommendRoutineService.kt | 2 +- .../bitnagil/domain/recommendroutine/model/RecommendRoutine.kt | 2 +- .../domain/recommendroutine/model/RecommendSubRoutine.kt | 2 +- .../recommendroutine/model/RecommendRoutineUiModel.kt | 2 +- .../recommendroutine/model/RecommendSubRoutineUiModel.kt | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasource/RecommendRoutineDataSource.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasource/RecommendRoutineDataSource.kt index e4538c40..24b43302 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasource/RecommendRoutineDataSource.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasource/RecommendRoutineDataSource.kt @@ -5,5 +5,5 @@ import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendedRou interface RecommendRoutineDataSource { suspend fun fetchRecommendRoutines(): Result - suspend fun getRecommendRoutine(recommendRoutineId: Int): Result + suspend fun getRecommendRoutine(recommendRoutineId: Long): Result } diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasourceImpl/RecommendRoutineDataSourceImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasourceImpl/RecommendRoutineDataSourceImpl.kt index 859c22e1..cfde760e 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasourceImpl/RecommendRoutineDataSourceImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasourceImpl/RecommendRoutineDataSourceImpl.kt @@ -16,7 +16,7 @@ class RecommendRoutineDataSourceImpl @Inject constructor( recommendRoutineService.fetchRecommendRoutines() } - override suspend fun getRecommendRoutine(recommendRoutineId: Int): Result = + override suspend fun getRecommendRoutine(recommendRoutineId: Long): Result = safeApiCall { recommendRoutineService.getRecommendRoutine(recommendRoutineId) } diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedRoutineDto.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedRoutineDto.kt index 9853ac05..c9965b96 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedRoutineDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedRoutineDto.kt @@ -9,7 +9,7 @@ import kotlinx.serialization.Serializable @Serializable data class RecommendedRoutineDto( @SerialName("recommendedRoutineId") - val recommendedRoutineId: Int, + val recommendedRoutineId: Long, @SerialName("recommendedRoutineName") val recommendedRoutineName: String, @SerialName("recommendedRoutineDescription") diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedSubRoutineDto.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedSubRoutineDto.kt index cf27e915..660c6dce 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedSubRoutineDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedSubRoutineDto.kt @@ -7,7 +7,7 @@ import kotlinx.serialization.Serializable @Serializable data class RecommendedSubRoutineDto( @SerialName("recommendedSubRoutineId") - val recommendedSubRoutineId: Int, + val recommendedSubRoutineId: Long, @SerialName("recommendedSubRoutineName") val recommendedSubRoutineName: String, ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/repositoryImpl/RecommendRoutineRepositoryImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/repositoryImpl/RecommendRoutineRepositoryImpl.kt index 05ca53fe..1f0a9d76 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/repositoryImpl/RecommendRoutineRepositoryImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/repositoryImpl/RecommendRoutineRepositoryImpl.kt @@ -15,7 +15,7 @@ class RecommendRoutineRepositoryImpl @Inject constructor( .map { it.toDomain() } override suspend fun getRecommendRoutine(recommendRoutineId: String): Result { - val recommendRoutineIdInt = recommendRoutineId.toIntOrNull() ?: return Result.failure( + val recommendRoutineIdInt = recommendRoutineId.toLongOrNull() ?: return Result.failure( IllegalArgumentException("recommendRoutineId is not a valid integer"), ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/service/RecommendRoutineService.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/service/RecommendRoutineService.kt index dccdf851..1d45f801 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/service/RecommendRoutineService.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/service/RecommendRoutineService.kt @@ -12,6 +12,6 @@ interface RecommendRoutineService { @GET("/api/v1/recommend-routines/{recommendedRoutineId}") suspend fun getRecommendRoutine( - @Path("recommendedRoutineId") recommendedRoutineId: Int, + @Path("recommendedRoutineId") recommendedRoutineId: Long, ): BaseResponse } diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutine.kt b/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutine.kt index 8cea9010..cf70199a 100644 --- a/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutine.kt +++ b/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutine.kt @@ -1,7 +1,7 @@ package com.threegap.bitnagil.domain.recommendroutine.model data class RecommendRoutine( - val id: Int, + val id: Long, val name: String, val description: String, val level: RecommendLevel, diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendSubRoutine.kt b/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendSubRoutine.kt index ec1c05ca..3d6e93fa 100644 --- a/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendSubRoutine.kt +++ b/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendSubRoutine.kt @@ -1,6 +1,6 @@ package com.threegap.bitnagil.domain.recommendroutine.model data class RecommendSubRoutine( - val id: Int, + val id: Long, val name: String, ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineUiModel.kt index 770207a5..ac496886 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineUiModel.kt @@ -8,7 +8,7 @@ import kotlinx.parcelize.Parcelize @Parcelize data class RecommendRoutineUiModel( - val id: Int = 0, + val id: Long = 0, val name: String = "", val level: RecommendLevel? = null, val recommendedRoutineType: RecommendCategory? = null, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendSubRoutineUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendSubRoutineUiModel.kt index ee33f574..7768d071 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendSubRoutineUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendSubRoutineUiModel.kt @@ -6,7 +6,7 @@ import kotlinx.parcelize.Parcelize @Parcelize data class RecommendSubRoutineUiModel( - val id: Int = 0, + val id: Long = 0, val name: String = "", ) : Parcelable From 85eb3d1ddb0713f1d40703674b6db2a2e7a03feb Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sat, 14 Feb 2026 23:45:01 +0900 Subject: [PATCH 22/31] =?UTF-8?q?Refactor:=20=EC=B6=94=EC=B2=9C=20?= =?UTF-8?q?=EB=A3=A8=ED=8B=B4=20=EA=B4=80=EB=A0=A8=20=EB=AA=A8=EB=8D=B8=20?= =?UTF-8?q?=EB=B0=8F=20=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 --- .../datasource/RecommendRoutineDataSource.kt | 8 +++---- .../RecommendRoutineDataSourceImpl.kt | 8 +++---- ...nesDto.kt => RecommendRoutinesResponse.kt} | 14 ++++++------- ...neDto.kt => RecommendedRoutineResponse.kt} | 10 ++++----- ...to.kt => RecommendedSubRoutineResponse.kt} | 4 ++-- .../service/RecommendRoutineService.kt | 8 +++---- .../model/response/RoutineScheduleResponse.kt | 2 +- .../model/EmotionMarbleType.kt | 13 ------------ .../model/RecommendRoutine.kt | 4 ++-- .../model/RecommendRoutines.kt | 2 ++ .../RecommendRoutineViewModel.kt | 2 +- .../component/block/RecommendRoutineItem.kt | 16 +++++++------- .../contract/RecommendRoutineState.kt | 2 +- .../model/RecommendRoutineUiModel.kt | 21 ++++++++----------- .../model/RecommendRoutinesUiModel.kt | 20 +++++++++++------- .../model/RecommendSubRoutineUiModel.kt | 11 ++++------ .../writeroutine/WriteRoutineViewModel.kt | 4 ++-- 17 files changed, 68 insertions(+), 81 deletions(-) rename data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/{RecommendRoutinesDto.kt => RecommendRoutinesResponse.kt} (67%) rename data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/{RecommendedRoutineDto.kt => RecommendedRoutineResponse.kt} (83%) rename data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/{RecommendedSubRoutineDto.kt => RecommendedSubRoutineResponse.kt} (82%) delete mode 100644 domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/EmotionMarbleType.kt diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasource/RecommendRoutineDataSource.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasource/RecommendRoutineDataSource.kt index 24b43302..0bc3279a 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasource/RecommendRoutineDataSource.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasource/RecommendRoutineDataSource.kt @@ -1,9 +1,9 @@ package com.threegap.bitnagil.data.recommendroutine.datasource -import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendRoutinesDto -import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendedRoutineDto +import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendRoutinesResponse +import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendedRoutineResponse interface RecommendRoutineDataSource { - suspend fun fetchRecommendRoutines(): Result - suspend fun getRecommendRoutine(recommendRoutineId: Long): Result + suspend fun fetchRecommendRoutines(): Result + suspend fun getRecommendRoutine(recommendRoutineId: Long): Result } diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasourceImpl/RecommendRoutineDataSourceImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasourceImpl/RecommendRoutineDataSourceImpl.kt index cfde760e..38b469ed 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasourceImpl/RecommendRoutineDataSourceImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/datasourceImpl/RecommendRoutineDataSourceImpl.kt @@ -2,8 +2,8 @@ package com.threegap.bitnagil.data.recommendroutine.datasourceImpl import com.threegap.bitnagil.data.common.safeApiCall import com.threegap.bitnagil.data.recommendroutine.datasource.RecommendRoutineDataSource -import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendRoutinesDto -import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendedRoutineDto +import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendRoutinesResponse +import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendedRoutineResponse import com.threegap.bitnagil.data.recommendroutine.service.RecommendRoutineService import javax.inject.Inject @@ -11,12 +11,12 @@ class RecommendRoutineDataSourceImpl @Inject constructor( private val recommendRoutineService: RecommendRoutineService, ) : RecommendRoutineDataSource { - override suspend fun fetchRecommendRoutines(): Result = + override suspend fun fetchRecommendRoutines(): Result = safeApiCall { recommendRoutineService.fetchRecommendRoutines() } - override suspend fun getRecommendRoutine(recommendRoutineId: Long): Result = + override suspend fun getRecommendRoutine(recommendRoutineId: Long): Result = safeApiCall { recommendRoutineService.getRecommendRoutine(recommendRoutineId) } diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendRoutinesDto.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendRoutinesResponse.kt similarity index 67% rename from data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendRoutinesDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendRoutinesResponse.kt index 03e88e0b..d18f8d80 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendRoutinesDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendRoutinesResponse.kt @@ -1,23 +1,23 @@ package com.threegap.bitnagil.data.recommendroutine.model.response -import com.threegap.bitnagil.domain.recommendroutine.model.EmotionMarbleType +import com.threegap.bitnagil.domain.emotion.model.EmotionMarbleType import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.recommendroutine.model.RecommendRoutines import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class RecommendRoutinesDto( +data class RecommendRoutinesResponse( @SerialName("recommendedRoutines") - val recommendedRoutinesByCategory: Map>, + val recommendedRoutinesByCategory: Map>, @SerialName("emotionMarbleType") val emotionMarbleType: EmotionMarbleType?, ) -fun RecommendRoutinesDto.toDomain(): RecommendRoutines = +fun RecommendRoutinesResponse.toDomain(): RecommendRoutines = RecommendRoutines( - recommendRoutinesByCategory = this.recommendedRoutinesByCategory.map { (category, routines) -> - category to routines.map { it.toDomain() } - }.toMap(), + recommendRoutinesByCategory = this.recommendedRoutinesByCategory.mapValues { (_, routines) -> + routines.map { it.toDomain() } + }, emotionMarbleType = this.emotionMarbleType, ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedRoutineDto.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedRoutineResponse.kt similarity index 83% rename from data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedRoutineDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedRoutineResponse.kt index c9965b96..7959f183 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedRoutineDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedRoutineResponse.kt @@ -7,7 +7,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class RecommendedRoutineDto( +data class RecommendedRoutineResponse( @SerialName("recommendedRoutineId") val recommendedRoutineId: Long, @SerialName("recommendedRoutineName") @@ -21,16 +21,16 @@ data class RecommendedRoutineDto( @SerialName("recommendedRoutineType") val recommendedRoutineType: RecommendCategory, @SerialName("recommendedSubRoutineSearchResult") - val recommendedSubRoutineSearchResult: List, + val recommendedSubRoutineSearchResult: List, ) -fun RecommendedRoutineDto.toDomain(): RecommendRoutine = +fun RecommendedRoutineResponse.toDomain(): RecommendRoutine = RecommendRoutine( id = this.recommendedRoutineId, name = this.recommendedRoutineName, description = this.recommendedRoutineDescription, level = this.recommendedRoutineLevel, executionTime = this.executionTime, - recommendedRoutineType = this.recommendedRoutineType, - recommendSubRoutines = this.recommendedSubRoutineSearchResult.map { it.toDomain() }, + category = this.recommendedRoutineType, + subRoutines = this.recommendedSubRoutineSearchResult.map { it.toDomain() }, ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedSubRoutineDto.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedSubRoutineResponse.kt similarity index 82% rename from data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedSubRoutineDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedSubRoutineResponse.kt index 660c6dce..79f02286 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedSubRoutineDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/model/response/RecommendedSubRoutineResponse.kt @@ -5,14 +5,14 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class RecommendedSubRoutineDto( +data class RecommendedSubRoutineResponse( @SerialName("recommendedSubRoutineId") val recommendedSubRoutineId: Long, @SerialName("recommendedSubRoutineName") val recommendedSubRoutineName: String, ) -fun RecommendedSubRoutineDto.toDomain(): RecommendSubRoutine = +fun RecommendedSubRoutineResponse.toDomain(): RecommendSubRoutine = RecommendSubRoutine( id = recommendedSubRoutineId, name = recommendedSubRoutineName, diff --git a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/service/RecommendRoutineService.kt b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/service/RecommendRoutineService.kt index 1d45f801..8b6734f3 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/service/RecommendRoutineService.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/recommendroutine/service/RecommendRoutineService.kt @@ -1,17 +1,17 @@ package com.threegap.bitnagil.data.recommendroutine.service -import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendRoutinesDto -import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendedRoutineDto +import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendRoutinesResponse +import com.threegap.bitnagil.data.recommendroutine.model.response.RecommendedRoutineResponse import com.threegap.bitnagil.network.model.BaseResponse import retrofit2.http.GET import retrofit2.http.Path interface RecommendRoutineService { @GET("/api/v1/recommend-routines") - suspend fun fetchRecommendRoutines(): BaseResponse + suspend fun fetchRecommendRoutines(): BaseResponse @GET("/api/v1/recommend-routines/{recommendedRoutineId}") suspend fun getRecommendRoutine( @Path("recommendedRoutineId") recommendedRoutineId: Long, - ): BaseResponse + ): BaseResponse } diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineScheduleResponse.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineScheduleResponse.kt index 14d6b6bc..6d14f0ce 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineScheduleResponse.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineScheduleResponse.kt @@ -12,5 +12,5 @@ data class RoutineScheduleResponse( fun RoutineScheduleResponse.toDomain(): RoutineSchedule = RoutineSchedule( - dailyRoutines = this.dailyRoutines.mapValues { (_, dailyRoutinesResponse) -> dailyRoutinesResponse.toDomain() } + dailyRoutines = this.dailyRoutines.mapValues { (_, dailyRoutinesResponse) -> dailyRoutinesResponse.toDomain() }, ) diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/EmotionMarbleType.kt b/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/EmotionMarbleType.kt deleted file mode 100644 index be751c95..00000000 --- a/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/EmotionMarbleType.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.threegap.bitnagil.domain.recommendroutine.model - -import kotlinx.serialization.Serializable - -@Serializable -enum class EmotionMarbleType { - CALM, - VITALITY, - LETHARGY, - ANXIETY, - SATISFACTION, - FATIGUE, -} diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutine.kt b/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutine.kt index cf70199a..6227e08a 100644 --- a/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutine.kt +++ b/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutine.kt @@ -6,6 +6,6 @@ data class RecommendRoutine( val description: String, val level: RecommendLevel, val executionTime: String, - val recommendedRoutineType: RecommendCategory, - val recommendSubRoutines: List, + val category: RecommendCategory, + val subRoutines: List, ) diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutines.kt b/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutines.kt index 21804f6b..771903f3 100644 --- a/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutines.kt +++ b/domain/src/main/java/com/threegap/bitnagil/domain/recommendroutine/model/RecommendRoutines.kt @@ -1,5 +1,7 @@ package com.threegap.bitnagil.domain.recommendroutine.model +import com.threegap.bitnagil.domain.emotion.model.EmotionMarbleType + data class RecommendRoutines( val recommendRoutinesByCategory: Map>, val emotionMarbleType: EmotionMarbleType?, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineViewModel.kt index aaca7825..dc663b41 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/RecommendRoutineViewModel.kt @@ -32,7 +32,7 @@ class RecommendRoutineViewModel @Inject constructor( observeEmotionChangeEvent() } - private var recommendRoutines: RecommendRoutinesUiModel = RecommendRoutinesUiModel() + private var recommendRoutines: RecommendRoutinesUiModel = RecommendRoutinesUiModel.INIT fun updateRoutineCategory(category: RecommendCategory) { intent { diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/component/block/RecommendRoutineItem.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/component/block/RecommendRoutineItem.kt index 7544b8bb..0adfaefd 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/component/block/RecommendRoutineItem.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/component/block/RecommendRoutineItem.kt @@ -49,11 +49,11 @@ fun RecommendRoutineItem( verticalAlignment = Alignment.CenterVertically, ) { BitnagilIcon( - id = routine.recommendedRoutineType?.displayIcon ?: R.drawable.ic_shine, + id = routine.category?.displayIcon ?: R.drawable.ic_shine, tint = null, modifier = Modifier .background( - color = routine.recommendedRoutineType?.displayColor ?: BitnagilTheme.colors.yellow10, + color = routine.category?.displayColor ?: BitnagilTheme.colors.yellow10, shape = RoundedCornerShape(4.dp), ) .padding(4.dp), @@ -75,7 +75,7 @@ fun RecommendRoutineItem( ) } - if (routine.recommendSubRoutines.isNotEmpty()) { + if (routine.subRoutines.isNotEmpty()) { HorizontalDivider( thickness = 1.dp, color = BitnagilTheme.colors.coolGray97, @@ -93,7 +93,7 @@ fun RecommendRoutineItem( style = BitnagilTheme.typography.body2Medium, ) - routine.recommendSubRoutines.forEach { subRoutine -> + routine.subRoutines.forEach { subRoutine -> Text( text = "• ${subRoutine.name}", color = BitnagilTheme.colors.coolGray40, @@ -113,8 +113,8 @@ private fun RecommendRoutineItemPreview() { id = 1, name = "개운하게 일어나기", level = RecommendLevel.LEVEL1, - recommendedRoutineType = RecommendCategory.WAKE_UP, - recommendSubRoutines = listOf( + category = RecommendCategory.WAKE_UP, + subRoutines = listOf( RecommendSubRoutineUiModel( id = 1, name = "일어나기", @@ -133,8 +133,8 @@ private fun EmptySubRoutineRecommendRoutineItemPreview() { id = 1, name = "개운하게 일어나기", level = RecommendLevel.LEVEL1, - recommendedRoutineType = RecommendCategory.WAKE_UP, - recommendSubRoutines = emptyList(), + category = RecommendCategory.WAKE_UP, + subRoutines = emptyList(), ), onAddRoutineClick = {}, ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/contract/RecommendRoutineState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/contract/RecommendRoutineState.kt index 2800b3a5..e206eca9 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/contract/RecommendRoutineState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/contract/RecommendRoutineState.kt @@ -1,6 +1,6 @@ package com.threegap.bitnagil.presentation.recommendroutine.contract -import com.threegap.bitnagil.domain.recommendroutine.model.EmotionMarbleType +import com.threegap.bitnagil.domain.emotion.model.EmotionMarbleType import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.recommendroutine.model.RecommendLevel import com.threegap.bitnagil.presentation.recommendroutine.model.RecommendRoutineUiModel diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineUiModel.kt index ac496886..8e1982de 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutineUiModel.kt @@ -1,25 +1,22 @@ package com.threegap.bitnagil.presentation.recommendroutine.model -import android.os.Parcelable import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.recommendroutine.model.RecommendLevel import com.threegap.bitnagil.domain.recommendroutine.model.RecommendRoutine -import kotlinx.parcelize.Parcelize -@Parcelize data class RecommendRoutineUiModel( - val id: Long = 0, - val name: String = "", - val level: RecommendLevel? = null, - val recommendedRoutineType: RecommendCategory? = null, - val recommendSubRoutines: List = emptyList(), -) : Parcelable + val id: Long, + val name: String, + val level: RecommendLevel?, + val category: RecommendCategory?, + val subRoutines: List, +) -fun RecommendRoutine.toUiModel() = +internal fun RecommendRoutine.toUiModel(): RecommendRoutineUiModel = RecommendRoutineUiModel( id = this.id, name = this.name, level = this.level, - recommendedRoutineType = this.recommendedRoutineType, - recommendSubRoutines = this.recommendSubRoutines.map { it.toUiModel() }, + category = this.category, + subRoutines = this.subRoutines.map { it.toUiModel() }, ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutinesUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutinesUiModel.kt index ef8c98e8..c6f270a1 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutinesUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendRoutinesUiModel.kt @@ -1,18 +1,22 @@ package com.threegap.bitnagil.presentation.recommendroutine.model -import android.os.Parcelable -import com.threegap.bitnagil.domain.recommendroutine.model.EmotionMarbleType +import com.threegap.bitnagil.domain.emotion.model.EmotionMarbleType import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.recommendroutine.model.RecommendRoutines -import kotlinx.parcelize.Parcelize -@Parcelize data class RecommendRoutinesUiModel( - val recommendRoutinesByCategory: Map> = emptyMap(), - val emotionMarbleType: EmotionMarbleType? = null, -) : Parcelable + val recommendRoutinesByCategory: Map>, + val emotionMarbleType: EmotionMarbleType?, +) { + companion object { + val INIT = RecommendRoutinesUiModel( + recommendRoutinesByCategory = emptyMap(), + emotionMarbleType = null, + ) + } +} -fun RecommendRoutines.toUiModel() = +internal fun RecommendRoutines.toUiModel(): RecommendRoutinesUiModel = RecommendRoutinesUiModel( recommendRoutinesByCategory = this.recommendRoutinesByCategory.mapValues { (_, routines) -> routines.map { it.toUiModel() } diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendSubRoutineUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendSubRoutineUiModel.kt index 7768d071..043a1458 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendSubRoutineUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/recommendroutine/model/RecommendSubRoutineUiModel.kt @@ -1,16 +1,13 @@ package com.threegap.bitnagil.presentation.recommendroutine.model -import android.os.Parcelable import com.threegap.bitnagil.domain.recommendroutine.model.RecommendSubRoutine -import kotlinx.parcelize.Parcelize -@Parcelize data class RecommendSubRoutineUiModel( - val id: Long = 0, - val name: String = "", -) : Parcelable + val id: Long, + val name: String, +) -fun RecommendSubRoutine.toUiModel() = +internal fun RecommendSubRoutine.toUiModel(): RecommendSubRoutineUiModel = RecommendSubRoutineUiModel( id = this.id, name = this.name, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt index d349bf1f..b00cfa58 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt @@ -131,7 +131,7 @@ class WriteRoutineViewModel @AssistedInject constructor( } getRecommendRoutineUseCase(recommendRoutineId).fold( onSuccess = { routine -> - oldSubRoutines = routine.recommendSubRoutines.map { SubRoutine.fromDomainRecommendSubRoutine(it) } + oldSubRoutines = routine.subRoutines.map { SubRoutine.fromDomainRecommendSubRoutine(it) } reduce { state.copy( @@ -147,7 +147,7 @@ class WriteRoutineViewModel @AssistedInject constructor( oldSubRoutines.getOrNull(2)?.name ?: "", ), loading = false, - recommendedRoutineType = routine.recommendedRoutineType.displayTitle, + recommendedRoutineType = routine.category.displayTitle, ) } }, From 289e75c6707b889984f3813d154ae25efa023ef0 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sun, 15 Feb 2026 00:48:45 +0900 Subject: [PATCH 23/31] =?UTF-8?q?Refactor:=20=EC=B6=94=EC=B2=9C=20?= =?UTF-8?q?=EB=A3=A8=ED=8B=B4=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20?= =?UTF-8?q?=EB=AA=A8=EB=8D=B8=20=ED=86=B5=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../routine/model/response/RoutineResponse.kt | 4 +-- .../routine/model/RecommendedRoutineType.kt | 15 ---------- .../bitnagil/domain/routine/model/Routine.kt | 4 ++- .../presentation/home/model/RoutineUiModel.kt | 4 +-- .../component/template/RoutineDetailsCard.kt | 8 ++--- .../routinelist/model/RoutineUiModel.kt | 30 ++----------------- 6 files changed, 13 insertions(+), 52 deletions(-) delete mode 100644 domain/src/main/java/com/threegap/bitnagil/domain/routine/model/RecommendedRoutineType.kt diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineResponse.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineResponse.kt index 36a4466d..65a764dc 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineResponse.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineResponse.kt @@ -1,7 +1,7 @@ package com.threegap.bitnagil.data.routine.model.response +import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.routine.model.DayOfWeek -import com.threegap.bitnagil.domain.routine.model.RecommendedRoutineType import com.threegap.bitnagil.domain.routine.model.Routine import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -25,7 +25,7 @@ data class RoutineResponse( @SerialName("subRoutineCompleteYn") val subRoutineCompleteYn: List, @SerialName("recommendedRoutineType") - val recommendedRoutineType: RecommendedRoutineType?, + val recommendedRoutineType: RecommendCategory?, @SerialName("routineDeletedYn") val routineDeletedYn: Boolean, @SerialName("routineStartDate") diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/routine/model/RecommendedRoutineType.kt b/domain/src/main/java/com/threegap/bitnagil/domain/routine/model/RecommendedRoutineType.kt deleted file mode 100644 index 9f1b8475..00000000 --- a/domain/src/main/java/com/threegap/bitnagil/domain/routine/model/RecommendedRoutineType.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.threegap.bitnagil.domain.routine.model - -import kotlinx.serialization.Serializable - -@Serializable -enum class RecommendedRoutineType { - PERSONALIZED, - OUTING, - WAKE_UP, - CONNECT, - REST, - GROW, - OUTING_REPORT, - ; -} diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/routine/model/Routine.kt b/domain/src/main/java/com/threegap/bitnagil/domain/routine/model/Routine.kt index d275d11f..4377c70b 100644 --- a/domain/src/main/java/com/threegap/bitnagil/domain/routine/model/Routine.kt +++ b/domain/src/main/java/com/threegap/bitnagil/domain/routine/model/Routine.kt @@ -1,5 +1,7 @@ package com.threegap.bitnagil.domain.routine.model +import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory + data class Routine( val id: String, val name: String, @@ -12,5 +14,5 @@ data class Routine( val isDeleted: Boolean, val subRoutineNames: List, val subRoutineCompletionStates: List, - val recommendedRoutineType: RecommendedRoutineType?, + val recommendedRoutineType: RecommendCategory?, ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineUiModel.kt index dfdf8ce6..07e56276 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/RoutineUiModel.kt @@ -1,7 +1,7 @@ package com.threegap.bitnagil.presentation.home.model +import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.routine.model.DayOfWeek -import com.threegap.bitnagil.domain.routine.model.RecommendedRoutineType import com.threegap.bitnagil.domain.routine.model.Routine data class RoutineUiModel( @@ -13,7 +13,7 @@ data class RoutineUiModel( val isCompleted: Boolean, val subRoutineNames: List, val subRoutineCompletionStates: List, - val recommendedRoutineType: RecommendedRoutineType?, + val recommendedRoutineType: RecommendCategory?, ) internal fun Routine.toUiModel(): RoutineUiModel = diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/component/template/RoutineDetailsCard.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/component/template/RoutineDetailsCard.kt index d10ef718..18e0f5d1 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/component/template/RoutineDetailsCard.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/component/template/RoutineDetailsCard.kt @@ -22,10 +22,10 @@ import com.threegap.bitnagil.designsystem.R import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon import com.threegap.bitnagil.designsystem.component.atom.BitnagilIconButton import com.threegap.bitnagil.domain.routine.model.DayOfWeek +import com.threegap.bitnagil.presentation.common.extension.displayColor +import com.threegap.bitnagil.presentation.common.extension.displayIcon import com.threegap.bitnagil.presentation.common.extension.displayTitle import com.threegap.bitnagil.presentation.routinelist.model.RoutineUiModel -import com.threegap.bitnagil.presentation.routinelist.model.getColor -import com.threegap.bitnagil.presentation.routinelist.model.getIcon @Composable fun RoutineDetailsCard( @@ -56,11 +56,11 @@ fun RoutineDetailsCard( verticalAlignment = Alignment.CenterVertically, ) { BitnagilIcon( - id = if (routine.recommendedRoutineType != null) routine.recommendedRoutineType.getIcon() else R.drawable.ic_shine, + id = if (routine.recommendedRoutineType != null) routine.recommendedRoutineType.displayIcon else R.drawable.ic_shine, tint = null, modifier = Modifier .background( - color = if (routine.recommendedRoutineType != null) routine.recommendedRoutineType.getColor() else BitnagilTheme.colors.yellow10, + color = if (routine.recommendedRoutineType != null) routine.recommendedRoutineType.displayColor else BitnagilTheme.colors.yellow10, shape = RoundedCornerShape(4.dp), ) .padding(4.dp), diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineUiModel.kt index 41a1b9eb..7364503e 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineUiModel.kt @@ -1,12 +1,8 @@ package com.threegap.bitnagil.presentation.routinelist.model import android.os.Parcelable -import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color -import com.threegap.bitnagil.designsystem.BitnagilTheme -import com.threegap.bitnagil.designsystem.R +import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.routine.model.DayOfWeek -import com.threegap.bitnagil.domain.routine.model.RecommendedRoutineType import com.threegap.bitnagil.domain.routine.model.Routine import com.threegap.bitnagil.presentation.home.util.formatExecutionTime12Hour import com.threegap.bitnagil.presentation.home.util.toShortDateFormat @@ -23,8 +19,8 @@ data class RoutineUiModel( val endDate: String, val routineDeletedYn: Boolean, val subRoutineNames: List, - val recommendedRoutineType: RecommendedRoutineType?, ) : Parcelable { + val recommendedRoutineType: RecommendCategory?, val formattedDateRange: String get() = "${startDate.toShortDateFormat()} - ${endDate.toShortDateFormat()}" } @@ -43,25 +39,3 @@ fun Routine.toUiModel(): RoutineUiModel = recommendedRoutineType = this.recommendedRoutineType, ) -fun RecommendedRoutineType.getIcon(): Int = - when (this) { - RecommendedRoutineType.OUTING -> R.drawable.ic_outside - RecommendedRoutineType.WAKE_UP -> R.drawable.ic_wakeup - RecommendedRoutineType.CONNECT -> R.drawable.ic_connect - RecommendedRoutineType.REST -> R.drawable.ic_rest - RecommendedRoutineType.GROW -> R.drawable.ic_grow - RecommendedRoutineType.PERSONALIZED -> R.drawable.ic_shine - RecommendedRoutineType.OUTING_REPORT -> R.drawable.ic_shine - } - -@Composable -fun RecommendedRoutineType.getColor(): Color = - when (this) { - RecommendedRoutineType.OUTING -> BitnagilTheme.colors.skyBlue10 - RecommendedRoutineType.WAKE_UP -> BitnagilTheme.colors.orange25 - RecommendedRoutineType.CONNECT -> BitnagilTheme.colors.purple10 - RecommendedRoutineType.REST -> BitnagilTheme.colors.green10 - RecommendedRoutineType.GROW -> BitnagilTheme.colors.pink10 - RecommendedRoutineType.PERSONALIZED -> BitnagilTheme.colors.yellow10 - RecommendedRoutineType.OUTING_REPORT -> BitnagilTheme.colors.yellow10 - } From a9602ac189b89410fa5ad48b2fa585defbb8b56e Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sun, 15 Feb 2026 01:17:55 +0900 Subject: [PATCH 24/31] =?UTF-8?q?Chore:=20=EB=A3=A8=ED=8B=B4=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EA=B4=80=EB=A0=A8=20UiModel=20=EB=84=A4?= =?UTF-8?q?=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 - DayRoutinesUiModel -> DailyRoutinesUiModel - RoutinesUiModel -> RoutineScheduleUiModel - 불필요한 Parcelize 제거 --- .../routinelist/contract/RoutineListState.kt | 8 ++++---- .../routinelist/model/DailyRoutinesUiModel.kt | 12 ++++++++++++ .../routinelist/model/DayRoutinesUiModel.kt | 15 --------------- .../model/RoutineScheduleUiModel.kt | 18 ++++++++++++++++++ .../routinelist/model/RoutineUiModel.kt | 8 ++------ .../routinelist/model/RoutinesUiModel.kt | 17 ----------------- 6 files changed, 36 insertions(+), 42 deletions(-) create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/DailyRoutinesUiModel.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/DayRoutinesUiModel.kt create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineScheduleUiModel.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutinesUiModel.kt diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/contract/RoutineListState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/contract/RoutineListState.kt index 03c712b2..fdcf5b88 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/contract/RoutineListState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/contract/RoutineListState.kt @@ -1,13 +1,13 @@ package com.threegap.bitnagil.presentation.routinelist.contract import com.threegap.bitnagil.presentation.home.util.getCurrentWeekDays +import com.threegap.bitnagil.presentation.routinelist.model.RoutineScheduleUiModel import com.threegap.bitnagil.presentation.routinelist.model.RoutineUiModel -import com.threegap.bitnagil.presentation.routinelist.model.RoutinesUiModel import java.time.LocalDate data class RoutineListState( val isLoading: Boolean, - val routines: RoutinesUiModel, + val routines: RoutineScheduleUiModel, val selectedRoutine: RoutineUiModel?, val selectedDate: LocalDate, val deleteConfirmBottomSheetVisible: Boolean, @@ -17,12 +17,12 @@ data class RoutineListState( get() = selectedDate.getCurrentWeekDays() val selectedDateRoutines: List - get() = routines.routines[selectedDate.toString()]?.routineList ?: emptyList() + get() = routines.routines[selectedDate.toString()]?.routines ?: emptyList() companion object { val INIT = RoutineListState( isLoading = false, - routines = RoutinesUiModel(), + routines = RoutineScheduleUiModel.INIT, selectedRoutine = null, selectedDate = LocalDate.now(), deleteConfirmBottomSheetVisible = false, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/DailyRoutinesUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/DailyRoutinesUiModel.kt new file mode 100644 index 00000000..46ab041a --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/DailyRoutinesUiModel.kt @@ -0,0 +1,12 @@ +package com.threegap.bitnagil.presentation.routinelist.model + +import com.threegap.bitnagil.domain.routine.model.DailyRoutines + +data class DailyRoutinesUiModel( + val routines: List, +) + +internal fun DailyRoutines.toUiModel(): DailyRoutinesUiModel = + DailyRoutinesUiModel( + routines = routines.map { it.toUiModel() }, + ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/DayRoutinesUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/DayRoutinesUiModel.kt deleted file mode 100644 index 7516e137..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/DayRoutinesUiModel.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.threegap.bitnagil.presentation.routinelist.model - -import android.os.Parcelable -import com.threegap.bitnagil.domain.routine.model.DailyRoutines -import kotlinx.parcelize.Parcelize - -@Parcelize -data class DayRoutinesUiModel( - val routineList: List = emptyList(), -) : Parcelable - -fun DailyRoutines.toUiModel(): DayRoutinesUiModel = - DayRoutinesUiModel( - routineList = routines.map { it.toUiModel() }, - ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineScheduleUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineScheduleUiModel.kt new file mode 100644 index 00000000..c415490b --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineScheduleUiModel.kt @@ -0,0 +1,18 @@ +package com.threegap.bitnagil.presentation.routinelist.model + +import com.threegap.bitnagil.domain.routine.model.RoutineSchedule + +data class RoutineScheduleUiModel( + val routines: Map, +) { + companion object { + val INIT = RoutineScheduleUiModel( + routines = emptyMap(), + ) + } +} + +internal fun RoutineSchedule.toUiModel(): RoutineScheduleUiModel = + RoutineScheduleUiModel( + routines = this.dailyRoutines.mapValues { (_, dailyRoutines) -> dailyRoutines.toUiModel() }, + ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineUiModel.kt index 7364503e..a0d20211 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineUiModel.kt @@ -1,14 +1,11 @@ package com.threegap.bitnagil.presentation.routinelist.model -import android.os.Parcelable import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.routine.model.DayOfWeek import com.threegap.bitnagil.domain.routine.model.Routine import com.threegap.bitnagil.presentation.home.util.formatExecutionTime12Hour import com.threegap.bitnagil.presentation.home.util.toShortDateFormat -import kotlinx.parcelize.Parcelize -@Parcelize data class RoutineUiModel( val routineId: String, val routineName: String, @@ -19,13 +16,13 @@ data class RoutineUiModel( val endDate: String, val routineDeletedYn: Boolean, val subRoutineNames: List, -) : Parcelable { val recommendedRoutineType: RecommendCategory?, +) { val formattedDateRange: String get() = "${startDate.toShortDateFormat()} - ${endDate.toShortDateFormat()}" } -fun Routine.toUiModel(): RoutineUiModel = +internal fun Routine.toUiModel(): RoutineUiModel = RoutineUiModel( routineId = this.id, routineName = this.name, @@ -38,4 +35,3 @@ fun Routine.toUiModel(): RoutineUiModel = subRoutineNames = this.subRoutineNames, recommendedRoutineType = this.recommendedRoutineType, ) - diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutinesUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutinesUiModel.kt deleted file mode 100644 index 21fd81c7..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutinesUiModel.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.threegap.bitnagil.presentation.routinelist.model - -import android.os.Parcelable -import com.threegap.bitnagil.domain.routine.model.RoutineSchedule -import kotlinx.parcelize.Parcelize - -@Parcelize -data class RoutinesUiModel( - val routines: Map = emptyMap(), -) : Parcelable - -fun RoutineSchedule.toUiModel(): RoutinesUiModel = - RoutinesUiModel( - routines = this.dailyRoutines.mapValues { (_, dayRoutines) -> - dayRoutines.toUiModel() - }, - ) From a64ea302c4a0d7fcadc739223174a0adc24ceeb8 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sun, 15 Feb 2026 17:26:20 +0900 Subject: [PATCH 25/31] =?UTF-8?q?Refactor:=20recommendedRoutineType=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=EC=9D=84=20RecommendCategory=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/writeroutine/model/request/RegisterRoutineRequest.kt | 3 ++- .../writeroutine/repositoryImpl/WriteRoutineRepositoryImpl.kt | 3 ++- .../domain/writeroutine/repository/WriteRoutineRepository.kt | 3 ++- .../domain/writeroutine/usecase/RegisterRoutineUseCase.kt | 3 ++- .../presentation/writeroutine/WriteRoutineViewModel.kt | 2 +- .../presentation/writeroutine/contract/WriteRoutineState.kt | 3 ++- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/data/src/main/java/com/threegap/bitnagil/data/writeroutine/model/request/RegisterRoutineRequest.kt b/data/src/main/java/com/threegap/bitnagil/data/writeroutine/model/request/RegisterRoutineRequest.kt index 7fff74e2..0c4a72c7 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/writeroutine/model/request/RegisterRoutineRequest.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/writeroutine/model/request/RegisterRoutineRequest.kt @@ -1,5 +1,6 @@ package com.threegap.bitnagil.data.writeroutine.model.request +import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.writeroutine.model.RepeatDay import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -19,5 +20,5 @@ data class RegisterRoutineRequest( @SerialName("subRoutineName") val subRoutineName: List, @SerialName("recommendedRoutineType") - val recommendedRoutineType: String?, + val recommendedRoutineType: RecommendCategory?, ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/writeroutine/repositoryImpl/WriteRoutineRepositoryImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/writeroutine/repositoryImpl/WriteRoutineRepositoryImpl.kt index be64ae27..80e5dcbf 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/writeroutine/repositoryImpl/WriteRoutineRepositoryImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/writeroutine/repositoryImpl/WriteRoutineRepositoryImpl.kt @@ -3,6 +3,7 @@ package com.threegap.bitnagil.data.writeroutine.repositoryImpl import com.threegap.bitnagil.data.writeroutine.datasource.WriteRoutineDataSource import com.threegap.bitnagil.data.writeroutine.model.request.EditRoutineRequest import com.threegap.bitnagil.data.writeroutine.model.request.RegisterRoutineRequest +import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.writeroutine.model.RepeatDay import com.threegap.bitnagil.domain.writeroutine.model.RoutineUpdateType import com.threegap.bitnagil.domain.writeroutine.model.WriteRoutineEvent @@ -24,7 +25,7 @@ class WriteRoutineRepositoryImpl @Inject constructor( startDate: LocalDate, endDate: LocalDate, subRoutines: List, - recommendedRoutineType: String?, + recommendedRoutineType: RecommendCategory?, ): Result { val request = RegisterRoutineRequest( routineName = name, diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/writeroutine/repository/WriteRoutineRepository.kt b/domain/src/main/java/com/threegap/bitnagil/domain/writeroutine/repository/WriteRoutineRepository.kt index 9a8b933a..3ff5059f 100644 --- a/domain/src/main/java/com/threegap/bitnagil/domain/writeroutine/repository/WriteRoutineRepository.kt +++ b/domain/src/main/java/com/threegap/bitnagil/domain/writeroutine/repository/WriteRoutineRepository.kt @@ -1,5 +1,6 @@ package com.threegap.bitnagil.domain.writeroutine.repository +import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.writeroutine.model.RepeatDay import com.threegap.bitnagil.domain.writeroutine.model.RoutineUpdateType import com.threegap.bitnagil.domain.writeroutine.model.WriteRoutineEvent @@ -15,7 +16,7 @@ interface WriteRoutineRepository { startDate: LocalDate, endDate: LocalDate, subRoutines: List, - recommendedRoutineType: String?, + recommendedRoutineType: RecommendCategory?, ): Result suspend fun editRoutine( diff --git a/domain/src/main/java/com/threegap/bitnagil/domain/writeroutine/usecase/RegisterRoutineUseCase.kt b/domain/src/main/java/com/threegap/bitnagil/domain/writeroutine/usecase/RegisterRoutineUseCase.kt index a25ec8f6..ae9ed932 100644 --- a/domain/src/main/java/com/threegap/bitnagil/domain/writeroutine/usecase/RegisterRoutineUseCase.kt +++ b/domain/src/main/java/com/threegap/bitnagil/domain/writeroutine/usecase/RegisterRoutineUseCase.kt @@ -1,5 +1,6 @@ package com.threegap.bitnagil.domain.writeroutine.usecase +import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.domain.writeroutine.model.RepeatDay import com.threegap.bitnagil.domain.writeroutine.repository.WriteRoutineRepository import java.time.LocalDate @@ -16,7 +17,7 @@ class RegisterRoutineUseCase @Inject constructor( startDate: LocalDate, endDate: LocalDate, subRoutines: List, - recommendedRoutineType: String?, + recommendedRoutineType: RecommendCategory?, ): Result { return writeRoutineRepository.registerRoutine( name = name, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt index b00cfa58..643e2af9 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt @@ -147,7 +147,7 @@ class WriteRoutineViewModel @AssistedInject constructor( oldSubRoutines.getOrNull(2)?.name ?: "", ), loading = false, - recommendedRoutineType = routine.category.displayTitle, + recommendedRoutineType = routine.category, ) } }, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineState.kt index 44ac5d74..3267a1b7 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineState.kt @@ -1,6 +1,7 @@ package com.threegap.bitnagil.presentation.writeroutine.contract import android.os.Parcelable +import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory import com.threegap.bitnagil.presentation.writeroutine.model.Date import com.threegap.bitnagil.presentation.writeroutine.model.Day import com.threegap.bitnagil.presentation.writeroutine.model.RepeatType @@ -29,7 +30,7 @@ data class WriteRoutineState( val repeatDaysUiExpanded: Boolean, val periodUiExpanded: Boolean, val startTimeUiExpanded: Boolean, - val recommendedRoutineType: String?, + val recommendedRoutineType: RecommendCategory?, ) : Parcelable { companion object { val INIT = WriteRoutineState( From 434bbb9ef7f7d4803d4a23f20c6485145091cf33 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sun, 15 Feb 2026 17:34:29 +0900 Subject: [PATCH 26/31] =?UTF-8?q?Refactor:=20SubRoutine=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20=EB=B0=8F=20=EA=B4=80=EB=A0=A8=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 - SubRoutine -> SubRoutineUiModel로 클래스명 변경 - 도메인 모델을 UI 모델로 변환하는 확장 함수 추가 - WriteRoutineViewModel에서 변경된 SubRoutineUiModel을 사용하도록 수정 --- .../writeroutine/WriteRoutineViewModel.kt | 14 +++++++------- .../writeroutine/contract/WriteRoutineState.kt | 5 ++--- .../writeroutine/model/SubRoutine.kt | 17 ----------------- .../writeroutine/model/SubRoutineUiModel.kt | 14 ++++++++++++++ 4 files changed, 23 insertions(+), 27 deletions(-) delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/SubRoutine.kt create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/SubRoutineUiModel.kt diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt index 643e2af9..1beb06f5 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt @@ -8,17 +8,17 @@ import com.threegap.bitnagil.domain.writeroutine.model.RepeatDay import com.threegap.bitnagil.domain.writeroutine.model.RoutineUpdateType import com.threegap.bitnagil.domain.writeroutine.usecase.EditRoutineUseCase import com.threegap.bitnagil.domain.writeroutine.usecase.RegisterRoutineUseCase -import com.threegap.bitnagil.presentation.common.extension.displayTitle import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineSideEffect import com.threegap.bitnagil.presentation.writeroutine.contract.WriteRoutineState import com.threegap.bitnagil.presentation.writeroutine.model.Date import com.threegap.bitnagil.presentation.writeroutine.model.Day import com.threegap.bitnagil.presentation.writeroutine.model.RepeatType import com.threegap.bitnagil.presentation.writeroutine.model.SelectableDay -import com.threegap.bitnagil.presentation.writeroutine.model.SubRoutine +import com.threegap.bitnagil.presentation.writeroutine.model.SubRoutineUiModel import com.threegap.bitnagil.presentation.writeroutine.model.Time import com.threegap.bitnagil.presentation.writeroutine.model.WriteRoutineType import com.threegap.bitnagil.presentation.writeroutine.model.navarg.WriteRoutineScreenArg +import com.threegap.bitnagil.presentation.writeroutine.model.toUiModel import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject @@ -46,7 +46,7 @@ class WriteRoutineViewModel @AssistedInject constructor( ) private var routineId: String? = null - private var oldSubRoutines: List = listOf() + private var oldSubRoutineUiModels: List = listOf() init { val navigationArg = writeRoutineArg @@ -131,7 +131,7 @@ class WriteRoutineViewModel @AssistedInject constructor( } getRecommendRoutineUseCase(recommendRoutineId).fold( onSuccess = { routine -> - oldSubRoutines = routine.subRoutines.map { SubRoutine.fromDomainRecommendSubRoutine(it) } + oldSubRoutineUiModels = routine.subRoutines.map { it.toUiModel() } reduce { state.copy( @@ -142,9 +142,9 @@ class WriteRoutineViewModel @AssistedInject constructor( startDate = Date.now(), endDate = Date.now(), subRoutineNames = listOf( - oldSubRoutines.getOrNull(0)?.name ?: "", - oldSubRoutines.getOrNull(1)?.name ?: "", - oldSubRoutines.getOrNull(2)?.name ?: "", + oldSubRoutineUiModels.getOrNull(0)?.name ?: "", + oldSubRoutineUiModels.getOrNull(1)?.name ?: "", + oldSubRoutineUiModels.getOrNull(2)?.name ?: "", ), loading = false, recommendedRoutineType = routine.category, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineState.kt index 3267a1b7..d3523530 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/contract/WriteRoutineState.kt @@ -97,9 +97,8 @@ data class WriteRoutineState( null -> "" } - val periodText: String get() { - return "${startDate.toYearShrinkageFormattedString()} ~ ${endDate.toYearShrinkageFormattedString()}" - } + val periodText: String + get() = "${startDate.toYearShrinkageFormattedString()} ~ ${endDate.toYearShrinkageFormattedString()}" val startTimeText: String get() = if (selectAllTime) "하루종일" else startTime?.let { "${it.toAmPmFormattedString()}부터 시작" } ?: "" diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/SubRoutine.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/SubRoutine.kt deleted file mode 100644 index 89547aa2..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/SubRoutine.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.threegap.bitnagil.presentation.writeroutine.model - -import com.threegap.bitnagil.domain.recommendroutine.model.RecommendSubRoutine - -data class SubRoutine( - val id: String, - val name: String, -) { - companion object { - fun fromDomainRecommendSubRoutine(subRoutine: RecommendSubRoutine): SubRoutine { - return SubRoutine( - id = subRoutine.id.toString(), - name = subRoutine.name, - ) - } - } -} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/SubRoutineUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/SubRoutineUiModel.kt new file mode 100644 index 00000000..14ebd61f --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/model/SubRoutineUiModel.kt @@ -0,0 +1,14 @@ +package com.threegap.bitnagil.presentation.writeroutine.model + +import com.threegap.bitnagil.domain.recommendroutine.model.RecommendSubRoutine + +data class SubRoutineUiModel( + val id: String, + val name: String, +) + +internal fun RecommendSubRoutine.toUiModel(): SubRoutineUiModel = + SubRoutineUiModel( + id = id.toString(), + name = name, + ) From 5ad95fc6cb06deed0fc4166efbfa38baa5e5e23e Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sun, 15 Feb 2026 17:56:28 +0900 Subject: [PATCH 27/31] =?UTF-8?q?Chore:=20Onboarding=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20UiModel=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=20=EB=B0=8F=20Mapper=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Onboarding에서 사용하는 UiModel 클래스명에 `UiModel` 접미사를 추가했습니다. - Domain Model을 UiModel로 변환하는 Mapper 함수를 추가하고, 기존의 `from` 팩토리 메서드를 대체했습니다. --- .../onboarding/OnBoardingScreen.kt | 4 +-- .../onboarding/OnBoardingViewModel.kt | 23 +++++------- .../template/OnBoardingAbstractTemplate.kt | 18 +++++----- .../template/OnBoardingSelectTemplate.kt | 4 +-- .../onboarding/component/template/Preview.kt | 10 +++--- .../model/OnBoardingAbstractTextItem.kt | 20 ----------- .../OnBoardingAbstractTextItemUiModel.kt | 17 +++++++++ .../onboarding/model/OnBoardingItem.kt | 36 ------------------- .../onboarding/model/OnBoardingItemUiModel.kt | 33 +++++++++++++++++ .../onboarding/model/OnBoardingPageInfo.kt | 30 ++++++++-------- 10 files changed, 90 insertions(+), 105 deletions(-) delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItem.kt create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItemUiModel.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingItem.kt create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingItemUiModel.kt diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt index c9217408..39bff7ef 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingScreen.kt @@ -17,7 +17,7 @@ import com.threegap.bitnagil.presentation.onboarding.component.template.OnBoardi import com.threegap.bitnagil.presentation.onboarding.component.template.OnBoardingSelectTemplate import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingSideEffect import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingState -import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItem +import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItemUiModel import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingPageInfo import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingSetType import org.orbitmvi.orbit.compose.collectAsState @@ -163,7 +163,7 @@ fun OnBoardingScreenPreview() { nextButtonEnable = false, currentOnBoardingPageInfo = OnBoardingPageInfo.RecommendRoutines( listOf( - OnBoardingItem("1", "루틴명", "세부 루틴 한 줄 설명", null), + OnBoardingItemUiModel("1", "루틴명", "세부 루틴 한 줄 설명", null), ), ), totalStep = 5, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt index 20ac5f8d..3f78ce91 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt @@ -11,11 +11,12 @@ import com.threegap.bitnagil.domain.onboarding.usecase.RegisterRecommendOnBoardi import com.threegap.bitnagil.domain.user.usecase.FetchUserProfileUseCase import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingSideEffect import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingState -import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingAbstractTextItem -import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItem +import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingAbstractTextItemUiModel +import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItemUiModel import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingPageInfo import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingSetType import com.threegap.bitnagil.presentation.onboarding.model.navarg.OnBoardingScreenArg +import com.threegap.bitnagil.presentation.onboarding.model.toUiModel import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject @@ -100,9 +101,7 @@ class OnBoardingViewModel @AssistedInject constructor( val abstractPagePrefixText = onBoardingAbstract.prefix val abstractTexts = onBoardingAbstract.abstractTexts.map { onBoardingAbstractText -> - onBoardingAbstractText.textItems.map { onBoardingAbstractTextItem -> - OnBoardingAbstractTextItem.fromOnBoardingAbstractTextItem(onBoardingAbstractTextItem) - } + onBoardingAbstractText.textItems.map { it.toUiModel() } } val existedOnBoardingAbstract = OnBoardingPageInfo.ExistedOnBoardingAbstract( @@ -125,9 +124,7 @@ class OnBoardingViewModel @AssistedInject constructor( fun loadOnBoardingItems() = intent { val onBoardings = getOnBoardingsUseCase() - val onBoardingPages = onBoardings.map { onBoarding -> - OnBoardingPageInfo.SelectOnBoarding.fromOnBoarding(onBoarding = onBoarding) - } + val onBoardingPages = onBoardings.map { it.toUiModel() } val currentState = state if (currentState !is OnBoardingState.Idle) return@intent @@ -175,9 +172,7 @@ class OnBoardingViewModel @AssistedInject constructor( val abstractPagePrefixText = onBoardingAbstract.prefix val abstractTexts = onBoardingAbstract.abstractTexts.map { onBoardingAbstractText -> - onBoardingAbstractText.textItems.map { onBoardingAbstractTextItem -> - OnBoardingAbstractTextItem.fromOnBoardingAbstractTextItem(onBoardingAbstractTextItem) - } + onBoardingAbstractText.textItems.map { it.toUiModel() } } reduce { @@ -291,9 +286,7 @@ class OnBoardingViewModel @AssistedInject constructor( onSuccess = { recommendRoutines -> if (isActive) { applyRecommendRoutines( - routines = recommendRoutines.map { - OnBoardingItem.fromOnBoardingRecommendRoutine(it) - }, + routines = recommendRoutines.map { it.toUiModel() }, ) } }, @@ -303,7 +296,7 @@ class OnBoardingViewModel @AssistedInject constructor( } } - private fun applyRecommendRoutines(routines: List) = intent { + private fun applyRecommendRoutines(routines: List) = intent { val currentState = state if (currentState !is OnBoardingState.Idle) return@intent diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/OnBoardingAbstractTemplate.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/OnBoardingAbstractTemplate.kt index 9c07d7e0..5c92dc8d 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/OnBoardingAbstractTemplate.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/OnBoardingAbstractTemplate.kt @@ -38,14 +38,14 @@ import com.threegap.bitnagil.designsystem.BitnagilTheme import com.threegap.bitnagil.designsystem.R import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButton import com.threegap.bitnagil.presentation.common.ninepatch.ninePatchBackgroundNode -import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingAbstractTextItem +import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingAbstractTextItemUiModel @Composable fun OnBoardingAbstractTemplate( modifier: Modifier = Modifier, title: String, userName: String, - onBoardingAbstractTexts: List>, + onBoardingAbstractTexts: List>, onDispose: () -> Unit, onClickNextButton: () -> Unit, nextButtonEnable: Boolean, @@ -120,7 +120,7 @@ private fun getIndexIconResourceId(index: Int): Int { @Composable private fun OnBoardingAbstractText( - onBoardingAbstractTextList: List, + onBoardingAbstractTextList: List, iconResourceId: Int, ) { val annotatedString = buildAnnotatedString { @@ -214,31 +214,31 @@ private fun OnBoardingAbstractTemplatePreview() { userName = "안드로이드", onBoardingAbstractTexts = listOf( listOf( - OnBoardingAbstractTextItem( + OnBoardingAbstractTextItemUiModel( text = "텍스트1", isBold = true, ), - OnBoardingAbstractTextItem( + OnBoardingAbstractTextItemUiModel( text = "텍스트2 아아아아아아아아아ㅏ아앙아아ㅏ아아아아아", isBold = false, ), ), listOf( - OnBoardingAbstractTextItem( + OnBoardingAbstractTextItemUiModel( text = "텍스트1", isBold = true, ), - OnBoardingAbstractTextItem( + OnBoardingAbstractTextItemUiModel( text = "텍스트2", isBold = false, ), ), listOf( - OnBoardingAbstractTextItem( + OnBoardingAbstractTextItemUiModel( text = "텍스트1", isBold = true, ), - OnBoardingAbstractTextItem( + OnBoardingAbstractTextItemUiModel( text = "텍스트2", isBold = false, ), diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/OnBoardingSelectTemplate.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/OnBoardingSelectTemplate.kt index 64dbf04d..c0305dd7 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/OnBoardingSelectTemplate.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/OnBoardingSelectTemplate.kt @@ -16,14 +16,14 @@ import com.threegap.bitnagil.designsystem.BitnagilTheme import com.threegap.bitnagil.designsystem.component.atom.BitnagilSelectButton import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButton import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButtonColor -import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItem +import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItemUiModel @Composable fun OnBoardingSelectTemplate( modifier: Modifier = Modifier, title: String, subText: String? = null, - items: List, + items: List, nextButtonEnable: Boolean = false, onClickNextButton: () -> Unit, onClickItem: ((String) -> Unit)?, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/Preview.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/Preview.kt index 78aeaf80..def6e45c 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/Preview.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/component/template/Preview.kt @@ -2,7 +2,7 @@ package com.threegap.bitnagil.presentation.onboarding.component.template import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview -import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItem +import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItemUiModel @Preview(showBackground = true) @Composable @@ -11,22 +11,22 @@ fun OnBoardingTemplatePreview() { title = "title", subText = "subText", items = listOf( - OnBoardingItem( + OnBoardingItemUiModel( id = "item1", title = "title1", description = "description1", ), - OnBoardingItem( + OnBoardingItemUiModel( id = "item2", title = "title2", description = "description2", ), - OnBoardingItem( + OnBoardingItemUiModel( id = "item3", title = "title3", description = "description3", ), - OnBoardingItem( + OnBoardingItemUiModel( id = "item4", title = "title4", description = "description4", diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItem.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItem.kt deleted file mode 100644 index c1310e62..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItem.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.threegap.bitnagil.presentation.onboarding.model - -import android.os.Parcelable -import kotlinx.parcelize.Parcelize -import com.threegap.bitnagil.domain.onboarding.model.OnBoardingAbstractTextItem as DomainOnBoardingAbstractTextItem - -@Parcelize -data class OnBoardingAbstractTextItem( - val text: String, - val isBold: Boolean, -) : Parcelable { - companion object { - fun fromOnBoardingAbstractTextItem(onBoardingAbstractTextItem: DomainOnBoardingAbstractTextItem): OnBoardingAbstractTextItem { - return OnBoardingAbstractTextItem( - text = onBoardingAbstractTextItem.text, - isBold = onBoardingAbstractTextItem.isBold, - ) - } - } -} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItemUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItemUiModel.kt new file mode 100644 index 00000000..a50256ad --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItemUiModel.kt @@ -0,0 +1,17 @@ +package com.threegap.bitnagil.presentation.onboarding.model + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize +import com.threegap.bitnagil.domain.onboarding.model.OnBoardingAbstractTextItem + +@Parcelize +data class OnBoardingAbstractTextItemUiModel( + val text: String, + val isBold: Boolean, +) : Parcelable + +internal fun OnBoardingAbstractTextItem.toUiModel(): OnBoardingAbstractTextItemUiModel = + OnBoardingAbstractTextItemUiModel( + text = this.text, + isBold = this.isBold, + ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingItem.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingItem.kt deleted file mode 100644 index 116dce3a..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingItem.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.threegap.bitnagil.presentation.onboarding.model - -import android.os.Parcelable -import com.threegap.bitnagil.domain.onboarding.model.OnBoardingRecommendRoutine -import kotlinx.parcelize.Parcelize -import com.threegap.bitnagil.domain.onboarding.model.OnBoardingItem as DomainOnBoardingItem - -@Parcelize -data class OnBoardingItem( - val id: String, - val title: String, - val description: String?, - val selectedIndex: Int? = null, -) : Parcelable { - companion object { - fun fromOnBoardingItem(onBoardingItem: DomainOnBoardingItem): OnBoardingItem { - return OnBoardingItem( - id = onBoardingItem.id, - title = onBoardingItem.title, - description = onBoardingItem.description, - selectedIndex = null, - ) - } - - fun fromOnBoardingRecommendRoutine(onBoardingRecommendRoutine: OnBoardingRecommendRoutine): OnBoardingItem { - return OnBoardingItem( - id = onBoardingRecommendRoutine.id, - title = onBoardingRecommendRoutine.name, - description = onBoardingRecommendRoutine.description, - selectedIndex = null, - ) - } - } - - val selected: Boolean get() = selectedIndex != null -} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingItemUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingItemUiModel.kt new file mode 100644 index 00000000..0f265884 --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingItemUiModel.kt @@ -0,0 +1,33 @@ +package com.threegap.bitnagil.presentation.onboarding.model + +import android.os.Parcelable +import com.threegap.bitnagil.domain.onboarding.model.OnBoardingItem +import com.threegap.bitnagil.domain.onboarding.model.OnBoardingRecommendRoutine +import kotlinx.parcelize.Parcelize + +@Parcelize +data class OnBoardingItemUiModel( + val id: String, + val title: String, + val description: String?, + val selectedIndex: Int? = null, +) : Parcelable { + val selected: Boolean + get() = selectedIndex != null +} + +internal fun OnBoardingItem.toUiModel(): OnBoardingItemUiModel = + OnBoardingItemUiModel( + id = this.id, + title = this.title, + description = this.description, + selectedIndex = null, + ) + +internal fun OnBoardingRecommendRoutine.toUiModel(): OnBoardingItemUiModel = + OnBoardingItemUiModel( + id = this.id, + title = this.name, + description = this.description, + selectedIndex = null, + ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingPageInfo.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingPageInfo.kt index 72eee88c..a0dd4ad2 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingPageInfo.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingPageInfo.kt @@ -3,6 +3,7 @@ package com.threegap.bitnagil.presentation.onboarding.model import android.os.Parcelable import androidx.compose.runtime.Stable import com.threegap.bitnagil.domain.onboarding.model.OnBoarding +import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingPageInfo.SelectOnBoarding import kotlinx.parcelize.Parcelize @Parcelize @@ -13,7 +14,7 @@ sealed class OnBoardingPageInfo : Parcelable { @Parcelize data class ExistedOnBoardingAbstract( val prefix: String, - @Stable val abstractTexts: List>, + @Stable val abstractTexts: List>, ) : OnBoardingPageInfo() @Parcelize @@ -21,22 +22,10 @@ sealed class OnBoardingPageInfo : Parcelable { val id: String, val title: String, val description: String?, - @Stable val items: List = emptyList(), + @Stable val items: List = emptyList(), val multipleSelectable: Boolean = false, ) : OnBoardingPageInfo() { companion object { - fun fromOnBoarding(onBoarding: OnBoarding): SelectOnBoarding { - return SelectOnBoarding( - id = onBoarding.id, - title = onBoarding.title, - description = onBoarding.description, - items = onBoarding.onboardingItemList.map { - OnBoardingItem.fromOnBoardingItem(it) - }, - multipleSelectable = onBoarding.multipleSelectable, - ) - } - private var lastSelectedIndex = 0 } @@ -68,11 +57,11 @@ sealed class OnBoardingPageInfo : Parcelable { @Parcelize data class Abstract( val prefix: String, - @Stable val abstractTexts: List>, + @Stable val abstractTexts: List>, ) : OnBoardingPageInfo() @Parcelize - data class RecommendRoutines(@Stable val routines: List) : OnBoardingPageInfo() { + data class RecommendRoutines(@Stable val routines: List) : OnBoardingPageInfo() { companion object { private var lastSelectedIndex = 0 } @@ -98,3 +87,12 @@ sealed class OnBoardingPageInfo : Parcelable { } } } + +internal fun OnBoarding.toUiModel(): SelectOnBoarding = + SelectOnBoarding( + id = this.id, + title = this.title, + description = this.description, + items = this.onboardingItemList.map { it.toUiModel() }, + multipleSelectable = this.multipleSelectable, + ) From df2095dd8ecd0c140700edd93c983268ea7ee61c Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sun, 15 Feb 2026 19:12:36 +0900 Subject: [PATCH 28/31] =?UTF-8?q?Refactor:=20Report=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20Presentation=20=EB=AA=A8=EB=8D=B8=EC=9D=84=20Domain=20?= =?UTF-8?q?=EB=AA=A8=EB=8D=B8=EB=A1=9C=20=EB=8C=80=EC=B2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Presentation 레이어에서 사용하던 ReportCategory, ReportProcess enum 클래스를 삭제하고, Domain 레이어의 모델을 직접 사용하도록 변경합니다. --- .../extension/ReportCategoryEtx.kt} | 9 ++- .../common/extension/ReportStatusEtx.kt | 27 +++++++ .../onboarding/OnBoardingViewModel.kt | 1 - .../OnBoardingAbstractTextItemUiModel.kt | 2 +- .../presentation/report/ReportScreen.kt | 4 +- .../report/component/CompleteReportCard.kt | 4 +- .../component/ReportCategoryBottomSheet.kt | 10 +-- .../reportdetail/ReportDetailScreen.kt | 5 +- .../reportdetail/ReportDetailViewModel.kt | 6 +- .../component/atom/ReportProcessBadge.kt | 39 ++++------ .../contract/ReportDetailState.kt | 10 +-- .../reportdetail/model/ReportCategory.kt | 31 -------- .../reportdetail/model/ReportProcess.kt | 22 ------ .../reporthistory/ReportHistoryScreen.kt | 30 +++---- .../reporthistory/ReportHistoryViewModel.kt | 14 ++-- .../component/atom/ReportProcessBadge.kt | 60 -------------- .../component/block/ReportHistoryItem.kt | 23 +++--- .../template/ReportCategoryBottomSheet.kt | 13 ++-- .../contract/ReportHistoryState.kt | 78 ++++++++----------- .../reporthistory/model/ReportCategory.kt | 43 ---------- .../model/ReportHistoryUiModel.kt | 29 ++++--- .../reporthistory/model/ReportProcess.kt | 23 ------ .../model/ReportProcessWithCount.kt | 15 ---- .../reporthistory/model/ReportStatusFilter.kt | 25 ++++++ .../model/ReportStatusFilterWithCount.kt | 15 ++++ 25 files changed, 193 insertions(+), 345 deletions(-) rename presentation/src/main/java/com/threegap/bitnagil/presentation/{report/model/ReportCategoryExtension.kt => common/extension/ReportCategoryEtx.kt} (81%) create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/common/extension/ReportStatusEtx.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/ReportCategory.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/ReportProcess.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/atom/ReportProcessBadge.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportCategory.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportProcess.kt delete mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportProcessWithCount.kt create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportStatusFilter.kt create mode 100644 presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportStatusFilterWithCount.kt diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/model/ReportCategoryExtension.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/common/extension/ReportCategoryEtx.kt similarity index 81% rename from presentation/src/main/java/com/threegap/bitnagil/presentation/report/model/ReportCategoryExtension.kt rename to presentation/src/main/java/com/threegap/bitnagil/presentation/common/extension/ReportCategoryEtx.kt index de494241..5a717661 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/model/ReportCategoryExtension.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/common/extension/ReportCategoryEtx.kt @@ -1,9 +1,10 @@ -package com.threegap.bitnagil.presentation.report.model +package com.threegap.bitnagil.presentation.common.extension +import androidx.annotation.DrawableRes import com.threegap.bitnagil.designsystem.R import com.threegap.bitnagil.domain.report.model.ReportCategory -val ReportCategory.uiTitle: String +val ReportCategory.displayTitle: String get() = when (this) { ReportCategory.TRANSPORTATION -> "교통 시설" ReportCategory.LIGHTING -> "조명 시설" @@ -11,7 +12,7 @@ val ReportCategory.uiTitle: String ReportCategory.AMENITY -> "편의 시설" } -val ReportCategory.uiDescription: String +val ReportCategory.displayExamples: String get() = when (this) { ReportCategory.TRANSPORTATION -> "신호등 고장, 표지판 파손, 횡단보도 등" ReportCategory.LIGHTING -> "가로등, 보안등 파손 등" @@ -20,7 +21,7 @@ val ReportCategory.uiDescription: String } val ReportCategory.iconRes: Int - get() = when (this) { + @DrawableRes get() = when (this) { ReportCategory.TRANSPORTATION -> R.drawable.ic_car ReportCategory.LIGHTING -> R.drawable.ic_light ReportCategory.WATERFACILITY -> R.drawable.ic_water diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/common/extension/ReportStatusEtx.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/common/extension/ReportStatusEtx.kt new file mode 100644 index 00000000..231541c5 --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/common/extension/ReportStatusEtx.kt @@ -0,0 +1,27 @@ +package com.threegap.bitnagil.presentation.common.extension + +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import com.threegap.bitnagil.designsystem.BitnagilTheme +import com.threegap.bitnagil.domain.report.model.ReportStatus + +val ReportStatus.displayTitle: String + get() = when (this) { + ReportStatus.PENDING -> "제보 완료" + ReportStatus.IN_PROGRESS -> "처리 중" + ReportStatus.COMPLETED -> "처리 완료" + } + +val ReportStatus.badgeBackgroundColor: Color + @Composable get() = when (this) { + ReportStatus.PENDING -> BitnagilTheme.colors.green10 + ReportStatus.IN_PROGRESS -> BitnagilTheme.colors.skyBlue10 + else -> BitnagilTheme.colors.coolGray95 + } + +val ReportStatus.textColor: Color + @Composable get() = when (this) { + ReportStatus.PENDING -> BitnagilTheme.colors.green300 + ReportStatus.IN_PROGRESS -> BitnagilTheme.colors.blue300 + else -> BitnagilTheme.colors.coolGray40 + } diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt index 3f78ce91..76191453 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/OnBoardingViewModel.kt @@ -11,7 +11,6 @@ import com.threegap.bitnagil.domain.onboarding.usecase.RegisterRecommendOnBoardi import com.threegap.bitnagil.domain.user.usecase.FetchUserProfileUseCase import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingSideEffect import com.threegap.bitnagil.presentation.onboarding.contract.OnBoardingState -import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingAbstractTextItemUiModel import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingItemUiModel import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingPageInfo import com.threegap.bitnagil.presentation.onboarding.model.OnBoardingSetType diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItemUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItemUiModel.kt index a50256ad..08b5debe 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItemUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/onboarding/model/OnBoardingAbstractTextItemUiModel.kt @@ -1,8 +1,8 @@ package com.threegap.bitnagil.presentation.onboarding.model import android.os.Parcelable -import kotlinx.parcelize.Parcelize import com.threegap.bitnagil.domain.onboarding.model.OnBoardingAbstractTextItem +import kotlinx.parcelize.Parcelize @Parcelize data class OnBoardingAbstractTextItemUiModel( diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportScreen.kt index 2964b236..4caf654d 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportScreen.kt @@ -53,6 +53,7 @@ import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButton import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButtonColor import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextField import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar +import com.threegap.bitnagil.presentation.common.extension.displayTitle import com.threegap.bitnagil.presentation.common.file.createCameraImageUri import com.threegap.bitnagil.presentation.common.premission.rememberPermissionHandler import com.threegap.bitnagil.presentation.report.component.AddPhotoButton @@ -68,7 +69,6 @@ import com.threegap.bitnagil.presentation.report.contract.ReportSideEffect import com.threegap.bitnagil.presentation.report.contract.ReportState import com.threegap.bitnagil.presentation.report.contract.ReportState.Companion.MAX_IMAGE_COUNT import com.threegap.bitnagil.presentation.report.model.SubmitState -import com.threegap.bitnagil.presentation.report.model.uiTitle import kotlinx.coroutines.delay import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect @@ -284,7 +284,7 @@ private fun ReportScreen( ReportField(title = "카테고리") { ReportCategorySelector( - title = uiState.selectedCategory?.uiTitle, + title = uiState.selectedCategory?.displayTitle, onClick = { focusManager.clearFocus() onShowReportCategoryBottomSheet() diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/CompleteReportCard.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/CompleteReportCard.kt index 8b29abfc..0d8efc66 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/CompleteReportCard.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/CompleteReportCard.kt @@ -23,7 +23,7 @@ import androidx.compose.ui.unit.dp import coil3.compose.AsyncImage import com.threegap.bitnagil.designsystem.BitnagilTheme import com.threegap.bitnagil.domain.report.model.ReportCategory -import com.threegap.bitnagil.presentation.report.model.uiTitle +import com.threegap.bitnagil.presentation.common.extension.displayTitle @Composable fun CompleteReportCard( @@ -66,7 +66,7 @@ fun CompleteReportCard( title = "카테고리", ) { Text( - text = category?.uiTitle ?: "카테고리 없음", + text = category?.displayTitle ?: "카테고리 없음", color = BitnagilTheme.colors.coolGray10, style = BitnagilTheme.typography.body1Medium, ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/ReportCategoryBottomSheet.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/ReportCategoryBottomSheet.kt index 8a4ea0d1..7b1a96cc 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/ReportCategoryBottomSheet.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/ReportCategoryBottomSheet.kt @@ -24,9 +24,9 @@ import com.threegap.bitnagil.designsystem.R import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple import com.threegap.bitnagil.domain.report.model.ReportCategory -import com.threegap.bitnagil.presentation.report.model.iconRes -import com.threegap.bitnagil.presentation.report.model.uiDescription -import com.threegap.bitnagil.presentation.report.model.uiTitle +import com.threegap.bitnagil.presentation.common.extension.displayExamples +import com.threegap.bitnagil.presentation.common.extension.displayTitle +import com.threegap.bitnagil.presentation.common.extension.iconRes import kotlinx.coroutines.launch @OptIn(ExperimentalMaterial3Api::class) @@ -54,8 +54,8 @@ fun ReportCategoryBottomSheet( categories.forEachIndexed { index, category -> ReportCategoryItem( icon = category.iconRes, - title = category.uiTitle, - description = category.uiDescription, + title = category.displayTitle, + description = category.displayExamples, isSelected = selectedCategory == category, onClick = { onSelected(category) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailScreen.kt index a833dfe4..1fdfe9d4 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailScreen.kt @@ -27,6 +27,7 @@ import coil3.compose.AsyncImage import coil3.request.ImageRequest import com.threegap.bitnagil.designsystem.BitnagilTheme import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar +import com.threegap.bitnagil.presentation.common.extension.displayTitle import com.threegap.bitnagil.presentation.reportdetail.component.atom.ReportProcessBadge import com.threegap.bitnagil.presentation.reportdetail.component.block.ReportDetailLabeledContent import com.threegap.bitnagil.presentation.reportdetail.contract.ReportDetailState @@ -74,7 +75,7 @@ private fun ReportDetailScreen( ) { Spacer(modifier = Modifier.height(20.dp)) - ReportProcessBadge(reportProcess = state.reportProcess) + ReportProcessBadge(reportStatus = state.reportProcess) Spacer(modifier = Modifier.height(6.dp)) @@ -116,7 +117,7 @@ private fun ReportDetailScreen( ReportDetailLabeledContent( label = "카테고리", - content = state.reportCategory.title, + content = state.reportCategory.displayTitle, ) ReportDetailLabeledContent( diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt index b3d3b79c..532fe214 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailViewModel.kt @@ -4,8 +4,6 @@ import androidx.lifecycle.ViewModel import com.threegap.bitnagil.domain.report.usecase.GetReportUseCase import com.threegap.bitnagil.presentation.reportdetail.contract.ReportDetailSideEffect import com.threegap.bitnagil.presentation.reportdetail.contract.ReportDetailState -import com.threegap.bitnagil.presentation.reportdetail.model.ReportCategory -import com.threegap.bitnagil.presentation.reportdetail.model.ReportProcess import com.threegap.bitnagil.presentation.reportdetail.model.navarg.ReportDetailScreenArg import dagger.assisted.Assisted import dagger.assisted.AssistedFactory @@ -36,10 +34,10 @@ class ReportDetailViewModel @AssistedInject constructor( onSuccess = { reportDetail -> reduce { state.copy( - reportProcess = ReportProcess.fromDomain(reportDetail.status), + reportProcess = reportDetail.status, reportTitle = reportDetail.title, reportContent = reportDetail.content, - reportCategory = ReportCategory.fromDomain(reportDetail.category), + reportCategory = reportDetail.category, imageUrls = reportDetail.imageUrls, location = reportDetail.address, date = reportDetail.date, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/component/atom/ReportProcessBadge.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/component/atom/ReportProcessBadge.kt index 9977e533..e2e1a3d5 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/component/atom/ReportProcessBadge.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/component/atom/ReportProcessBadge.kt @@ -8,43 +8,32 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.threegap.bitnagil.designsystem.BitnagilTheme -import com.threegap.bitnagil.presentation.reportdetail.model.ReportProcess +import com.threegap.bitnagil.domain.report.model.ReportStatus +import com.threegap.bitnagil.presentation.common.extension.badgeBackgroundColor +import com.threegap.bitnagil.presentation.common.extension.displayTitle +import com.threegap.bitnagil.presentation.common.extension.textColor @Composable fun ReportProcessBadge( modifier: Modifier = Modifier, - reportProcess: ReportProcess, + reportStatus: ReportStatus, ) { Text( - text = reportProcess.title, + text = reportStatus.displayTitle, style = BitnagilTheme.typography.caption1SemiBold, - color = reportProcess.getProcessBadgeTextColor(), + color = reportStatus.textColor, modifier = modifier - .background(color = reportProcess.getProcessBadgeBackgroundColor(), shape = RoundedCornerShape(6.dp)) + .background( + color = reportStatus.badgeBackgroundColor, + shape = RoundedCornerShape(6.dp), + ) .padding(horizontal = 10.dp, vertical = 4.dp), ) } -@Composable -private fun ReportProcess.getProcessBadgeBackgroundColor(): Color = - when (this) { - ReportProcess.Reported -> BitnagilTheme.colors.green10 - ReportProcess.Progress -> BitnagilTheme.colors.skyBlue10 - else -> BitnagilTheme.colors.coolGray95 - } - -@Composable -private fun ReportProcess.getProcessBadgeTextColor(): Color = - when (this) { - ReportProcess.Reported -> BitnagilTheme.colors.green300 - ReportProcess.Progress -> BitnagilTheme.colors.blue300 - else -> BitnagilTheme.colors.coolGray40 - } - @Composable @Preview private fun ReportProcessBadgePreview() { @@ -52,9 +41,9 @@ private fun ReportProcessBadgePreview() { Column( verticalArrangement = Arrangement.spacedBy(4.dp), ) { - ReportProcessBadge(reportProcess = ReportProcess.Progress) - ReportProcessBadge(reportProcess = ReportProcess.Reported) - ReportProcessBadge(reportProcess = ReportProcess.Complete) + ReportProcessBadge(reportStatus = ReportStatus.PENDING) + ReportProcessBadge(reportStatus = ReportStatus.IN_PROGRESS) + ReportProcessBadge(reportStatus = ReportStatus.COMPLETED) } } } diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/contract/ReportDetailState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/contract/ReportDetailState.kt index e3ac8114..66292845 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/contract/ReportDetailState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/contract/ReportDetailState.kt @@ -1,11 +1,11 @@ package com.threegap.bitnagil.presentation.reportdetail.contract -import com.threegap.bitnagil.presentation.reportdetail.model.ReportCategory -import com.threegap.bitnagil.presentation.reportdetail.model.ReportProcess +import com.threegap.bitnagil.domain.report.model.ReportCategory +import com.threegap.bitnagil.domain.report.model.ReportStatus import java.time.LocalDate data class ReportDetailState( - val reportProcess: ReportProcess, + val reportProcess: ReportStatus, val reportTitle: String, val reportContent: String, val reportCategory: ReportCategory, @@ -15,10 +15,10 @@ data class ReportDetailState( ) { companion object { val Init = ReportDetailState( - reportProcess = ReportProcess.Reported, + reportProcess = ReportStatus.PENDING, reportTitle = "", reportContent = "", - reportCategory = ReportCategory.TrafficFacilities, + reportCategory = ReportCategory.TRANSPORTATION, imageUrls = emptyList(), location = "", date = LocalDate.now(), diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/ReportCategory.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/ReportCategory.kt deleted file mode 100644 index 96a91f1d..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/ReportCategory.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.threegap.bitnagil.presentation.reportdetail.model -import com.threegap.bitnagil.domain.report.model.ReportCategory as DomainReportCategory - -enum class ReportCategory( - val title: String, -) { - TrafficFacilities( - title = "교통 시설", - ), - LightingFacilities( - title = "조명 시설", - ), - WaterFacilities( - title = "상하수도 시설", - ), - Amenities( - title = "편의 시설", - ), - ; - - companion object { - fun fromDomain(domainReportCategory: com.threegap.bitnagil.domain.report.model.ReportCategory): ReportCategory { - return when (domainReportCategory) { - DomainReportCategory.TRANSPORTATION -> TrafficFacilities - DomainReportCategory.LIGHTING -> LightingFacilities - DomainReportCategory.WATERFACILITY -> WaterFacilities - DomainReportCategory.AMENITY -> Amenities - } - } - } -} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/ReportProcess.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/ReportProcess.kt deleted file mode 100644 index 96f889c0..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/model/ReportProcess.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.threegap.bitnagil.presentation.reportdetail.model - -import com.threegap.bitnagil.domain.report.model.ReportStatus - -enum class ReportProcess( - val title: String, -) { - Reported(title = "제보 완료"), - Progress(title = "처리 중"), - Complete(title = "처리 완료"), - ; - - companion object { - fun fromDomain(status: ReportStatus): ReportProcess { - return when (status) { - ReportStatus.PENDING -> Reported - ReportStatus.IN_PROGRESS -> Progress - ReportStatus.COMPLETED -> Complete - } - } - } -} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt index 721c2f77..d84eb94d 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryScreen.kt @@ -32,13 +32,15 @@ import com.threegap.bitnagil.designsystem.component.atom.BitnagilChip import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple +import com.threegap.bitnagil.domain.report.model.ReportCategory +import com.threegap.bitnagil.domain.report.model.ReportStatus +import com.threegap.bitnagil.presentation.common.extension.displayTitle import com.threegap.bitnagil.presentation.reporthistory.component.block.ReportHistoryItem import com.threegap.bitnagil.presentation.reporthistory.component.template.ReportCategoryBottomSheet import com.threegap.bitnagil.presentation.reporthistory.contract.ReportHistoryState -import com.threegap.bitnagil.presentation.reporthistory.model.ReportCategory import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoriesPerDayUiModel import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoryUiModel -import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcess +import com.threegap.bitnagil.presentation.reporthistory.model.ReportStatusFilter import com.threegap.bitnagil.presentation.reporthistory.util.toPresentationFormat import org.orbitmvi.orbit.compose.collectAsState import java.time.LocalDate @@ -62,7 +64,7 @@ fun ReportHistoryScreenContainer( ReportHistoryScreen( state = state, onClickPreviousButton = navigateToBack, - onClickReportProcessChip = viewModel::selectReportProcess, + onClickReportStatusFilterChip = viewModel::selectReportStatusFilter, onClickReportCategoryButton = viewModel::showReportCategoryBottomSheet, onClickReportItem = navigateToReportDetail, ) @@ -73,7 +75,7 @@ private fun ReportHistoryScreen( modifier: Modifier = Modifier, state: ReportHistoryState, onClickPreviousButton: () -> Unit, - onClickReportProcessChip: (ReportProcess) -> Unit, + onClickReportStatusFilterChip: (ReportStatusFilter) -> Unit, onClickReportCategoryButton: () -> Unit, onClickReportItem: (String) -> Unit, ) { @@ -99,12 +101,12 @@ private fun ReportHistoryScreen( ) { Spacer(modifier = Modifier.width(8.dp)) - state.reportProcessWithCounts.forEach { reportProcessWithCount -> + state.reportStatusFilterWithCounts.forEach { filterWithCount -> BitnagilChip( - title = reportProcessWithCount.titleWithCount, - isSelected = state.selectedReportProcess == reportProcessWithCount.process, + title = filterWithCount.titleWithCount, + isSelected = state.selectedReportStatusFilter == filterWithCount.filter, onCategorySelected = { - onClickReportProcessChip(reportProcessWithCount.process) + onClickReportStatusFilterChip(filterWithCount.filter) }, ) } @@ -172,7 +174,7 @@ private fun ReportHistoryScreen( .clickableWithoutRipple(onClick = onClickReportCategoryButton), ) { Text( - text = state.selectedReportCategory?.title ?: "카테고리", + text = state.selectedReportCategory?.displayTitle ?: "카테고리", color = BitnagilTheme.colors.coolGray40, style = BitnagilTheme.typography.body2Medium, modifier = Modifier.padding(start = 10.dp), @@ -206,23 +208,23 @@ private fun ReportHistoryScreenPreview() { title = "제보 1", imageUrl = "-", location = "서울특별시 성북구 안암로 106", - process = ReportProcess.Reported, - category = ReportCategory.Amenities, + status = ReportStatus.PENDING, + category = ReportCategory.AMENITY, ), ReportHistoryUiModel( id = "1", title = "제보 1", imageUrl = "-", location = "서울특별시 성북구 안암로 106", - process = ReportProcess.Progress, - category = ReportCategory.Amenities, + status = ReportStatus.IN_PROGRESS, + category = ReportCategory.AMENITY, ), ), ) }, ), onClickPreviousButton = {}, - onClickReportProcessChip = {}, + onClickReportStatusFilterChip = {}, onClickReportCategoryButton = {}, onClickReportItem = {}, ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt index 2a7edcd4..63e00c58 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/ReportHistoryViewModel.kt @@ -1,13 +1,13 @@ package com.threegap.bitnagil.presentation.reporthistory import androidx.lifecycle.ViewModel +import com.threegap.bitnagil.domain.report.model.ReportCategory import com.threegap.bitnagil.domain.report.usecase.GetReportHistoriesUseCase import com.threegap.bitnagil.presentation.reporthistory.contract.ReportHistorySideEffect import com.threegap.bitnagil.presentation.reporthistory.contract.ReportHistoryState -import com.threegap.bitnagil.presentation.reporthistory.model.ReportCategory import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoriesPerDayUiModel -import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoryUiModel -import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcess +import com.threegap.bitnagil.presentation.reporthistory.model.ReportStatusFilter +import com.threegap.bitnagil.presentation.reporthistory.model.toUiModel import dagger.hilt.android.lifecycle.HiltViewModel import org.orbitmvi.orbit.Container import org.orbitmvi.orbit.ContainerHost @@ -31,9 +31,7 @@ class ReportHistoryViewModel @Inject constructor( .map { reportHistoryPerDateMap -> ReportHistoriesPerDayUiModel( date = reportHistoryPerDateMap.key, - reports = reportHistoryPerDateMap.value.map { - ReportHistoryUiModel.fromDomain(it) - }, + reports = reportHistoryPerDateMap.value.map { it.toUiModel() }, ) } .sortedByDescending { reportHistoryPerDate -> @@ -61,10 +59,10 @@ class ReportHistoryViewModel @Inject constructor( } } - fun selectReportProcess(reportProcess: ReportProcess) = intent { + fun selectReportStatusFilter(reportStatusFilter: ReportStatusFilter) = intent { reduce { state.copy( - selectedReportProcess = reportProcess, + selectedReportStatusFilter = reportStatusFilter, ) } } diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/atom/ReportProcessBadge.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/atom/ReportProcessBadge.kt deleted file mode 100644 index b93bf260..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/atom/ReportProcessBadge.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.threegap.bitnagil.presentation.reporthistory.component.atom - -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import com.threegap.bitnagil.designsystem.BitnagilTheme -import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcess - -@Composable -fun ReportProcessBadge( - modifier: Modifier = Modifier, - reportProcess: ReportProcess, -) { - Text( - text = reportProcess.title, - style = BitnagilTheme.typography.caption1SemiBold, - color = reportProcess.getProcessBadgeTextColor(), - modifier = modifier - .background(color = reportProcess.getProcessBadgeBackgroundColor(), shape = RoundedCornerShape(6.dp)) - .padding(horizontal = 10.dp, vertical = 4.dp), - ) -} - -@Composable -private fun ReportProcess.getProcessBadgeBackgroundColor(): Color = - when (this) { - ReportProcess.Reported -> BitnagilTheme.colors.green10 - ReportProcess.Progress -> BitnagilTheme.colors.skyBlue10 - else -> BitnagilTheme.colors.coolGray95 - } - -@Composable -private fun ReportProcess.getProcessBadgeTextColor(): Color = - when (this) { - ReportProcess.Reported -> BitnagilTheme.colors.green300 - ReportProcess.Progress -> BitnagilTheme.colors.blue300 - else -> BitnagilTheme.colors.coolGray40 - } - -@Composable -@Preview -private fun ReportProcessBadgePreview() { - BitnagilTheme { - Column( - verticalArrangement = Arrangement.spacedBy(4.dp), - ) { - ReportProcessBadge(reportProcess = ReportProcess.Progress) - ReportProcessBadge(reportProcess = ReportProcess.Reported) - ReportProcessBadge(reportProcess = ReportProcess.Complete) - } - } -} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/block/ReportHistoryItem.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/block/ReportHistoryItem.kt index 57b940ac..8732c60f 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/block/ReportHistoryItem.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/block/ReportHistoryItem.kt @@ -25,10 +25,11 @@ import coil3.compose.AsyncImage import coil3.request.ImageRequest import com.threegap.bitnagil.designsystem.BitnagilTheme import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple -import com.threegap.bitnagil.presentation.reporthistory.component.atom.ReportProcessBadge -import com.threegap.bitnagil.presentation.reporthistory.model.ReportCategory +import com.threegap.bitnagil.domain.report.model.ReportCategory +import com.threegap.bitnagil.domain.report.model.ReportStatus +import com.threegap.bitnagil.presentation.common.extension.displayTitle +import com.threegap.bitnagil.presentation.reportdetail.component.atom.ReportProcessBadge import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoryUiModel -import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcess @Composable fun ReportHistoryItem( @@ -46,7 +47,7 @@ fun ReportHistoryItem( Column( modifier = Modifier.weight(1f), ) { - ReportProcessBadge(reportProcess = report.process) + ReportProcessBadge(reportStatus = report.status) Spacer(modifier = Modifier.height(8.dp)) @@ -59,7 +60,7 @@ fun ReportHistoryItem( horizontalArrangement = Arrangement.spacedBy(6.dp), verticalAlignment = Alignment.CenterVertically, ) { - Text(text = report.category.title, style = BitnagilTheme.typography.caption1Medium.copy(color = BitnagilTheme.colors.coolGray50)) + Text(text = report.category.displayTitle, style = BitnagilTheme.typography.caption1Medium.copy(color = BitnagilTheme.colors.coolGray50)) Box( modifier = Modifier @@ -103,8 +104,8 @@ private fun ReportHistoryItemPreview() { title = "다이소 덕소점 앞 가로등 심해요", imageUrl = "-", location = "서울특별시 성북구 안암로 106", - process = ReportProcess.Reported, - category = ReportCategory.TrafficFacilities, + status = ReportStatus.PENDING, + category = ReportCategory.TRANSPORTATION, ), onClick = {}, ) @@ -115,8 +116,8 @@ private fun ReportHistoryItemPreview() { title = "다이소 덕소점 앞 가로등 깜빡이는데 어쩌죠 이거 진짜로 심각한 문제인데 이 뒷부분은 figma에서 짤려 보여서 임의로 채웁니다", imageUrl = "-", location = "서울특별시 성북구 안암로 106", - process = ReportProcess.Progress, - category = ReportCategory.TrafficFacilities, + status = ReportStatus.IN_PROGRESS, + category = ReportCategory.TRANSPORTATION, ), onClick = {}, ) @@ -127,8 +128,8 @@ private fun ReportHistoryItemPreview() { title = "퇴근하고 싶어요", imageUrl = "-", location = "서울특별시 성북구 안암로 106 서울특별시 성북구 안암로 106 서울특별시 성북구 안암로 106", - process = ReportProcess.Complete, - category = ReportCategory.Amenities, + status = ReportStatus.COMPLETED, + category = ReportCategory.AMENITY, ), onClick = {}, ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/template/ReportCategoryBottomSheet.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/template/ReportCategoryBottomSheet.kt index 1e1ce5d5..af4603c7 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/template/ReportCategoryBottomSheet.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/component/template/ReportCategoryBottomSheet.kt @@ -23,7 +23,10 @@ import com.threegap.bitnagil.designsystem.BitnagilTheme import com.threegap.bitnagil.designsystem.R import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple -import com.threegap.bitnagil.presentation.reporthistory.model.ReportCategory +import com.threegap.bitnagil.domain.report.model.ReportCategory +import com.threegap.bitnagil.presentation.common.extension.displayExamples +import com.threegap.bitnagil.presentation.common.extension.displayTitle +import com.threegap.bitnagil.presentation.common.extension.iconRes import kotlinx.coroutines.launch @OptIn(ExperimentalMaterial3Api::class) @@ -49,9 +52,9 @@ fun ReportCategoryBottomSheet( ) { ReportCategory.entries.forEachIndexed { index, category -> ReportCategoryItem( - icon = category.iconResourceId, - title = category.title, - description = category.description, + icon = category.iconRes, + title = category.displayTitle, + description = category.displayExamples, isSelected = selectedCategory == category, onClick = { onSelected(category) @@ -123,7 +126,7 @@ private fun ReportCategoryItem( @Composable private fun ReportCategoryBottomSheetPreview() { ReportCategoryBottomSheet( - selectedCategory = ReportCategory.WaterFacilities, + selectedCategory = ReportCategory.WATERFACILITY, onDismiss = {}, onSelected = {}, ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistoryState.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistoryState.kt index fe2e5a57..50ba53f7 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistoryState.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/contract/ReportHistoryState.kt @@ -1,68 +1,52 @@ package com.threegap.bitnagil.presentation.reporthistory.contract -import com.threegap.bitnagil.presentation.reporthistory.model.ReportCategory +import com.threegap.bitnagil.domain.report.model.ReportCategory import com.threegap.bitnagil.presentation.reporthistory.model.ReportHistoriesPerDayUiModel -import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcess -import com.threegap.bitnagil.presentation.reporthistory.model.ReportProcessWithCount +import com.threegap.bitnagil.presentation.reporthistory.model.ReportStatusFilter +import com.threegap.bitnagil.presentation.reporthistory.model.ReportStatusFilterWithCount data class ReportHistoryState( val selectedReportCategory: ReportCategory?, - val selectedReportProcess: ReportProcess, + val selectedReportStatusFilter: ReportStatusFilter, val reportHistoriesPerDays: List, val showSelectReportCategoryBottomSheet: Boolean, ) { - val filteredReportHistoriesPerDays: List = reportHistoriesPerDays - .map { reportHistoriesPerDay -> - reportHistoriesPerDay.copy( - reports = reportHistoriesPerDay.reports.filter { - val processMatched = when (selectedReportProcess) { - ReportProcess.Total -> true - ReportProcess.Reported -> it.process == ReportProcess.Reported - ReportProcess.Progress -> it.process == ReportProcess.Progress - ReportProcess.Complete -> it.process == ReportProcess.Complete - } + val filteredReportHistoriesPerDays: List = + reportHistoriesPerDays + .map { reportHistoriesPerDay -> + reportHistoriesPerDay.copy( + reports = reportHistoriesPerDay.reports.filter { report -> + val statusMatched = selectedReportStatusFilter.matches(report.status) - val categoryMatched = when (selectedReportCategory) { - ReportCategory.TrafficFacilities -> it.category == ReportCategory.TrafficFacilities - ReportCategory.LightingFacilities -> it.category == ReportCategory.LightingFacilities - ReportCategory.WaterFacilities -> it.category == ReportCategory.WaterFacilities - ReportCategory.Amenities -> it.category == ReportCategory.Amenities - null -> true - } + val categoryMatched = when (selectedReportCategory) { + null -> true + else -> report.category == selectedReportCategory + } - processMatched && categoryMatched - }, - ) - } - .filter { reportHistoriesPerDay -> - reportHistoriesPerDay.reports.isNotEmpty() - } + statusMatched && categoryMatched + }, + ) + } + .filter { reportHistoriesPerDay -> + reportHistoriesPerDay.reports.isNotEmpty() + } - val reportProcessWithCounts: List = listOf( - ReportProcessWithCount( - ReportProcess.Total, - reportHistoriesPerDays.sumOf { it.reports.size }, - ), - ReportProcessWithCount( - ReportProcess.Reported, - reportHistoriesPerDays.sumOf { it.reports.filter { report -> report.process == ReportProcess.Reported }.size }, - ), - ReportProcessWithCount( - ReportProcess.Progress, - reportHistoriesPerDays.sumOf { it.reports.filter { report -> report.process == ReportProcess.Progress }.size }, - ), - ReportProcessWithCount( - ReportProcess.Complete, - reportHistoriesPerDays.sumOf { it.reports.filter { report -> report.process == ReportProcess.Complete }.size }, - ), - ) + val reportStatusFilterWithCounts: List = + ReportStatusFilter.values().map { filter -> + val count = reportHistoriesPerDays.sumOf { day -> + day.reports.count { report -> + filter.matches(report.status) + } + } + ReportStatusFilterWithCount(filter, count) + } val showCategorySelectButton: Boolean = reportHistoriesPerDays.isNotEmpty() companion object { val Init = ReportHistoryState( selectedReportCategory = null, - selectedReportProcess = ReportProcess.Total, + selectedReportStatusFilter = ReportStatusFilter.All, reportHistoriesPerDays = listOf(), showSelectReportCategoryBottomSheet = false, ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportCategory.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportCategory.kt deleted file mode 100644 index 642eca1c..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportCategory.kt +++ /dev/null @@ -1,43 +0,0 @@ -package com.threegap.bitnagil.presentation.reporthistory.model - -import com.threegap.bitnagil.designsystem.R -import com.threegap.bitnagil.domain.report.model.ReportCategory as DomainReportCategory - -enum class ReportCategory( - val title: String, - val description: String, - val iconResourceId: Int, -) { - TrafficFacilities( - title = "교통 시설", - description = "신호등 고장, 표지판 파손, 횡단보도 등", - iconResourceId = R.drawable.ic_car, - ), - LightingFacilities( - title = "조명 시설", - description = "가로등, 보안등 파손 등", - iconResourceId = R.drawable.ic_light, - ), - WaterFacilities( - title = "상하수도 시설", - description = "맨홀 뚜껑 손상 등", - iconResourceId = R.drawable.ic_water, - ), - Amenities( - title = "편의 시설", - description = "벤치 파손, 휴지통 넘침 등", - iconResourceId = R.drawable.ic_hammer, - ), - ; - - companion object { - fun fromDomain(domainReportCategory: DomainReportCategory): ReportCategory { - return when (domainReportCategory) { - DomainReportCategory.TRANSPORTATION -> TrafficFacilities - DomainReportCategory.LIGHTING -> LightingFacilities - DomainReportCategory.WATERFACILITY -> WaterFacilities - DomainReportCategory.AMENITY -> Amenities - } - } - } -} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportHistoryUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportHistoryUiModel.kt index ee6f32af..b89977e2 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportHistoryUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportHistoryUiModel.kt @@ -1,25 +1,24 @@ package com.threegap.bitnagil.presentation.reporthistory.model +import com.threegap.bitnagil.domain.report.model.ReportCategory import com.threegap.bitnagil.domain.report.model.ReportItem +import com.threegap.bitnagil.domain.report.model.ReportStatus data class ReportHistoryUiModel( val id: String, val title: String, val imageUrl: String, val location: String, - val process: ReportProcess, + val status: ReportStatus, val category: ReportCategory, -) { - companion object { - fun fromDomain(reportItem: ReportItem): ReportHistoryUiModel { - return ReportHistoryUiModel( - id = "${reportItem.id}", - title = reportItem.title, - imageUrl = reportItem.imageUrl, - location = reportItem.address, - process = ReportProcess.fromDomain(reportItem.status), - category = ReportCategory.fromDomain(reportItem.category), - ) - } - } -} +) + +internal fun ReportItem.toUiModel(): ReportHistoryUiModel = + ReportHistoryUiModel( + id = this.id.toString(), + title = this.title, + imageUrl = this.imageUrl, + location = this.address, + status = this.status, + category = this.category, + ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportProcess.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportProcess.kt deleted file mode 100644 index 5ab5729f..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportProcess.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.threegap.bitnagil.presentation.reporthistory.model - -import com.threegap.bitnagil.domain.report.model.ReportStatus - -enum class ReportProcess( - val title: String, -) { - Total(title = "전체"), - Reported(title = "제보 완료"), - Progress(title = "처리 중"), - Complete(title = "처리 완료"), - ; - - companion object { - fun fromDomain(status: ReportStatus): ReportProcess { - return when (status) { - ReportStatus.PENDING -> Reported - ReportStatus.IN_PROGRESS -> Progress - ReportStatus.COMPLETED -> Complete - } - } - } -} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportProcessWithCount.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportProcessWithCount.kt deleted file mode 100644 index df6409b4..00000000 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportProcessWithCount.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.threegap.bitnagil.presentation.reporthistory.model - -data class ReportProcessWithCount( - val process: ReportProcess, - val count: Int, -) { - val titleWithCount: String = if (count == 0) process.title else "${process.title} $count" - - companion object { - val Init = ReportProcessWithCount( - process = ReportProcess.Total, - count = 0, - ) - } -} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportStatusFilter.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportStatusFilter.kt new file mode 100644 index 00000000..711d4a2a --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportStatusFilter.kt @@ -0,0 +1,25 @@ +package com.threegap.bitnagil.presentation.reporthistory.model + +import com.threegap.bitnagil.domain.report.model.ReportStatus +import com.threegap.bitnagil.presentation.common.extension.displayTitle + +sealed class ReportStatusFilter { + data object All : ReportStatusFilter() + data class Specific(val status: ReportStatus) : ReportStatusFilter() + + fun getTitle(): String = when (this) { + is All -> "전체" + is Specific -> status.displayTitle + } + + fun matches(status: ReportStatus): Boolean = when (this) { + is All -> true + is Specific -> this.status == status + } + + companion object { + fun values(): List { + return listOf(All) + ReportStatus.entries.map { Specific(it) } + } + } +} diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportStatusFilterWithCount.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportStatusFilterWithCount.kt new file mode 100644 index 00000000..99286100 --- /dev/null +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/reporthistory/model/ReportStatusFilterWithCount.kt @@ -0,0 +1,15 @@ +package com.threegap.bitnagil.presentation.reporthistory.model + +data class ReportStatusFilterWithCount( + val filter: ReportStatusFilter, + val count: Int, +) { + val titleWithCount: String = if (count == 0) filter.getTitle() else "${filter.getTitle()} $count" + + companion object { + val Init = ReportStatusFilterWithCount( + filter = ReportStatusFilter.All, + count = 0, + ) + } +} From 595254e0870492c4b30c4f8b3be0b62b3885483b Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sun, 15 Feb 2026 19:17:02 +0900 Subject: [PATCH 29/31] =?UTF-8?q?Refactor:=20Emotion=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20UiModel=20=EB=A7=A4=ED=95=91=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Domain Model을 UiModel로 변환하는 로직을 각 UiModel의 companion object에서 확장 함수(toUiModel)로 변경합니다. --- .../presentation/emotion/EmotionViewModel.kt | 5 ++- .../model/EmotionRecommendRoutineUiModel.kt | 23 +++++------- .../emotion/model/EmotionUiModel.kt | 37 +++++++++++-------- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt index 59b5ccbc..468e7840 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt @@ -11,6 +11,7 @@ import com.threegap.bitnagil.presentation.emotion.contract.EmotionState import com.threegap.bitnagil.presentation.emotion.model.EmotionRecommendRoutineUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel +import com.threegap.bitnagil.presentation.emotion.model.toUiModel import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -39,7 +40,7 @@ class EmotionViewModel @Inject constructor( onSuccess = { emotions -> reduce { state.copy( - emotionTypeUiModels = emotions.map { EmotionUiModel.fromDomain(it) }, + emotionTypeUiModels = emotions.map { it.toUiModel() }, isLoading = false, ) } @@ -69,7 +70,7 @@ class EmotionViewModel @Inject constructor( registerEmotionUseCase(emotionType = emotionType).fold( onSuccess = { emotionRecommendRoutines -> - val recommendRoutines = emotionRecommendRoutines.map { EmotionRecommendRoutineUiModel.fromEmotionRecommendRoutine(it) } + val recommendRoutines = emotionRecommendRoutines.map { it.toUiModel() } reduce { state.copy( recommendRoutines = recommendRoutines, diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionRecommendRoutineUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionRecommendRoutineUiModel.kt index a93a3784..19c09326 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionRecommendRoutineUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionRecommendRoutineUiModel.kt @@ -10,17 +10,12 @@ data class EmotionRecommendRoutineUiModel( val name: String, val description: String, val selected: Boolean, -) : Parcelable { - companion object { - fun fromEmotionRecommendRoutine( - emotionRecommendRoutine: EmotionRecommendRoutine, - ): EmotionRecommendRoutineUiModel { - return EmotionRecommendRoutineUiModel( - id = emotionRecommendRoutine.routineId, - name = emotionRecommendRoutine.routineName, - description = emotionRecommendRoutine.routineDescription, - selected = false, - ) - } - } -} +) : Parcelable + +internal fun EmotionRecommendRoutine.toUiModel(): EmotionRecommendRoutineUiModel = + EmotionRecommendRoutineUiModel( + id = this.routineId, + name = this.routineName, + description = this.routineDescription, + selected = false, + ) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionUiModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionUiModel.kt index 487e7275..39a46e91 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionUiModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionUiModel.kt @@ -3,6 +3,10 @@ package com.threegap.bitnagil.presentation.emotion.model import android.os.Parcelable import com.threegap.bitnagil.designsystem.R import com.threegap.bitnagil.domain.emotion.model.Emotion +import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel.Companion.getMessage +import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel.Companion.getOfflineBackupImageResourceId +import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel.Companion.getSymbolBackgroundColor +import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel.Companion.getSymbolColor import kotlinx.parcelize.Parcelize @Parcelize @@ -16,19 +20,7 @@ data class EmotionUiModel( val symbolColor: Long = 0xFF878A93, ) : Parcelable { companion object { - fun fromDomain(emotion: Emotion) = EmotionUiModel( - emotionType = emotion.emotionType, - emotionMarbleName = emotion.emotionMarbleName, - image = EmotionImageUiModel.Url( - url = emotion.imageUrl, - offlineBackupImageResourceId = getOfflineBackupImageResourceId(emotion.emotionType), - ), - message = getMessage(emotion.emotionType), - symbolBackgroundColor = getSymbolBackgroundColor(emotion.emotionType), - symbolColor = getSymbolColor(emotion.emotionType), - ) - - private fun getOfflineBackupImageResourceId(emotionType: String): Int? { + fun getOfflineBackupImageResourceId(emotionType: String): Int? { return when (emotionType) { "CALM" -> R.drawable.calm "VITALITY" -> R.drawable.vitality @@ -40,7 +32,7 @@ data class EmotionUiModel( } } - private fun getMessage(emotionType: String): String? { + fun getMessage(emotionType: String): String? { return when (emotionType) { "CALM" -> "평온함은 마음이 고요하고 편안해\n균형을 이루는 상태에요." "VITALITY" -> "활기참은 생기가 가득 차\n활발하고 적극적인 상태예요." @@ -52,7 +44,7 @@ data class EmotionUiModel( } } - private fun getSymbolBackgroundColor(emotionType: String): Long { + fun getSymbolBackgroundColor(emotionType: String): Long { return when (emotionType) { "CALM" -> 0xFFEFECFF "VITALITY" -> 0xFFE9FAD0 @@ -64,7 +56,7 @@ data class EmotionUiModel( } } - private fun getSymbolColor(emotionType: String): Long { + fun getSymbolColor(emotionType: String): Long { return when (emotionType) { "CALM" -> 0xFF692BD0 "VITALITY" -> 0xFF609F00 @@ -87,3 +79,16 @@ data class EmotionUiModel( ) } } + +internal fun Emotion.toUiModel(): EmotionUiModel = + EmotionUiModel( + emotionType = this.emotionType, + emotionMarbleName = this.emotionMarbleName, + image = EmotionImageUiModel.Url( + url = this.imageUrl, + offlineBackupImageResourceId = getOfflineBackupImageResourceId(this.emotionType), + ), + message = getMessage(this.emotionType), + symbolBackgroundColor = getSymbolBackgroundColor(this.emotionType), + symbolColor = getSymbolColor(this.emotionType), + ) From a9dbe2c8344622fac5be38b2a8d7aa102003ae90 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sun, 15 Feb 2026 19:24:12 +0900 Subject: [PATCH 30/31] =?UTF-8?q?Refactor:=20data=20=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=96=B4=20=EB=AA=A8=EB=8D=B8=20=EB=84=A4=EC=9D=B4=EB=B0=8D?= =?UTF-8?q?=EC=97=90=EC=84=9C=20Dto=20=EC=A0=91=EB=AF=B8=EC=82=AC=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/datasource/AuthRemoteDataSource.kt | 12 +++++----- .../AuthRemoteDataSourceImpl.kt | 16 +++++++------- .../bitnagil/data/auth/mapper/AuthMapper.kt | 22 ------------------- .../{LoginRequestDto.kt => LoginRequest.kt} | 2 +- ...RequestDto.kt => TermsAgreementRequest.kt} | 10 ++++++++- .../{LoginResponseDto.kt => LoginResponse.kt} | 10 ++++++++- .../auth/repositoryimpl/AuthRepositoryImpl.kt | 8 +++---- .../bitnagil/data/auth/service/AuthService.kt | 14 ++++++------ .../data/file/datasource/FileDataSource.kt | 4 ++-- .../file/datasourceImpl/FileDataSourceImpl.kt | 4 ++-- ...leInfoRequestDto.kt => FileInfoRequest.kt} | 2 +- .../file/repositoryImpl/FileRepositoryImpl.kt | 4 ++-- .../bitnagil/data/file/service/FileService.kt | 4 ++-- .../report/datasource/ReportDataSource.kt | 12 +++++----- .../datasourceImpl/ReportDataSourceImpl.kt | 14 ++++++------ .../{ReportRequestDto.kt => ReportRequest.kt} | 6 ++--- ...rtDetailDto.kt => ReportDetailResponse.kt} | 4 ++-- ...o.kt => ReportHistoriesPerDateResponse.kt} | 6 ++--- ...ReportItemDto.kt => ReportItemResponse.kt} | 4 ++-- .../data/report/service/ReportService.kt | 12 +++++----- .../datasource/RoutineRemoteDataSource.kt | 4 ++-- .../RoutineRemoteDataSourceImpl.kt | 6 ++--- ...Dto.kt => RoutineCompletionInfoRequest.kt} | 4 ++-- ...uestDto.kt => RoutineCompletionRequest.kt} | 6 ++--- .../request/SubRoutineDeletionInfoDto.kt | 19 ---------------- .../data/routine/service/RoutineService.kt | 4 ++-- .../data/user/datasource/UserDataSource.kt | 4 ++-- .../user/datasourceImpl/UserDataSourceImpl.kt | 4 ++-- ...eResponseDto.kt => UserProfileResponse.kt} | 4 ++-- .../bitnagil/data/user/service/UserService.kt | 4 ++-- .../version/datasource/VersionDataSource.kt | 4 ++-- .../datasourceImpl/VersionDataSourceImpl.kt | 4 ++-- ...ResponseDto.kt => VersionCheckResponse.kt} | 4 ++-- .../data/version/service/VersionService.kt | 4 ++-- 34 files changed, 110 insertions(+), 135 deletions(-) delete mode 100644 data/src/main/java/com/threegap/bitnagil/data/auth/mapper/AuthMapper.kt rename data/src/main/java/com/threegap/bitnagil/data/auth/model/request/{LoginRequestDto.kt => LoginRequest.kt} (88%) rename data/src/main/java/com/threegap/bitnagil/data/auth/model/request/{TermsAgreementRequestDto.kt => TermsAgreementRequest.kt} (53%) rename data/src/main/java/com/threegap/bitnagil/data/auth/model/response/{LoginResponseDto.kt => LoginResponse.kt} (59%) rename data/src/main/java/com/threegap/bitnagil/data/file/model/request/{FileInfoRequestDto.kt => FileInfoRequest.kt} (89%) rename data/src/main/java/com/threegap/bitnagil/data/report/model/request/{ReportRequestDto.kt => ReportRequest.kt} (91%) rename data/src/main/java/com/threegap/bitnagil/data/report/model/response/{ReportDetailDto.kt => ReportDetailResponse.kt} (92%) rename data/src/main/java/com/threegap/bitnagil/data/report/model/response/{ReportHistoriesPerDateDto.kt => ReportHistoriesPerDateResponse.kt} (69%) rename data/src/main/java/com/threegap/bitnagil/data/report/model/response/{ReportItemDto.kt => ReportItemResponse.kt} (92%) rename data/src/main/java/com/threegap/bitnagil/data/routine/model/request/{RoutineCompletionInfoDto.kt => RoutineCompletionInfoRequest.kt} (89%) rename data/src/main/java/com/threegap/bitnagil/data/routine/model/request/{RoutineCompletionRequestDto.kt => RoutineCompletionRequest.kt} (74%) delete mode 100644 data/src/main/java/com/threegap/bitnagil/data/routine/model/request/SubRoutineDeletionInfoDto.kt rename data/src/main/java/com/threegap/bitnagil/data/user/model/response/{UserProfileResponseDto.kt => UserProfileResponse.kt} (81%) rename data/src/main/java/com/threegap/bitnagil/data/version/model/response/{VersionCheckResponseDto.kt => VersionCheckResponse.kt} (82%) diff --git a/data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthRemoteDataSource.kt b/data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthRemoteDataSource.kt index 8de92dc3..f711a103 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthRemoteDataSource.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthRemoteDataSource.kt @@ -1,13 +1,13 @@ package com.threegap.bitnagil.data.auth.datasource -import com.threegap.bitnagil.data.auth.model.request.LoginRequestDto -import com.threegap.bitnagil.data.auth.model.request.TermsAgreementRequestDto -import com.threegap.bitnagil.data.auth.model.response.LoginResponseDto +import com.threegap.bitnagil.data.auth.model.request.LoginRequest +import com.threegap.bitnagil.data.auth.model.request.TermsAgreementRequest +import com.threegap.bitnagil.data.auth.model.response.LoginResponse interface AuthRemoteDataSource { - suspend fun login(socialAccessToken: String, loginRequestDto: LoginRequestDto): Result - suspend fun submitAgreement(termsAgreementRequestDto: TermsAgreementRequestDto): Result + suspend fun login(socialAccessToken: String, loginRequest: LoginRequest): Result + suspend fun submitAgreement(termsAgreementRequest: TermsAgreementRequest): Result suspend fun logout(): Result suspend fun withdrawal(reason: String): Result - suspend fun reissueToken(refreshToken: String): Result + suspend fun reissueToken(refreshToken: String): Result } diff --git a/data/src/main/java/com/threegap/bitnagil/data/auth/datasourceimpl/AuthRemoteDataSourceImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/auth/datasourceimpl/AuthRemoteDataSourceImpl.kt index 96a1e8b0..05b67739 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/auth/datasourceimpl/AuthRemoteDataSourceImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/auth/datasourceimpl/AuthRemoteDataSourceImpl.kt @@ -1,10 +1,10 @@ package com.threegap.bitnagil.data.auth.datasourceimpl import com.threegap.bitnagil.data.auth.datasource.AuthRemoteDataSource -import com.threegap.bitnagil.data.auth.model.request.LoginRequestDto -import com.threegap.bitnagil.data.auth.model.request.TermsAgreementRequestDto +import com.threegap.bitnagil.data.auth.model.request.LoginRequest +import com.threegap.bitnagil.data.auth.model.request.TermsAgreementRequest import com.threegap.bitnagil.data.auth.model.request.WithdrawalReasonRequest -import com.threegap.bitnagil.data.auth.model.response.LoginResponseDto +import com.threegap.bitnagil.data.auth.model.response.LoginResponse import com.threegap.bitnagil.data.auth.service.AuthService import com.threegap.bitnagil.data.common.safeApiCall import com.threegap.bitnagil.data.common.safeUnitApiCall @@ -13,14 +13,14 @@ import javax.inject.Inject class AuthRemoteDataSourceImpl @Inject constructor( private val authService: AuthService, ) : AuthRemoteDataSource { - override suspend fun login(socialAccessToken: String, loginRequestDto: LoginRequestDto): Result = + override suspend fun login(socialAccessToken: String, loginRequest: LoginRequest): Result = safeApiCall { - authService.postLogin(socialAccessToken, loginRequestDto) + authService.postLogin(socialAccessToken, loginRequest) } - override suspend fun submitAgreement(termsAgreementRequestDto: TermsAgreementRequestDto): Result = + override suspend fun submitAgreement(termsAgreementRequest: TermsAgreementRequest): Result = safeUnitApiCall { - authService.submitAgreement(termsAgreementRequestDto) + authService.submitAgreement(termsAgreementRequest) } override suspend fun logout(): Result = @@ -33,7 +33,7 @@ class AuthRemoteDataSourceImpl @Inject constructor( authService.postWithdrawal(WithdrawalReasonRequest(reason)) } - override suspend fun reissueToken(refreshToken: String): Result = + override suspend fun reissueToken(refreshToken: String): Result = safeApiCall { authService.postReissueToken(refreshToken) } diff --git a/data/src/main/java/com/threegap/bitnagil/data/auth/mapper/AuthMapper.kt b/data/src/main/java/com/threegap/bitnagil/data/auth/mapper/AuthMapper.kt deleted file mode 100644 index aa0e7434..00000000 --- a/data/src/main/java/com/threegap/bitnagil/data/auth/mapper/AuthMapper.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.threegap.bitnagil.data.auth.mapper - -import com.threegap.bitnagil.data.auth.model.request.TermsAgreementRequestDto -import com.threegap.bitnagil.data.auth.model.response.LoginResponseDto -import com.threegap.bitnagil.domain.auth.model.AuthSession -import com.threegap.bitnagil.domain.auth.model.TermsAgreement - -// toDomain -internal fun LoginResponseDto.toDomain() = - AuthSession( - accessToken = this.accessToken, - refreshToken = this.refreshToken, - role = this.role, - ) - -// toDto -internal fun TermsAgreement.toDto() = - TermsAgreementRequestDto( - agreedToTermsOfService = this.agreedToTermsOfService, - agreedToPrivacyPolicy = this.agreedToPrivacyPolicy, - isOverFourteen = this.isOverFourteen, - ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/auth/model/request/LoginRequestDto.kt b/data/src/main/java/com/threegap/bitnagil/data/auth/model/request/LoginRequest.kt similarity index 88% rename from data/src/main/java/com/threegap/bitnagil/data/auth/model/request/LoginRequestDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/auth/model/request/LoginRequest.kt index 9ffbb088..aad59938 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/auth/model/request/LoginRequestDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/auth/model/request/LoginRequest.kt @@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class LoginRequestDto( +data class LoginRequest( @SerialName("socialType") val socialType: String, ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/auth/model/request/TermsAgreementRequestDto.kt b/data/src/main/java/com/threegap/bitnagil/data/auth/model/request/TermsAgreementRequest.kt similarity index 53% rename from data/src/main/java/com/threegap/bitnagil/data/auth/model/request/TermsAgreementRequestDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/auth/model/request/TermsAgreementRequest.kt index 170b994a..5a7210c1 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/auth/model/request/TermsAgreementRequestDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/auth/model/request/TermsAgreementRequest.kt @@ -1,10 +1,11 @@ package com.threegap.bitnagil.data.auth.model.request +import com.threegap.bitnagil.domain.auth.model.TermsAgreement import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class TermsAgreementRequestDto( +data class TermsAgreementRequest( @SerialName("agreedToTermsOfService") val agreedToTermsOfService: Boolean, @SerialName("agreedToPrivacyPolicy") @@ -12,3 +13,10 @@ data class TermsAgreementRequestDto( @SerialName("isOverFourteen") val isOverFourteen: Boolean, ) + +internal fun TermsAgreement.toDto() = + TermsAgreementRequest( + agreedToTermsOfService = this.agreedToTermsOfService, + agreedToPrivacyPolicy = this.agreedToPrivacyPolicy, + isOverFourteen = this.isOverFourteen, + ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/auth/model/response/LoginResponseDto.kt b/data/src/main/java/com/threegap/bitnagil/data/auth/model/response/LoginResponse.kt similarity index 59% rename from data/src/main/java/com/threegap/bitnagil/data/auth/model/response/LoginResponseDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/auth/model/response/LoginResponse.kt index 8542f22f..84c14892 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/auth/model/response/LoginResponseDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/auth/model/response/LoginResponse.kt @@ -1,11 +1,12 @@ package com.threegap.bitnagil.data.auth.model.response +import com.threegap.bitnagil.domain.auth.model.AuthSession import com.threegap.bitnagil.domain.auth.model.UserRole import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class LoginResponseDto( +data class LoginResponse( @SerialName("accessToken") val accessToken: String, @SerialName("refreshToken") @@ -13,3 +14,10 @@ data class LoginResponseDto( @SerialName("role") val role: UserRole, ) + +internal fun LoginResponse.toDomain() = + AuthSession( + accessToken = this.accessToken, + refreshToken = this.refreshToken, + role = this.role, + ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/auth/repositoryimpl/AuthRepositoryImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/auth/repositoryimpl/AuthRepositoryImpl.kt index 5901ed92..1ad4b1d8 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/auth/repositoryimpl/AuthRepositoryImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/auth/repositoryimpl/AuthRepositoryImpl.kt @@ -2,9 +2,9 @@ package com.threegap.bitnagil.data.auth.repositoryimpl import com.threegap.bitnagil.data.auth.datasource.AuthLocalDataSource import com.threegap.bitnagil.data.auth.datasource.AuthRemoteDataSource -import com.threegap.bitnagil.data.auth.mapper.toDomain -import com.threegap.bitnagil.data.auth.mapper.toDto -import com.threegap.bitnagil.data.auth.model.request.LoginRequestDto +import com.threegap.bitnagil.data.auth.model.request.LoginRequest +import com.threegap.bitnagil.data.auth.model.request.toDto +import com.threegap.bitnagil.data.auth.model.response.toDomain import com.threegap.bitnagil.domain.auth.model.AuthSession import com.threegap.bitnagil.domain.auth.model.TermsAgreement import com.threegap.bitnagil.domain.auth.repository.AuthRepository @@ -15,7 +15,7 @@ class AuthRepositoryImpl @Inject constructor( private val authLocalDataSource: AuthLocalDataSource, ) : AuthRepository { override suspend fun login(socialAccessToken: String, socialType: String): Result = - authRemoteDataSource.login(socialAccessToken, LoginRequestDto(socialType)) + authRemoteDataSource.login(socialAccessToken, LoginRequest(socialType)) .map { it.toDomain() } override suspend fun submitAgreement(termsAgreement: TermsAgreement): Result = diff --git a/data/src/main/java/com/threegap/bitnagil/data/auth/service/AuthService.kt b/data/src/main/java/com/threegap/bitnagil/data/auth/service/AuthService.kt index e360c61c..8b74dc6a 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/auth/service/AuthService.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/auth/service/AuthService.kt @@ -1,9 +1,9 @@ package com.threegap.bitnagil.data.auth.service -import com.threegap.bitnagil.data.auth.model.request.LoginRequestDto -import com.threegap.bitnagil.data.auth.model.request.TermsAgreementRequestDto +import com.threegap.bitnagil.data.auth.model.request.LoginRequest +import com.threegap.bitnagil.data.auth.model.request.TermsAgreementRequest import com.threegap.bitnagil.data.auth.model.request.WithdrawalReasonRequest -import com.threegap.bitnagil.data.auth.model.response.LoginResponseDto +import com.threegap.bitnagil.data.auth.model.response.LoginResponse import com.threegap.bitnagil.network.model.BaseResponse import retrofit2.http.Body import retrofit2.http.Header @@ -15,12 +15,12 @@ interface AuthService { @Headers("No-Service-Token: true") suspend fun postLogin( @Header("SocialAccessToken") socialAccessToken: String, - @Body loginRequestDto: LoginRequestDto, - ): BaseResponse + @Body loginRequest: LoginRequest, + ): BaseResponse @POST("/api/v1/auth/agreements") suspend fun submitAgreement( - @Body termsAgreementRequestDto: TermsAgreementRequestDto, + @Body termsAgreementRequest: TermsAgreementRequest, ): BaseResponse @POST("/api/v1/auth/withdrawal") @@ -33,5 +33,5 @@ interface AuthService { @Headers("No-Service-Token: true", "Auto-Login: true") suspend fun postReissueToken( @Header("Refresh-Token") refreshToken: String, - ): BaseResponse + ): BaseResponse } diff --git a/data/src/main/java/com/threegap/bitnagil/data/file/datasource/FileDataSource.kt b/data/src/main/java/com/threegap/bitnagil/data/file/datasource/FileDataSource.kt index 62bf670b..5b90a804 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/file/datasource/FileDataSource.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/file/datasource/FileDataSource.kt @@ -1,6 +1,6 @@ package com.threegap.bitnagil.data.file.datasource -import com.threegap.bitnagil.data.file.model.request.FileInfoRequestDto +import com.threegap.bitnagil.data.file.model.request.FileInfoRequest interface FileDataSource { /** @@ -8,5 +8,5 @@ interface FileDataSource { * @param fileInfos 파일 정보 리스트 (prefix + fileName) * @return key: S3 경로, value: presigned URL */ - suspend fun fetchPresignedUrls(fileInfos: List): Result> + suspend fun fetchPresignedUrls(fileInfos: List): Result> } diff --git a/data/src/main/java/com/threegap/bitnagil/data/file/datasourceImpl/FileDataSourceImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/file/datasourceImpl/FileDataSourceImpl.kt index b584d017..1e159cdc 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/file/datasourceImpl/FileDataSourceImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/file/datasourceImpl/FileDataSourceImpl.kt @@ -2,14 +2,14 @@ package com.threegap.bitnagil.data.file.datasourceImpl import com.threegap.bitnagil.data.common.safeApiCall import com.threegap.bitnagil.data.file.datasource.FileDataSource -import com.threegap.bitnagil.data.file.model.request.FileInfoRequestDto +import com.threegap.bitnagil.data.file.model.request.FileInfoRequest import com.threegap.bitnagil.data.file.service.FileService import javax.inject.Inject class FileDataSourceImpl @Inject constructor( private val fileService: FileService, ) : FileDataSource { - override suspend fun fetchPresignedUrls(fileInfos: List): Result> { + override suspend fun fetchPresignedUrls(fileInfos: List): Result> { return safeApiCall { fileService.fetchPresignedUrls(fileInfos) } } } diff --git a/data/src/main/java/com/threegap/bitnagil/data/file/model/request/FileInfoRequestDto.kt b/data/src/main/java/com/threegap/bitnagil/data/file/model/request/FileInfoRequest.kt similarity index 89% rename from data/src/main/java/com/threegap/bitnagil/data/file/model/request/FileInfoRequestDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/file/model/request/FileInfoRequest.kt index abbc4049..f3a4e895 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/file/model/request/FileInfoRequestDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/file/model/request/FileInfoRequest.kt @@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class FileInfoRequestDto( +data class FileInfoRequest( @SerialName("prefix") val prefix: String, @SerialName("fileName") diff --git a/data/src/main/java/com/threegap/bitnagil/data/file/repositoryImpl/FileRepositoryImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/file/repositoryImpl/FileRepositoryImpl.kt index dcfb0658..595641d4 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/file/repositoryImpl/FileRepositoryImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/file/repositoryImpl/FileRepositoryImpl.kt @@ -1,7 +1,7 @@ package com.threegap.bitnagil.data.file.repositoryImpl import com.threegap.bitnagil.data.file.datasource.FileDataSource -import com.threegap.bitnagil.data.file.model.request.FileInfoRequestDto +import com.threegap.bitnagil.data.file.model.request.FileInfoRequest import com.threegap.bitnagil.data.file.uploader.ImageUploader import com.threegap.bitnagil.domain.file.model.ImageFile import com.threegap.bitnagil.domain.file.repository.FileRepository @@ -17,7 +17,7 @@ class FileRepositoryImpl @Inject constructor( override suspend fun uploadImages(imageFiles: List): Result> { return runCatching { val fileInfos = imageFiles.map { imageFile -> - FileInfoRequestDto(prefix = imageFile.prefix, fileName = imageFile.name) + FileInfoRequest(prefix = imageFile.prefix, fileName = imageFile.name) } val presignedUrlMap: Map = fileDataSource diff --git a/data/src/main/java/com/threegap/bitnagil/data/file/service/FileService.kt b/data/src/main/java/com/threegap/bitnagil/data/file/service/FileService.kt index 240fe324..a3922cc2 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/file/service/FileService.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/file/service/FileService.kt @@ -1,6 +1,6 @@ package com.threegap.bitnagil.data.file.service -import com.threegap.bitnagil.data.file.model.request.FileInfoRequestDto +import com.threegap.bitnagil.data.file.model.request.FileInfoRequest import com.threegap.bitnagil.network.model.BaseResponse import retrofit2.http.Body import retrofit2.http.POST @@ -8,6 +8,6 @@ import retrofit2.http.POST interface FileService { @POST("/api/v2/files/presigned-urls") suspend fun fetchPresignedUrls( - @Body fileInfos: List, + @Body fileInfos: List, ): BaseResponse> } diff --git a/data/src/main/java/com/threegap/bitnagil/data/report/datasource/ReportDataSource.kt b/data/src/main/java/com/threegap/bitnagil/data/report/datasource/ReportDataSource.kt index 82cdf53a..c2fa87bf 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/report/datasource/ReportDataSource.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/report/datasource/ReportDataSource.kt @@ -1,11 +1,11 @@ package com.threegap.bitnagil.data.report.datasource -import com.threegap.bitnagil.data.report.model.request.ReportRequestDto -import com.threegap.bitnagil.data.report.model.response.ReportDetailDto -import com.threegap.bitnagil.data.report.model.response.ReportHistoriesPerDateDto +import com.threegap.bitnagil.data.report.model.request.ReportRequest +import com.threegap.bitnagil.data.report.model.response.ReportDetailResponse +import com.threegap.bitnagil.data.report.model.response.ReportHistoriesPerDateResponse interface ReportDataSource { - suspend fun submitReport(reportRequestDto: ReportRequestDto): Result - suspend fun getReports(): Result - suspend fun getReport(reportId: String): Result + suspend fun submitReport(reportRequest: ReportRequest): Result + suspend fun getReports(): Result + suspend fun getReport(reportId: String): Result } diff --git a/data/src/main/java/com/threegap/bitnagil/data/report/datasourceImpl/ReportDataSourceImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/report/datasourceImpl/ReportDataSourceImpl.kt index 0351d514..f0651adb 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/report/datasourceImpl/ReportDataSourceImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/report/datasourceImpl/ReportDataSourceImpl.kt @@ -2,24 +2,24 @@ package com.threegap.bitnagil.data.report.datasourceImpl import com.threegap.bitnagil.data.common.safeApiCall import com.threegap.bitnagil.data.report.datasource.ReportDataSource -import com.threegap.bitnagil.data.report.model.request.ReportRequestDto -import com.threegap.bitnagil.data.report.model.response.ReportDetailDto -import com.threegap.bitnagil.data.report.model.response.ReportHistoriesPerDateDto +import com.threegap.bitnagil.data.report.model.request.ReportRequest +import com.threegap.bitnagil.data.report.model.response.ReportDetailResponse +import com.threegap.bitnagil.data.report.model.response.ReportHistoriesPerDateResponse import com.threegap.bitnagil.data.report.service.ReportService import javax.inject.Inject class ReportDataSourceImpl @Inject constructor( private val reportService: ReportService, ) : ReportDataSource { - override suspend fun submitReport(reportRequestDto: ReportRequestDto): Result { - return safeApiCall { reportService.submitReport(reportRequestDto) } + override suspend fun submitReport(reportRequest: ReportRequest): Result { + return safeApiCall { reportService.submitReport(reportRequest) } } - override suspend fun getReports(): Result { + override suspend fun getReports(): Result { return safeApiCall { reportService.getReports() } } - override suspend fun getReport(reportId: String): Result { + override suspend fun getReport(reportId: String): Result { return safeApiCall { reportService.getReport(reportId = reportId) } } } diff --git a/data/src/main/java/com/threegap/bitnagil/data/report/model/request/ReportRequestDto.kt b/data/src/main/java/com/threegap/bitnagil/data/report/model/request/ReportRequest.kt similarity index 91% rename from data/src/main/java/com/threegap/bitnagil/data/report/model/request/ReportRequestDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/report/model/request/ReportRequest.kt index e35790ff..238a0151 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/report/model/request/ReportRequestDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/report/model/request/ReportRequest.kt @@ -6,7 +6,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class ReportRequestDto( +data class ReportRequest( @SerialName("reportTitle") val reportTitle: String, @SerialName("reportContent") @@ -23,8 +23,8 @@ data class ReportRequestDto( val longitude: Double, ) -fun Report.toDto(): ReportRequestDto { - return ReportRequestDto( +fun Report.toDto(): ReportRequest { + return ReportRequest( reportTitle = this.title, reportContent = this.content, reportCategory = this.category, diff --git a/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportDetailDto.kt b/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportDetailResponse.kt similarity index 92% rename from data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportDetailDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportDetailResponse.kt index db949bfc..48e1801e 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportDetailDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportDetailResponse.kt @@ -8,7 +8,7 @@ import kotlinx.serialization.Serializable import java.time.LocalDate @Serializable -class ReportDetailDto( +class ReportDetailResponse( @SerialName("reportDate") val reportDate: String, @SerialName("reportStatus") @@ -25,7 +25,7 @@ class ReportDetailDto( val reportImageUrls: List, ) -fun ReportDetailDto.toDomain(id: String?): ReportDetail = +fun ReportDetailResponse.toDomain(id: String?): ReportDetail = ReportDetail( id = id ?: "", date = LocalDate.parse(this.reportDate), diff --git a/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportHistoriesPerDateDto.kt b/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportHistoriesPerDateResponse.kt similarity index 69% rename from data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportHistoriesPerDateDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportHistoriesPerDateResponse.kt index 27577b76..6933e595 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportHistoriesPerDateDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportHistoriesPerDateResponse.kt @@ -6,12 +6,12 @@ import kotlinx.serialization.Serializable import java.time.LocalDate @Serializable -data class ReportHistoriesPerDateDto( +data class ReportHistoriesPerDateResponse( @SerialName("reportInfos") - val reportInfos: Map>, + val reportInfos: Map>, ) -fun ReportHistoriesPerDateDto.toDomainMap(): Map> = +fun ReportHistoriesPerDateResponse.toDomainMap(): Map> = this.reportInfos .mapKeys { LocalDate.parse(it.key) } .mapValues { entry -> diff --git a/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportItemDto.kt b/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportItemResponse.kt similarity index 92% rename from data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportItemDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportItemResponse.kt index aca22611..e413c273 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportItemDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportItemResponse.kt @@ -7,7 +7,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class ReportItemDto( +data class ReportItemResponse( @SerialName("reportId") val reportId: Int, @SerialName("reportStatus") @@ -22,7 +22,7 @@ data class ReportItemDto( val reportImageUrl: String, ) -fun ReportItemDto.toDomain(): ReportItem = +fun ReportItemResponse.toDomain(): ReportItem = ReportItem( id = this.reportId, status = this.reportStatus, diff --git a/data/src/main/java/com/threegap/bitnagil/data/report/service/ReportService.kt b/data/src/main/java/com/threegap/bitnagil/data/report/service/ReportService.kt index f89d71de..0bc35bf4 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/report/service/ReportService.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/report/service/ReportService.kt @@ -1,8 +1,8 @@ package com.threegap.bitnagil.data.report.service -import com.threegap.bitnagil.data.report.model.request.ReportRequestDto -import com.threegap.bitnagil.data.report.model.response.ReportDetailDto -import com.threegap.bitnagil.data.report.model.response.ReportHistoriesPerDateDto +import com.threegap.bitnagil.data.report.model.request.ReportRequest +import com.threegap.bitnagil.data.report.model.response.ReportDetailResponse +import com.threegap.bitnagil.data.report.model.response.ReportHistoriesPerDateResponse import com.threegap.bitnagil.network.model.BaseResponse import retrofit2.http.Body import retrofit2.http.GET @@ -12,14 +12,14 @@ import retrofit2.http.Path interface ReportService { @POST("/api/v2/reports") suspend fun submitReport( - @Body reportRequestDto: ReportRequestDto, + @Body reportRequest: ReportRequest, ): BaseResponse @GET("/api/v2/reports") - suspend fun getReports(): BaseResponse + suspend fun getReports(): BaseResponse @GET("/api/v2/reports/{reportId}") suspend fun getReport( @Path("reportId") reportId: String, - ): BaseResponse + ): BaseResponse } diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/datasource/RoutineRemoteDataSource.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/datasource/RoutineRemoteDataSource.kt index 6b3e2cb9..9df14a8c 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/datasource/RoutineRemoteDataSource.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/datasource/RoutineRemoteDataSource.kt @@ -1,12 +1,12 @@ package com.threegap.bitnagil.data.routine.datasource -import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequestDto +import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequest import com.threegap.bitnagil.data.routine.model.response.RoutineResponse import com.threegap.bitnagil.data.routine.model.response.RoutineScheduleResponse interface RoutineRemoteDataSource { suspend fun fetchWeeklyRoutines(startDate: String, endDate: String): Result - suspend fun syncRoutineCompletion(routineCompletionRequestDto: RoutineCompletionRequestDto): Result + suspend fun syncRoutineCompletion(routineCompletionRequest: RoutineCompletionRequest): Result suspend fun getRoutine(routineId: String): Result suspend fun deleteRoutine(routineId: String): Result suspend fun deleteRoutineForDay(routineId: String): Result diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/datasourceImpl/RoutineRemoteDataSourceImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/datasourceImpl/RoutineRemoteDataSourceImpl.kt index 59218f88..8d683be5 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/datasourceImpl/RoutineRemoteDataSourceImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/datasourceImpl/RoutineRemoteDataSourceImpl.kt @@ -3,7 +3,7 @@ package com.threegap.bitnagil.data.routine.datasourceImpl import com.threegap.bitnagil.data.common.safeApiCall import com.threegap.bitnagil.data.common.safeUnitApiCall import com.threegap.bitnagil.data.routine.datasource.RoutineRemoteDataSource -import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequestDto +import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequest import com.threegap.bitnagil.data.routine.model.response.RoutineResponse import com.threegap.bitnagil.data.routine.model.response.RoutineScheduleResponse import com.threegap.bitnagil.data.routine.service.RoutineService @@ -17,9 +17,9 @@ class RoutineRemoteDataSourceImpl @Inject constructor( routineService.fetchRoutineSchedule(startDate, endDate) } - override suspend fun syncRoutineCompletion(routineCompletionRequestDto: RoutineCompletionRequestDto): Result = + override suspend fun syncRoutineCompletion(routineCompletionRequest: RoutineCompletionRequest): Result = safeUnitApiCall { - routineService.routineCompletion(routineCompletionRequestDto) + routineService.routineCompletion(routineCompletionRequest) } override suspend fun getRoutine(routineId: String): Result = diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionInfoDto.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionInfoRequest.kt similarity index 89% rename from data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionInfoDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionInfoRequest.kt index 06427e87..cd72b9b0 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionInfoDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionInfoRequest.kt @@ -5,7 +5,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class RoutineCompletionInfoDto( +data class RoutineCompletionInfoRequest( @SerialName("routineId") val routineId: String, @SerialName("routineCompleteYn") @@ -15,7 +15,7 @@ data class RoutineCompletionInfoDto( ) internal fun RoutineCompletionInfo.toDto() = - RoutineCompletionInfoDto( + RoutineCompletionInfoRequest( routineId = this.routineId, routineCompleteYn = this.routineCompleteYn, subRoutineCompleteYn = this.subRoutineCompleteYn, diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionRequestDto.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionRequest.kt similarity index 74% rename from data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionRequestDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionRequest.kt index 464e0d93..80f9075c 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionRequestDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/model/request/RoutineCompletionRequest.kt @@ -5,12 +5,12 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class RoutineCompletionRequestDto( +data class RoutineCompletionRequest( @SerialName("routineCompletionInfos") - val routineCompletionInfos: List, + val routineCompletionInfos: List, ) internal fun RoutineCompletionInfos.toDto() = - RoutineCompletionRequestDto( + RoutineCompletionRequest( routineCompletionInfos = this.routineCompletionInfos.map { it.toDto() }, ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/model/request/SubRoutineDeletionInfoDto.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/model/request/SubRoutineDeletionInfoDto.kt deleted file mode 100644 index f10463ec..00000000 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/model/request/SubRoutineDeletionInfoDto.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.threegap.bitnagil.data.routine.model.request - -import com.threegap.bitnagil.domain.routine.model.SubRoutineDeletionInfo -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -@Serializable -data class SubRoutineDeletionInfoDto( - @SerialName("routineCompletionId") - val routineCompletionId: Int?, - @SerialName("subRoutineId") - val subRoutineId: String, -) - -fun SubRoutineDeletionInfo.toDto() = - SubRoutineDeletionInfoDto( - routineCompletionId = this.routineCompletionId, - subRoutineId = this.subRoutineId, - ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/routine/service/RoutineService.kt b/data/src/main/java/com/threegap/bitnagil/data/routine/service/RoutineService.kt index dcfd98de..fc504e9b 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/routine/service/RoutineService.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/routine/service/RoutineService.kt @@ -1,6 +1,6 @@ package com.threegap.bitnagil.data.routine.service -import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequestDto +import com.threegap.bitnagil.data.routine.model.request.RoutineCompletionRequest import com.threegap.bitnagil.data.routine.model.response.RoutineResponse import com.threegap.bitnagil.data.routine.model.response.RoutineScheduleResponse import com.threegap.bitnagil.network.model.BaseResponse @@ -25,7 +25,7 @@ interface RoutineService { @PUT("/api/v2/routines/completions") suspend fun routineCompletion( - @Body request: RoutineCompletionRequestDto, + @Body request: RoutineCompletionRequest, ): BaseResponse @DELETE("/api/v1/routines/{routineId}") diff --git a/data/src/main/java/com/threegap/bitnagil/data/user/datasource/UserDataSource.kt b/data/src/main/java/com/threegap/bitnagil/data/user/datasource/UserDataSource.kt index 55cac914..c492b8e0 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/user/datasource/UserDataSource.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/user/datasource/UserDataSource.kt @@ -1,7 +1,7 @@ package com.threegap.bitnagil.data.user.datasource -import com.threegap.bitnagil.data.user.model.response.UserProfileResponseDto +import com.threegap.bitnagil.data.user.model.response.UserProfileResponse interface UserDataSource { - suspend fun fetchUserProfile(): Result + suspend fun fetchUserProfile(): Result } diff --git a/data/src/main/java/com/threegap/bitnagil/data/user/datasourceImpl/UserDataSourceImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/user/datasourceImpl/UserDataSourceImpl.kt index dbde8d74..9b7f9190 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/user/datasourceImpl/UserDataSourceImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/user/datasourceImpl/UserDataSourceImpl.kt @@ -2,14 +2,14 @@ package com.threegap.bitnagil.data.user.datasourceImpl import com.threegap.bitnagil.data.common.safeApiCall import com.threegap.bitnagil.data.user.datasource.UserDataSource -import com.threegap.bitnagil.data.user.model.response.UserProfileResponseDto +import com.threegap.bitnagil.data.user.model.response.UserProfileResponse import com.threegap.bitnagil.data.user.service.UserService import javax.inject.Inject class UserDataSourceImpl @Inject constructor( private val userService: UserService, ) : UserDataSource { - override suspend fun fetchUserProfile(): Result = + override suspend fun fetchUserProfile(): Result = safeApiCall { userService.fetchUserProfile() } diff --git a/data/src/main/java/com/threegap/bitnagil/data/user/model/response/UserProfileResponseDto.kt b/data/src/main/java/com/threegap/bitnagil/data/user/model/response/UserProfileResponse.kt similarity index 81% rename from data/src/main/java/com/threegap/bitnagil/data/user/model/response/UserProfileResponseDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/user/model/response/UserProfileResponse.kt index 5f3749d2..1c9b4c2f 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/user/model/response/UserProfileResponseDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/user/model/response/UserProfileResponse.kt @@ -5,12 +5,12 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class UserProfileResponseDto( +data class UserProfileResponse( @SerialName("nickname") val nickname: String, ) -fun UserProfileResponseDto.toDomain() = +fun UserProfileResponse.toDomain() = UserProfile( nickname = this.nickname, ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/user/service/UserService.kt b/data/src/main/java/com/threegap/bitnagil/data/user/service/UserService.kt index d2fc21db..39b6147d 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/user/service/UserService.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/user/service/UserService.kt @@ -1,10 +1,10 @@ package com.threegap.bitnagil.data.user.service -import com.threegap.bitnagil.data.user.model.response.UserProfileResponseDto +import com.threegap.bitnagil.data.user.model.response.UserProfileResponse import com.threegap.bitnagil.network.model.BaseResponse import retrofit2.http.GET interface UserService { @GET("/api/v1/users/infos") - suspend fun fetchUserProfile(): BaseResponse + suspend fun fetchUserProfile(): BaseResponse } diff --git a/data/src/main/java/com/threegap/bitnagil/data/version/datasource/VersionDataSource.kt b/data/src/main/java/com/threegap/bitnagil/data/version/datasource/VersionDataSource.kt index bfdaf968..c6e5ec24 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/version/datasource/VersionDataSource.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/version/datasource/VersionDataSource.kt @@ -1,7 +1,7 @@ package com.threegap.bitnagil.data.version.datasource -import com.threegap.bitnagil.data.version.model.response.VersionCheckResponseDto +import com.threegap.bitnagil.data.version.model.response.VersionCheckResponse interface VersionDataSource { - suspend fun checkVersion(): Result + suspend fun checkVersion(): Result } diff --git a/data/src/main/java/com/threegap/bitnagil/data/version/datasourceImpl/VersionDataSourceImpl.kt b/data/src/main/java/com/threegap/bitnagil/data/version/datasourceImpl/VersionDataSourceImpl.kt index e83a11e6..1726afd5 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/version/datasourceImpl/VersionDataSourceImpl.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/version/datasourceImpl/VersionDataSourceImpl.kt @@ -3,7 +3,7 @@ package com.threegap.bitnagil.data.version.datasourceImpl import com.threegap.bitnagil.data.BuildConfig import com.threegap.bitnagil.data.common.safeApiCall import com.threegap.bitnagil.data.version.datasource.VersionDataSource -import com.threegap.bitnagil.data.version.model.response.VersionCheckResponseDto +import com.threegap.bitnagil.data.version.model.response.VersionCheckResponse import com.threegap.bitnagil.data.version.service.VersionService import javax.inject.Inject @@ -11,7 +11,7 @@ class VersionDataSourceImpl @Inject constructor( private val versionService: VersionService, ) : VersionDataSource { - override suspend fun checkVersion(): Result = + override suspend fun checkVersion(): Result = safeApiCall { versionService.checkVersion( majorVersion = BuildConfig.VERSION_MAJOR, diff --git a/data/src/main/java/com/threegap/bitnagil/data/version/model/response/VersionCheckResponseDto.kt b/data/src/main/java/com/threegap/bitnagil/data/version/model/response/VersionCheckResponse.kt similarity index 82% rename from data/src/main/java/com/threegap/bitnagil/data/version/model/response/VersionCheckResponseDto.kt rename to data/src/main/java/com/threegap/bitnagil/data/version/model/response/VersionCheckResponse.kt index c31481e8..3b8503c7 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/version/model/response/VersionCheckResponseDto.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/version/model/response/VersionCheckResponse.kt @@ -5,12 +5,12 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class VersionCheckResponseDto( +data class VersionCheckResponse( @SerialName("forceUpdateYn") val forceUpdateYn: Boolean, ) -fun VersionCheckResponseDto.toDomain() = +fun VersionCheckResponse.toDomain() = UpdateRequirement( isForced = this.forceUpdateYn, ) diff --git a/data/src/main/java/com/threegap/bitnagil/data/version/service/VersionService.kt b/data/src/main/java/com/threegap/bitnagil/data/version/service/VersionService.kt index 4f8441b4..c5204633 100644 --- a/data/src/main/java/com/threegap/bitnagil/data/version/service/VersionService.kt +++ b/data/src/main/java/com/threegap/bitnagil/data/version/service/VersionService.kt @@ -1,6 +1,6 @@ package com.threegap.bitnagil.data.version.service -import com.threegap.bitnagil.data.version.model.response.VersionCheckResponseDto +import com.threegap.bitnagil.data.version.model.response.VersionCheckResponse import com.threegap.bitnagil.network.model.BaseResponse import retrofit2.http.GET import retrofit2.http.Query @@ -11,5 +11,5 @@ interface VersionService { @Query("major") majorVersion: Int, @Query("minor") minorVersion: Int, @Query("patch") patchVersion: Int, - ): BaseResponse + ): BaseResponse } From a0544e113516ed2e6ab986dc66bde39a937a7230 Mon Sep 17 00:00:00 2001 From: wjdrjs00 Date: Sun, 15 Feb 2026 21:43:04 +0900 Subject: [PATCH 31/31] =?UTF-8?q?Chore:=20=EB=A6=B0=ED=8A=B8=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 --- .../threegap/bitnagil/presentation/emotion/EmotionViewModel.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt index 468e7840..2f6a6c89 100644 --- a/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt +++ b/presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt @@ -8,9 +8,7 @@ import com.threegap.bitnagil.domain.emotion.usecase.RegisterEmotionUseCase import com.threegap.bitnagil.domain.onboarding.usecase.RegisterRecommendOnBoardingRoutinesUseCase import com.threegap.bitnagil.presentation.emotion.contract.EmotionSideEffect import com.threegap.bitnagil.presentation.emotion.contract.EmotionState -import com.threegap.bitnagil.presentation.emotion.model.EmotionRecommendRoutineUiModel import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep -import com.threegap.bitnagil.presentation.emotion.model.EmotionUiModel import com.threegap.bitnagil.presentation.emotion.model.toUiModel import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.delay