Added RCTDataRequestHandler

Summary: public

Added RCTDataRequestHandler, which is responsible for loading data URLs. This moves the logic for data URL handling out of RCTImageDownloader (no longer needed) and into the RCTNetwork library, where it makes more sense.

This also means that it is now possible to load data URLs via XHR, and use them for purposes other than just images.

Reviewed By: javache

Differential Revision: D2540964

fb-gh-sync-id: 4f0418bd6b9186f047cc8297276bb970795af104
This commit is contained in:
Nick Lockwood
2015-10-19 09:04:54 -07:00
committed by facebook-github-bot-4
parent 31f9a690f3
commit 1076f4a172
19 changed files with 516 additions and 397 deletions

View File

@@ -11,13 +11,13 @@
#import <MobileCoreServices/MobileCoreServices.h>
#import "RCTUtils.h"
@implementation RCTFileRequestHandler
{
NSOperationQueue *_fileQueue;
}
@synthesize methodQueue = _methodQueue;
RCT_EXPORT_MODULE()
- (void)invalidate
@@ -28,7 +28,9 @@ RCT_EXPORT_MODULE()
- (BOOL)canHandleRequest:(NSURLRequest *)request
{
return [request.URL.scheme caseInsensitiveCompare:@"file"] == NSOrderedSame;
return
[request.URL.scheme caseInsensitiveCompare:@"file"] == NSOrderedSame
&& !RCTIsXCAssetURL(request.URL);
}
- (NSOperation *)sendRequest:(NSURLRequest *)request