Skip to content

Commit 87a36ab

Browse files
committed
Feat: 루틴 리스트 화면 연결
- route 정의
1 parent e9ea930 commit 87a36ab

7 files changed

Lines changed: 40 additions & 2 deletions

File tree

app/src/main/java/com/threegap/bitnagil/MainNavHost.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import com.threegap.bitnagil.presentation.login.LoginScreenContainer
1212
import com.threegap.bitnagil.presentation.onboarding.OnBoardingScreenContainer
1313
import com.threegap.bitnagil.presentation.onboarding.OnBoardingViewModel
1414
import com.threegap.bitnagil.presentation.onboarding.model.navarg.OnBoardingScreenArg
15+
import com.threegap.bitnagil.presentation.routinelist.RoutineListScreenContainer
1516
import com.threegap.bitnagil.presentation.setting.SettingScreenContainer
1617
import com.threegap.bitnagil.presentation.splash.SplashScreenContainer
1718
import com.threegap.bitnagil.presentation.terms.TermsAgreementScreenContainer
@@ -118,6 +119,13 @@ fun MainNavHost(
118119
navigateToEmotion = {
119120
navigator.navController.navigate(Route.Emotion)
120121
},
122+
navigateToRoutineList = { selectedDate ->
123+
navigator.navController.navigate(
124+
Route.RoutineList(selectedDate = selectedDate)
125+
) {
126+
launchSingleTop = true
127+
}
128+
}
121129
)
122130
}
123131

@@ -241,5 +249,15 @@ fun MainNavHost(
241249
},
242250
)
243251
}
252+
253+
composable<Route.RoutineList> {
254+
RoutineListScreenContainer(
255+
navigateToBack = {
256+
if (navigator.navController.previousBackStackEntry != null) {
257+
navigator.navController.popBackStack()
258+
}
259+
},
260+
)
261+
}
244262
}
245263
}

app/src/main/java/com/threegap/bitnagil/Route.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,7 @@ sealed interface Route {
4141

4242
@Serializable
4343
data object Withdrawal : Route
44+
45+
@Serializable
46+
data class RoutineList(val selectedDate: String) : Route
4447
}

app/src/main/java/com/threegap/bitnagil/navigation/home/HomeNavHost.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ fun HomeNavHost(
4141
navigateToQnA: () -> Unit,
4242
navigateToRegisterRoutine: (String?) -> Unit,
4343
navigateToEmotion: () -> Unit,
44+
navigateToRoutineList: (String) -> Unit,
4445
) {
4546
val navigator = rememberHomeNavigator()
4647
var showFloatingOverlay by remember { mutableStateOf(false) }
@@ -66,6 +67,9 @@ fun HomeNavHost(
6667
navigateToRegisterRoutine(null)
6768
},
6869
navigateToEmotion = navigateToEmotion,
70+
navigateToRoutineList = { selectedDate ->
71+
navigateToRoutineList(selectedDate)
72+
},
6973
)
7074
}
7175

presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeScreen.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ import java.time.LocalDate
3939

4040
@Composable
4141
fun HomeScreenContainer(
42-
viewModel: HomeViewModel = hiltViewModel(),
4342
navigateToRegisterRoutine: () -> Unit,
4443
navigateToEmotion: () -> Unit,
44+
navigateToRoutineList: (String) -> Unit,
45+
viewModel: HomeViewModel = hiltViewModel(),
4546
) {
4647
val uiState by viewModel.stateFlow.collectAsStateWithLifecycle()
4748

@@ -55,6 +56,10 @@ fun HomeScreenContainer(
5556
navigateToEmotion()
5657
}
5758

59+
is HomeSideEffect.NavigateToRoutineList -> {
60+
navigateToRoutineList(sideEffect.selectedDate)
61+
}
62+
5863
is HomeSideEffect.ShowToastWithIcon -> {
5964
GlobalBitnagilToast.showCheck(sideEffect.message)
6065
}
@@ -89,7 +94,7 @@ fun HomeScreenContainer(
8994
viewModel.sendIntent(HomeIntent.OnRegisterEmotionClick)
9095
},
9196
onShowMoreRoutinesClick = {
92-
// TODO: 루틴 리스트 화면으로 이동
97+
viewModel.sendIntent((HomeIntent.OnShowMoreRoutinesClick))
9398
},
9499
)
95100
}

presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ class HomeViewModel @Inject constructor(
120120
null
121121
}
122122

123+
is HomeIntent.OnShowMoreRoutinesClick -> {
124+
val selectedDate = container.stateFlow.value.selectedDate.toString()
125+
sendSideEffect(HomeSideEffect.NavigateToRoutineList(selectedDate))
126+
null
127+
}
128+
123129
is HomeIntent.RoutineToggleCompletionFailure -> {
124130
sendSideEffect(HomeSideEffect.ShowToast("루틴 완료 상태 저장에 실패했어요.\n다시 시도해 주세요."))
125131
null

presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/HomeIntent.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ sealed class HomeIntent : MviIntent {
1616
data object OnRegisterRoutineClick : HomeIntent()
1717
data object OnPreviousWeekClick : HomeIntent()
1818
data object OnNextWeekClick : HomeIntent()
19+
data object OnShowMoreRoutinesClick : HomeIntent()
1920
}

presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/HomeSideEffect.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ sealed interface HomeSideEffect : MviSideEffect {
77
data class ShowToastWithIcon(val message: String) : HomeSideEffect
88
data object NavigateToRegisterRoutine : HomeSideEffect
99
data object NavigateToEmotion : HomeSideEffect
10+
data class NavigateToRoutineList(val selectedDate: String) : HomeSideEffect
1011
}

0 commit comments

Comments
 (0)