Skip to content

Commit

Permalink
Refactor the NSOperation logic and tests
Browse files Browse the repository at this point in the history
- Better handling of states
- No more connection failed error overriding
- No more localized strings
- Refactor tests (this is still untestable)
  • Loading branch information
thibaultcha committed Jan 4, 2015
1 parent c69d20c commit b52f4e7
Show file tree
Hide file tree
Showing 20 changed files with 272 additions and 440 deletions.
Binary file modified TCBlobDownload/Docs/TCBlobDownloadDocset.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ <h4 class="method-subtitle">Declared In</h4>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-02)</span><br />
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-03)</span><br />

<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.2 (build 963)</a>.</span></p>

Expand Down
8 changes: 4 additions & 4 deletions TCBlobDownload/Docs/html/Classes/TCBlobDownloader.html
Original file line number Diff line number Diff line change
Expand Up @@ -749,16 +749,16 @@ <h3 class="subsubtitle method-title">addDependentDownload:</h3>



<div class="method-subsection method-declaration"><code>- (void)addDependentDownload:(TCBlobDownloader *)<em>blobDownload</em></code></div>
<div class="method-subsection method-declaration"><code>- (void)addDependentDownload:(TCBlobDownloader *)<em>download</em></code></div>



<div class="method-subsection arguments-section parameters">
<h4 class="method-subtitle parameter-title">Parameters</h4>

<dl class="argument-def parameter-def">
<dt><em>blobDownload</em></dt>
<dd><p>The download on which to depend.</p></dd>
<dt><em>download</em></dt>
<dd><p>The TCBlobDownloader on which to depend.</p></dd>
</dl>

</div>
Expand Down Expand Up @@ -1004,7 +1004,7 @@ <h4 class="method-subtitle">Declared In</h4>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-02)</span><br />
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-03)</span><br />

<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.2 (build 963)</a>.</span></p>

Expand Down
23 changes: 2 additions & 21 deletions TCBlobDownload/Docs/html/Constants/TCBlobDownloadError.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ <h4 class="method-subtitle">Definition</h4>

&nbsp;&nbsp; <a href="">TCBlobDownloadErrorInvalidURL</a> = 0,<br/>

&nbsp;&nbsp; <a href="">TCBlobDownloadErrorConnectionFailed</a>,<br/>

&nbsp;&nbsp; <a href="">TCBlobDownloadErrorHTTPError</a>,<br/>

&nbsp;&nbsp; <a href="">TCBlobDownloadErrorNotEnoughFreeDiskSpace</a>,<br/>
Expand All @@ -111,24 +109,7 @@ <h4 class="method-subtitle">Constants</h4>
<dd>


<p><code>NSURLConnection</code> was unable to handle the provided URL.</p>






<p>
Declared In <code class="declared-in-ref">TCBlobDownloader.h</code>.
</p>

</dd>

<dt><a name="" title="TCBlobDownloadErrorConnectionFailed"></a><code>TCBlobDownloadErrorConnectionFailed</code></dt>
<dd>


<p>The connection to the asked URL failed.</p>
<p><code>NSURLConnection</code> was unable to handle the provided request.</p>



Expand Down Expand Up @@ -210,7 +191,7 @@ <h4 class="method-subtitle">Declared In</h4>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-02)</span><br />
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-03)</span><br />

<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.2 (build 963)</a>.</span></p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ <h4 class="method-subtitle">Declared In</h4>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-02)</span><br />
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-03)</span><br />

<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.2 (build 963)</a>.</span></p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ <h4 class="method-subtitle">Declared In</h4>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-02)</span><br />
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-03)</span><br />

<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.2 (build 963)</a>.</span></p>

Expand Down
2 changes: 1 addition & 1 deletion TCBlobDownload/Docs/html/hierarchy.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ <h2 class="index-title">Constant References</h2>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-02)</span><br />
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-03)</span><br />

<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.2 (build 963)</a>.</span></p>

Expand Down
2 changes: 1 addition & 1 deletion TCBlobDownload/Docs/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h2 class="index-title">Constant References</h2>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-02)</span><br />
<p><span class="copyright">&copy; 2015 thibaultCha. All rights reserved. (Last updated: 2015-01-03)</span><br />

<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.2 (build 963)</a>.</span></p>

Expand Down
28 changes: 1 addition & 27 deletions TCBlobDownload/TCBlobDownload.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
21776214172FFC4A001956C7 /* TCBlobDownloadManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2177620F172FFBD9001956C7 /* TCBlobDownloadManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
21776215172FFC56001956C7 /* TCBlobDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 2177620D172FFBD9001956C7 /* TCBlobDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; };
21776220172FFE64001956C7 /* TCBlobDownload-Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 2177621F172FFE64001956C7 /* TCBlobDownload-Prefix.pch */; };
21D06E26181852B600CAADCD /* XCTestCase+AsyncTesting.m in Sources */ = {isa = PBXBuildFile; fileRef = 21D06E25181852B600CAADCD /* XCTestCase+AsyncTesting.m */; };
21D06E281818539500CAADCD /* DownloadFailureTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 21D06E271818539500CAADCD /* DownloadFailureTests.m */; };
C30D071318C375FB00D5CBB3 /* TCBlobDownloadTestsBase.m in Sources */ = {isa = PBXBuildFile; fileRef = C30D071218C375FB00D5CBB3 /* TCBlobDownloadTestsBase.m */; };
C30D071618C3772F00D5CBB3 /* TCBlobDownloadManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C30D071518C3772F00D5CBB3 /* TCBlobDownloadManagerTests.m */; };
Expand Down Expand Up @@ -81,11 +80,7 @@
2177620F172FFBD9001956C7 /* TCBlobDownloadManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TCBlobDownloadManager.h; path = TCBlobDownload/TCBlobDownloadManager.h; sourceTree = "<group>"; };
21776210172FFBD9001956C7 /* TCBlobDownloadManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TCBlobDownloadManager.m; path = TCBlobDownload/TCBlobDownloadManager.m; sourceTree = "<group>"; };
2177621F172FFE64001956C7 /* TCBlobDownload-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "TCBlobDownload-Prefix.pch"; path = "TCBlobDownload/TCBlobDownload-Prefix.pch"; sourceTree = "<group>"; };
217AB36D17395D0700A174C5 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = TCBlobDownload/fr.lproj/Localizable.strings; sourceTree = "<group>"; };
21D06E24181852B600CAADCD /* XCTestCase+AsyncTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "XCTestCase+AsyncTesting.h"; sourceTree = "<group>"; };
21D06E25181852B600CAADCD /* XCTestCase+AsyncTesting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "XCTestCase+AsyncTesting.m"; sourceTree = "<group>"; };
21D06E271818539500CAADCD /* DownloadFailureTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DownloadFailureTests.m; sourceTree = "<group>"; };
21EE597D17395AA10084CF48 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = TCBlobDownload/en.lproj/Localizable.strings; sourceTree = "<group>"; };
C30D071118C375FB00D5CBB3 /* TCBlobDownloadTestsBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCBlobDownloadTestsBase.h; sourceTree = "<group>"; };
C30D071218C375FB00D5CBB3 /* TCBlobDownloadTestsBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TCBlobDownloadTestsBase.m; sourceTree = "<group>"; };
C30D071518C3772F00D5CBB3 /* TCBlobDownloadManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TCBlobDownloadManagerTests.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -123,7 +118,6 @@
C30D071518C3772F00D5CBB3 /* TCBlobDownloadManagerTests.m */,
21203AE0178C593900C19335 /* TCBlobDownloadTests.m */,
21D06E271818539500CAADCD /* DownloadFailureTests.m */,
21D06E231818529000CAADCD /* libs */,
21203ADB178C593900C19335 /* Supporting Files */,
);
path = TCBlobDownloadTests;
Expand All @@ -133,8 +127,8 @@
isa = PBXGroup;
children = (
21203ADC178C593900C19335 /* TCBlobDownloadTests-Info.plist */,
21203ADD178C593900C19335 /* InfoPlist.strings */,
21203AE2178C593900C19335 /* TCBlobDownloadTests-Prefix.pch */,
21203ADD178C593900C19335 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
Expand Down Expand Up @@ -178,20 +172,10 @@
isa = PBXGroup;
children = (
2177621F172FFE64001956C7 /* TCBlobDownload-Prefix.pch */,
21EE597C17395AA10084CF48 /* Localizable.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
21D06E231818529000CAADCD /* libs */ = {
isa = PBXGroup;
children = (
21D06E24181852B600CAADCD /* XCTestCase+AsyncTesting.h */,
21D06E25181852B600CAADCD /* XCTestCase+AsyncTesting.m */,
);
name = libs;
sourceTree = "<group>";
};
C30D071418C3760000D5CBB3 /* Base */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -337,7 +321,6 @@
21D06E281818539500CAADCD /* DownloadFailureTests.m in Sources */,
C30D071318C375FB00D5CBB3 /* TCBlobDownloadTestsBase.m in Sources */,
21203AE1178C593900C19335 /* TCBlobDownloadTests.m in Sources */,
21D06E26181852B600CAADCD /* XCTestCase+AsyncTesting.m in Sources */,
21203AEC178C63AB00C19335 /* TCBlobDownloadManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -371,15 +354,6 @@
name = InfoPlist.strings;
sourceTree = "<group>";
};
21EE597C17395AA10084CF48 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
21EE597D17395AA10084CF48 /* en */,
217AB36D17395D0700A174C5 /* fr */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
Expand Down
8 changes: 3 additions & 5 deletions TCBlobDownload/TCBlobDownload/TCBlobDownloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ extern NSString * const TCBlobDownloadErrorDomain;
@since 1.5.0
*/
typedef NS_ENUM(NSUInteger, TCBlobDownloadError) {
/** `NSURLConnection` was unable to handle the provided URL. */
/** `NSURLConnection` was unable to handle the provided request. */
TCBlobDownloadErrorInvalidURL = 0,
/** The connection to the asked URL failed. */
TCBlobDownloadErrorConnectionFailed,
/** The connection encountered an HTTP error. Please refer to `TCHTTPStatusCode` documentation for further details on how to handle such errors. */
TCBlobDownloadErrorHTTPError,
/** The device has not enough free disk space to download the file. */
Expand Down Expand Up @@ -215,11 +213,11 @@ typedef NS_ENUM(NSUInteger, TCBlobDownloadState) {
/**
Makes the receiver download dependent of the given download. The receiver download will not execute itself until the given download has finished.
@param blobDownload The download on which to depend.
@param download The TCBlobDownloader on which to depend.
@since 1.2
*/
- (void)addDependentDownload:(TCBlobDownloader *)blobDownload;
- (void)addDependentDownload:(TCBlobDownloader *)download;

@end

Expand Down
Loading

0 comments on commit b52f4e7

Please sign in to comment.