From 023d14c2d64c1512bbcd646aae6522e3181b8617 Mon Sep 17 00:00:00 2001 From: HieuTV279 <133959118+HieuTV279@users.noreply.github.com> Date: Thu, 18 May 2023 15:59:40 +0700 Subject: [PATCH 1/7] Update MZDownloadModel.swift --- Sources/MZDownloadManager/Classes/MZDownloadModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/MZDownloadManager/Classes/MZDownloadModel.swift b/Sources/MZDownloadManager/Classes/MZDownloadModel.swift index fd82170..f07e749 100644 --- a/Sources/MZDownloadManager/Classes/MZDownloadModel.swift +++ b/Sources/MZDownloadManager/Classes/MZDownloadModel.swift @@ -55,7 +55,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 From 895e3067f320cd10f4452fd34fd084d56092d0f4 Mon Sep 17 00:00:00 2001 From: HieuTV279 <133959118+HieuTV279@users.noreply.github.com> Date: Thu, 18 May 2023 16:02:37 +0700 Subject: [PATCH 2/7] Update MZDownloadManager.swift --- Sources/MZDownloadManager/Classes/MZDownloadManager.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/MZDownloadManager/Classes/MZDownloadManager.swift b/Sources/MZDownloadManager/Classes/MZDownloadManager.swift index e50d846..7a8abc2 100644 --- a/Sources/MZDownloadManager/Classes/MZDownloadManager.swift +++ b/Sources/MZDownloadManager/Classes/MZDownloadManager.swift @@ -64,7 +64,7 @@ fileprivate func > (lhs: T?, rhs: T?) -> Bool { open class MZDownloadManager: NSObject { - fileprivate var sessionManager: URLSession! + fileprivate(set) var sessionManager: URLSession! fileprivate var backgroundSessionCompletionHandler: (() -> Void)? @@ -72,7 +72,7 @@ open class MZDownloadManager: NSObject { fileprivate let TaskDescFileURLIndex = 1 fileprivate let TaskDescFileDestinationIndex = 2 - fileprivate weak var delegate: MZDownloadManagerDelegate? + fileprivate(set) weak var delegate: MZDownloadManagerDelegate? open var downloadingArray: [MZDownloadModel] = [] From 7383d545015e619ceaa9c697a9b67ec4fdc89b0c Mon Sep 17 00:00:00 2001 From: HieuTV279 <133959118+HieuTV279@users.noreply.github.com> Date: Thu, 18 May 2023 16:18:23 +0700 Subject: [PATCH 3/7] Update MZDownloadManager.swift --- Sources/MZDownloadManager/Classes/MZDownloadManager.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/MZDownloadManager/Classes/MZDownloadManager.swift b/Sources/MZDownloadManager/Classes/MZDownloadManager.swift index 7a8abc2..db01204 100644 --- a/Sources/MZDownloadManager/Classes/MZDownloadManager.swift +++ b/Sources/MZDownloadManager/Classes/MZDownloadManager.swift @@ -64,7 +64,7 @@ fileprivate func > (lhs: T?, rhs: T?) -> Bool { open class MZDownloadManager: NSObject { - fileprivate(set) var sessionManager: URLSession! + private var sessionManager: URLSession! fileprivate var backgroundSessionCompletionHandler: (() -> Void)? @@ -72,7 +72,7 @@ open class MZDownloadManager: NSObject { fileprivate let TaskDescFileURLIndex = 1 fileprivate let TaskDescFileDestinationIndex = 2 - fileprivate(set) weak var delegate: MZDownloadManagerDelegate? + private weak var delegate: MZDownloadManagerDelegate? open var downloadingArray: [MZDownloadModel] = [] From 7b4de05640edfd9972b8efa9c392019a1f721feb Mon Sep 17 00:00:00 2001 From: HieuTV279 <133959118+HieuTV279@users.noreply.github.com> Date: Thu, 18 May 2023 16:28:05 +0700 Subject: [PATCH 4/7] Update MZDownloadManager.swift --- Sources/MZDownloadManager/Classes/MZDownloadManager.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/MZDownloadManager/Classes/MZDownloadManager.swift b/Sources/MZDownloadManager/Classes/MZDownloadManager.swift index db01204..a355c31 100644 --- a/Sources/MZDownloadManager/Classes/MZDownloadManager.swift +++ b/Sources/MZDownloadManager/Classes/MZDownloadManager.swift @@ -64,7 +64,7 @@ fileprivate func > (lhs: T?, rhs: T?) -> Bool { open class MZDownloadManager: NSObject { - private var sessionManager: URLSession! + internal var sessionManager: URLSession! fileprivate var backgroundSessionCompletionHandler: (() -> Void)? @@ -72,7 +72,7 @@ open class MZDownloadManager: NSObject { fileprivate let TaskDescFileURLIndex = 1 fileprivate let TaskDescFileDestinationIndex = 2 - private weak var delegate: MZDownloadManagerDelegate? + internal weak var delegate: MZDownloadManagerDelegate? open var downloadingArray: [MZDownloadModel] = [] From a8ea391e4cb5f43efc247ad5b5175d2b2bbc44d9 Mon Sep 17 00:00:00 2001 From: HieuTV279 <133959118+HieuTV279@users.noreply.github.com> Date: Thu, 18 May 2023 16:40:37 +0700 Subject: [PATCH 5/7] Update MZDownloadManager.swift --- Sources/MZDownloadManager/Classes/MZDownloadManager.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/MZDownloadManager/Classes/MZDownloadManager.swift b/Sources/MZDownloadManager/Classes/MZDownloadManager.swift index a355c31..5e15518 100644 --- a/Sources/MZDownloadManager/Classes/MZDownloadManager.swift +++ b/Sources/MZDownloadManager/Classes/MZDownloadManager.swift @@ -64,7 +64,7 @@ fileprivate func > (lhs: T?, rhs: T?) -> Bool { open class MZDownloadManager: NSObject { - internal var sessionManager: URLSession! + public var sessionManager: URLSession! fileprivate var backgroundSessionCompletionHandler: (() -> Void)? @@ -72,7 +72,7 @@ open class MZDownloadManager: NSObject { fileprivate let TaskDescFileURLIndex = 1 fileprivate let TaskDescFileDestinationIndex = 2 - internal weak var delegate: MZDownloadManagerDelegate? + public weak var delegate: MZDownloadManagerDelegate? open var downloadingArray: [MZDownloadModel] = [] From 338d90c0740bb091ec3f434a694c65f592121281 Mon Sep 17 00:00:00 2001 From: HieuTV279 <133959118+HieuTV279@users.noreply.github.com> Date: Thu, 25 May 2023 17:35:30 +0700 Subject: [PATCH 6/7] Update MZDownloadModel.swift --- Sources/MZDownloadManager/Classes/MZDownloadModel.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/MZDownloadManager/Classes/MZDownloadModel.swift b/Sources/MZDownloadManager/Classes/MZDownloadModel.swift index f07e749..cd6a49b 100644 --- a/Sources/MZDownloadManager/Classes/MZDownloadModel.swift +++ b/Sources/MZDownloadManager/Classes/MZDownloadModel.swift @@ -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) { From d3b0109d621fb4fb934b457f7e113df405e3d381 Mon Sep 17 00:00:00 2001 From: HieuTV279 <133959118+HieuTV279@users.noreply.github.com> Date: Thu, 25 May 2023 17:36:03 +0700 Subject: [PATCH 7/7] Update MZDownloadManager.swift --- Sources/MZDownloadManager/Classes/MZDownloadManager.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/MZDownloadManager/Classes/MZDownloadManager.swift b/Sources/MZDownloadManager/Classes/MZDownloadManager.swift index 5e15518..db6d975 100644 --- a/Sources/MZDownloadManager/Classes/MZDownloadManager.swift +++ b/Sources/MZDownloadManager/Classes/MZDownloadManager.swift @@ -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)