Skip to content

Commit 0c2466a

Browse files
committed
FIX: 감정 등록 중간에 다시 감정을 선택해도 api를 호출하지 않도록 수정, ktlint 적용
1 parent dfe8b9d commit 0c2466a

File tree

12 files changed

+38
-25
lines changed

12 files changed

+38
-25
lines changed

data/src/main/java/com/threegap/bitnagil/data/emotion/datasourceImpl/EmotionDataSourceImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import com.threegap.bitnagil.data.emotion.service.EmotionService
99
import javax.inject.Inject
1010

1111
class EmotionDataSourceImpl @Inject constructor(
12-
private val emotionService: EmotionService
12+
private val emotionService: EmotionService,
1313
) : EmotionDataSource {
1414
override suspend fun getEmotions(): Result<GetEmotionsResponse> {
1515
return safeApiCall {

data/src/main/java/com/threegap/bitnagil/data/emotion/model/dto/EmotionRecommendedRoutineDto.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ data class EmotionRecommendedRoutineDto(
1212
@SerialName("routineDescription")
1313
val routineDescription: String,
1414
@SerialName("recommendedSubRoutines")
15-
val recommendedSubRoutines: List<EmotionRecommendedSubRoutineDto>
15+
val recommendedSubRoutines: List<EmotionRecommendedSubRoutineDto>,
1616
)

data/src/main/java/com/threegap/bitnagil/data/emotion/model/request/RegisterEmotionRequest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
66
@Serializable
77
data class RegisterEmotionRequest(
88
@SerialName("emotionMarbleType")
9-
val emotionMarbleType: String
9+
val emotionMarbleType: String,
1010
)

data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/GetEmotionsResponse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
66
@Serializable
77
data class GetEmotionsResponse(
88
@SerialName("emotionMarbleTypes")
9-
val emotionMarbleTypes: List<String>
9+
val emotionMarbleTypes: List<String>,
1010
)

data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/RegisterEmotionResponse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ import kotlinx.serialization.Serializable
77
@Serializable
88
data class RegisterEmotionResponse(
99
@SerialName("recommendedRoutines")
10-
val recommendedRoutines: List<EmotionRecommendedRoutineDto>
10+
val recommendedRoutines: List<EmotionRecommendedRoutineDto>,
1111
)

data/src/main/java/com/threegap/bitnagil/data/emotion/repositoryImpl/EmotionRepositoryImpl.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import com.threegap.bitnagil.domain.emotion.repository.EmotionRepository
66
import javax.inject.Inject
77

88
class EmotionRepositoryImpl @Inject constructor(
9-
private val emotionDataSource: EmotionDataSource
9+
private val emotionDataSource: EmotionDataSource,
1010
) : EmotionRepository {
1111
override suspend fun getEmotions(): Result<List<Emotion>> {
1212
return emotionDataSource.getEmotions().map { response ->
1313
response.emotionMarbleTypes.mapNotNull {
14-
when(it) {
14+
when (it) {
1515
"CALM" -> Emotion.CALM
1616
"VITALITY" -> Emotion.VITALITY
1717
"LETHARGY" -> Emotion.LETHARGY
@@ -25,7 +25,7 @@ class EmotionRepositoryImpl @Inject constructor(
2525
}
2626

2727
override suspend fun registerEmotion(emotion: Emotion): Result<Unit> {
28-
val selectedEmotion = when(emotion) {
28+
val selectedEmotion = when (emotion) {
2929
Emotion.CALM -> "CALM"
3030
Emotion.VITALITY -> "VITALITY"
3131
Emotion.LETHARGY -> "LETHARGY"
@@ -36,5 +36,4 @@ class EmotionRepositoryImpl @Inject constructor(
3636

3737
return emotionDataSource.registerEmotion(selectedEmotion).map { _ -> }
3838
}
39-
4039
}

data/src/main/java/com/threegap/bitnagil/data/emotion/service/EmotionService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ interface EmotionService {
1414

1515
@POST("/api/v1/emotion-marbles")
1616
suspend fun postEmotions(
17-
@Body request: RegisterEmotionRequest
17+
@Body request: RegisterEmotionRequest,
1818
): BaseResponse<RegisterEmotionResponse>
1919
}

domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/GetEmotionsUseCase.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import com.threegap.bitnagil.domain.emotion.repository.EmotionRepository
55
import javax.inject.Inject
66

77
class GetEmotionsUseCase @Inject constructor(
8-
private val emotionRepository: EmotionRepository
8+
private val emotionRepository: EmotionRepository,
99
) {
10-
suspend operator fun invoke() : Result<List<Emotion>> {
10+
suspend operator fun invoke(): Result<List<Emotion>> {
1111
return emotionRepository.getEmotions()
1212
}
1313
}

domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/RegisterEmotionUseCase.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import com.threegap.bitnagil.domain.emotion.repository.EmotionRepository
55
import javax.inject.Inject
66

77
class RegisterEmotionUseCase @Inject constructor(
8-
private val emotionRepository: EmotionRepository
8+
private val emotionRepository: EmotionRepository,
99
) {
10-
suspend operator fun invoke(emotion: Emotion) : Result<Unit> {
10+
suspend operator fun invoke(emotion: Emotion): Result<Unit> {
1111
return emotionRepository.registerEmotion(emotion)
1212
}
1313
}

presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private fun EmotionScreen(
6363
modifier = Modifier
6464
.fillMaxSize()
6565
.background(color = BitnagilTheme.colors.white),
66-
horizontalAlignment = Alignment.CenterHorizontally
66+
horizontalAlignment = Alignment.CenterHorizontally,
6767
) {
6868
Box(
6969
modifier = Modifier
@@ -86,26 +86,30 @@ private fun EmotionScreen(
8686

8787
Spacer(modifier = Modifier.height(6.dp))
8888

89-
Text("감정구슬을 등록하면 루틴을 추천받아요!", style = BitnagilTheme.typography.subtitle1Regular.copy(color = BitnagilTheme.colors.navy300), textAlign = TextAlign.Center)
89+
Text(
90+
"감정구슬을 등록하면 루틴을 추천받아요!",
91+
style = BitnagilTheme.typography.subtitle1Regular.copy(color = BitnagilTheme.colors.navy300),
92+
textAlign = TextAlign.Center,
93+
)
9094

9195
Spacer(modifier = Modifier.height(64.dp))
9296

9397
LazyVerticalGrid(
9498
columns = GridCells.Fixed(3),
9599
modifier = Modifier.padding(horizontal = 40.dp).widthIn(300.dp),
96100
horizontalArrangement = Arrangement.spacedBy(32.dp),
97-
verticalArrangement = Arrangement.spacedBy(32.dp)
101+
verticalArrangement = Arrangement.spacedBy(32.dp),
98102
) {
99103
items(state.emotions) { emotion ->
100104
Column(
101-
horizontalAlignment = Alignment.CenterHorizontally
105+
horizontalAlignment = Alignment.CenterHorizontally,
102106
) {
103107
Image(
104108
painter = painterResource(id = emotion.imageResourceId),
105109
contentDescription = null,
106110
modifier = Modifier.size(72.dp).clickable {
107111
onClickEmotion(emotion)
108-
}
112+
},
109113
)
110114
Spacer(modifier = Modifier.height(12.dp))
111115
Text(emotion.emotionName, style = BitnagilTheme.typography.body1Regular.copy(color = BitnagilTheme.colors.coolGray20))
@@ -125,7 +129,7 @@ fun MyPageScreenPreview() {
125129
isLoading = false,
126130
),
127131
onClickEmotion = { _ -> },
128-
onClickPreviousButton = {}
132+
onClickPreviousButton = {},
129133
)
130134
}
131135
}

0 commit comments

Comments
 (0)