Fixed manual download of a content that tried to be auto-downloaded but failed
This commit is contained in:
parent
05ddd072a3
commit
8373eaeb7d
1 changed files with 17 additions and 12 deletions
|
@ -176,22 +176,27 @@ class ChatMessageContentData(
|
|||
|
||||
val content = getContent()
|
||||
val filePath = content.filePath
|
||||
if (content.isFileTransfer && (filePath == null || filePath.isEmpty())) {
|
||||
if (content.isFileTransfer) {
|
||||
if (filePath == null || filePath.isEmpty()) {
|
||||
val contentName = content.name
|
||||
if (contentName != null) {
|
||||
val file = FileUtils.getFileStoragePath(contentName)
|
||||
content.filePath = file.path
|
||||
downloadEnabled.value = false
|
||||
|
||||
Log.i("[Content] Started downloading $contentName into ${content.filePath}")
|
||||
} else {
|
||||
Log.e("[Content] Content name is null, can't download it!")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
Log.w("[Content] File path already set [$filePath] using it (auto download that failed probably)")
|
||||
}
|
||||
|
||||
downloadEnabled.value = false
|
||||
if (!chatMessage.downloadContent(content)) {
|
||||
Log.e("[Content] Failed to start content download!")
|
||||
}
|
||||
} else {
|
||||
Log.e("[Content] Content name is null, can't download it!")
|
||||
}
|
||||
} else {
|
||||
Log.e("[Content] Either content is not a FileTransfer or it's filePath has already been set, can't download it anyway!")
|
||||
Log.e("[Content] Content is not a FileTransfer, can't download it!")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue