Skip to content

[SES-3743] - Fix message request approval message not showing #1118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1910,7 +1910,7 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
private fun sendTextOnlyMessage(hasPermissionToSendSeed: Boolean = false): Pair<Address, Long>? {
val recipient = viewModel.recipient ?: return null
val sentTimestamp = SnodeAPI.nowWithOffset
viewModel.beforeSendingTextOnlyMessage()
viewModel.implicitlyApproveRecipient()
val text = getMessageBody()
val userPublicKey = textSecurePreferences.getLocalNumber()
val isNoteToSelf = (recipient.isContactRecipient && recipient.address.toString() == userPublicKey)
Expand Down Expand Up @@ -1949,6 +1949,7 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
null,
true
)

MessageSender.send(message, recipient.address)
}
// Send a typing stopped message
Expand All @@ -1968,7 +1969,7 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
}
val recipient = viewModel.recipient!!
val sentTimestamp = SnodeAPI.nowWithOffset
viewModel.beforeSendingAttachments()
viewModel.implicitlyApproveRecipient()

// Create the message
val message = VisibleMessage().applyExpiryMode(viewModel.threadId)
Expand Down Expand Up @@ -2014,6 +2015,7 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
null,
runThreadUpdate = true
)

MessageSender.send(message, recipient.address, attachments, quote, linkPreview)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import dagger.assisted.AssistedInject
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
Expand Down Expand Up @@ -971,18 +972,10 @@ class ConversationViewModel(
attachmentDownloadHandler.retryFailedAttachments(attachments)
}

fun beforeSendingTextOnlyMessage() {
implicitlyApproveRecipient()
}

fun beforeSendingAttachments() {
implicitlyApproveRecipient()
}

private fun implicitlyApproveRecipient() {
val recipient = recipient
fun implicitlyApproveRecipient() {
val recipient = recipient

if (uiState.value.messageRequestState is MessageRequestUiState.Visible) {
if (uiState.value.messageRequestState is MessageRequestUiState.Visible) {
acceptMessageRequest()
} else if (recipient?.isApproved == false) {
// edge case for new outgoing thread on new recipient without sending approval messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,8 @@ class DefaultConversationRepository @Inject constructor(
)
} else {
val message = MessageRequestResponse(true)
MessageSender.sendNonDurably(
message = message,
destination = Destination.from(recipient.address),
isSyncMessage = recipient.isLocalNumber
).await()

MessageSender.send(message = message, address = recipient.address)

// add a control message for our user
storage.insertMessageRequestResponseFromYou(threadId)
Expand Down