diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/util/ComposeUtil.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/util/ComposeUtil.kt
index dc486129..7001e041 100644
--- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/util/ComposeUtil.kt
+++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/util/ComposeUtil.kt
@@ -1,13 +1,17 @@
package ac.dnd.bookkeeping.android.presentation.common.util
+import ac.dnd.bookkeeping.android.presentation.R
import ac.dnd.bookkeeping.android.presentation.common.base.BaseViewModel
import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.eventObserve
import ac.dnd.bookkeeping.android.presentation.common.view.DialogScreen
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalLifecycleOwner
+import androidx.compose.ui.res.stringResource
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
@@ -22,15 +26,22 @@ import kotlin.coroutines.EmptyCoroutineContext
fun ErrorObserver(
viewModel: BaseViewModel
) {
- val dialogIsShowingState = remember { mutableStateOf(false) }
- DialogScreen(dialogIsShowingState)
+ var isDialogShowing by remember { mutableStateOf(false) }
+
+ DialogScreen(
+ isShowing = isDialogShowing,
+ title = stringResource(id = R.string.error_dialog_title),
+ onDismissRequest = {
+ isDialogShowing = false
+ }
+ )
LaunchedEffectWithLifecycle(viewModel.errorEvent) {
viewModel.errorEvent.eventObserve { event ->
Timber.d(event.throwable)
Sentry.captureException(event.throwable)
- dialogIsShowingState.value = true
+ isDialogShowing = true
}
}
}
diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml
index 8f8b0669..cf65dd35 100644
--- a/presentation/src/main/res/values/strings.xml
+++ b/presentation/src/main/res/values/strings.xml
@@ -5,6 +5,8 @@
확인
취소
+ 앗, 에러가 발생했어요!
+
테스트