fix(lib): move to local variable instead of relying on the string constant from RN core (#63)
This commit is contained in:
parent
f321084c7b
commit
a2d39f0971
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
@implementation RNCAssetsLibraryRequestHandler
|
@implementation RNCAssetsLibraryRequestHandler
|
||||||
|
|
||||||
|
NSString *const PHUploadScheme = @"ph-upload";
|
||||||
|
|
||||||
RCT_EXPORT_MODULE()
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
#pragma mark - RNCURLRequestHandler
|
#pragma mark - RNCURLRequestHandler
|
||||||
|
@ -32,7 +34,7 @@ RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
return [request.URL.scheme caseInsensitiveCompare:@"assets-library"] == NSOrderedSame
|
return [request.URL.scheme caseInsensitiveCompare:@"assets-library"] == NSOrderedSame
|
||||||
|| [request.URL.scheme caseInsensitiveCompare:@"ph"] == NSOrderedSame
|
|| [request.URL.scheme caseInsensitiveCompare:@"ph"] == NSOrderedSame
|
||||||
|| [request.URL.scheme caseInsensitiveCompare:RCTNetworkingPHUploadHackScheme] == NSOrderedSame;
|
|| [request.URL.scheme caseInsensitiveCompare:PHUploadScheme] == NSOrderedSame;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)sendRequest:(NSURLRequest *)request
|
- (id)sendRequest:(NSURLRequest *)request
|
||||||
|
@ -44,9 +46,9 @@ RCT_EXPORT_MODULE()
|
||||||
};
|
};
|
||||||
|
|
||||||
NSURL *requestURL = request.URL;
|
NSURL *requestURL = request.URL;
|
||||||
BOOL isPHUpload = [requestURL.scheme caseInsensitiveCompare:RCTNetworkingPHUploadHackScheme] == NSOrderedSame;
|
BOOL isPHUpload = [requestURL.scheme caseInsensitiveCompare:PHUploadScheme] == NSOrderedSame;
|
||||||
if (isPHUpload) {
|
if (isPHUpload) {
|
||||||
requestURL = [NSURL URLWithString:[@"ph" stringByAppendingString:[requestURL.absoluteString substringFromIndex:RCTNetworkingPHUploadHackScheme.length]]];
|
requestURL = [NSURL URLWithString:[@"ph" stringByAppendingString:[requestURL.absoluteString substringFromIndex:PHUploadScheme.length]]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!requestURL) {
|
if (!requestURL) {
|
||||||
|
|
Loading…
Reference in New Issue