Skip to content

Commit 289e75c

Browse files
committed
Refactor: 추천 루틴 카테고리 모델 통합
1 parent 85eb3d1 commit 289e75c

6 files changed

Lines changed: 13 additions & 52 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.threegap.bitnagil.data.routine.model.response
22

3+
import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory
34
import com.threegap.bitnagil.domain.routine.model.DayOfWeek
4-
import com.threegap.bitnagil.domain.routine.model.RecommendedRoutineType
55
import com.threegap.bitnagil.domain.routine.model.Routine
66
import kotlinx.serialization.SerialName
77
import kotlinx.serialization.Serializable
@@ -25,7 +25,7 @@ data class RoutineResponse(
2525
@SerialName("subRoutineCompleteYn")
2626
val subRoutineCompleteYn: List<Boolean>,
2727
@SerialName("recommendedRoutineType")
28-
val recommendedRoutineType: RecommendedRoutineType?,
28+
val recommendedRoutineType: RecommendCategory?,
2929
@SerialName("routineDeletedYn")
3030
val routineDeletedYn: Boolean,
3131
@SerialName("routineStartDate")

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

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

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.threegap.bitnagil.domain.routine.model
22

3+
import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory
4+
35
data class Routine(
46
val id: String,
57
val name: String,
@@ -12,5 +14,5 @@ data class Routine(
1214
val isDeleted: Boolean,
1315
val subRoutineNames: List<String>,
1416
val subRoutineCompletionStates: List<Boolean>,
15-
val recommendedRoutineType: RecommendedRoutineType?,
17+
val recommendedRoutineType: RecommendCategory?,
1618
)

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

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

3+
import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory
34
import com.threegap.bitnagil.domain.routine.model.DayOfWeek
4-
import com.threegap.bitnagil.domain.routine.model.RecommendedRoutineType
55
import com.threegap.bitnagil.domain.routine.model.Routine
66

77
data class RoutineUiModel(
@@ -13,7 +13,7 @@ data class RoutineUiModel(
1313
val isCompleted: Boolean,
1414
val subRoutineNames: List<String>,
1515
val subRoutineCompletionStates: List<Boolean>,
16-
val recommendedRoutineType: RecommendedRoutineType?,
16+
val recommendedRoutineType: RecommendCategory?,
1717
)
1818

1919
internal fun Routine.toUiModel(): RoutineUiModel =

presentation/src/main/java/com/threegap/bitnagil/presentation/routinelist/component/template/RoutineDetailsCard.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import com.threegap.bitnagil.designsystem.R
2222
import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon
2323
import com.threegap.bitnagil.designsystem.component.atom.BitnagilIconButton
2424
import com.threegap.bitnagil.domain.routine.model.DayOfWeek
25+
import com.threegap.bitnagil.presentation.common.extension.displayColor
26+
import com.threegap.bitnagil.presentation.common.extension.displayIcon
2527
import com.threegap.bitnagil.presentation.common.extension.displayTitle
2628
import com.threegap.bitnagil.presentation.routinelist.model.RoutineUiModel
27-
import com.threegap.bitnagil.presentation.routinelist.model.getColor
28-
import com.threegap.bitnagil.presentation.routinelist.model.getIcon
2929

3030
@Composable
3131
fun RoutineDetailsCard(
@@ -56,11 +56,11 @@ fun RoutineDetailsCard(
5656
verticalAlignment = Alignment.CenterVertically,
5757
) {
5858
BitnagilIcon(
59-
id = if (routine.recommendedRoutineType != null) routine.recommendedRoutineType.getIcon() else R.drawable.ic_shine,
59+
id = if (routine.recommendedRoutineType != null) routine.recommendedRoutineType.displayIcon else R.drawable.ic_shine,
6060
tint = null,
6161
modifier = Modifier
6262
.background(
63-
color = if (routine.recommendedRoutineType != null) routine.recommendedRoutineType.getColor() else BitnagilTheme.colors.yellow10,
63+
color = if (routine.recommendedRoutineType != null) routine.recommendedRoutineType.displayColor else BitnagilTheme.colors.yellow10,
6464
shape = RoundedCornerShape(4.dp),
6565
)
6666
.padding(4.dp),
Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
package com.threegap.bitnagil.presentation.routinelist.model
22

33
import android.os.Parcelable
4-
import androidx.compose.runtime.Composable
5-
import androidx.compose.ui.graphics.Color
6-
import com.threegap.bitnagil.designsystem.BitnagilTheme
7-
import com.threegap.bitnagil.designsystem.R
4+
import com.threegap.bitnagil.domain.recommendroutine.model.RecommendCategory
85
import com.threegap.bitnagil.domain.routine.model.DayOfWeek
9-
import com.threegap.bitnagil.domain.routine.model.RecommendedRoutineType
106
import com.threegap.bitnagil.domain.routine.model.Routine
117
import com.threegap.bitnagil.presentation.home.util.formatExecutionTime12Hour
128
import com.threegap.bitnagil.presentation.home.util.toShortDateFormat
@@ -23,8 +19,8 @@ data class RoutineUiModel(
2319
val endDate: String,
2420
val routineDeletedYn: Boolean,
2521
val subRoutineNames: List<String>,
26-
val recommendedRoutineType: RecommendedRoutineType?,
2722
) : Parcelable {
23+
val recommendedRoutineType: RecommendCategory?,
2824
val formattedDateRange: String
2925
get() = "${startDate.toShortDateFormat()} - ${endDate.toShortDateFormat()}"
3026
}
@@ -43,25 +39,3 @@ fun Routine.toUiModel(): RoutineUiModel =
4339
recommendedRoutineType = this.recommendedRoutineType,
4440
)
4541

46-
fun RecommendedRoutineType.getIcon(): Int =
47-
when (this) {
48-
RecommendedRoutineType.OUTING -> R.drawable.ic_outside
49-
RecommendedRoutineType.WAKE_UP -> R.drawable.ic_wakeup
50-
RecommendedRoutineType.CONNECT -> R.drawable.ic_connect
51-
RecommendedRoutineType.REST -> R.drawable.ic_rest
52-
RecommendedRoutineType.GROW -> R.drawable.ic_grow
53-
RecommendedRoutineType.PERSONALIZED -> R.drawable.ic_shine
54-
RecommendedRoutineType.OUTING_REPORT -> R.drawable.ic_shine
55-
}
56-
57-
@Composable
58-
fun RecommendedRoutineType.getColor(): Color =
59-
when (this) {
60-
RecommendedRoutineType.OUTING -> BitnagilTheme.colors.skyBlue10
61-
RecommendedRoutineType.WAKE_UP -> BitnagilTheme.colors.orange25
62-
RecommendedRoutineType.CONNECT -> BitnagilTheme.colors.purple10
63-
RecommendedRoutineType.REST -> BitnagilTheme.colors.green10
64-
RecommendedRoutineType.GROW -> BitnagilTheme.colors.pink10
65-
RecommendedRoutineType.PERSONALIZED -> BitnagilTheme.colors.yellow10
66-
RecommendedRoutineType.OUTING_REPORT -> BitnagilTheme.colors.yellow10
67-
}

0 commit comments

Comments
 (0)