-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
๐ :: (#416) - update expocreatescreen location input #422
๐ :: (#416) - update expocreatescreen location input #422
Conversation
โฆsUiState ๋ฅผ ์ด๊ธฐํ ํ๋๋ก ๊ธฐ๋ฅ ์ถ๊ฐ
โฆ์ธ์คํด์ค๋ฅผ ๊ณต์ ํ๋๋ก ์์
โฆ๊ฐ, ํธ๋ค๋งํจ์ ์ถ๊ฐ
Walkthrough์ด๋ฒ ๋ณ๊ฒฝ ์ฌํญ์ ์ฑ ๋ด ๋ค๋น๊ฒ์ด์
๊ธฐ๋ฅ์ ํ์ฅํ๊ธฐ ์ํ ์์ ์ผ๋ก, ์ฃผ์ ๊ฒ์ ํ๋ฉด์ ์ถ๊ฐํ๊ณ ํด๋น ๊ธฐ๋ฅ์ผ๋ก ์ด๋ํ ์ ์๋ ๋ค๋น๊ฒ์ด์
๋ฉ์๋๋ฅผ ๋์
ํฉ๋๋ค. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
๐ Recent review detailsConfiguration used: CodeRabbit UI ๐ Files selected for processing (2)
๐ง Files skipped from review as they are similar to previous changes (1)
โฐ Context from checks skipped due to timeout of 90000ms (1)
๐ Additional comments (4)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? ๐ชง TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pr ์ปจ๋ฒค์ ์ ๋ง์ถฐ์ ๋ค์ ์์ฑํด์ฃผ์ธ์ฌ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
๐งน Nitpick comments (2)
core/design-system/src/main/java/com/school_of_company/design_system/component/textfield/ExpoTextField.kt (1)
444-498
: ์ฝ๋ ์ค๋ณต์ ์ ๊ฑฐํ๊ธฐ ์ํ ๋ฆฌํฉํ ๋ง ์ ์๊ตฌํ์ ์ ํํ์ง๋ง,
ExpoLocationIconTextField
์ ๊ฑฐ์ ๋์ผํ ์ฝ๋๊ฐ ์ค๋ณต๋์ด ์์ต๋๋ค. ์์ด์ฝ๋ง ๋ค๋ฅธ ๋ ์ปดํฌ๋ํธ๋ฅผ ํ๋๋ก ํตํฉํ๋ ๊ฒ์ด ์ข๊ฒ ์ต๋๋ค.๋ค์๊ณผ ๊ฐ์ด ๋ฆฌํฉํ ๋งํ๋ ๊ฒ์ ์ ์ํฉ๋๋ค:
-@Composable -fun ExpoLocationIconTextField( - modifier: Modifier = Modifier, - value: String, - onValueChange: (String) -> Unit, - placeholder: String, - isDisabled: Boolean, - onButtonClicked: () -> Unit, -) { - ExpoAndroidTheme { colors, typography -> - Box { - OutlinedTextField( - // ... existing implementation - trailingIcon = { - IconButton(onClick = onButtonClicked) { - LocationIcon( - tint = colors.gray500, - modifier = Modifier.size(24.dp) - ) - } - } - ) - } - } -} - -@Composable -fun ExpoSearchIconTextField( - modifier: Modifier = Modifier, - value: String, - onValueChange: (String) -> Unit, - placeholder: String, - isDisabled: Boolean, - onButtonClicked: () -> Unit, -) { - ExpoAndroidTheme { colors, typography -> - Box { - OutlinedTextField( - // ... existing implementation - trailingIcon = { - IconButton(onClick = onButtonClicked) { - SearchIcon( - tint = colors.gray500, - modifier = Modifier.size(24.dp) - ) - } - } - ) - } - } -} +enum class ExpoIconType { + LOCATION, + SEARCH +} + +@Composable +fun ExpoIconTextField( + modifier: Modifier = Modifier, + value: String, + onValueChange: (String) -> Unit, + placeholder: String, + isDisabled: Boolean, + onButtonClicked: () -> Unit, + iconType: ExpoIconType +) { + ExpoAndroidTheme { colors, typography -> + Box { + OutlinedTextField( + // ... existing implementation + trailingIcon = { + IconButton(onClick = onButtonClicked) { + when (iconType) { + ExpoIconType.LOCATION -> LocationIcon( + tint = colors.gray500, + modifier = Modifier.size(24.dp) + ) + ExpoIconType.SEARCH -> SearchIcon( + tint = colors.gray500, + modifier = Modifier.size(24.dp) + ) + } + } + } + ) + } + } +} + +@Composable +fun ExpoLocationIconTextField( + modifier: Modifier = Modifier, + value: String, + onValueChange: (String) -> Unit, + placeholder: String, + isDisabled: Boolean, + onButtonClicked: () -> Unit, +) { + ExpoIconTextField( + modifier = modifier, + value = value, + onValueChange = onValueChange, + placeholder = placeholder, + isDisabled = isDisabled, + onButtonClicked = onButtonClicked, + iconType = ExpoIconType.LOCATION + ) +} + +@Composable +fun ExpoSearchIconTextField( + modifier: Modifier = Modifier, + value: String, + onValueChange: (String) -> Unit, + placeholder: String, + isDisabled: Boolean, + onButtonClicked: () -> Unit, +) { + ExpoIconTextField( + modifier = modifier, + value = value, + onValueChange = onValueChange, + placeholder = placeholder, + isDisabled = isDisabled, + onButtonClicked = onButtonClicked, + iconType = ExpoIconType.SEARCH + ) +}feature/expo/src/main/java/com/school_of_company/expo/view/ExpoCreateScreen.kt (1)
513-534
: ์์ฑ ๋ฒํผ์ ํ์ฑํ ์กฐ๊ฑด์ด ๋ณต์กํฉ๋๋ค.๋ฒํผ ํ์ฑํ ์กฐ๊ฑด์ด ํ ์ค์ ๋๋ฌด ๊ธธ๊ฒ ์์ฑ๋์ด ์์ด ๊ฐ๋ ์ฑ์ด ๋จ์ด์ง๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ๊ฐ์ ํ๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค:
-state = if ( - modifyTitleState.isNotEmpty() && - startedDateState.isNotEmpty() && - endedDateState.isNotEmpty() && - introduceTitleState.isNotEmpty() && - addressState.isNotEmpty() && - locationState.isNotEmpty() && - trainingProgramTextState.isNotEmpty() && - standardProgramTextState.isNotEmpty() && - startedDateState.isValidDateSequence(endedDateState) -) { - ButtonState.Enable -} else { - ButtonState.Disable -} +state = run { + val isRequiredFieldsFilled = listOf( + modifyTitleState, + startedDateState, + endedDateState, + introduceTitleState, + addressState, + locationState + ).all { it.isNotEmpty() } + + val isProgramsNotEmpty = trainingProgramTextState.isNotEmpty() && + standardProgramTextState.isNotEmpty() + + val isDateValid = startedDateState.isValidDateSequence(endedDateState) + + if (isRequiredFieldsFilled && isProgramsNotEmpty && isDateValid) { + ButtonState.Enable + } else { + ButtonState.Disable + } +}
๐ Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
๐ Files selected for processing (7)
app/src/main/java/com/school_of_company/expo_android/navigation/ExpoNavHost.kt
(2 hunks)core/design-system/src/main/java/com/school_of_company/design_system/component/textfield/ExpoTextField.kt
(2 hunks)feature/expo/src/main/java/com/school_of_company/expo/navigation/ExpoNavigation.kt
(5 hunks)feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt
(1 hunks)feature/expo/src/main/java/com/school_of_company/expo/view/ExpoCreateScreen.kt
(10 hunks)feature/expo/src/main/java/com/school_of_company/expo/view/ExpoModifyScreen.kt
(7 hunks)feature/expo/src/main/java/com/school_of_company/expo/viewmodel/ExpoViewModel.kt
(11 hunks)
โฐ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
๐ Additional comments (21)
feature/expo/src/main/java/com/school_of_company/expo/navigation/ExpoNavigation.kt (5)
19-19
: ์ฃผ์ ๊ฒ์ ๋ผ์ฐํธ ์์๊ฐ ์ ์ ํ ์ ์๋์์ต๋๋ค.๋ผ์ฐํธ ์์์ ์ด๋ฆ์ด ๋ช ํํ๊ณ ์ผ๊ด๋ ๋ค์ด๋ฐ ์ปจ๋ฒค์ ์ ๋ฐ๋ฅด๊ณ ์์ต๋๋ค.
53-55
: ์ฃผ์ ๊ฒ์ ํ๋ฉด์ผ๋ก์ ๋ค๋น๊ฒ์ด์ ํจ์๊ฐ ์ ๊ตฌํ๋์์ต๋๋ค.๊ธฐ์กด ๋ค๋น๊ฒ์ด์ ํจ์๋ค๊ณผ ์ผ๊ด๋ ํจํด์ผ๋ก ๊ตฌํ๋์ด ์์ต๋๋ค.
89-93
: ExpoModifyScreen์ ๋ค๋น๊ฒ์ด์ ํ๋ผ๋ฏธํฐ๊ฐ ์ ์ ํ ์ถ๊ฐ๋์์ต๋๋ค.์ฃผ์ ๊ฒ์ ๊ธฐ๋ฅ ์ถ๊ฐ์ ๋ฐ๋ฅธ ๋ค๋น๊ฒ์ด์ ํ๋ผ๋ฏธํฐ๊ฐ ์ ํตํฉ๋์ด ์์ต๋๋ค.
Also applies to: 97-101
105-108
: ExpoCreateScreen์ ๋ค๋น๊ฒ์ด์ ํ๋ผ๋ฏธํฐ๊ฐ ์ ์ ํ ์ถ๊ฐ๋์์ต๋๋ค.์ฃผ์ ๊ฒ์ ๊ธฐ๋ฅ ์ถ๊ฐ์ ๋ฐ๋ฅธ ๋ค๋น๊ฒ์ด์ ํ๋ผ๋ฏธํฐ๊ฐ ์ ํตํฉ๋์ด ์์ต๋๋ค.
Also applies to: 110-113
125-135
: ์ฃผ์ ๊ฒ์ ํ๋ฉด ์ปดํฌ์ ๋ธ์ด ์ ๊ตฌํ๋์์ต๋๋ค.์ค๋ฅ ์ฒ๋ฆฌ์ ๋ฐฑ ๋ค๋น๊ฒ์ด์ ์ด ์ ์ ํ ๊ตฌํ๋์ด ์์ต๋๋ค.
app/src/main/java/com/school_of_company/expo_android/navigation/ExpoNavHost.kt (4)
9-9
: ์ฃผ์ ๊ฒ์ ๊ด๋ จ import๋ฌธ์ด ์ ์ ํ ์ถ๊ฐ๋์์ต๋๋ค.ํ์ํ import๋ฌธ๋ค์ด ์ ์ ๋ฆฌ๋์ด ์์ต๋๋ค.
Also applies to: 15-15
144-146
: ExpoModifyScreen์ ๋ค๋น๊ฒ์ด์ ํ๋ผ๋ฏธํฐ๊ฐ ์ ์ ํ ์ฐ๊ฒฐ๋์์ต๋๋ค.์ฃผ์ ๊ฒ์ ๋ค๋น๊ฒ์ด์ ์ด navController๋ฅผ ํตํด ์ ์ฐ๊ฒฐ๋์ด ์์ต๋๋ค.
149-152
: ExpoCreateScreen์ ๋ค๋น๊ฒ์ด์ ํ๋ผ๋ฏธํฐ๊ฐ ์ ์ ํ ์ฐ๊ฒฐ๋์์ต๋๋ค.์ฃผ์ ๊ฒ์ ๋ค๋น๊ฒ์ด์ ์ด navController๋ฅผ ํตํด ์ ์ฐ๊ฒฐ๋์ด ์์ต๋๋ค.
158-161
: ์ฃผ์ ๊ฒ์ ํ๋ฉด์ด ๋ค๋น๊ฒ์ด์ ๊ทธ๋ํ์ ์ ์ถ๊ฐ๋์์ต๋๋ค.์ค๋ฅ ์ฒ๋ฆฌ์ ๋ฐฑ ๋ค๋น๊ฒ์ด์ ์ด ์ ์ ํ ์ฐ๊ฒฐ๋์ด ์์ต๋๋ค.
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt (3)
41-47
: ExpoAddressSearchRoute ์ปดํฌ์ ๋ธ์ด ์ ๊ตฌํ๋์์ต๋๋ค.๋ทฐ๋ชจ๋ธ๊ณผ ์ํ ๊ด๋ฆฌ๊ฐ ์ ์ ํ ๊ตฌํ๋์ด ์์ต๋๋ค.
56-61
: ์ด๊ธฐ ์ํ ์ด๊ธฐํ๊ฐ ์ ์ ํ ๊ตฌํ๋์์ต๋๋ค.LaunchedEffect๋ฅผ ์ฌ์ฉํ ์ํ ์ด๊ธฐํ๊ฐ ์ ๋์ด ์์ต๋๋ค.
63-72
: ์ค๋ฅ ์ฒ๋ฆฌ๊ฐ ์ฒด๊ณ์ ์ผ๋ก ๊ตฌํ๋์์ต๋๋ค.์ขํ ๋ณํ๊ณผ ์ฃผ์ ๊ฒ์ ์คํจ์ ๋ํ ์ค๋ฅ ์ฒ๋ฆฌ๊ฐ ์ ๋์ด ์์ต๋๋ค.
Also applies to: 74-83
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoCreateScreen.kt (2)
120-130
: ์ํ ์ด๊ธฐํ๊ฐ ์ ์ ํ ๊ตฌํ๋์์ต๋๋ค.LaunchedEffect๋ฅผ ์ฌ์ฉํ ์ํ ์ด๊ธฐํ์ ๋๊ธฐํ๊ฐ ์ ๋์ด ์์ต๋๋ค.
494-500
: ์ฃผ์ ์ ๋ ฅ UI๊ฐ ์ ์ ํ ๊ตฌํ๋์์ต๋๋ค.์ฌ์ฉ์ ์ ๋ ฅ์ ๋นํ์ฑํํ๊ณ ์ฃผ์ ๊ฒ์ ํ๋ฉด์ผ๋ก ๋ฆฌ๋ค์ด๋ ์ ํ๋ ๋ก์ง์ด ์ ๊ตฌํ๋์ด ์์ต๋๋ค.
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoModifyScreen.kt (4)
91-93
: ๋ทฐ๋ชจ๋ธ ์ธ์คํด์คํ ๋ฐฉ์์ด ๊ฐ์ ๋์์ต๋๋ค.ComponentActivity๋ฅผ ์ฌ์ฉํ์ฌ ๋ทฐ๋ชจ๋ธ์ ์ธ์คํด์คํํ๋ ๊ฒ์ ์ข์ ๋ฐฉ์์ ๋๋ค. ์ด๋ ๋ฉ๋ชจ๋ฆฌ ๋์๋ฅผ ๋ฐฉ์งํ๊ณ ์๋ช ์ฃผ๊ธฐ๋ฅผ ๋ ์ ๊ด๋ฆฌํ ์ ์๊ฒ ํด์ค๋๋ค.
130-134
: ๋ฆฌ์์ค ์ ๋ฆฌ ๋ก์ง์ด ์ถ๊ฐ๋์์ต๋๋ค.DisposableEffect๋ฅผ ์ฌ์ฉํ์ฌ ํ๋ฉด์ด dispose๋ ๋ Expo ์ ๋ณด๋ฅผ ์ด๊ธฐํํ๋ ๊ฒ์ ์ข์ ๋ฐฉ์์ ๋๋ค.
192-200
: ๊ฒ์๋ ์์น ์ ๋ณด ์ฒ๋ฆฌ ๋ก์ง์ด ๊ฐ์ ๋์์ต๋๋ค.๊ฒ์๋ ์์น๊ฐ ์์ ๊ฒฝ์ฐ ํด๋น ์ ๋ณด๋ฅผ ์ฐ์ ์ ์ผ๋ก ์ฌ์ฉํ๊ณ , ์์ ๊ฒฝ์ฐ ๊ธฐ์กด ์ ๋ณด๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ์์ผ๋ก ๊ตฌํ๋์์ต๋๋ค.
536-542
: ์์น ์ ๋ ฅ ํ๋๊ฐ ์ฃผ์ ๊ฒ์ ํ๋ฉด๊ณผ ์ฐ๋๋์์ต๋๋ค.
- ์์น ์ ๋ ฅ ํ๋๊ฐ ๋นํ์ฑํ๋๊ณ ์ฃผ์ ๊ฒ์ ํ๋ฉด์ผ๋ก ์ด๋ํ๋ ๋ฐฉ์์ผ๋ก ๋ณ๊ฒฝ๋์์ต๋๋ค.
- ์ด๋ ์ฌ์ฉ์ ๊ฒฝํ์ ๊ฐ์ ํ๊ณ ์ผ๊ด๋ ์ฃผ์ ๋ฐ์ดํฐ ์ ๋ ฅ์ ๋ณด์ฅํฉ๋๋ค.
feature/expo/src/main/java/com/school_of_company/expo/viewmodel/ExpoViewModel.kt (3)
80-82
: ๊ฒ์๋ ์์น ์ ๋ณด๋ฅผ ์ํ ์์๊ฐ ์ถ๊ฐ๋์์ต๋๋ค.์์น ๊ฒ์ ๊ด๋ จ ์ํ๋ฅผ ๊ด๋ฆฌํ๊ธฐ ์ํ ์์๋ค์ด ์ ์ ํ๊ฒ ์ ์๋์์ต๋๋ค.
154-158
: ๊ฒ์๋ ์์น ์ ๋ณด๋ฅผ ์ํ ์ํ ๋ณ์๊ฐ ์ถ๊ฐ๋์์ต๋๋ค.SavedStateHandle์ ์ฌ์ฉํ์ฌ ๊ฒ์๋ ์์น ์ ๋ณด์ ์ํ๋ฅผ ๊ด๋ฆฌํ๋ ๊ฒ์ ๊ตฌ์ฑ ๋ณ๊ฒฝ ์์๋ ๋ฐ์ดํฐ๋ฅผ ์ ์งํ ์ ์์ด ์ข์ ๋ฐฉ์์ ๋๋ค.
420-433
: ์์น ๊ฒ์ ๋ก์ง์ด ๊ฐ์ ๋์์ต๋๋ค.๊ฒ์ ์์ ์ ์ขํ๋ฅผ ์ด๊ธฐํํ๊ณ , ๊ฒ์ ๊ฒฐ๊ณผ๊ฐ ์์ ๊ฒฝ์ฐ ์ ์ ํ ์์ธ ์ฒ๋ฆฌ๋ฅผ ํ๋ ๋ฐฉ์์ผ๋ก ๊ตฌํ๋์์ต๋๋ค.
if ( | ||
coordinateX.isNotBlank() | ||
&& coordinateY.isNotBlank() | ||
) { | ||
HomeKakaoMap( | ||
locationX = coordinateX.toDouble(), | ||
locationY = coordinateY.toDouble(), | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ ๏ธ Refactor suggestion
์ง๋ ํ์ ๋ก์ง์ ๋ํ ๊ฐ์ ์ด ํ์ํฉ๋๋ค.
์ขํ๊ฐ ๊ฒ์ฆ์ด ๋ฌธ์์ด ๋น๊ต๋ก๋ง ๋์ด ์์ด ์ ์ฌ์ ์ธ ๋ฌธ์ ๊ฐ ์์ ์ ์์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ๊ฐ์ ํ๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค:
-if (
- coordinateX.isNotBlank()
- && coordinateY.isNotBlank()
-) {
+if (coordinateX.isNotBlank() && coordinateY.isNotBlank()) {
+ try {
+ val x = coordinateX.toDouble()
+ val y = coordinateY.toDouble()
+ if (x.isFinite() && y.isFinite()) {
HomeKakaoMap(
- locationX = coordinateX.toDouble(),
- locationY = coordinateY.toDouble(),
+ locationX = x,
+ locationY = y,
)
+ }
+ } catch (e: NumberFormatException) {
+ // ์ขํ ๋ณํ ์คํจ ์ฒ๋ฆฌ
+ }
}
๐ Committable suggestion
โผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if ( | |
coordinateX.isNotBlank() | |
&& coordinateY.isNotBlank() | |
) { | |
HomeKakaoMap( | |
locationX = coordinateX.toDouble(), | |
locationY = coordinateY.toDouble(), | |
) | |
} | |
} | |
if (coordinateX.isNotBlank() && coordinateY.isNotBlank()) { | |
try { | |
val x = coordinateX.toDouble() | |
val y = coordinateY.toDouble() | |
if (x.isFinite() && y.isFinite()) { | |
HomeKakaoMap( | |
locationX = x, | |
locationY = y, | |
) | |
} | |
} catch (e: NumberFormatException) { | |
// ์ขํ ๋ณํ ์คํจ ์ฒ๋ฆฌ | |
} | |
} | |
} |
onSearchedCoordinateChange( | ||
x = result.data.x.toDoubleOrNull()?.let { "%.6f".format(it) } ?: "0.000000", | ||
y = result.data.y.toDoubleOrNull()?.let { "%.6f".format(it) } ?: "0.000000" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ ๏ธ Refactor suggestion
์ขํ ์ ๋ฐ๋ ์ฒ๋ฆฌ๊ฐ ๊ฐ์ ๋์์ต๋๋ค.
์ขํ๊ฐ์ ์์์ 6์๋ฆฌ๋ก ์ ํํ๋ ๊ฒ์ ์ข์ ๋ฐฉ์์ ๋๋ค. ํ์ง๋ง ์ขํ ๋ณํ ์คํจ ์ "0.000000"์ ์ฌ์ฉํ๋ ๊ฒ์ ์ํํ ์ ์์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ์์ ํ๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค:
-x = result.data.x.toDoubleOrNull()?.let { "%.6f".format(it) } ?: "0.000000",
-y = result.data.y.toDoubleOrNull()?.let { "%.6f".format(it) } ?: "0.000000"
+x = result.data.x.toDoubleOrNull()?.let { "%.6f".format(it) } ?: throw IllegalArgumentException("Invalid coordinate value"),
+y = result.data.y.toDoubleOrNull()?.let { "%.6f".format(it) } ?: throw IllegalArgumentException("Invalid coordinate value")
๐ Committable suggestion
โผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
onSearchedCoordinateChange( | |
x = result.data.x.toDoubleOrNull()?.let { "%.6f".format(it) } ?: "0.000000", | |
y = result.data.y.toDoubleOrNull()?.let { "%.6f".format(it) } ?: "0.000000" | |
) | |
onSearchedCoordinateChange( | |
x = result.data.x.toDoubleOrNull()?.let { "%.6f".format(it) } ?: throw IllegalArgumentException("Invalid coordinate value"), | |
y = result.data.y.toDoubleOrNull()?.let { "%.6f".format(it) } ?: throw IllegalArgumentException("Invalid coordinate value") | |
) |
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt
Outdated
Show resolved
Hide resolved
LaunchedEffect(getCoordinatesUiState) { | ||
when (getCoordinatesUiState) { | ||
is GetCoordinatesUiState.Error -> onErrorToast( | ||
(getCoordinatesUiState as GetCoordinatesUiState.Error).exception, | ||
R.string.get_address_convert_fail | ||
) | ||
|
||
else -> Unit | ||
} | ||
} | ||
|
||
LaunchedEffect(getAddressUiState) { | ||
when (getAddressUiState) { | ||
is GetAddressUiState.Error -> onErrorToast( | ||
(getAddressUiState as GetAddressUiState.Error).exception, | ||
R.string.get_address_fail | ||
) | ||
|
||
else -> Unit | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error ์ํ์ผ๋ ๋ง๊ณ ๋ค๋ฅธ Success Loading ์ํ๋ ๋ํ๋ด์ฃผ๋ฉด ์ข์ ๊ฒ ๊ฐ์์ฌ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ถ๋ฌ์ค๊ธฐ ๊ธฐ๋ฅ์ Screen๋จ์์ ๋๊ฐ ํ๋ฒ์ ์ฒ๋ฆฌ๋ฅผ ํ ํ ๊ฐ ์ํ์ ๋ง๊ฒ ํ๋ฉด์ ๋์์ฃผ๋ ๋ฐฉ๋ฒ๋ ์์ ๊ฒ ๊ฐ์์ฌ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoCreateScreen.kt
Outdated
Show resolved
Hide resolved
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt
Outdated
Show resolved
Hide resolved
โฆํธ๋ฅผ ๋์ฐ๋๋ก ์์
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
โป๏ธ Duplicate comments (1)
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt (1)
176-185
:โ ๏ธ Potential issue์ขํ๊ฐ ๊ฒ์ฆ ๋ก์ง ๊ฐ์ ํ์
์ขํ๊ฐ ๋ณํ ์ ์์ธ ์ฒ๋ฆฌ๊ฐ ๋๋ฝ๋์ด ์์ด ์ ์ฌ์ ์ธ ํฌ๋์๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค.
-if ( - coordinateX.isNotBlank() - && coordinateY.isNotBlank() -) { +if (coordinateX.isNotBlank() && coordinateY.isNotBlank()) { + try { + val x = coordinateX.toDouble() + val y = coordinateY.toDouble() + if (x.isFinite() && y.isFinite()) { HomeKakaoMap( - locationX = coordinateX.toDouble(), - locationY = coordinateY.toDouble(), + locationX = x, + locationY = y, ) + } + } catch (e: NumberFormatException) { + // ์ขํ ๋ณํ ์คํจ ์ฒ๋ฆฌ + } }
๐งน Nitpick comments (2)
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt (2)
56-61
: ๋งค์ง ์คํธ๋ง ์์ํ ํ์"InitSearched" ๋ฌธ์์ด์ ์์๋ก ๋ถ๋ฆฌํ์ฌ ๊ด๋ฆฌํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+private const val INIT_SEARCHED_KEY = "InitSearched" @Composable internal fun ExpoAddressSearchRoute( // ... ) { - LaunchedEffect("InitSearched") { + LaunchedEffect(INIT_SEARCHED_KEY) { // ... } }
63-87
: ๋ก๋ฉ ์ํ UI ํผ๋๋ฐฑ ์ถ๊ฐ ํ์ํ์ฌ Loading ์ํ์์ ์ฌ์ฉ์์๊ฒ ์๊ฐ์ ํผ๋๋ฐฑ์ด ์์ต๋๋ค. ํ๋ก๊ทธ๋ ์ค ๋ฐ๋ ๋ก๋ฉ ์ธ๋์ผ์ดํฐ๋ฅผ ์ถ๊ฐํ์ฌ ์ฌ์ฉ์ ๊ฒฝํ์ ๊ฐ์ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
@Composable private fun ExpoAddressSearchScreen( // ... + isLoading: Boolean, ) { ExpoAndroidTheme { colors, typography -> Column { + if (isLoading) { + CircularProgressIndicator( + modifier = Modifier.align(Alignment.CenterHorizontally) + ) + } // ... } } }
๐ Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
๐ Files selected for processing (1)
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt
(1 hunks)
โฐ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
๐ Additional comments (1)
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt (1)
117-123
: ํค๋ณด๋ ํฌ์ปค์ค ํด์ ์ฒ๋ฆฌ ํ์์ฌ์ฉ์๊ฐ ํ ์คํธ ํ๋๋ ํค๋ณด๋ ์์ญ ์ธ์ ํ๋ฉด์ ํฐ์นํ ๋ ํค๋ณด๋๊ฐ ์๋์ผ๋ก ๋ซํ๋๋ก ์ฒ๋ฆฌ๊ฐ ํ์ํฉ๋๋ค.
Column( modifier = modifier .fillMaxSize() .background(color = colors.white) .padding(16.dp) + .pointerInput(Unit) { + detectTapGestures( + onTap = { + LocalFocusManager.current.clearFocus() + } + ) + } ) {
ExpoStateButton( | ||
text = "์๋ฃ", | ||
state = if ( | ||
location.isNotEmpty() && | ||
coordinateX.isNotBlank() && | ||
coordinateY.isNotBlank() | ||
) { | ||
ButtonState.Enable | ||
} else { | ||
ButtonState.Disable | ||
}, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(14.dp), | ||
onClick = popUpBackStack | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ ๏ธ Refactor suggestion
๋ฒํผ ํ์ฑํ ์กฐ๊ฑด ๊ฐ์ ํ์
ํ์ฌ ๋ฒํผ ํ์ฑํ ์กฐ๊ฑด์ด ๋จ์ ๋ฌธ์์ด ๊ฒ์ฌ์๋ง ์์กดํ๊ณ ์์ต๋๋ค. ์ขํ๊ฐ์ ์ ํจ์ฑ๋ ํจ๊ป ๊ฒ์ฆํ๋ ๊ฒ์ด ์์ ํฉ๋๋ค.
+private fun isValidCoordinate(value: String): Boolean {
+ return try {
+ val num = value.toDouble()
+ num.isFinite()
+ } catch (e: NumberFormatException) {
+ false
+ }
+}
ExpoStateButton(
text = "์๋ฃ",
state = if (
location.isNotEmpty() &&
- coordinateX.isNotBlank() &&
- coordinateY.isNotBlank()
+ isValidCoordinate(coordinateX) &&
+ isValidCoordinate(coordinateY)
) {
ButtonState.Enable
} else {
ButtonState.Disable
},
// ...
)
๐ Committable suggestion
โผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
ExpoStateButton( | |
text = "์๋ฃ", | |
state = if ( | |
location.isNotEmpty() && | |
coordinateX.isNotBlank() && | |
coordinateY.isNotBlank() | |
) { | |
ButtonState.Enable | |
} else { | |
ButtonState.Disable | |
}, | |
modifier = Modifier | |
.fillMaxWidth() | |
.padding(14.dp), | |
onClick = popUpBackStack | |
) | |
// Add this helper function at the appropriate scope in the file | |
private fun isValidCoordinate(value: String): Boolean { | |
return try { | |
val num = value.toDouble() | |
num.isFinite() | |
} catch (e: NumberFormatException) { | |
false | |
} | |
} | |
ExpoStateButton( | |
text = "์๋ฃ", | |
state = if ( | |
location.isNotEmpty() && | |
isValidCoordinate(coordinateX) && | |
isValidCoordinate(coordinateY) | |
) { | |
ButtonState.Enable | |
} else { | |
ButtonState.Disable | |
}, | |
modifier = Modifier | |
.fillMaxWidth() | |
.padding(14.dp), | |
onClick = popUpBackStack | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
๐งน Nitpick comments (1)
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt (1)
60-65
: LaunchedEffect ํค ๊ฐ ๊ฐ์ ํ์๋ฌธ์์ด "InitSearched"๋ฅผ ํค๋ก ์ฌ์ฉํ๋ ๊ฒ์ ๊ถ์ฅ๋์ง ์์ต๋๋ค. ๋์ ๊ฐ์ฒด ์ฐธ์กฐ๋ ์์๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ๋ ์์ ํฉ๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ์์ ํ๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค:
-LaunchedEffect("InitSearched") { +private object InitSearchedKey +LaunchedEffect(InitSearchedKey) { with(viewModel) { onSearchedLocationChange("") onSearchedCoordinateChange("", "") } }
๐ Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
๐ Files selected for processing (1)
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt
(1 hunks)
โฐ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
๐ Additional comments (3)
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt (3)
188-197
: ์ง๋ ํ์ ๋ก์ง์ ๋ํ ๊ฐ์ ์ด ํ์ํฉ๋๋ค.์ขํ๊ฐ ๊ฒ์ฆ์ด ๋ฌธ์์ด ๋น๊ต๋ก๋ง ๋์ด ์์ด ์ ์ฌ์ ์ธ ๋ฌธ์ ๊ฐ ์์ ์ ์์ต๋๋ค.
128-134
: ํฌ์ปค์ค ๊ด๋ฆฌ ๊ตฌํ์ด ์ ๋์์ต๋๋ค!ํ๋ฉด ํญ ๊ฐ์ง๋ฅผ ํตํ ํค๋ณด๋ ํฌ์ปค์ค ํด์ ๊ฐ ์ ์ ํ๊ฒ ๊ตฌํ๋์์ต๋๋ค.
201-216
: ๋ฒํผ ํ์ฑํ ์กฐ๊ฑด ๊ฐ์ ํ์ํ์ฌ ๋ฒํผ ํ์ฑํ ์กฐ๊ฑด์ด ๋จ์ ๋ฌธ์์ด ๊ฒ์ฌ์๋ง ์์กดํ๊ณ ์์ต๋๋ค. ์ขํ๊ฐ์ ์ ํจ์ฑ๋ ํจ๊ป ๊ฒ์ฆํ๋ ๊ฒ์ด ์์ ํฉ๋๋ค.
โฆiState ํจ์ ์ถ๊ฐ
initializeWithSearchedData ์ถ๊ฐ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
๐งน Nitpick comments (2)
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt (2)
61-95
: ์ํ ๊ด๋ฆฌ ๋ก์ง ๊ฐ์ ์ด ํ์ํฉ๋๋ค.LaunchedEffect ๋ธ๋ก๋ค์ด ๋ถ์ฐ๋์ด ์์ด ์ฝ๋์ ๊ฐ๋ ์ฑ๊ณผ ์ ์ง๋ณด์์ฑ์ด ์ ํ๋ ์ ์์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ๊ฐ์ ํ๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค:
-LaunchedEffect(getCoordinatesUiState) { - when (getCoordinatesUiState) { - is GetCoordinatesUiState.Loading -> Unit - is GetCoordinatesUiState.Success -> onErrorToast( - null, - R.string.get_address_convert_success - ) - is GetCoordinatesUiState.Error -> onErrorToast( - (getCoordinatesUiState as GetCoordinatesUiState.Error).exception, - R.string.get_address_convert_fail - ) - } -} - -LaunchedEffect(getAddressUiState) { - when (getAddressUiState) { - is GetAddressUiState.Loading -> Unit - is GetAddressUiState.Success -> onErrorToast(null, R.string.get_address_success) - is GetAddressUiState.Error -> onErrorToast( - (getAddressUiState as GetAddressUiState.Error).exception, - R.string.get_address_fail - ) - } -} +LaunchedEffect(getCoordinatesUiState, getAddressUiState) { + when (getCoordinatesUiState) { + is GetCoordinatesUiState.Loading -> Unit + is GetCoordinatesUiState.Success -> onErrorToast( + null, + R.string.get_address_convert_success + ) + is GetCoordinatesUiState.Error -> onErrorToast( + getCoordinatesUiState.exception, + R.string.get_address_convert_fail + ) + } + + when (getAddressUiState) { + is GetAddressUiState.Loading -> Unit + is GetAddressUiState.Success -> onErrorToast( + null, + R.string.get_address_success + ) + is GetAddressUiState.Error -> onErrorToast( + getAddressUiState.exception, + R.string.get_address_fail + ) + } +}
175-190
: ์ฃผ์ ๊ฒ์ ๊ฒฐ๊ณผ์ ๋ํ ์ฌ์ฉ์ ํผ๋๋ฐฑ ๊ฐ์ ์ด ํ์ํฉ๋๋ค.ํ์ฌ ๊ตฌํ์์๋ ๋ก๋ฉ ์ํ๋ ์๋ฌ ์ํ๋ฅผ ์ฌ์ฉ์์๊ฒ ์๊ฐ์ ์ผ๋ก ํ์ํ์ง ์๊ณ ์์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ ๊ฐ์ ์ฌํญ์ ์ ์๋๋ฆฝ๋๋ค:
LazyColumn(modifier.zIndex(1f)) { + when { + addressList.isEmpty() && getAddressUiState is GetAddressUiState.Loading -> { + item { + LoadingIndicator() + } + } + addressList.isEmpty() && getAddressUiState is GetAddressUiState.Error -> { + item { + ErrorMessage( + message = "์ฃผ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.", + onRetry = onLocationSearch + ) + } + } + addressList.isEmpty() -> { + item { + EmptyMessage(message = "๊ฒ์ ๊ฒฐ๊ณผ๊ฐ ์์ต๋๋ค.") + } + } + else -> { itemsIndexed(addressList) { index, address -> // ... existing code ... } + } + } }
๐ Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
๐ Files selected for processing (3)
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt
(1 hunks)feature/expo/src/main/java/com/school_of_company/expo/view/ExpoCreateScreen.kt
(10 hunks)feature/expo/src/main/java/com/school_of_company/expo/viewmodel/ExpoViewModel.kt
(11 hunks)
๐ง Files skipped from review as they are similar to previous changes (2)
- feature/expo/src/main/java/com/school_of_company/expo/viewmodel/ExpoViewModel.kt
- feature/expo/src/main/java/com/school_of_company/expo/view/ExpoCreateScreen.kt
โฐ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
๐ Additional comments (2)
feature/expo/src/main/java/com/school_of_company/expo/view/ExpoAddressSearchScreen.kt (2)
192-201
: ์ง๋ ํ์ ๋ก์ง์ ๋ํ ๊ฐ์ ์ด ํ์ํฉ๋๋ค.์ขํ๊ฐ ๊ฒ์ฆ์ด ๋ฌธ์์ด ๋น๊ต๋ก๋ง ๋์ด ์์ด ์ ์ฌ์ ์ธ ๋ฌธ์ ๊ฐ ์์ ์ ์์ต๋๋ค.
205-220
: ๋ฒํผ ํ์ฑํ ์กฐ๊ฑด ๊ฐ์ ํ์ํ์ฌ ๋ฒํผ ํ์ฑํ ์กฐ๊ฑด์ด ๋จ์ ๋ฌธ์์ด ๊ฒ์ฌ์๋ง ์์กดํ๊ณ ์์ต๋๋ค.
โฆ-expocreatescreen-location-input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ ๊ฐ์ฌํฉ๋๋ค~~
๐ก ๊ฐ์
2025-02-09.235223.mp4
2025-02-10.011859.mp4
์ฃผ์๊ฒ์์ expoScreen์ด ์๋ AddressSearchScreen์ผ๋ก ์ด๋ํ์ฌ ์ํํ๋๋ก ๋ณ๊ฒฝํ์ต๋๋ค
๐ ์์ ๋ด์ฉ
๐ ๋ณ๊ฒฝ์ฌํญ
ExpoCreateRoute
์์ ์ฃผ์๊ฒ์ ๋ฐ ๋ณํ ๊ธฐ๋ฅ ์ญ์ ExpoAddressSearchRoute
์์ ๊ด๋ จ UI ๋ฐ Navigation ์ฒ๋ฆฌ ์ถ๊ฐ๐โโ๏ธ ์ง๋ฌธ์ฌํญ
๐ด ์ฌ์ฉ๋ฐฉ๋ฒ
ExpoAddressSearchRoute
๋ฅผ ํธ์ถํ์ฌ ์ฃผ์ ๊ฒ์ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.ExpoAddressSearchScreen
์์ ์์น๋ฅผ ์ ๋ ฅํ๊ณ ์๋์ผ๋ก ์ขํ๋ฅผ ๋ณํํ ์ ์์ต๋๋ค.Summary by CodeRabbit
์ ๊ท ๊ธฐ๋ฅ
๊ฐ์ ์ฌํญ