Skip to content

Commit cf810ca

Browse files
committed
Fix: 토끼 리뷰사항 반영
1 parent d7b0c90 commit cf810ca

5 files changed

Lines changed: 17 additions & 16 deletions

File tree

presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportScreen.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import com.threegap.bitnagil.presentation.report.component.template.CompleteRepo
6666
import com.threegap.bitnagil.presentation.report.component.template.SubmittingReportContent
6767
import com.threegap.bitnagil.presentation.report.model.ReportSideEffect
6868
import com.threegap.bitnagil.presentation.report.model.ReportState
69+
import com.threegap.bitnagil.presentation.report.model.ReportState.Companion.MAX_IMAGE_COUNT
6970
import com.threegap.bitnagil.presentation.report.model.SubmitState
7071
import com.threegap.bitnagil.presentation.report.model.uiTitle
7172
import kotlinx.coroutines.delay
@@ -95,7 +96,7 @@ fun ReportScreenContainer(
9596
var pendingCameraPhotoUri by remember { mutableStateOf<Uri?>(null) }
9697

9798
val pickMultipleMediaLauncher = rememberLauncherForActivityResult(
98-
contract = ActivityResultContracts.PickMultipleVisualMedia(ReportViewModel.MAX_IMAGE_COUNT),
99+
contract = ActivityResultContracts.PickMultipleVisualMedia(MAX_IMAGE_COUNT),
99100
onResult = viewModel::addImages,
100101
)
101102

@@ -242,7 +243,7 @@ private fun ReportScreen(
242243
AddPhotoButton(
243244
onClick = onShowImageSourceBottomSheet,
244245
imageCount = uiState.reportImages.size,
245-
maxImageCount = ReportViewModel.MAX_IMAGE_COUNT,
246+
maxImageCount = MAX_IMAGE_COUNT,
246247
)
247248

248249
LazyRow(
@@ -324,7 +325,7 @@ private fun ReportScreen(
324325
)
325326
}
326327

327-
ReportField(title = " 신고 위치") {
328+
ReportField(title = "신고 위치") {
328329
CurrentLocationInput(
329330
currentLocation = uiState.currentAddress,
330331
onClick = onGetCurrentLocationClick,

presentation/src/main/java/com/threegap/bitnagil/presentation/report/ReportViewModel.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import com.threegap.bitnagil.domain.report.usecase.SubmitReportUseCase
1111
import com.threegap.bitnagil.presentation.common.file.convertUriToImageFile
1212
import com.threegap.bitnagil.presentation.report.model.ReportSideEffect
1313
import com.threegap.bitnagil.presentation.report.model.ReportState
14+
import com.threegap.bitnagil.presentation.report.model.ReportState.Companion.MAX_IMAGE_COUNT
1415
import com.threegap.bitnagil.presentation.report.model.SubmitState
1516
import dagger.hilt.android.lifecycle.HiltViewModel
1617
import dagger.hilt.android.qualifiers.ApplicationContext
@@ -119,13 +120,13 @@ class ReportViewModel @Inject constructor(
119120

120121
fun submitReportWithImages() {
121122
intent {
122-
reduce { state.copy(submitState = SubmitState.SUBMITTING) }
123-
124123
val category = state.selectedCategory ?: return@intent
125124
val address = state.currentAddress ?: return@intent
126125
val latitude = state.currentLatitude ?: return@intent
127126
val longitude = state.currentLongitude ?: return@intent
128127

128+
reduce { state.copy(submitState = SubmitState.SUBMITTING) }
129+
129130
coroutineScope {
130131
val minDelayJob = async {
131132
delay(1000L)
@@ -173,13 +174,11 @@ class ReportViewModel @Inject constructor(
173174
)
174175
}
175176
},
176-
onFailure = { error -> },
177+
onFailure = { error ->
178+
reduce { state.copy(submitState = SubmitState.IDLE) }
179+
},
177180
)
178181
}
179182
}
180183
}
181-
182-
companion object {
183-
const val MAX_IMAGE_COUNT = 3
184-
}
185184
}

presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/CompleteReportCard.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fun CompleteReportCard(
6363
}
6464

6565
CompleteReportCardItem(
66-
title = "키테고리",
66+
title = "카테고리",
6767
) {
6868
Text(
6969
text = category?.uiTitle ?: "카테고리 없음",

presentation/src/main/java/com/threegap/bitnagil/presentation/report/component/ReportCategoryBottomSheet.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import com.threegap.bitnagil.designsystem.BitnagilTheme
2323
import com.threegap.bitnagil.designsystem.R
2424
import com.threegap.bitnagil.designsystem.component.atom.BitnagilIcon
2525
import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple
26-
import com.threegap.bitnagil.domain.recommendroutine.model.RecommendLevel
2726
import com.threegap.bitnagil.domain.report.model.ReportCategory
2827
import com.threegap.bitnagil.presentation.report.model.iconRes
2928
import com.threegap.bitnagil.presentation.report.model.uiDescription
@@ -51,7 +50,8 @@ fun ReportCategoryBottomSheet(
5150
Column(
5251
modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 28.dp),
5352
) {
54-
ReportCategory.entries.forEachIndexed { index, category ->
53+
val categories = ReportCategory.entries
54+
categories.forEachIndexed { index, category ->
5555
ReportCategoryItem(
5656
icon = category.iconRes,
5757
title = category.uiTitle,
@@ -67,7 +67,7 @@ fun ReportCategoryBottomSheet(
6767
},
6868
)
6969

70-
if (index < RecommendLevel.entries.size) {
70+
if (index < categories.lastIndex) {
7171
HorizontalDivider(
7272
color = BitnagilTheme.colors.coolGray97,
7373
)

presentation/src/main/java/com/threegap/bitnagil/presentation/report/model/ReportState.kt

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

33
import android.net.Uri
44
import com.threegap.bitnagil.domain.report.model.ReportCategory
5-
import com.threegap.bitnagil.presentation.report.ReportViewModel
65

76
data class ReportState(
87
val reportImages: List<Uri>,
@@ -18,7 +17,7 @@ data class ReportState(
1817
val submitState: SubmitState,
1918
) {
2019
val canAddMoreImages: Boolean
21-
get() = reportImages.size < ReportViewModel.Companion.MAX_IMAGE_COUNT
20+
get() = reportImages.size < MAX_IMAGE_COUNT
2221

2322
val isSubmittable: Boolean
2423
get() = reportImages.isNotEmpty() &&
@@ -30,6 +29,8 @@ data class ReportState(
3029
currentLongitude != null
3130

3231
companion object {
32+
const val MAX_IMAGE_COUNT = 3
33+
3334
val Init = ReportState(
3435
reportImages = emptyList(),
3536
reportTitle = "",

0 commit comments

Comments
 (0)