|
|
@@ -522,27 +522,27 @@ public class Manager {
|
|
|
public var downloadTaskDidResumeAtOffset: ((NSURLSession!, NSURLSessionDownloadTask!, Int64, Int64) -> Void)?
|
|
|
|
|
|
public func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didFinishDownloadingToURL location: NSURL) {
|
|
|
- if let delegate = self[downloadTask] as? Request.DownloadTaskDelegate {
|
|
|
+ if downloadTaskDidFinishDownloadingToURL != nil {
|
|
|
+ downloadTaskDidFinishDownloadingToURL!(session, downloadTask, location)
|
|
|
+ } else if let delegate = self[downloadTask] as? Request.DownloadTaskDelegate {
|
|
|
delegate.URLSession(session, downloadTask: downloadTask, didFinishDownloadingToURL: location)
|
|
|
}
|
|
|
-
|
|
|
- downloadTaskDidFinishDownloadingToURL?(session, downloadTask, location)
|
|
|
}
|
|
|
|
|
|
public func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {
|
|
|
- if let delegate = self[downloadTask] as? Request.DownloadTaskDelegate {
|
|
|
+ if downloadTaskDidWriteData != nil {
|
|
|
+ downloadTaskDidWriteData!(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite)
|
|
|
+ } else if let delegate = self[downloadTask] as? Request.DownloadTaskDelegate {
|
|
|
delegate.URLSession(session, downloadTask: downloadTask, didWriteData: bytesWritten, totalBytesWritten: totalBytesWritten, totalBytesExpectedToWrite: totalBytesExpectedToWrite)
|
|
|
}
|
|
|
-
|
|
|
- downloadTaskDidWriteData?(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite)
|
|
|
}
|
|
|
|
|
|
public func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didResumeAtOffset fileOffset: Int64, expectedTotalBytes: Int64) {
|
|
|
- if let delegate = self[downloadTask] as? Request.DownloadTaskDelegate {
|
|
|
+ if downloadTaskDidResumeAtOffset != nil {
|
|
|
+ downloadTaskDidResumeAtOffset!(session, downloadTask, fileOffset, expectedTotalBytes)
|
|
|
+ } else if let delegate = self[downloadTask] as? Request.DownloadTaskDelegate {
|
|
|
delegate.URLSession(session, downloadTask: downloadTask, didResumeAtOffset: fileOffset, expectedTotalBytes: expectedTotalBytes)
|
|
|
}
|
|
|
-
|
|
|
- downloadTaskDidResumeAtOffset?(session, downloadTask, fileOffset, expectedTotalBytes)
|
|
|
}
|
|
|
|
|
|
// MARK: NSObject
|