Skip to content

Commit a9602ac

Browse files
committed
Chore: 루틴 리스트 관련 UiModel 네이밍 변경
- DayRoutinesUiModel -> DailyRoutinesUiModel - RoutinesUiModel -> RoutineScheduleUiModel - 불필요한 Parcelize 제거
1 parent 289e75c commit a9602ac

6 files changed

Lines changed: 36 additions & 42 deletions

File tree

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/contract/RoutineListState.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.threegap.bitnagil.presentation.routinelist.contract
22

33
import com.threegap.bitnagil.presentation.home.util.getCurrentWeekDays
4+
import com.threegap.bitnagil.presentation.routinelist.model.RoutineScheduleUiModel
45
import com.threegap.bitnagil.presentation.routinelist.model.RoutineUiModel
5-
import com.threegap.bitnagil.presentation.routinelist.model.RoutinesUiModel
66
import java.time.LocalDate
77

88
data class RoutineListState(
99
val isLoading: Boolean,
10-
val routines: RoutinesUiModel,
10+
val routines: RoutineScheduleUiModel,
1111
val selectedRoutine: RoutineUiModel?,
1212
val selectedDate: LocalDate,
1313
val deleteConfirmBottomSheetVisible: Boolean,
@@ -17,12 +17,12 @@ data class RoutineListState(
1717
get() = selectedDate.getCurrentWeekDays()
1818

1919
val selectedDateRoutines: List<RoutineUiModel>
20-
get() = routines.routines[selectedDate.toString()]?.routineList ?: emptyList()
20+
get() = routines.routines[selectedDate.toString()]?.routines ?: emptyList()
2121

2222
companion object {
2323
val INIT = RoutineListState(
2424
isLoading = false,
25-
routines = RoutinesUiModel(),
25+
routines = RoutineScheduleUiModel.INIT,
2626
selectedRoutine = null,
2727
selectedDate = LocalDate.now(),
2828
deleteConfirmBottomSheetVisible = false,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.threegap.bitnagil.presentation.routinelist.model
2+
3+
import com.threegap.bitnagil.domain.routine.model.DailyRoutines
4+
5+
data class DailyRoutinesUiModel(
6+
val routines: List<RoutineUiModel>,
7+
)
8+
9+
internal fun DailyRoutines.toUiModel(): DailyRoutinesUiModel =
10+
DailyRoutinesUiModel(
11+
routines = routines.map { it.toUiModel() },
12+
)

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/DayRoutinesUiModel.kt

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.threegap.bitnagil.presentation.routinelist.model
2+
3+
import com.threegap.bitnagil.domain.routine.model.RoutineSchedule
4+
5+
data class RoutineScheduleUiModel(
6+
val routines: Map<String, DailyRoutinesUiModel>,
7+
) {
8+
companion object {
9+
val INIT = RoutineScheduleUiModel(
10+
routines = emptyMap(),
11+
)
12+
}
13+
}
14+
15+
internal fun RoutineSchedule.toUiModel(): RoutineScheduleUiModel =
16+
RoutineScheduleUiModel(
17+
routines = this.dailyRoutines.mapValues { (_, dailyRoutines) -> dailyRoutines.toUiModel() },
18+
)

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutineUiModel.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
package com.threegap.bitnagil.presentation.routinelist.model
22

3-
import android.os.Parcelable
43
import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory
54
import com.threegap.bitnagil.domain.routine.model.DayOfWeek
65
import com.threegap.bitnagil.domain.routine.model.Routine
76
import com.threegap.bitnagil.presentation.home.util.formatExecutionTime12Hour
87
import com.threegap.bitnagil.presentation.home.util.toShortDateFormat
9-
import kotlinx.parcelize.Parcelize
108

11-
@Parcelize
129
data class RoutineUiModel(
1310
val routineId: String,
1411
val routineName: String,
@@ -19,13 +16,13 @@ data class RoutineUiModel(
1916
val endDate: String,
2017
val routineDeletedYn: Boolean,
2118
val subRoutineNames: List<String>,
22-
) : Parcelable {
2319
val recommendedRoutineType: RecommendCategory?,
20+
) {
2421
val formattedDateRange: String
2522
get() = "${startDate.toShortDateFormat()} - ${endDate.toShortDateFormat()}"
2623
}
2724

28-
fun Routine.toUiModel(): RoutineUiModel =
25+
internal fun Routine.toUiModel(): RoutineUiModel =
2926
RoutineUiModel(
3027
routineId = this.id,
3128
routineName = this.name,
@@ -38,4 +35,3 @@ fun Routine.toUiModel(): RoutineUiModel =
3835
subRoutineNames = this.subRoutineNames,
3936
recommendedRoutineType = this.recommendedRoutineType,
4037
)
41-

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/model/RoutinesUiModel.kt

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)