Skip to content

Commit 4c6c08b

Browse files
authored
Merge pull request #4645 from nextcloud/bugfix/4643/fixShimmerAndOfflineNoMessagesInfo
fix shimmer and "offlineNoMessages"-info handling
2 parents 7d0c6d6 + 3330fc8 commit 4c6c08b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt

+7-4
Original file line numberDiff line numberDiff line change
@@ -828,12 +828,15 @@ class ChatActivity :
828828
// Handle UI on first load
829829
cancelNotificationsForCurrentConversation()
830830
binding.progressBar.visibility = View.GONE
831+
binding.offline.root.visibility = View.GONE
831832
binding.messagesListView.visibility = View.VISIBLE
832833
collapseSystemMessages()
833834
}
834835

835836
is ChatViewModel.ChatMessageUpdateState -> {
836-
// unused atm
837+
binding.progressBar.visibility = View.GONE
838+
binding.offline.root.visibility = View.GONE
839+
binding.messagesListView.visibility = View.VISIBLE
837840
}
838841

839842
is ChatViewModel.ChatMessageErrorState -> {
@@ -918,9 +921,9 @@ class ChatActivity :
918921
chatViewModel.getGeneralUIFlow.onEach { key ->
919922
when (key) {
920923
NO_OFFLINE_MESSAGES_FOUND -> {
921-
if (networkMonitor.isOnline.value.not()) {
922-
binding.offline.root.visibility = View.VISIBLE
923-
}
924+
binding.progressBar.visibility = View.GONE
925+
binding.messagesListView.visibility = View.GONE
926+
binding.offline.root.visibility = View.VISIBLE
924927
}
925928

926929
else -> {}

app/src/main/java/com/nextcloud/talk/chat/data/network/OfflineFirstChatRepository.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ class OfflineFirstChatRepository @Inject constructor(
157157
} else {
158158
if (!weAlreadyHaveSomeOfflineMessages) {
159159
Log.d(TAG, "An online request for newest 100 messages is made because offline chat is empty")
160-
_generalUIFlow.emit(ChatActivity.NO_OFFLINE_MESSAGES_FOUND)
160+
if (networkMonitor.isOnline.value.not()) {
161+
_generalUIFlow.emit(ChatActivity.NO_OFFLINE_MESSAGES_FOUND)
162+
}
161163
} else {
162164
Log.d(
163165
TAG,

0 commit comments

Comments
 (0)