mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-28 09:38:14 +03:00
fix to display message queue when revisiting chat in offline mode
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
967c3aedd3
commit
d96682889c
3 changed files with 2 additions and 7 deletions
|
@ -91,13 +91,13 @@ import com.nextcloud.talk.adapters.messages.IncomingPreviewMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.IncomingTextMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.IncomingTextMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.IncomingVoiceMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.IncomingVoiceMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.MessagePayload
|
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.OutcomingLinkPreviewMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.OutcomingLocationMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.OutcomingLocationMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.OutcomingPollMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.OutcomingPollMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.OutcomingPreviewMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.OutcomingPreviewMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.OutcomingTextMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.OutcomingTextMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.OutcomingVoiceMessageViewHolder
|
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.PreviewMessageInterface
|
||||||
import com.nextcloud.talk.adapters.messages.PreviewMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.PreviewMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.SystemMessageInterface
|
import com.nextcloud.talk.adapters.messages.SystemMessageInterface
|
||||||
|
@ -540,7 +540,6 @@ class ChatActivity :
|
||||||
|
|
||||||
messageInputViewModel.messageQueueFlow.observe(this) { list ->
|
messageInputViewModel.messageQueueFlow.observe(this) { list ->
|
||||||
list.forEachIndexed { _, qMsg ->
|
list.forEachIndexed { _, qMsg ->
|
||||||
Log.d("Julius", "Message recieved: ${qMsg.message}")
|
|
||||||
val temporaryChatMessage = ChatMessage()
|
val temporaryChatMessage = ChatMessage()
|
||||||
temporaryChatMessage.jsonMessageId = -3
|
temporaryChatMessage.jsonMessageId = -3
|
||||||
temporaryChatMessage.actorId = "-3"
|
temporaryChatMessage.actorId = "-3"
|
||||||
|
@ -565,7 +564,6 @@ class ChatActivity :
|
||||||
pos = adapter?.getMessagePositionById("-3")
|
pos = adapter?.getMessagePositionById("-3")
|
||||||
}
|
}
|
||||||
adapter?.notifyDataSetChanged()
|
adapter?.notifyDataSetChanged()
|
||||||
Log.d("Julius", "End i: $i")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,13 +662,13 @@ class ChatActivity :
|
||||||
withCredentials = credentials!!,
|
withCredentials = credentials!!,
|
||||||
withUrl = urlForChatting
|
withUrl = urlForChatting
|
||||||
)
|
)
|
||||||
|
messageInputViewModel.getTempMessagesFromMessageQueue(currentConversation!!.internalId)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w(
|
Log.w(
|
||||||
TAG,
|
TAG,
|
||||||
"currentConversation was null in observer ChatViewModel.GetCapabilitiesInitialLoadState"
|
"currentConversation was null in observer ChatViewModel.GetCapabilitiesInitialLoadState"
|
||||||
)
|
)
|
||||||
messageInputViewModel.getTempMessagesFromMessageQueue(currentConversation!!.internalId)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,8 +190,6 @@ class MessageInputFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
chatActivity.messageInputViewModel.messageQueueSizeFlow.observe(viewLifecycleOwner) { size ->
|
chatActivity.messageInputViewModel.messageQueueSizeFlow.observe(viewLifecycleOwner) { size ->
|
||||||
Log.d("Julius", "MessageQueueSizeFlow recieved: $size")
|
|
||||||
|
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
binding.fragmentConnectionLost.text = getString(R.string.connection_lost_queued, size)
|
binding.fragmentConnectionLost.text = getString(R.string.connection_lost_queued, size)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -277,7 +277,6 @@ class MessageInputViewModel @Inject constructor(
|
||||||
val queue = dataStore.getMessageQueue(internalId)
|
val queue = dataStore.getMessageQueue(internalId)
|
||||||
val list = mutableListOf<QueuedMessage>()
|
val list = mutableListOf<QueuedMessage>()
|
||||||
for (msg in queue) {
|
for (msg in queue) {
|
||||||
Log.d("Julius", "Msg: ${msg.message}")
|
|
||||||
list.add(msg)
|
list.add(msg)
|
||||||
}
|
}
|
||||||
_messageQueueFlow.postValue(list)
|
_messageQueueFlow.postValue(list)
|
||||||
|
|
Loading…
Reference in a new issue