pref: LaunchedEffect
This commit is contained in:
parent
5515e8f457
commit
fd8f89153b
|
|
@ -184,15 +184,19 @@ fun BlockSettingsPage(
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
val snackbarHostState = LocalSnackbarHostState.current
|
val snackbarHostState = LocalSnackbarHostState.current
|
||||||
coroutineScope.launch {
|
LaunchedEffect(null) {
|
||||||
viewModel.uiEventFlow
|
coroutineScope.launch {
|
||||||
.filterIsInstance<BlockSettingsUiEvent.Success>()
|
viewModel.uiEventFlow
|
||||||
.collect {
|
.filterIsInstance<BlockSettingsUiEvent.Success>()
|
||||||
snackbarHostState.showSnackbar(when (it) {
|
.collect {
|
||||||
is BlockSettingsUiEvent.Success.Add -> context.getString(R.string.toast_add_success)
|
snackbarHostState.showSnackbar(
|
||||||
is BlockSettingsUiEvent.Success.Delete -> context.getString(R.string.toast_delete_success)
|
when (it) {
|
||||||
})
|
is BlockSettingsUiEvent.Success.Add -> context.getString(R.string.toast_add_success)
|
||||||
}
|
is BlockSettingsUiEvent.Success.Delete -> context.getString(R.string.toast_delete_success)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
HorizontalPager(
|
HorizontalPager(
|
||||||
count = 2,
|
count = 2,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue