diff --git a/Squirrel.xcodeproj/project.pbxproj b/Squirrel.xcodeproj/project.pbxproj index afbe13b..a1d2e7a 100644 --- a/Squirrel.xcodeproj/project.pbxproj +++ b/Squirrel.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 5316AF7A188EFC1800C070DF /* RACSignal+SQRLFileManagerExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 5316AF78188EFC1800C070DF /* RACSignal+SQRLFileManagerExtensions.h */; }; 5316AF7B188EFC1800C070DF /* RACSignal+SQRLFileManagerExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 5316AF79188EFC1800C070DF /* RACSignal+SQRLFileManagerExtensions.m */; }; 5316AF95188EFFA100C070DF /* RACSignal+SQRLFileManagerExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 5316AF79188EFC1800C070DF /* RACSignal+SQRLFileManagerExtensions.m */; }; + 5316AFA8188F002100C070DF /* SQRLDownload+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 5316AFA6188F002100C070DF /* SQRLDownload+Private.h */; }; 533076EB17EB688300BDCCE0 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D097B9BC17BB4777006C3FEB /* IOKit.framework */; }; 53390936184F6219009FA41F /* NSHTTPURLResponse+SQRLExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 53390934184F6219009FA41F /* NSHTTPURLResponse+SQRLExtensions.h */; }; 53390937184F6219009FA41F /* NSHTTPURLResponse+SQRLExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 53390935184F6219009FA41F /* NSHTTPURLResponse+SQRLExtensions.m */; }; @@ -431,6 +432,7 @@ /* Begin PBXFileReference section */ 5316AF78188EFC1800C070DF /* RACSignal+SQRLFileManagerExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RACSignal+SQRLFileManagerExtensions.h"; sourceTree = ""; }; 5316AF79188EFC1800C070DF /* RACSignal+SQRLFileManagerExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RACSignal+SQRLFileManagerExtensions.m"; sourceTree = ""; }; + 5316AFA6188F002100C070DF /* SQRLDownload+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SQRLDownload+Private.h"; sourceTree = ""; }; 53390934184F6219009FA41F /* NSHTTPURLResponse+SQRLExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSHTTPURLResponse+SQRLExtensions.h"; sourceTree = ""; }; 53390935184F6219009FA41F /* NSHTTPURLResponse+SQRLExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSHTTPURLResponse+SQRLExtensions.m"; sourceTree = ""; }; 53390949184F6322009FA41F /* NSHTTPURLResponseExtensionsSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSHTTPURLResponseExtensionsSpec.m; sourceTree = ""; }; @@ -681,6 +683,7 @@ 53C3186A1816C38A0074B481 /* SQRLDownloadManager.m */, 536CD4E0183E5D7F000C0FD1 /* SQRLDownload.h */, 536CD4E1183E5D7F000C0FD1 /* SQRLDownload.m */, + 5316AFA6188F002100C070DF /* SQRLDownload+Private.h */, 53C3186D1816C38A0074B481 /* SQRLResumableDownload.h */, 53C3186E1816C38A0074B481 /* SQRLResumableDownload.m */, 53C3186B1816C38A0074B481 /* SQRLURLConnection.h */, @@ -1089,6 +1092,7 @@ D0964B3C17F2E20B00D88BF7 /* NSBundle+SQRLVersionExtensions.h in Headers */, D0C22C4C179CC15100158214 /* SQRLUpdater.h in Headers */, D0C22C52179CC23900158214 /* Squirrel.h in Headers */, + 5316AFA8188F002100C070DF /* SQRLDownload+Private.h in Headers */, 53390936184F6219009FA41F /* NSHTTPURLResponse+SQRLExtensions.h in Headers */, D0964B3817F2E01500D88BF7 /* SQRLDownloadedUpdate.h in Headers */, 53AACF4B17E9CA0500B41027 /* SQRLUpdate.h in Headers */, diff --git a/Squirrel/SQRLDownload+Private.h b/Squirrel/SQRLDownload+Private.h new file mode 100644 index 0000000..d7f233b --- /dev/null +++ b/Squirrel/SQRLDownload+Private.h @@ -0,0 +1,21 @@ +// +// SQRLDownload+Private.h +// Squirrel +// +// Created by Keith Duncan on 21/01/2014. +// Copyright (c) 2014 GitHub. All rights reserved. +// + +#import "SQRLDownload.h" + +@interface SQRLDownload () + +// Designated initialiser. +// +// request - Must not be nil. The request this download is for. +// fileURL - Must not be nil. The file location to save received data to. +// +// Returns an initialised download suitable for saving response data. +- (instancetype)initWithRequest:(NSURLRequest *)request fileURL:(NSURL *)fileURL; + +@end diff --git a/Squirrel/SQRLDownload.h b/Squirrel/SQRLDownload.h index 16dea11..ba35c96 100644 --- a/Squirrel/SQRLDownload.h +++ b/Squirrel/SQRLDownload.h @@ -10,16 +10,13 @@ @class RACSignal; +// A download is a file which holds the response body for a request and can be +// resumed by a subsequent request if the initial transfer is interrupted. +// +// Don't create a download directly, instead retrieve one from +// `SQRLDownloadManager`. @interface SQRLDownload : MTLModel -// Designated initialiser. -// -// request - Must not be nil. The request this download is for. -// fileURL - Must not be nil. The file location to save received data to. -// -// Returns an initialised download suitable for saving response data. -- (instancetype)initWithRequest:(NSURLRequest *)request fileURL:(NSURL *)fileURL; - // The `request` the receiver was initialised with. @property (readonly, copy, nonatomic) NSURLRequest *request; diff --git a/Squirrel/SQRLDownload.m b/Squirrel/SQRLDownload.m index a79bc06..e72e4a8 100644 --- a/Squirrel/SQRLDownload.m +++ b/Squirrel/SQRLDownload.m @@ -7,6 +7,7 @@ // #import "SQRLDownload.h" +#import "SQRLDownload+Private.h" #import diff --git a/Squirrel/SQRLDownloadManager.m b/Squirrel/SQRLDownloadManager.m index f0f89bd..1b3c48f 100644 --- a/Squirrel/SQRLDownloadManager.m +++ b/Squirrel/SQRLDownloadManager.m @@ -12,6 +12,8 @@ #import #import "SQRLDirectoryManager.h" +#import "SQRLDownload.h" +#import "SQRLDownload+Private.h" #import "SQRLResumableDownload.h" @interface SQRLDownloadManager ()