From e83feffeba567b4e304181632128ee1caa036c45 Mon Sep 17 00:00:00 2001 From: Peter Argany Date: Tue, 22 Jun 2021 19:16:55 -0700 Subject: [PATCH] Back out "Avoid re-encoding images when uploading local files" Summary: This was causing an upload error in FB Dating, will need to re-land with the fix. Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D29320144 fbshipit-source-id: 5d09dd2171b5696afe89cffa064947f0a0bb413d --- Libraries/Network/RCTNetworking.h | 2 -- Libraries/Network/RCTNetworking.mm | 18 ++---------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Libraries/Network/RCTNetworking.h b/Libraries/Network/RCTNetworking.h index 358ab52b6d1..2068f32b803 100644 --- a/Libraries/Network/RCTNetworking.h +++ b/Libraries/Network/RCTNetworking.h @@ -45,8 +45,6 @@ - (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request completionBlock:(RCTURLRequestCompletionBlock)completionBlock; -- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request handler:(id)handler completionBlock:(RCTURLRequestCompletionBlock)completionBlock; - - (void)addRequestHandler:(id)handler; - (void)addResponseHandler:(id)handler; diff --git a/Libraries/Network/RCTNetworking.mm b/Libraries/Network/RCTNetworking.mm index e90c1b29655..22ca45b0fa3 100644 --- a/Libraries/Network/RCTNetworking.mm +++ b/Libraries/Network/RCTNetworking.mm @@ -17,7 +17,6 @@ #import #import -#import #import "RCTNetworkPlugins.h" @@ -394,9 +393,9 @@ RCT_EXPORT_MODULE() } NSURLRequest *request = [RCTConvert NSURLRequest:query[@"uri"]]; if (request) { + __block RCTURLRequestCancellationBlock cancellationBlock = nil; - id handler = [self.moduleRegistry moduleForName:"FileRequestHandler"]; - RCTNetworkTask *task = [self networkTaskWithRequest:request handler:handler completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) { + RCTNetworkTask *task = [self networkTaskWithRequest:request completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) { dispatch_async(self->_methodQueue, ^{ cancellationBlock = callback(error, data ? @{@"body": data, @"contentType": RCTNullIfNil(response.MIMEType)} : nil); }); @@ -677,19 +676,6 @@ RCT_EXPORT_MODULE() return task; } -- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request handler:(id)handler completionBlock:(RCTURLRequestCompletionBlock)completionBlock -{ - if (!handler) { - // specified handler is nil, fall back to generic method - return [self networkTaskWithRequest:request completionBlock:completionBlock]; - } - RCTNetworkTask *task = [[RCTNetworkTask alloc] initWithRequest:request - handler:handler - callbackQueue:_methodQueue]; - task.completionBlock = completionBlock; - return task; -} - #pragma mark - JS API RCT_EXPORT_METHOD(sendRequest:(JS::NativeNetworkingIOS::SpecSendRequestQuery &)query