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