mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-12 11:27:49 +00:00
Debug
This commit is contained in:
@@ -30,7 +30,7 @@ interface MessageDataProvider {
|
||||
fun isOutgoingMessage(timestamp: Long): Boolean
|
||||
|
||||
fun handleSuccessfulAttachmentUpload(attachmentId: Long, attachmentStream: SignalServiceAttachmentStream, attachmentKey: ByteArray, uploadResult: DotNetAPI.UploadResult)
|
||||
fun updateAttachmentAfterUploadFailed(attachmentId: Long)
|
||||
fun handleFailedAttachmentUpload(attachmentId: Long)
|
||||
|
||||
fun getMessageForQuote(timestamp: Long, author: Address): Pair<Long, Boolean>?
|
||||
fun getAttachmentsAndLinkPreviewFor(mmsId: Long): List<Attachment>
|
||||
|
@@ -105,15 +105,10 @@ class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val mess
|
||||
// it easier to deal with inputStream and outputStreamFactory.
|
||||
val pad = PushAttachmentData(attachment.contentType, inputStream, length, outputStreamFactory, attachment.listener)
|
||||
val contentType = "application/octet-stream"
|
||||
val drb = DigestingRequestBody(pad.data, pad.outputStreamFactory, contentType, pad.dataSize, attachment.listener)
|
||||
val drb = DigestingRequestBody(pad.data, pad.outputStreamFactory, contentType, pad.dataSize, pad.listener)
|
||||
Log.d("Loki", "File size: ${length.toDouble() / 1000} kb.")
|
||||
val mpb = MultipartBody.Builder()
|
||||
.setType(MultipartBody.FORM)
|
||||
.addFormDataPart("Content-Type", contentType)
|
||||
.addFormDataPart("content", UUID.randomUUID().toString(), drb)
|
||||
.build()
|
||||
val b = Buffer()
|
||||
mpb.writeTo(b)
|
||||
drb.writeTo(b)
|
||||
val data = b.readByteArray()
|
||||
// Upload the data
|
||||
val id = upload(data).get()
|
||||
@@ -132,7 +127,7 @@ class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val mess
|
||||
private fun handlePermanentFailure(e: Exception) {
|
||||
Log.w(TAG, "Attachment upload failed permanently due to error: $this.")
|
||||
delegate?.handleJobFailedPermanently(this, e)
|
||||
MessagingModuleConfiguration.shared.messageDataProvider.updateAttachmentAfterUploadFailed(attachmentID)
|
||||
MessagingModuleConfiguration.shared.messageDataProvider.handleFailedAttachmentUpload(attachmentID)
|
||||
failAssociatedMessageSendJob(e)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user