Fix bug when replying with a voice note.

This commit is contained in:
Greyson Parrelli
2025-09-17 13:30:02 -04:00
parent f5effa5be9
commit 52005cf62c
4 changed files with 25 additions and 3 deletions

View File

@@ -256,7 +256,7 @@ public abstract class PushSendJob extends SendJob {
.map(Contact.Avatar::getAttachment).withoutNulls()
.toList());
return new HashSet<>(Stream.of(attachments).map(a -> {
HashSet<String> jobs = new HashSet<>(Stream.of(attachments).map(a -> {
final AttachmentId attachmentId = ((DatabaseAttachment) a).attachmentId;
Log.d(TAG, "Enqueueing job chain to upload " + attachmentId);
AttachmentUploadJob attachmentUploadJob = new AttachmentUploadJob(attachmentId);
@@ -268,6 +268,17 @@ public abstract class PushSendJob extends SendJob {
return attachmentUploadJob.getId();
})
.toList());
if (message.getOutgoingQuote() != null && message.getOutgoingQuote().getAttachment() != null) {
AttachmentId attachmentId = ((DatabaseAttachment) message.getOutgoingQuote().getAttachment()).attachmentId;
AttachmentUploadJob quoteUploadJob = new AttachmentUploadJob(attachmentId);
jobManager.add(quoteUploadJob);
jobs.add(quoteUploadJob.getId());
}
return jobs;
}
protected @NonNull List<SignalServiceAttachment> getAttachmentPointersFor(List<Attachment> attachments) {

View File

@@ -32,6 +32,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.core.os.bundleOf
import androidx.fragment.app.FragmentActivity
import org.signal.core.ui.compose.Dividers
import org.thoughtcrime.securesms.compose.ComposeFullScreenDialogFragment
import org.thoughtcrime.securesms.database.model.MessageRecord
import org.thoughtcrime.securesms.messagedetails.InternalMessageDetailsViewModel.AttachmentInfo
@@ -143,8 +144,12 @@ private fun Content(state: ViewState) {
.fillMaxWidth()
)
} else {
state.attachments.forEach { attachment ->
state.attachments.forEachIndexed { i, attachment ->
AttachmentBlock(attachment)
if (i != state.attachments.lastIndex) {
Dividers.Default()
}
}
}
}
@@ -199,6 +204,10 @@ private fun AttachmentBlock(attachment: AttachmentInfo) {
name = "Content Type",
value = attachment.contentType ?: "null"
)
ClickToCopyRow(
name = "Quote Target Content Type",
value = attachment.quoteTargetContentType ?: "Not a quote"
)
ClickToCopyRow(
name = "Start Hash",
value = attachment.hashStart ?: "null"

View File

@@ -39,6 +39,7 @@ class InternalMessageDetailsViewModel(val messageId: Long) : ViewModel() {
AttachmentInfo(
id = attachment.attachmentId.id,
contentType = attachment.contentType,
quoteTargetContentType = attachment.quoteTargetContentType,
size = attachment.size,
fileName = attachment.fileName,
hashStart = info?.hashStart,
@@ -63,6 +64,7 @@ class InternalMessageDetailsViewModel(val messageId: Long) : ViewModel() {
data class AttachmentInfo(
val id: Long,
val contentType: String?,
val quoteTargetContentType: String?,
val size: Long,
val fileName: String?,
val hashStart: String?,

View File

@@ -562,7 +562,7 @@ public class MessageSender {
{
Set<String> finalUploadJobIds = new HashSet<>(uploadJobIds);
if (quoteAttachmentId != null && SignalDatabase.attachments().hasData(quoteAttachmentId)) {
if (quoteAttachmentId != null && SignalDatabase.attachments().hasData(quoteAttachmentId) && uploadJobIds.size() > 0) {
Job uploadJob = new AttachmentUploadJob(quoteAttachmentId);
AppDependencies.getJobManager().add(uploadJob);
finalUploadJobIds.add(uploadJob.getId());