|
|
|
@ -9,7 +9,6 @@ import org.session.libsession.messaging.sending_receiving.attachments.*
|
|
|
|
|
import org.session.libsession.messaging.threads.Address
|
|
|
|
|
import org.session.libsession.messaging.utilities.DotNetAPI
|
|
|
|
|
import org.session.libsession.utilities.Util
|
|
|
|
|
import org.session.libsession.utilities.Util.toIntExact
|
|
|
|
|
import org.session.libsignal.libsignal.util.guava.Optional
|
|
|
|
|
import org.session.libsignal.service.api.messages.SignalServiceAttachment
|
|
|
|
|
import org.session.libsignal.service.api.messages.SignalServiceAttachmentPointer
|
|
|
|
@ -90,6 +89,11 @@ class DatabaseAttachmentProvider(context: Context, helper: SQLCipherOpenHelper)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun getLinkPreviewAttachmentIDFor(messageID: Long): Long? {
|
|
|
|
|
val message = DatabaseFactory.getMmsDatabase(context).getOutgoingMessage(messageID)
|
|
|
|
|
return message.linkPreviews.firstOrNull()?.attachmentId?.rowId
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun insertAttachment(messageId: Long, attachmentId: Long, stream: InputStream) {
|
|
|
|
|
val attachmentDatabase = DatabaseFactory.getAttachmentDatabase(context)
|
|
|
|
|
attachmentDatabase.insertAttachmentsForPlaceholder(messageId, AttachmentId(attachmentId, 0), stream)
|
|
|
|
@ -216,7 +220,7 @@ fun DatabaseAttachment.toSignalAttachmentPointer(): SignalServiceAttachmentPoint
|
|
|
|
|
SignalServiceAttachmentPointer(id,
|
|
|
|
|
contentType,
|
|
|
|
|
key,
|
|
|
|
|
Optional.of(toIntExact(size)),
|
|
|
|
|
Optional.of(Util.toIntExact(size)),
|
|
|
|
|
Optional.absent(),
|
|
|
|
|
width,
|
|
|
|
|
height,
|
|
|
|
|