Skip to content

Commit 647d4ed

Browse files
committed
FIX: 루틴 수정/작성 useCase와 repository에서 시작/종료일자를 nullable하지 않도록 수정, 날자 선택 바텀시트에서 월을 변경해도 초기 달력이 항상 유지되던 문제 수정
1 parent 4efe102 commit 647d4ed

5 files changed

Lines changed: 20 additions & 20 deletions

File tree

data/src/main/java/com/threegap/bitnagil/data/writeroutine/repositoryImpl/WriteRoutineRepositoryImpl.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ class WriteRoutineRepositoryImpl @Inject constructor(
2121
name: String,
2222
repeatDay: List<RepeatDay>,
2323
startTime: Time,
24-
startDate: Date?,
25-
endDate: Date?,
24+
startDate: Date,
25+
endDate: Date,
2626
subRoutines: List<String>,
2727
): Result<Unit> {
2828
val request = RegisterRoutineRequest(
2929
routineName = name,
3030
repeatDay = repeatDay.map { it.fullName },
3131
executionTime = startTime.toFormattedString(),
32-
routineStartDate = startDate?.toFormattedString(),
33-
routineEndDate = endDate?.toFormattedString(),
32+
routineStartDate = startDate.toFormattedString(),
33+
routineEndDate = endDate.toFormattedString(),
3434
subRoutineName = subRoutines,
3535
)
3636
return writeRoutineDataSource.registerRoutine(request).also {
@@ -46,8 +46,8 @@ class WriteRoutineRepositoryImpl @Inject constructor(
4646
name: String,
4747
repeatDay: List<RepeatDay>,
4848
startTime: Time,
49-
startDate: Date?,
50-
endDate: Date?,
49+
startDate: Date,
50+
endDate: Date,
5151
subRoutines: List<String>,
5252
): Result<Unit> {
5353
val request = EditRoutineRequest(
@@ -56,8 +56,8 @@ class WriteRoutineRepositoryImpl @Inject constructor(
5656
routineName = name,
5757
repeatDay = repeatDay.map { it.fullName },
5858
executionTime = startTime.toFormattedString(),
59-
routineStartDate = startDate?.toFormattedString(),
60-
routineEndDate = endDate?.toFormattedString(),
59+
routineStartDate = startDate.toFormattedString(),
60+
routineEndDate = endDate.toFormattedString(),
6161
subRoutineName = subRoutines,
6262
)
6363

domain/src/main/java/com/threegap/bitnagil/domain/writeroutine/repository/WriteRoutineRepository.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ interface WriteRoutineRepository {
1212
name: String,
1313
repeatDay: List<RepeatDay>,
1414
startTime: Time,
15-
startDate: Date?,
16-
endDate: Date?,
15+
startDate: Date,
16+
endDate: Date,
1717
subRoutines: List<String>,
1818
): Result<Unit>
1919

@@ -23,8 +23,8 @@ interface WriteRoutineRepository {
2323
name: String,
2424
repeatDay: List<RepeatDay>,
2525
startTime: Time,
26-
startDate: Date?,
27-
endDate: Date?,
26+
startDate: Date,
27+
endDate: Date,
2828
subRoutines: List<String>,
2929
): Result<Unit>
3030

domain/src/main/java/com/threegap/bitnagil/domain/writeroutine/usecase/EditRoutineUseCase.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class EditRoutineUseCase @Inject constructor(
1616
name: String,
1717
repeatDay: List<RepeatDay>,
1818
startTime: Time,
19-
startDate: Date?,
20-
endDate: Date?,
19+
startDate: Date,
20+
endDate: Date,
2121
subRoutines: List<String>,
2222
): Result<Unit> {
2323
return writeRoutineRepository.editRoutine(

domain/src/main/java/com/threegap/bitnagil/domain/writeroutine/usecase/RegisterRoutineUseCase.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class RegisterRoutineUseCase @Inject constructor(
1313
name: String,
1414
repeatDay: List<RepeatDay>,
1515
startTime: Time,
16-
startDate: Date?,
17-
endDate: Date?,
16+
startDate: Date,
17+
endDate: Date,
1818
subRoutines: List<String>,
1919
): Result<Unit> {
2020
return writeRoutineRepository.registerRoutine(

presentation/src/main/java/com/threegap/bitnagil/presentation/writeroutine/component/template/datepickerbottomsheet/DatePickerBottomSheet.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ private fun DatePickerBottomSheetContent(
9595
var currentMonth by remember { mutableIntStateOf(initDate.month) }
9696
var selectedDate by remember { mutableStateOf(initDate) }
9797

98-
val lastDaysOfPrevMonth = remember(initDate) {
99-
CalendarUtils.lastDaysOfPrevMonth(initDate.year, initDate.month)
98+
val lastDaysOfPrevMonth = remember(currentYear, currentMonth) {
99+
CalendarUtils.lastDaysOfPrevMonth(currentYear, currentMonth)
100100
}
101101
val firstDaysOfNextMonth = remember(currentYear, currentMonth) {
102-
CalendarUtils.firstDaysOfNextMonth(initDate.year, initDate.month)
102+
CalendarUtils.firstDaysOfNextMonth(currentYear, currentMonth)
103103
}
104104
val currentDaysOfMonth = remember(currentYear, currentMonth) {
105-
CalendarUtils.getDayAmountOfMonth(initDate.year, initDate.month)
105+
CalendarUtils.getDayAmountOfMonth(currentYear, currentMonth)
106106
}
107107

108108
val prevMonthButtonEnabled by remember(availableStartDate) {

0 commit comments

Comments
 (0)