Skip to content

Commit

Permalink
snackbar duration 1초로 커스텀하게 변경 (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
easyhooon committed Aug 22, 2023
1 parent 518364b commit bcd1eae
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ import com.nexters.bandalart.android.feature.home.ui.BandalartListBottomSheet
import com.nexters.bandalart.android.feature.home.ui.BandalartSkeleton
import com.nexters.bandalart.android.feature.home.ui.CompletionRatioProgressBar
import com.nexters.bandalart.android.feature.home.ui.HomeTopBar
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

private const val SnackbarDuration = 1000L

@Composable
internal fun HomeRoute(
Expand All @@ -93,7 +97,11 @@ internal fun HomeRoute(
viewModel.eventFlow.collect { event ->
when (event) {
is HomeUiEvent.ShowSnackbar -> {
onShowSnackbar(event.message.asString(context))
val job = launch {
onShowSnackbar(event.message.asString(context))
}
delay(SnackbarDuration)
job.cancel()
}
is HomeUiEvent.ShowToast -> {
Toast.makeText(context, event.message.asString(context), Toast.LENGTH_SHORT).show()
Expand Down

0 comments on commit bcd1eae

Please sign in to comment.