Skip to content

Commit a0af44e

Browse files
committed
FIX: 세부 항목 수정
- "세부루틴 설정 안 함" 선택시 기존 입력한 세부루틴이 초기화되도록 수정 - 반복요일, 목표 기간을 필수 항목으로 수정 - 시작일/종료일 선택시 선택 범위 해제 - ExpandableContent의 패키지 경로 누락 추가 - Routine 내 routineDeleteYn 변수 추가
1 parent 16cbba8 commit a0af44e

5 files changed

Lines changed: 17 additions & 9 deletions

File tree

data/src/main/java/com/threegap/bitnagil/data/routine/model/response/RoutineDto.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ fun RoutineDto.toDomain(): Routine =
4545
subRoutineNames = this.subRoutineNames,
4646
subRoutineCompleteYn = this.subRoutineCompleteYn,
4747
recommendedRoutineType = RecommendedRoutineType.fromString(this.recommendedRoutineType),
48+
routineDeletedYn = routineDeletedYn,
4849
startDate = this.routineStartDate,
4950
endDate = this.routineEndDate,
5051
)

domain/src/main/java/com/threegap/bitnagil/domain/routine/model/Routine.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ data class Routine(
99
val endDate: String,
1010
val routineDate: String,
1111
val routineCompleteYn: Boolean,
12+
val routineDeletedYn: Boolean,
1213
val subRoutineNames: List<String>,
1314
val subRoutineCompleteYn: List<Boolean>,
1415
val recommendedRoutineType: RecommendedRoutineType?,

presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineScreen.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.threegap.bitnagil.presentation.writeroutine
22

3-
import ExpandableContent
43
import androidx.compose.foundation.background
54
import androidx.compose.foundation.layout.Arrangement
65
import androidx.compose.foundation.layout.Column
@@ -33,12 +32,12 @@ import com.threegap.bitnagil.presentation.common.flow.collectAsEffect
3332
import com.threegap.bitnagil.presentation.writeroutine.component.atom.namefield.NameField
3433
import com.threegap.bitnagil.presentation.writeroutine.component.atom.selectcell.SelectCell
3534
import com.threegap.bitnagil.presentation.writeroutine.component.atom.writeroutinebutton.WriteRoutineButton
35+
import com.threegap.bitnagil.presentation.writeroutine.component.block.expandablecontent.ExpandableContent
3636
import com.threegap.bitnagil.presentation.writeroutine.component.block.labeledcheckbox.LabeledCheckBox
3737
import com.threegap.bitnagil.presentation.writeroutine.component.block.routinedetailrow.RoutineDetailRow
3838
import com.threegap.bitnagil.presentation.writeroutine.component.block.subroutinefield.SubRoutineField
3939
import com.threegap.bitnagil.presentation.writeroutine.component.template.datepickerbottomsheet.DatePickerBottomSheet
4040
import com.threegap.bitnagil.presentation.writeroutine.component.template.timepickerbottomsheet.TimePickerBottomSheet
41-
import com.threegap.bitnagil.presentation.writeroutine.model.Date
4241
import com.threegap.bitnagil.presentation.writeroutine.model.Day
4342
import com.threegap.bitnagil.presentation.writeroutine.model.RepeatType
4443
import com.threegap.bitnagil.presentation.writeroutine.model.Time
@@ -77,8 +76,8 @@ fun WriteRoutineScreenContainer(
7776
onDateSelected = viewModel::setStartDate,
7877
date = state.startDate,
7978
onDismiss = viewModel::hideStartDatePickerBottomSheet,
80-
availableStartDate = Date.now(),
81-
availableEndDate = state.endDate,
79+
availableStartDate = null,
80+
availableEndDate = null,
8281
)
8382
}
8483

@@ -88,7 +87,7 @@ fun WriteRoutineScreenContainer(
8887
onDateSelected = viewModel::setEndDate,
8988
date = state.endDate,
9089
onDismiss = viewModel::hideEndDatePickerBottomSheet,
91-
availableStartDate = state.startDate,
90+
availableStartDate = null,
9291
availableEndDate = null,
9392
)
9493
}
@@ -215,7 +214,7 @@ private fun WriteRoutineScreen(
215214

216215
ExpandableContent(
217216
expand = state.repeatDaysUiExpanded,
218-
required = false,
217+
required = true,
219218
iconResourceId = R.drawable.img_repeat_days,
220219
title = "반복 요일",
221220
placeHolder = "ex) 매주 월,화,수.목,금",
@@ -271,7 +270,7 @@ private fun WriteRoutineScreen(
271270

272271
ExpandableContent(
273272
expand = state.periodUiExpanded,
274-
required = false,
273+
required = true,
275274
iconResourceId = R.drawable.img_routine_period,
276275
title = "목표 기간",
277276
placeHolder = "ex) 25.08.06 - 25.08.06",

presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/WriteRoutineViewModel.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,18 +302,23 @@ class WriteRoutineViewModel @AssistedInject constructor(
302302
}
303303
is WriteRoutineIntent.SetEndDate -> {
304304
return state.copy(
305+
startDate = Date.min(intent.date, state.startDate),
305306
endDate = intent.date,
306307
)
307308
}
308309
is WriteRoutineIntent.SetStartDate -> {
309310
return state.copy(
310311
startDate = intent.date,
312+
endDate = Date.max(intent.date, state.endDate),
311313
)
312314
}
313315

314316
WriteRoutineIntent.SelectNotUseSubRoutines -> {
317+
val toggledSelectNotUseSubRoutines = !state.selectNotUseSUbRoutines
318+
315319
return state.copy(
316-
selectNotUseSUbRoutines = !state.selectNotUseSUbRoutines,
320+
selectNotUseSUbRoutines = toggledSelectNotUseSubRoutines,
321+
subRoutineNames = if (toggledSelectNotUseSubRoutines) listOf("", "", "") else state.subRoutineNames,
317322
)
318323
}
319324
}

presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/component/block/expandablecontent/ExpandableContent.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package com.threegap.bitnagil.presentation.writeroutine.component.block.expandablecontent
2+
13
import androidx.compose.animation.AnimatedVisibility
24
import androidx.compose.animation.animateContentSize
35
import androidx.compose.foundation.Image
@@ -123,7 +125,7 @@ fun ExpandableContent(
123125

124126
@Preview(heightDp = 300)
125127
@Composable
126-
fun ExpandableContentPreview() {
128+
private fun ExpandableContentPreview() {
127129
var isExpanded by remember { mutableStateOf(true) }
128130
var isChecked by remember { mutableStateOf(false) }
129131

0 commit comments

Comments
 (0)