Fix potential issue with video message conten
This commit is contained in:
parent
d6b6768f41
commit
765380ab95
|
@ -176,10 +176,8 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
|
||||||
&& params.compressBeforeSending) {
|
&& params.compressBeforeSending) {
|
||||||
fileToUpload = videoCompressor.compress(workingFile)
|
fileToUpload = videoCompressor.compress(workingFile)
|
||||||
.also { compressedFile ->
|
.also { compressedFile ->
|
||||||
// Get new Video size
|
// Get new Video file size. For now video dimensions are not updated
|
||||||
newAttachmentAttributes = NewAttachmentAttributes(
|
newAttachmentAttributes = newAttachmentAttributes.copy(newFileSize = compressedFile.length())
|
||||||
newFileSize = compressedFile.length()
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
.also { filesToDelete.add(it) }
|
.also { filesToDelete.add(it) }
|
||||||
} else {
|
} else {
|
||||||
|
@ -346,8 +344,7 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
|
||||||
val messageContent: MessageContent? = event.asDomain().content.toModel()
|
val messageContent: MessageContent? = event.asDomain().content.toModel()
|
||||||
val updatedContent = when (messageContent) {
|
val updatedContent = when (messageContent) {
|
||||||
is MessageImageContent -> messageContent.update(url, encryptedFileInfo, newAttachmentAttributes)
|
is MessageImageContent -> messageContent.update(url, encryptedFileInfo, newAttachmentAttributes)
|
||||||
is MessageVideoContent -> messageContent.update(url, encryptedFileInfo, thumbnailUrl, thumbnailEncryptedFileInfo,
|
is MessageVideoContent -> messageContent.update(url, encryptedFileInfo, thumbnailUrl, thumbnailEncryptedFileInfo, newAttachmentAttributes)
|
||||||
newAttachmentAttributes.newFileSize)
|
|
||||||
is MessageFileContent -> messageContent.update(url, encryptedFileInfo, newAttachmentAttributes.newFileSize)
|
is MessageFileContent -> messageContent.update(url, encryptedFileInfo, newAttachmentAttributes.newFileSize)
|
||||||
is MessageAudioContent -> messageContent.update(url, encryptedFileInfo, newAttachmentAttributes.newFileSize)
|
is MessageAudioContent -> messageContent.update(url, encryptedFileInfo, newAttachmentAttributes.newFileSize)
|
||||||
else -> messageContent
|
else -> messageContent
|
||||||
|
@ -378,14 +375,16 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
|
||||||
encryptedFileInfo: EncryptedFileInfo?,
|
encryptedFileInfo: EncryptedFileInfo?,
|
||||||
thumbnailUrl: String?,
|
thumbnailUrl: String?,
|
||||||
thumbnailEncryptedFileInfo: EncryptedFileInfo?,
|
thumbnailEncryptedFileInfo: EncryptedFileInfo?,
|
||||||
size: Long): MessageVideoContent {
|
newAttachmentAttributes: NewAttachmentAttributes?): MessageVideoContent {
|
||||||
return copy(
|
return copy(
|
||||||
url = if (encryptedFileInfo == null) url else null,
|
url = if (encryptedFileInfo == null) url else null,
|
||||||
encryptedFileInfo = encryptedFileInfo?.copy(url = url),
|
encryptedFileInfo = encryptedFileInfo?.copy(url = url),
|
||||||
videoInfo = videoInfo?.copy(
|
videoInfo = videoInfo?.copy(
|
||||||
thumbnailUrl = if (thumbnailEncryptedFileInfo == null) thumbnailUrl else null,
|
thumbnailUrl = if (thumbnailEncryptedFileInfo == null) thumbnailUrl else null,
|
||||||
thumbnailFile = thumbnailEncryptedFileInfo?.copy(url = thumbnailUrl),
|
thumbnailFile = thumbnailEncryptedFileInfo?.copy(url = thumbnailUrl),
|
||||||
size = size
|
width = newAttachmentAttributes?.newWidth ?: videoInfo.width,
|
||||||
|
height = newAttachmentAttributes?.newHeight ?: videoInfo.height,
|
||||||
|
size = newAttachmentAttributes?.newFileSize ?: videoInfo.size
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue