Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
rapterjet2004 2024-09-19 09:21:03 -05:00 committed by Marcel Hibbe
parent 498a1274d9
commit fb9a7b8e04
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
3 changed files with 24 additions and 1 deletions

View File

@ -535,6 +535,16 @@ class ChatActivity :
private fun initObservers() {
Log.d(TAG, "initObservers Called")
messageInputViewModel.messageQueueFlow.observe(this) { message ->
// TODO shouldn't be able save state
val temporaryChatMessage = ChatMessage()
temporaryChatMessage.jsonMessageId = -3
temporaryChatMessage.actorId = "-3"
temporaryChatMessage.timestamp = (adapter?.items?.get(0)?.item as ChatMessage).timestamp
temporaryChatMessage.message = message
adapter?.addToStart(temporaryChatMessage, true)
}
this.lifecycleScope.launch {
chatViewModel.getConversationFlow
.onEach { conversationModel ->

View File

@ -124,6 +124,10 @@ class MessageInputViewModel @Inject constructor(
val messageQueueSizeFlow: LiveData<Int>
get() = _messageQueueSizeFlow.asLiveData()
private val _messageQueueFlow: MutableLiveData<String> = MutableLiveData()
val messageQueueFlow: LiveData<String>
get() = _messageQueueFlow
@Suppress("LongParameterList")
fun sendChatMessage(
roomToken: String,
@ -138,6 +142,7 @@ class MessageInputViewModel @Inject constructor(
messageQueue.add(QueuedMessage(message, displayName, replyTo, sendWithoutNotification))
dataStore.saveMessageQueue(roomToken, messageQueue)
_messageQueueSizeFlow.update { messageQueue.size }
_messageQueueFlow.postValue(message.toString())
return
}
@ -274,6 +279,6 @@ class MessageInputViewModel @Inject constructor(
companion object {
private val TAG = MessageInputViewModel::class.java.simpleName
private const val DELAY_BETWEEN_QUEUED_MESSAGES: Long = 100
private const val DELAY_BETWEEN_QUEUED_MESSAGES: Long = 500
}
}

View File

@ -15,6 +15,14 @@
android:layout_marginRight="16dp"
android:layout_marginBottom="2dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_signal_wifi_off_white_24dp"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/standard_margin"
app:tint="@color/hwSecurityRed" />
<com.google.android.flexbox.FlexboxLayout
android:id="@id/bubble"
android:layout_width="wrap_content"