wip
This commit is contained in:
parent
36bfdf9dcb
commit
318d792928
|
@ -27,10 +27,14 @@ final class DownloadManager {
|
|||
|
||||
if let tempLocalUrl = tempLocalUrl, error == nil {
|
||||
do {
|
||||
let destinationDirectory = localUrl.deletingLastPathComponent()
|
||||
if !FileManager.default.fileExists(atPath: destinationDirectory.path) {
|
||||
try FileManager.default.createDirectory(at: destinationDirectory, withIntermediateDirectories: true, attributes: nil)
|
||||
}
|
||||
if FileManager.default.fileExists(atPath: localUrl.path) {
|
||||
try FileManager.default.removeItem(at: localUrl)
|
||||
}
|
||||
try FileManager.default.copyItem(at: tempLocalUrl, to: localUrl)
|
||||
try FileManager.default.moveItem(at: tempLocalUrl, to: localUrl)
|
||||
completion(nil)
|
||||
} catch let writeError {
|
||||
completion(writeError)
|
||||
|
|
|
@ -298,7 +298,7 @@ final class DatabaseMiddleware {
|
|||
_ = try database._db.write { db in
|
||||
try Message
|
||||
.filter(Column("id") == id)
|
||||
.updateAll(db, Column("attachmentLocalPath").set(to: localUrl))
|
||||
.updateAll(db, Column("attachmentLocalPath").set(to: localUrl), Column("attachmentDownloadFailed").set(to: false))
|
||||
}
|
||||
promise(.success(.empty))
|
||||
} catch {
|
||||
|
|
|
@ -33,7 +33,7 @@ enum Const {
|
|||
static let videoDurationLimit = 60.0
|
||||
|
||||
// Upload/download file folder
|
||||
static let fileFolder = "Downloads"
|
||||
static let fileFolder = "downloads"
|
||||
|
||||
// Grid size for gallery preview (3 in a row)
|
||||
static let galleryGridSize = UIScreen.main.bounds.width / 3
|
||||
|
|
Loading…
Reference in a new issue