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