Skip to content

Commit

Permalink
Merge tag '0.9.9' into develop
Browse files Browse the repository at this point in the history
release 0.9.9 - fixed NSURLConnections not started on main thread; prepared new API using blocks instead of delegate
  • Loading branch information
Lars Blumberg authored and Lars Blumberg committed Jul 29, 2014
2 parents f71022c + 6e36000 commit 4d66316
Show file tree
Hide file tree
Showing 9 changed files with 626 additions and 465 deletions.
24 changes: 24 additions & 0 deletions AFCache.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@
05FA238E1357544F00050BCB /* Constants.h in Headers */ = {isa = PBXBuildFile; fileRef = 05C9BAEE132A291B0087CEA1 /* Constants.h */; };
05FA238F1357545000050BCB /* DateParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 05C9BAEF132A291B0087CEA1 /* DateParser.h */; };
05FA23901357548D00050BCB /* libAFCacheOSXStatic.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 05FA235F1357539B00050BCB /* libAFCacheOSXStatic.a */; };
C73C71CC19816F13008EDA23 /* AFRequestConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = C73C71CA19816F13008EDA23 /* AFRequestConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
C73C71CD19816F13008EDA23 /* AFRequestConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = C73C71CA19816F13008EDA23 /* AFRequestConfiguration.h */; };
C73C71CE19816F13008EDA23 /* AFRequestConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = C73C71CB19816F13008EDA23 /* AFRequestConfiguration.m */; };
C73C71CF19816F13008EDA23 /* AFRequestConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = C73C71CB19816F13008EDA23 /* AFRequestConfiguration.m */; };
C7503D46198640AA0032E451 /* AFDownloadOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = C7503D44198640AA0032E451 /* AFDownloadOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
C7503D47198640AA0032E451 /* AFDownloadOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = C7503D44198640AA0032E451 /* AFDownloadOperation.h */; };
C7503D48198640AA0032E451 /* AFDownloadOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = C7503D45198640AA0032E451 /* AFDownloadOperation.m */; };
C7503D49198640AA0032E451 /* AFDownloadOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = C7503D45198640AA0032E451 /* AFDownloadOperation.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -202,6 +210,10 @@
05FA23751357539C00050BCB /* AFCacheOSXStaticTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AFCacheOSXStaticTests.h; sourceTree = "<group>"; };
05FA23771357539C00050BCB /* AFCacheOSXStaticTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFCacheOSXStaticTests.m; sourceTree = "<group>"; };
05FA237F135753C500050BCB /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
C73C71CA19816F13008EDA23 /* AFRequestConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFRequestConfiguration.h; path = src/shared/AFRequestConfiguration.h; sourceTree = "<group>"; };
C73C71CB19816F13008EDA23 /* AFRequestConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFRequestConfiguration.m; path = src/shared/AFRequestConfiguration.m; sourceTree = "<group>"; };
C7503D44198640AA0032E451 /* AFDownloadOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFDownloadOperation.h; path = src/shared/AFDownloadOperation.h; sourceTree = "<group>"; };
C7503D45198640AA0032E451 /* AFDownloadOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFDownloadOperation.m; path = src/shared/AFDownloadOperation.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -364,6 +376,10 @@
05C9BAE5132A291B0087CEA1 /* AFCacheableItem.m */,
05C9BAE8132A291B0087CEA1 /* AFCacheableItemInfo.h */,
05C9BAE9132A291B0087CEA1 /* AFCacheableItemInfo.m */,
C73C71CA19816F13008EDA23 /* AFRequestConfiguration.h */,
C73C71CB19816F13008EDA23 /* AFRequestConfiguration.m */,
C7503D44198640AA0032E451 /* AFDownloadOperation.h */,
C7503D45198640AA0032E451 /* AFDownloadOperation.m */,
);
name = core;
sourceTree = "<group>";
Expand Down Expand Up @@ -528,6 +544,8 @@
046BEFAF152D180A00FE16B8 /* AFURLCache.h in Headers */,
046BEFB0152D180A00FE16B8 /* AFHTTPURLProtocol.h in Headers */,
046BEFB4152D180A00FE16B8 /* AFPackageInfo.h in Headers */,
C7503D46198640AA0032E451 /* AFDownloadOperation.h in Headers */,
C73C71CC19816F13008EDA23 /* AFRequestConfiguration.h in Headers */,
04007352153242D400335735 /* AFCache+Mimetypes.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -537,13 +555,15 @@
buildActionMask = 2147483647;
files = (
05FA23831357540400050BCB /* AFCacheLib.h in Headers */,
C73C71CD19816F13008EDA23 /* AFRequestConfiguration.h in Headers */,
05FA23841357543A00050BCB /* AFCache_Logging.h in Headers */,
05FA23891357544400050BCB /* AFCacheableItem.h in Headers */,
05FA238B1357544B00050BCB /* AFCacheableItemInfo.h in Headers */,
05FA238C1357544C00050BCB /* AFPackageInfo.h in Headers */,
05FA238E1357544F00050BCB /* Constants.h in Headers */,
05FA238F1357545000050BCB /* DateParser.h in Headers */,
05FA238D1357544D00050BCB /* AFURLCache.h in Headers */,
C7503D47198640AA0032E451 /* AFDownloadOperation.h in Headers */,
05FA23881357544200050BCB /* AFCache+PrivateAPI.h in Headers */,
05FA23851357543D00050BCB /* AFCache.h in Headers */,
05C49201150F9D5C009EDA8F /* AFMediaTypeParser.h in Headers */,
Expand Down Expand Up @@ -782,10 +802,12 @@
05C9BAFE132A291B0087CEA1 /* AFCacheableItemInfo.m in Sources */,
05C9BB00132A291B0087CEA1 /* AFPackageInfo.m in Sources */,
05C9BB02132A291B0087CEA1 /* AFURLCache.m in Sources */,
C7503D48198640AA0032E451 /* AFDownloadOperation.m in Sources */,
05C9BB05132A291B0087CEA1 /* DateParser.m in Sources */,
05C9BB19132A29370087CEA1 /* AFRegexString.m in Sources */,
05C491FB150F9CB1009EDA8F /* AFMediaTypeParser.m in Sources */,
05C491FF150F9CBA009EDA8F /* AFHTTPURLProtocol.m in Sources */,
C73C71CE19816F13008EDA23 /* AFRequestConfiguration.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -816,6 +838,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C7503D49198640AA0032E451 /* AFDownloadOperation.m in Sources */,
055AAF6813575674006E1CF9 /* ioapi.c in Sources */,
055AAF6913575677006E1CF9 /* mztools.c in Sources */,
055AAF6A1357567A006E1CF9 /* unzip.c in Sources */,
Expand All @@ -824,6 +847,7 @@
055AAF5B13575581006E1CF9 /* AFCache+Mimetypes.m in Sources */,
055AAF5D13575581006E1CF9 /* AFCacheableItem.m in Sources */,
055AAF5E13575581006E1CF9 /* AFCacheableItem+Packaging.m in Sources */,
C73C71CF19816F13008EDA23 /* AFRequestConfiguration.m in Sources */,
055AAF5F13575581006E1CF9 /* AFCacheableItemInfo.m in Sources */,
055AAF6013575581006E1CF9 /* AFPackageInfo.m in Sources */,
055AAF671357565B006E1CF9 /* AFRegexString.m in Sources */,
Expand Down
91 changes: 64 additions & 27 deletions src/shared/AFCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#import "TouchXML.h"
#endif
#import "AFCacheableItem.h"
#import "AFRequestConfiguration.h"
#import "AFURLCache.h"

