Fixed & improve content logs

This commit is contained in:
Sylvain Berfini 2022-01-21 10:52:43 +01:00
parent fea1e9d27f
commit 13261f78f9

View file

@ -188,7 +188,7 @@ class ChatMessageContentData(
val content = getContent() val content = getContent()
isFileEncrypted = content.isFileEncrypted isFileEncrypted = content.isFileEncrypted
Log.i("[Content] Is content encrypted ? $isFileEncrypted") Log.i("[Content] Is ${if (content.isFile) "file" else "file transfer"} content encrypted ? $isFileEncrypted")
filePath.value = "" filePath.value = ""
fileName.value = if (content.name.isNullOrEmpty() && !content.filePath.isNullOrEmpty()) { fileName.value = if (content.name.isNullOrEmpty() && !content.filePath.isNullOrEmpty()) {
@ -204,8 +204,12 @@ class ChatMessageContentData(
downloadLabel.value = spannable downloadLabel.value = spannable
if (content.isFile || (content.isFileTransfer && chatMessage.isOutgoing)) { if (content.isFile || (content.isFileTransfer && chatMessage.isOutgoing)) {
val path = if (isFileEncrypted) {
Log.i("[Content] Content is encrypted, requesting plain file path") Log.i("[Content] Content is encrypted, requesting plain file path")
val path = if (isFileEncrypted) content.plainFilePath else content.filePath ?: "" content.plainFilePath
} else {
content.filePath ?: ""
}
downloadable.value = content.filePath.orEmpty().isEmpty() downloadable.value = content.filePath.orEmpty().isEmpty()
if (path.isNotEmpty()) { if (path.isNotEmpty()) {
@ -231,7 +235,7 @@ class ChatMessageContentData(
} }
} }
} else { } else {
Log.w("[Content] Found content with empty path...") Log.w("[Content] Found ${if (content.isFile) "file" else "file transfer"} content with empty path...")
isImage.value = false isImage.value = false
isVideo.value = false isVideo.value = false
isAudio.value = false isAudio.value = false