mirror of
https://github.com/nextcloud/talk-android
synced 2025-08-03 18:15:40 +01:00
Merge pull request #4193 from nextcloud/bugfix/4168/doNotPullMessagesWhenOfflineOrPaused
do not try to pull chat messages when offline or paused
This commit is contained in:
commit
9976767591
@ -199,8 +199,9 @@ class OfflineFirstChatRepository @Inject constructor(
|
|||||||
val networkParams = Bundle()
|
val networkParams = Bundle()
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!monitor.isOnline.first() || itIsPaused) Thread.sleep(HALF_SECOND)
|
if (!monitor.isOnline.first() || itIsPaused) {
|
||||||
|
Thread.sleep(HALF_SECOND)
|
||||||
|
} else {
|
||||||
// sync database with server (This is a long blocking call because long polling (lookIntoFuture) is set)
|
// sync database with server (This is a long blocking call because long polling (lookIntoFuture) is set)
|
||||||
networkParams.putSerializable(BundleKeys.KEY_FIELD_MAP, fieldMap)
|
networkParams.putSerializable(BundleKeys.KEY_FIELD_MAP, fieldMap)
|
||||||
|
|
||||||
@ -224,6 +225,7 @@ class OfflineFirstChatRepository @Inject constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private suspend fun hasToLoadPreviousMessagesFromServer(beforeMessageId: Long): Boolean {
|
private suspend fun hasToLoadPreviousMessagesFromServer(beforeMessageId: Long): Boolean {
|
||||||
val loadFromServer: Boolean
|
val loadFromServer: Boolean
|
||||||
|
Loading…
Reference in New Issue
Block a user