Uses default thread to wait for a 250 milliseconds before navigating away from the video upload page.

pull/449/head
Vitor Pamplona 2023-06-08 16:31:04 -04:00
rodzic 9589f68028
commit b641684377
1 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -88,8 +88,10 @@ import com.vitorpamplona.amethyst.ui.screen.NostrVideoFeedViewModel
import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys
import com.vitorpamplona.amethyst.ui.screen.rememberForeverPagerState import com.vitorpamplona.amethyst.ui.screen.rememberForeverPagerState
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@Composable @Composable
fun VideoScreen( fun VideoScreen(
@ -415,11 +417,13 @@ fun NewImageButton(accountViewModel: AccountViewModel, nav: (String) -> Unit) {
val postViewModel: NewMediaModel = viewModel() val postViewModel: NewMediaModel = viewModel()
postViewModel.onceUploaded { postViewModel.onceUploaded {
scope.launch { scope.launch(Dispatchers.Default) {
// awaits an refresh on the list // awaits an refresh on the list
delay(250) delay(250)
val route = Route.Video.route.replace("{scrollToTop}", "true") withContext(Dispatchers.Main) {
nav(route) val route = Route.Video.route.replace("{scrollToTop}", "true")
nav(route)
}
} }
} }