Fix attachment download resumption
This commit is contained in:
parent
5ed5c02ad4
commit
aa68e91a4d
|
@ -37,17 +37,17 @@ final class DownloadAttachmentModal : Modal {
|
|||
messageLabel.numberOfLines = 0
|
||||
messageLabel.lineBreakMode = .byWordWrapping
|
||||
messageLabel.textAlignment = .center
|
||||
// Unblock button
|
||||
let unblockButton = UIButton()
|
||||
unblockButton.set(.height, to: Values.mediumButtonHeight)
|
||||
unblockButton.layer.cornerRadius = Modal.buttonCornerRadius
|
||||
unblockButton.backgroundColor = Colors.buttonBackground
|
||||
unblockButton.titleLabel!.font = .systemFont(ofSize: Values.smallFontSize)
|
||||
unblockButton.setTitleColor(Colors.text, for: UIControl.State.normal)
|
||||
unblockButton.setTitle("Download", for: UIControl.State.normal)
|
||||
unblockButton.addTarget(self, action: #selector(trust), for: UIControl.Event.touchUpInside)
|
||||
// Download button
|
||||
let downloadButton = UIButton()
|
||||
downloadButton.set(.height, to: Values.mediumButtonHeight)
|
||||
downloadButton.layer.cornerRadius = Modal.buttonCornerRadius
|
||||
downloadButton.backgroundColor = Colors.buttonBackground
|
||||
downloadButton.titleLabel!.font = .systemFont(ofSize: Values.smallFontSize)
|
||||
downloadButton.setTitleColor(Colors.text, for: UIControl.State.normal)
|
||||
downloadButton.setTitle("Download", for: UIControl.State.normal)
|
||||
downloadButton.addTarget(self, action: #selector(trust), for: UIControl.Event.touchUpInside)
|
||||
// Button stack view
|
||||
let buttonStackView = UIStackView(arrangedSubviews: [ cancelButton, unblockButton ])
|
||||
let buttonStackView = UIStackView(arrangedSubviews: [ cancelButton, downloadButton ])
|
||||
buttonStackView.axis = .horizontal
|
||||
buttonStackView.spacing = Values.mediumSpacing
|
||||
buttonStackView.distribution = .fillEqually
|
||||
|
|
|
@ -88,6 +88,7 @@ extension Storage {
|
|||
let jobs = getAttachmentDownloadJobs(for: tsMessageID)
|
||||
jobs.forEach { job in
|
||||
job.delegate = JobQueue.shared
|
||||
job.isDeferred = false
|
||||
job.execute()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,13 +36,12 @@ public final class AttachmentDownloadJob : NSObject, Job, NSCoding { // NSObject
|
|||
public init?(coder: NSCoder) {
|
||||
guard let attachmentID = coder.decodeObject(forKey: "attachmentID") as! String?,
|
||||
let tsMessageID = coder.decodeObject(forKey: "tsIncomingMessageID") as! String?,
|
||||
let id = coder.decodeObject(forKey: "id") as! String?,
|
||||
let isDeferred = coder.decodeObject(forKey: "isDeferred") as! Bool? else { return nil }
|
||||
let id = coder.decodeObject(forKey: "id") as! String? else { return nil }
|
||||
self.attachmentID = attachmentID
|
||||
self.tsMessageID = tsMessageID
|
||||
self.id = id
|
||||
self.failureCount = coder.decodeObject(forKey: "failureCount") as! UInt? ?? 0
|
||||
self.isDeferred = isDeferred
|
||||
self.isDeferred = coder.decodeBool(forKey: "isDeferred")
|
||||
}
|
||||
|
||||
public func encode(with coder: NSCoder) {
|
||||
|
|
Loading…
Reference in New Issue