kopia lustrzana https://github.com/vitorpamplona/amethyst
Increasing Delays to update lists to 5 seconds while making sure it refreshes quickly when the user switches the tab.
rodzic
90bdeffc52
commit
a050236d6a
|
@ -125,7 +125,7 @@ class CardFeedViewModel(val dataSource: NostrDataSource<Note>): ViewModel() {
|
|||
handlerWaiting.set(true)
|
||||
val scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||
scope.launch {
|
||||
delay(100)
|
||||
delay(5000)
|
||||
refresh()
|
||||
handlerWaiting.set(false)
|
||||
}
|
||||
|
|
|
@ -78,7 +78,6 @@ abstract class FeedViewModel(val dataSource: NostrDataSource<Note>): ViewModel()
|
|||
}
|
||||
|
||||
fun refresh() {
|
||||
println("AAA Refresh")
|
||||
val scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||
scope.launch {
|
||||
refreshSuspended()
|
||||
|
@ -123,7 +122,7 @@ abstract class FeedViewModel(val dataSource: NostrDataSource<Note>): ViewModel()
|
|||
handlerWaiting.set(true)
|
||||
val scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||
scope.launch {
|
||||
delay(1000)
|
||||
delay(5000)
|
||||
refresh()
|
||||
handlerWaiting.set(false)
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ open class UserFeedViewModel(val dataSource: NostrDataSource<User>): ViewModel()
|
|||
handlerWaiting.set(true)
|
||||
val scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||
scope.launch {
|
||||
delay(1000)
|
||||
delay(5000)
|
||||
refresh()
|
||||
handlerWaiting.set(false)
|
||||
}
|
||||
|
|
|
@ -131,6 +131,7 @@ fun ChannelScreen(channelId: String?, accountViewModel: AccountViewModel, accoun
|
|||
onPost = {
|
||||
account.sendChannelMeesage(newPost.value.text, channel.idHex, null, null)
|
||||
newPost.value = TextFieldValue("")
|
||||
feedViewModel.refresh() // Don't wait a full second before updating
|
||||
},
|
||||
newPost.value.text.isNotBlank(),
|
||||
modifier = Modifier.padding(end = 10.dp)
|
||||
|
|
|
@ -75,7 +75,8 @@ fun TabKnown(accountViewModel: AccountViewModel, navController: NavController) {
|
|||
val feedViewModel: NostrChatroomListKnownFeedViewModel = viewModel()
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
feedViewModel.refresh()
|
||||
feedViewModel.hardRefresh() // refresh filters
|
||||
feedViewModel.refresh() // refresh view
|
||||
}
|
||||
|
||||
Column(Modifier.fillMaxHeight()) {
|
||||
|
@ -92,7 +93,8 @@ fun TabNew(accountViewModel: AccountViewModel, navController: NavController) {
|
|||
val feedViewModel: NostrChatroomListNewFeedViewModel = viewModel()
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
feedViewModel.refresh()
|
||||
feedViewModel.hardRefresh() // refresh filters
|
||||
feedViewModel.refresh() // refresh view
|
||||
}
|
||||
|
||||
Column(Modifier.fillMaxHeight()) {
|
||||
|
|
|
@ -110,6 +110,7 @@ fun ChatroomScreen(userId: String?, accountViewModel: AccountViewModel, navContr
|
|||
onPost = {
|
||||
account.sendPrivateMeesage(newPost.value.text, userId)
|
||||
newPost.value = TextFieldValue("")
|
||||
feedViewModel.refresh() // Don't wait a full second before updating
|
||||
},
|
||||
newPost.value.text.isNotBlank(),
|
||||
modifier = Modifier.padding(end = 10.dp)
|
||||
|
|
|
@ -34,6 +34,7 @@ fun HomeScreen(accountViewModel: AccountViewModel, navController: NavController)
|
|||
|
||||
LaunchedEffect(Unit) {
|
||||
feedViewModel.refresh()
|
||||
feedViewModelReplies.refresh()
|
||||
}
|
||||
|
||||
Column(Modifier.fillMaxHeight()) {
|
||||
|
|
Ładowanie…
Reference in New Issue