Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

. #95

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

. #95

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Sources/MZDownloadManager/Classes/MZDownloadManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ fileprivate func > <T : Comparable>(lhs: T?, rhs: T?) -> Bool {

open class MZDownloadManager: NSObject {

fileprivate var sessionManager: URLSession!
public var sessionManager: URLSession!

fileprivate var backgroundSessionCompletionHandler: (() -> Void)?

fileprivate let TaskDescFileNameIndex = 0
fileprivate let TaskDescFileURLIndex = 1
fileprivate let TaskDescFileDestinationIndex = 2

fileprivate weak var delegate: MZDownloadManagerDelegate?
public weak var delegate: MZDownloadManagerDelegate?

open var downloadingArray: [MZDownloadModel] = []

Expand Down Expand Up @@ -287,6 +287,7 @@ extension MZDownloadManager: URLSessionDownloadDelegate {
self.downloadingArray.remove(at: index)

if err == nil {
downloadModel.finished?()
self.delegate?.downloadRequestFinished?(downloadModel, index: index)
} else {
self.delegate?.downloadRequestCanceled?(downloadModel, index: index)
Expand Down
4 changes: 3 additions & 1 deletion Sources/MZDownloadManager/Classes/MZDownloadModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ open class MZDownloadModel: NSObject {

open var startTime: Date?

open var finished: (() -> Void)?

fileprivate(set) open var destinationPath: String = ""

fileprivate convenience init(fileName: String, fileURL: String) {
Expand All @@ -55,7 +57,7 @@ open class MZDownloadModel: NSObject {
self.fileURL = fileURL
}

convenience init(fileName: String, fileURL: String, destinationPath: String) {
public convenience init(fileName: String, fileURL: String, destinationPath: String) {
self.init(fileName: fileName, fileURL: fileURL)

self.destinationPath = destinationPath
Expand Down