mirror of
https://github.com/nextcloud/talk-android.git
synced 2025-08-16 18:21:54 +00:00
only make network call when device is online
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
@ -161,8 +161,13 @@ class OfflineFirstChatRepository @Inject constructor(
|
||||
} else {
|
||||
if (!weAlreadyHaveSomeOfflineMessages) {
|
||||
Log.d(TAG, "An online request for newest 100 messages is made because offline chat is empty")
|
||||
val maintenanceMode = network.getServerStatus(currentUser.baseUrl!!).maintenance
|
||||
if (networkMonitor.isOnline.value.not() || maintenanceMode) {
|
||||
val offline = networkMonitor.isOnline.value.not()
|
||||
val maintenance = if (!offline) {
|
||||
network.getServerStatus(currentUser.baseUrl!!).maintenance
|
||||
} else {
|
||||
false
|
||||
}
|
||||
if (offline || maintenance) {
|
||||
_generalUIFlow.emit(ChatActivity.NO_OFFLINE_MESSAGES_FOUND)
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user