File tree Expand file tree Collapse file tree 6 files changed +22
-6
lines changed
kotlin/com/ninecraft/booket/core/common
ui/src/main/kotlin/com/ninecraft/booket/core/ui
main/src/main/kotlin/com/ninecraft/booket/feature/main
splash/src/main/kotlin/com/ninecraft/booket/splash Expand file tree Collapse file tree 6 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,6 @@ package com.ninecraft.booket.core.common.constants
22
33data class ErrorDialogSpec (
44 val message : String ,
5- val buttonLabel : String ,
5+ val buttonLabelResId : Int ,
66 val action : () -> Unit ,
77)
Original file line number Diff line number Diff line change 11package com.ninecraft.booket.core.common.utils
22
3+ import androidx.annotation.StringRes
4+ import com.ninecraft.booket.core.common.R
35import com.ninecraft.booket.core.common.constants.ErrorDialogSpec
46import com.ninecraft.booket.core.common.constants.ErrorScope
57import com.ninecraft.booket.core.common.event.ErrorEvent
@@ -46,11 +48,13 @@ fun handleException(
4648fun postErrorDialog (
4749 errorScope : ErrorScope ,
4850 exception : Throwable ,
51+ @StringRes buttonLabelResId : Int = R .string.confirm,
4952 action : () -> Unit = {},
5053) {
5154 val spec = buildDialog(
5255 scope = errorScope,
5356 exception = exception,
57+ buttonLabelResId = buttonLabelResId,
5458 action = action,
5559 )
5660
@@ -60,6 +64,7 @@ fun postErrorDialog(
6064private fun buildDialog (
6165 scope : ErrorScope ,
6266 exception : Throwable ,
67+ @StringRes buttonLabelResId : Int ,
6368 action : () -> Unit ,
6469): ErrorDialogSpec {
6570 val message = when {
@@ -92,7 +97,7 @@ private fun buildDialog(
9297 }
9398 }
9499
95- return ErrorDialogSpec (message = message, buttonLabel = " 확인 " , action = action)
100+ return ErrorDialogSpec (message = message, buttonLabelResId = buttonLabelResId , action = action)
96101}
97102
98103@Suppress(" TooGenericExceptionCaught" )
Original file line number Diff line number Diff line change 55 <string name =" book_status_completed" >독서 완료</string >
66 <string name =" record_sort_page_ascending" >페이지순</string >
77 <string name =" record_sort_recent_register" >최신 등록순</string >
8+ <string name =" confirm" >확인</string >
89</resources >
Original file line number Diff line number Diff line change @@ -22,13 +22,13 @@ fun ReedScaffold(
2222 content : @Composable (PaddingValues ) -> Unit ,
2323) {
2424 Scaffold (
25+ modifier = modifier.keyboardHide(),
2526 topBar = topBar,
2627 bottomBar = bottomBar,
2728 snackbarHost = snackbarHost,
2829 floatingActionButton = floatingActionButton,
2930 containerColor = containerColor,
3031 contentWindowInsets = contentWindowInsets,
31- modifier = modifier.keyboardHide(),
3232 ) { innerPadding ->
3333 content(innerPadding)
3434 }
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import androidx.compose.runtime.mutableStateOf
1111import androidx.compose.runtime.remember
1212import androidx.compose.ui.Modifier
1313import androidx.compose.ui.graphics.Color
14+ import androidx.compose.ui.res.stringResource
1415import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
1516import com.ninecraft.booket.core.common.constants.ErrorDialogSpec
1617import com.ninecraft.booket.core.common.event.ErrorEvent
@@ -70,7 +71,8 @@ class MainActivity : ComponentActivity() {
7071 dialogSpec.value?.let { spec ->
7172 ReedDialog (
7273 description = spec.message,
73- confirmButtonText = spec.buttonLabel,
74+ confirmButtonText = stringResource(spec.buttonLabelResId),
75+
7476 onConfirmRequest = {
7577 spec.action()
7678 dialogSpec.value = null
Original file line number Diff line number Diff line change @@ -6,10 +6,13 @@ import androidx.compose.runtime.getValue
66import androidx.compose.runtime.mutableStateOf
77import androidx.compose.runtime.rememberCoroutineScope
88import androidx.compose.runtime.setValue
9+ import com.ninecraft.booket.core.common.constants.ErrorScope
10+ import com.ninecraft.booket.core.common.utils.postErrorDialog
911import com.ninecraft.booket.core.data.api.repository.AuthRepository
1012import com.ninecraft.booket.core.data.api.repository.UserRepository
1113import com.ninecraft.booket.core.model.AutoLoginState
1214import com.ninecraft.booket.core.model.OnboardingState
15+ import com.ninecraft.booket.core.ui.R
1316import com.ninecraft.booket.feature.screens.HomeScreen
1417import com.ninecraft.booket.feature.screens.LoginScreen
1518import com.ninecraft.booket.feature.screens.OnboardingScreen
@@ -50,8 +53,13 @@ class SplashPresenter @AssistedInject constructor(
5053 navigator.resetRoot(LoginScreen )
5154 }
5255 }
53- .onFailure {
54- navigator.resetRoot(LoginScreen )
56+ .onFailure { exception ->
57+ postErrorDialog(
58+ errorScope = ErrorScope .GLOBAL ,
59+ exception = exception,
60+ buttonLabelResId = R .string.retry,
61+ action = { checkTermsAgreement() },
62+ )
5563 }
5664 }
5765 }
You can’t perform that action at this time.
0 commit comments