Skip to content
Snippets Groups Projects
Verified Commit 7e534c97 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Only load data if buffer is empty

parent 9761d199
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -324,9 +324,16 @@ class MessageListFragment : ServiceBoundFragment() {
this, Observer {
if (it?.orNull() == ConnectionState.CONNECTED) {
runInBackgroundDelayed(16) {
viewModel.buffer { bufferId ->
// Try loading messages when switching to isEmpty buffer
if (database.message().bufferSize(bufferId) == 0) {
if (bufferId > 0 && bufferId != Int.MAX_VALUE) {
loadMore(initial = true)
}
}
}
}
}
})
viewModel.session.toLiveData().zip(lastMessageId).observe(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment