Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/src/main/java/com/threegap/bitnagil/MainNavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ fun MainNavHost(
)
},
navigateToOnBoarding = {
navigator.navController.navigate(Route.OnBoarding())
navigator.navController.navigate(Route.OnBoarding()) {
popUpTo(0) { inclusive = true }
}
},
navigateToBack = {
if (navigator.navController.previousBackStackEntry != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.LineHeightStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.threegap.bitnagil.designsystem.BitnagilTheme
Expand Down Expand Up @@ -93,7 +94,12 @@ fun BitnagilSelectButton(
Text(
text = title,
color = contentColor,
style = titleTextStyle,
style = titleTextStyle.copy(
lineHeightStyle = LineHeightStyle(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)

description?.let {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ enum class GuideType(
description = "오늘 느끼는 감정을 선택하면, 그 기분에 맞춰 추천 루틴을 확인할 수 있어요.",
image = R.drawable.img_register_guide,
),
HOME_LIST(
title = "홈에서 더보기란?",
description = "루틴리스트에서 세부 항목(세부루틴, 반복, 기간, 시간)을\n확인하고, 필요 시 수정하거나 삭제할 수 있어요.",
image = R.drawable.img_list_guide,
),
RECOMMEND(
title = "맞춤 추천 루틴이란?",
description = "처음 설정한 목표에 맞춰 루틴을 추천받을 수 있으며,\n필요할 때 언제든 수정할 수 있어요.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.threegap.bitnagil.presentation.recommendroutine

import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.viewModelScope
import com.threegap.bitnagil.domain.emotion.usecase.GetEmotionChangeEventFlowUseCase
import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory
import com.threegap.bitnagil.domain.recommendroutine.model.RecommendLevel
import com.threegap.bitnagil.domain.recommendroutine.usecase.FetchRecommendRoutinesUseCase
Expand All @@ -21,13 +22,15 @@ import javax.inject.Inject
class RecommendRoutineViewModel @Inject constructor(
savedStateHandle: SavedStateHandle,
private val fetchRecommendRoutinesUseCase: FetchRecommendRoutinesUseCase,
private val getEmotionChangeEventFlowUseCase: GetEmotionChangeEventFlowUseCase,
) : MviViewModel<RecommendRoutineState, RecommendRoutineSideEffect, RecommendRoutineIntent>(
initState = RecommendRoutineState(),
savedStateHandle = savedStateHandle,
) {

init {
loadRecommendRoutines()
observeEmotionChangeEvent()
}

private var recommendRoutines: RecommendRoutinesUiModel = RecommendRoutinesUiModel()
Expand Down Expand Up @@ -90,6 +93,14 @@ class RecommendRoutineViewModel @Inject constructor(
}
}

private fun observeEmotionChangeEvent() {
viewModelScope.launch {
getEmotionChangeEventFlowUseCase().collect {
loadRecommendRoutines()
}
}
}

private fun loadRecommendRoutines() {
sendIntent(RecommendRoutineIntent.UpdateLoading(true))
viewModelScope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import com.threegap.bitnagil.designsystem.R
import com.threegap.bitnagil.designsystem.component.atom.BitnagilTextButton
import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar
import com.threegap.bitnagil.presentation.common.flow.collectAsEffect
import com.threegap.bitnagil.presentation.common.toast.GlobalBitnagilToast
import com.threegap.bitnagil.presentation.writeroutine.component.atom.namefield.NameField
import com.threegap.bitnagil.presentation.writeroutine.component.atom.selectcell.SelectCell
import com.threegap.bitnagil.presentation.writeroutine.component.atom.writeroutinebutton.WriteRoutineButton
Expand Down Expand Up @@ -57,6 +58,10 @@ fun WriteRoutineScreenContainer(
WriteRoutineSideEffect.MoveToPreviousScreen -> {
navigateToBack()
}

is WriteRoutineSideEffect.ShowToast -> {
GlobalBitnagilToast.showCheck(sideEffect.message)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ class WriteRoutineViewModel @AssistedInject constructor(
}
WriteRoutineIntent.EditRoutineSuccess -> {
sendSideEffect(WriteRoutineSideEffect.MoveToPreviousScreen)
sendSideEffect(WriteRoutineSideEffect.ShowToast("루틴 수정이 완료되었습니다."))

return state.copy(
loading = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import com.threegap.bitnagil.presentation.common.mviviewmodel.MviSideEffect

sealed class WriteRoutineSideEffect : MviSideEffect {
data object MoveToPreviousScreen : WriteRoutineSideEffect()
data class ShowToast(val message: String) : WriteRoutineSideEffect()
}