Skip to content

Commit c7ae0c4

Browse files
committed
FIX: 제보하기 제목 글자 제한 추가, 로딩 뷰 표시 최소 시간 조정, 글자수 제한 및 시간 관련 값 상수로 분리
1 parent 60c6743 commit c7ae0c4

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ private fun ReportScreen(
265265
BitnagilTextField(
266266
value = uiState.reportTitle,
267267
onValueChange = onReportTitleChange,
268-
singleLine = true,
269268
keyboardActions = KeyboardActions(
270269
onDone = {
271270
focusManager.clearFocus()
@@ -279,6 +278,16 @@ private fun ReportScreen(
279278
color = BitnagilTheme.colors.coolGray80,
280279
)
281280
},
281+
maxLines = 2,
282+
minLines = 2,
283+
)
284+
285+
Text(
286+
text = "${uiState.reportTitle.length} / ${ReportState.MAX_TITLE_LENGTH}",
287+
style = BitnagilTheme.typography.caption1Medium,
288+
color = BitnagilTheme.colors.coolGray80,
289+
textAlign = TextAlign.End,
290+
modifier = Modifier.fillMaxWidth(),
282291
)
283292
}
284293

@@ -309,15 +318,15 @@ private fun ReportScreen(
309318
),
310319
placeholder = {
311320
Text(
312-
text = "어떤 위험인지 간단히 설명해주세요.(100자 내외)",
321+
text = "어떤 위험인지 간단히 설명해주세요.(${ReportState.MAX_CONTENT_LENGTH} 내외)",
313322
style = BitnagilTheme.typography.body2Medium,
314323
color = BitnagilTheme.colors.coolGray80,
315324
)
316325
},
317326
)
318327

319328
Text(
320-
text = "${uiState.reportContent.length} / 150",
329+
text = "${uiState.reportContent.length} / ${ReportState.MAX_CONTENT_LENGTH}",
321330
style = BitnagilTheme.typography.caption1Medium,
322331
color = BitnagilTheme.colors.coolGray80,
323332
textAlign = TextAlign.End,

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ class ReportViewModel @Inject constructor(
3636

3737
fun updateReportTitle(title: String) {
3838
intent {
39+
if (title.length > ReportState.MAX_TITLE_LENGTH) return@intent;
3940
reduce { state.copy(reportTitle = title) }
4041
}
4142
}
4243

4344
fun updateReportContent(content: String) {
4445
intent {
46+
if (content.length > ReportState.MAX_CONTENT_LENGTH) return@intent;
4547
reduce { state.copy(reportContent = content) }
4648
}
4749
}
@@ -129,7 +131,7 @@ class ReportViewModel @Inject constructor(
129131

130132
coroutineScope {
131133
val minDelayJob = async {
132-
delay(1000L)
134+
delay(timeMillis = ReportState.MIN_LOADING_TIME)
133135
}
134136

135137
val processingJob = async {
@@ -174,7 +176,7 @@ class ReportViewModel @Inject constructor(
174176
)
175177
}
176178
},
177-
onFailure = { error ->
179+
onFailure = { _ ->
178180
reduce { state.copy(submitState = SubmitState.IDLE) }
179181
},
180182
)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ data class ReportState(
3030
currentLongitude != null
3131

3232
companion object {
33+
const val MAX_TITLE_LENGTH = 50
34+
const val MAX_CONTENT_LENGTH = 150
35+
const val MIN_LOADING_TIME = 1500L
36+
3337
const val MAX_IMAGE_COUNT = 3
3438

3539
val Init = ReportState(

0 commit comments

Comments
 (0)