Only wait 5 seconds to update lists if contents are already been displayed.

This commit is contained in:
Vitor Pamplona
2023-02-14 17:42:35 -05:00
parent c56d3af0fc
commit c0fe13d79c
3 changed files with 6 additions and 3 deletions

View File

@@ -125,6 +125,7 @@ class CardFeedViewModel(val dataSource: NostrDataSource<Note>): ViewModel() {
handlerWaiting.set(true)
val scope = CoroutineScope(Job() + Dispatchers.Default)
scope.launch {
if (feedContent.value is CardFeedState.Loaded)
delay(5000)
refresh()
handlerWaiting.set(false)

View File

@@ -122,6 +122,7 @@ abstract class FeedViewModel(val dataSource: NostrDataSource<Note>): ViewModel()
handlerWaiting.set(true)
val scope = CoroutineScope(Job() + Dispatchers.Default)
scope.launch {
if (feedContent.value is FeedState.Loaded)
delay(5000)
refresh()
handlerWaiting.set(false)

View File

@@ -87,6 +87,7 @@ open class UserFeedViewModel(val dataSource: NostrDataSource<User>): ViewModel()
handlerWaiting.set(true)
val scope = CoroutineScope(Job() + Dispatchers.Default)
scope.launch {
if (feedContent.value is UserFeedState.Loaded)
delay(5000)
refresh()
handlerWaiting.set(false)