From 20abe8fdb88e6d53b814eadc6401cd3472cbe4f8 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Fri, 25 Jun 2021 15:24:34 +1000 Subject: [PATCH] Clean --- .../conversation/v2/ConversationActivityV2.kt | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 065bab2716..c95a514b8e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -343,7 +343,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe val lastCharIndex = text.lastIndex val lastChar = text[lastCharIndex] // Check if there is whitespace before the '@' or the '@' is the first character - val isCharacterBeforeLastWhiteSpaceOrStartOfLine: Boolean if (text.length == 1) { isCharacterBeforeLastWhiteSpaceOrStartOfLine = true // Start of line @@ -403,12 +402,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe isShowingMentionCandidatesView = false } - private fun resetMentions() { - previousText = "" - currentMentionStartIndex = -1 - mentions.clear() - } - override fun toggleAttachmentOptions() { val targetAlpha = if (isShowingAttachmentOptions) 0.0f else 1.0f val allButtons = listOf( cameraButtonContainer, libraryButtonContainer, documentButtonContainer, gifButtonContainer) @@ -639,23 +632,23 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe } override fun send() { + // Create the message val message = VisibleMessage() message.sentTimestamp = System.currentTimeMillis() message.text = getMessageBody() val outgoingTextMessage = OutgoingTextMessage.from(message, thread) - ApplicationContext.getInstance(this).typingStatusSender.onTypingStopped(threadID) - -// silentlySetComposeText("") -// val id: Long = fragment.stageOutgoingMessage(outgoingTextMessage) -// -// if (initiating) { -// DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true) -// } -// -// val allocatedThreadId: Long = getAllocatedThreadId(context) - message.id = DatabaseFactory.getSmsDatabase(this).insertMessageOutbox(threadID, outgoingTextMessage, false, message.sentTimestamp!!) { /**fragment.releaseOutgoingMessage(id)*/ } - + // Clear the input bar + inputBar.text = "" + // Clear mentions + previousText = "" + currentMentionStartIndex = -1 + mentions.clear() + // Put the message in the database + message.id = DatabaseFactory.getSmsDatabase(this).insertMessageOutbox(threadID, outgoingTextMessage, false, message.sentTimestamp!!) { } + // Send it MessageSender.send(message, thread.address) + // Send a typing stopped message + ApplicationContext.getInstance(this).typingStatusSender.onTypingStopped(threadID) } // endregion