From d96682889c77c6363d295b4d10ebdc6af59d766c Mon Sep 17 00:00:00 2001 From: rapterjet2004 Date: Thu, 24 Oct 2024 08:39:16 -0500 Subject: [PATCH] fix to display message queue when revisiting chat in offline mode Signed-off-by: rapterjet2004 --- app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt | 6 ++---- .../java/com/nextcloud/talk/chat/MessageInputFragment.kt | 2 -- .../nextcloud/talk/chat/viewmodels/MessageInputViewModel.kt | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index 0845caddd6..08103488ce 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -91,13 +91,13 @@ import com.nextcloud.talk.adapters.messages.IncomingPreviewMessageViewHolder import com.nextcloud.talk.adapters.messages.IncomingTextMessageViewHolder import com.nextcloud.talk.adapters.messages.IncomingVoiceMessageViewHolder import com.nextcloud.talk.adapters.messages.MessagePayload +import com.nextcloud.talk.adapters.messages.OutcomingDeckCardViewHolder import com.nextcloud.talk.adapters.messages.OutcomingLinkPreviewMessageViewHolder import com.nextcloud.talk.adapters.messages.OutcomingLocationMessageViewHolder import com.nextcloud.talk.adapters.messages.OutcomingPollMessageViewHolder import com.nextcloud.talk.adapters.messages.OutcomingPreviewMessageViewHolder import com.nextcloud.talk.adapters.messages.OutcomingTextMessageViewHolder import com.nextcloud.talk.adapters.messages.OutcomingVoiceMessageViewHolder -import com.nextcloud.talk.adapters.messages.OutcomingDeckCardViewHolder import com.nextcloud.talk.adapters.messages.PreviewMessageInterface import com.nextcloud.talk.adapters.messages.PreviewMessageViewHolder import com.nextcloud.talk.adapters.messages.SystemMessageInterface @@ -540,7 +540,6 @@ class ChatActivity : messageInputViewModel.messageQueueFlow.observe(this) { list -> list.forEachIndexed { _, qMsg -> - Log.d("Julius", "Message recieved: ${qMsg.message}") val temporaryChatMessage = ChatMessage() temporaryChatMessage.jsonMessageId = -3 temporaryChatMessage.actorId = "-3" @@ -565,7 +564,6 @@ class ChatActivity : pos = adapter?.getMessagePositionById("-3") } adapter?.notifyDataSetChanged() - Log.d("Julius", "End i: $i") } } @@ -664,13 +662,13 @@ class ChatActivity : withCredentials = credentials!!, withUrl = urlForChatting ) + messageInputViewModel.getTempMessagesFromMessageQueue(currentConversation!!.internalId) } } else { Log.w( TAG, "currentConversation was null in observer ChatViewModel.GetCapabilitiesInitialLoadState" ) - messageInputViewModel.getTempMessagesFromMessageQueue(currentConversation!!.internalId) } } diff --git a/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt b/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt index 79af0a4f53..9ddcc6c560 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt @@ -190,8 +190,6 @@ class MessageInputFragment : Fragment() { } chatActivity.messageInputViewModel.messageQueueSizeFlow.observe(viewLifecycleOwner) { size -> - Log.d("Julius", "MessageQueueSizeFlow recieved: $size") - if (size > 0) { binding.fragmentConnectionLost.text = getString(R.string.connection_lost_queued, size) } else { diff --git a/app/src/main/java/com/nextcloud/talk/chat/viewmodels/MessageInputViewModel.kt b/app/src/main/java/com/nextcloud/talk/chat/viewmodels/MessageInputViewModel.kt index c553de7d98..6e17ac0b61 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/viewmodels/MessageInputViewModel.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/viewmodels/MessageInputViewModel.kt @@ -277,7 +277,6 @@ class MessageInputViewModel @Inject constructor( val queue = dataStore.getMessageQueue(internalId) val list = mutableListOf() for (msg in queue) { - Log.d("Julius", "Msg: ${msg.message}") list.add(msg) } _messageQueueFlow.postValue(list)