mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05:19 +00:00
Merge pull request #1671 from oxen-io/fix/attachment-anrs
Moving the heavy lifting code in a coroutine to help with ANRs
This commit is contained in:
commit
f35f30a3b1
@ -1785,10 +1785,21 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
attachmentManager.clear()
|
||||
// Reset attachments button if needed
|
||||
if (isShowingAttachmentOptions) { toggleAttachmentOptions() }
|
||||
|
||||
// do the heavy work in the bg
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
// Put the message in the database
|
||||
message.id = mmsDb.insertMessageOutbox(outgoingTextMessage, viewModel.threadId, false, null, runThreadUpdate = true)
|
||||
message.id = mmsDb.insertMessageOutbox(
|
||||
outgoingTextMessage,
|
||||
viewModel.threadId,
|
||||
false,
|
||||
null,
|
||||
runThreadUpdate = true
|
||||
)
|
||||
// Send it
|
||||
MessageSender.send(message, recipient.address, attachments, quote, linkPreview)
|
||||
}
|
||||
|
||||
// Send a typing stopped message
|
||||
ApplicationContext.getInstance(this).typingStatusSender.onTypingStopped(viewModel.threadId)
|
||||
return Pair(recipient.address, sentTimestamp)
|
||||
|
Loading…
Reference in New Issue
Block a user