#import <Foundation/NSObjCRuntime.h>
Expand Down Expand Up @@ -129,7 +130,7 @@ typedef struct NetworkTimeoutIntervals {
@property (nonatomic, copy) NSString *dataPath;

/*
* set the number of maximum concurrent downloadble items
* set the number of maximum concurrent downloadable items
* Default is 5
*/
@property (nonatomic, assign) int concurrentConnections;
Expand Down Expand Up @@ -196,31 +197,31 @@ typedef struct NetworkTimeoutIntervals {


- (AFCacheableItem *)cachedObjectForURL: (NSURL *) url
delegate: (id) aDelegate;
delegate: (id) aDelegate __attribute__((deprecated("use cacheItemForURL instead")));

- (AFCacheableItem *)cachedObjectForRequest: (NSURLRequest *) aRequest
delegate: (id) aDelegate;
delegate: (id) aDelegate __attribute__((deprecated("use cacheItemForURL instead")));

- (AFCacheableItem *)cachedObjectForURL: (NSURL *) url
delegate: (id) aDelegate
options: (int) options;
options: (int) options __attribute__((deprecated("use cacheItemForURL instead")));

- (AFCacheableItem *)cachedObjectForURL: (NSURL *) url
delegate: (id) aDelegate
selector: (SEL) aSelector
options: (int) options;
options: (int) options __attribute__((deprecated("use cacheItemForURL instead")));

- (AFCacheableItem *)cachedObjectForURL: (NSURL *) url
delegate: (id) aDelegate
selector: (SEL) aSelector
options: (int) options
userData:(id)userData;
userData:(id)userData __attribute__((deprecated("use cacheItemForURL instead")));

- (AFCacheableItem *)cachedObjectForURL: (NSURL *) url
delegate: (id) aDelegate
selector: (SEL) aSelector
didFailSelector: (SEL) aFailSelector
options: (int) options;
options: (int) options __attribute__((deprecated("use cacheItemForURL instead")));

- (AFCacheableItem *)cachedObjectForURL: (NSURL *) url
delegate: (id) aDelegate
Expand All @@ -230,7 +231,7 @@ typedef struct NetworkTimeoutIntervals {
userData: (id)userData
username: (NSString *)aUsername
password: (NSString *)aPassword
request: (NSURLRequest*)aRequest;
request: (NSURLRequest*)aRequest __attribute__((deprecated("use cacheItemForURL instead")));

- (AFCacheableItem *)cachedObjectForURL: (NSURL *) url
delegate: (id)aDelegate
Expand All @@ -243,7 +244,7 @@ typedef struct NetworkTimeoutIntervals {
userData: (id)userData
username: (NSString *)aUsername
password: (NSString *)aPassword
request: (NSURLRequest*)aRequest;
request: (NSURLRequest*)aRequest __attribute__((deprecated("use cacheItemForURL instead")));

- (AFCacheableItem *)cachedObjectForURLSynchronous: (NSURL *) url;
- (AFCacheableItem *)cachedObjectForURLSynchronous:(NSURL *)url options: (int)options;
Expand All @@ -268,9 +269,8 @@ typedef struct NetworkTimeoutIntervals {
/*
* Cancel any asynchronous operations and downloads
*/
- (void)cancelAsynchronousOperationsForURL:(NSURL *)url itemDelegate:(id)aDelegate;
- (void)cancelAsynchronousOperationsForURL:(NSURL *)url itemDelegate:(id)aDelegate didLoadSelector:(SEL)selector;
- (void)cancelAsynchronousOperationsForDelegate:(id)aDelegate;
- (void)cancelAsynchronousOperationsForURL:(NSURL *)url itemDelegate:(id)itemDelegate;
- (void)cancelAsynchronousOperationsForDelegate:(id)itemDelegate;

/*
* Prioritize the URL or item in the queue
Expand All @@ -285,9 +285,57 @@ typedef struct NetworkTimeoutIntervals {
-(void)addRedirectFromURL:(NSURL*)originalURL toURL:(NSURL*)redirectURL;
-(void)addRedirectFromURLString:(NSString*)originalURLString toURL:(NSString*)redirectURLString;

#pragma mark - Public API for getting cache items (do not use any other, replace your existing deprecated calls with new ones)

/*
* Get a cached item from cache.
*
* @param url the requested url
* @param urlCredential the credential for requested url
* @param completionBlock
* @param failBlock
*/
- (AFCacheableItem *)cacheItemForURL:(NSURL *)url
urlCredential:(NSURLCredential*)urlCredential
completionBlock:(AFCacheableItemBlock)completionBlock
failBlock:(AFCacheableItemBlock)failBlock;

/*
* Get a cached item from cache.
*
* @param url the requested url
* @param urlCredential the credential for requested url
* @param completionBlock
* @param failBlock
* @param progressBlock
*/
- (AFCacheableItem *)cacheItemForURL:(NSURL *)url
urlCredential:(NSURLCredential*)urlCredential
completionBlock:(AFCacheableItemBlock)completionBlock
failBlock:(AFCacheableItemBlock)failBlock
progressBlock:(AFCacheableItemBlock)progressBlock;

/*
* Get a cached item from cache.
*
* @param url the requested url
* @param urlCredential the credential for requested url
* @param completionBlock
* @param failBlock
* @param progressBlock
* @param requestConfiguration
*/
- (AFCacheableItem *)cacheItemForURL:(NSURL *)url
urlCredential:(NSURLCredential*)urlCredential
completionBlock:(AFCacheableItemBlock)completionBlock
failBlock:(AFCacheableItemBlock)failBlock
progressBlock:(AFCacheableItemBlock)progressBlock
requestConfiguration:(AFRequestConfiguration*)requestConfiguration;

@end

#pragma mark - LoggingSupport

@interface AFCache( LoggingSupport )

/*
Expand All @@ -302,20 +350,19 @@ typedef struct NetworkTimeoutIntervals {


@interface AFCache( BLOCKS )
#if NS_BLOCKS_AVAILABLE

- (AFCacheableItem *)cachedObjectForURL: (NSURL *) url
completionBlock: (AFCacheableItemBlock)aCompletionBlock
failBlock: (AFCacheableItemBlock)aFailBlock
options: (int) options;
options: (int) options __attribute__((deprecated("use cacheItemForURL instead")));

- (AFCacheableItem *)cachedObjectForURL: (NSURL *) url
completionBlock: (AFCacheableItemBlock)aCompletionBlock
failBlock: (AFCacheableItemBlock)aFailBlock
options: (int) options
userData: (id)userData
username: (NSString *)aUsername
password: (NSString *)aPassword;
password: (NSString *)aPassword __attribute__((deprecated("use cacheItemForURL instead")));

#pragma mark With progress block

Expand All @@ -326,24 +373,14 @@ typedef struct NetworkTimeoutIntervals {
options: (int) options
userData: (id)userData
username: (NSString *)aUsername
password: (NSString *)aPassword;
password: (NSString *)aPassword __attribute__((deprecated("use cacheItemForURL instead")));

- (AFCacheableItem *)cachedObjectForURL: (NSURL *) url
completionBlock: (AFCacheableItemBlock)aCompletionBlock
failBlock: (AFCacheableItemBlock)aFailBlock
progressBlock: (AFCacheableItemBlock)aProgressBlock
options: (int) options;





#endif
options: (int) options __attribute__((deprecated("use cacheItemForURL instead")));

- (BOOL) persistDownloadQueue;

@end




Loading

0 comments on commit 4d66316

Please sign in to comment.