Skip to content

Commit

Permalink
Got it fixed - was a parsing bug
Browse files Browse the repository at this point in the history
Signed-off-by: rapterjet2004 <[email protected]>
  • Loading branch information
rapterjet2004 committed Sep 10, 2024
1 parent b67fcad commit 0c97784
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
24 changes: 24 additions & 0 deletions .idea/inspectionProfiles/ktlint.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ class MessageInputFragment : Fragment() {
val connectionGained = (!wasOnline && isOnline)
wasOnline = !binding.fragmentMessageInputView.isShown
Log.d(TAG, "isOnline: $isOnline\nwasOnline: $wasOnline\nconnectionGained: $connectionGained")

// FIXME timeout exception - maybe something to do with the room?
// handleMessageQueue(isOnline)
handleMessageQueue(isOnline)
handleUI(isOnline, connectionGained)
}.collect()
}
Expand Down Expand Up @@ -225,7 +223,6 @@ class MessageInputFragment : Fragment() {
binding.fragmentConnectionLost.visibility = View.VISIBLE
binding.fragmentMessageInputView.attachmentButton.isEnabled = false
binding.fragmentMessageInputView.recordAudioButton.isEnabled = false
binding.fragmentMessageInputView.messageInput.isEnabled = false
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
var queueStr = ""
queue?.let {
for (msg in queue) {
val msgStr = "[${msg.message},${msg.replyTo},${msg.displayName},${msg.sendWithoutNotification}]"
val msgStr = "${msg.message},${msg.replyTo},${msg.displayName},${msg.sendWithoutNotification}^"
queueStr += msgStr
}
}
Expand All @@ -500,18 +500,20 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
val queue: MutableList<MessageInputViewModel.QueuedMessage> = mutableListOf()
if (queueStr.isEmpty()) return queue

for (msgStr in queueStr.split("]")) {
for (msgStr in queueStr.split("^")) {
try {
val msgArray = msgStr.replace("[", "").split(",")
val message = msgArray[MESSAGE_INDEX]
val replyTo = msgArray[REPLY_TO_INDEX].toInt()
val displayName = msgArray[DISPLY_NAME_INDEX]
val silent = msgArray[SILENT_INDEX].toBoolean()

val qMsg = MessageInputViewModel.QueuedMessage(message, displayName, replyTo, silent)
queue.add(qMsg)
if (msgStr.isNotEmpty()) {
val msgArray = msgStr.split(",")
val message = msgArray[MESSAGE_INDEX]
val replyTo = msgArray[REPLY_TO_INDEX].toInt()
val displayName = msgArray[DISPLY_NAME_INDEX]
val silent = msgArray[SILENT_INDEX].toBoolean()

val qMsg = MessageInputViewModel.QueuedMessage(message, displayName, replyTo, silent)
queue.add(qMsg)
}
} catch (e: IndexOutOfBoundsException) {
Log.e(TAG, "Message string: $msgStr\n $e")
Log.e(TAG, "Message string: $msgStr\n Queue String: $queueStr \n$e")
}
}

Expand Down

0 comments on commit 0c97784

Please sign in to comment.