Browse Source

Merge pull request #3839 from nextcloud/bug-fix-chat-refresh-on-load

Fix onLoadMore not refreshing instantly
Marcel Hibbe 1 year ago
parent
commit
97cdfb1795
1 changed files with 2 additions and 1 deletions
  1. 2 1
      app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt

+ 2 - 1
app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt

@@ -3968,7 +3968,7 @@ class ChatActivity :
     }
 
     override fun onLoadMore(page: Int, totalItemsCount: Int) {
-        val calculatedPage = page / MESSAGE_PULL_LIMIT
+        val calculatedPage = totalItemsCount / PAGE_SIZE
         if (calculatedPage > 0) {
             chatViewModel.refreshChatParams(
                 setupFieldsForPullChatMessages(
@@ -4991,5 +4991,6 @@ class ChatActivity :
         private const val CURRENT_AUDIO_POSITION_KEY = "CURRENT_AUDIO_POSITION"
         private const val CURRENT_AUDIO_WAS_PLAYING_KEY = "CURRENT_AUDIO_PLAYING"
         private const val RESUME_AUDIO_TAG = "RESUME_AUDIO_TAG"
+        private const val PAGE_SIZE = 50
     }
 }