From 0d54b1c23f9d8943cfa5380eb9a16cd4dd2ae34e Mon Sep 17 00:00:00 2001 From: grabbou Date: Tue, 29 Oct 2019 21:13:15 +0100 Subject: [PATCH] Revert "Make RCTFileReaderModule and RCTBlobManager TurboModule-compatible" This reverts commit 3908702de97c9530a5b470be4fae2c0454d02826. --- Libraries/Blob/NativeBlobModule.js | 4 +-- Libraries/Blob/RCTBlobManager.mm | 26 ++++----------- Libraries/Blob/RCTBlobPlugins.mm | 33 ------------------- ...eReaderModule.mm => RCTFileReaderModule.m} | 16 --------- Libraries/Blob/React-RCTBlob.podspec | 14 ++------ .../FBReactNativeSpec-generated.mm | 4 +-- .../FBReactNativeSpec/FBReactNativeSpec.h | 4 +-- RNTester/Podfile.lock | 4 +-- 8 files changed, 16 insertions(+), 89 deletions(-) delete mode 100644 Libraries/Blob/RCTBlobPlugins.mm rename Libraries/Blob/{RCTFileReaderModule.mm => RCTFileReaderModule.m} (82%) diff --git a/Libraries/Blob/NativeBlobModule.js b/Libraries/Blob/NativeBlobModule.js index 4810cd89f88431..2949b755951b5a 100644 --- a/Libraries/Blob/NativeBlobModule.js +++ b/Libraries/Blob/NativeBlobModule.js @@ -18,8 +18,8 @@ export interface Spec extends TurboModule { +addNetworkingHandler: () => void; +addWebSocketHandler: (id: number) => void; +removeWebSocketHandler: (id: number) => void; - +sendOverSocket: (blob: Object, socketID: number) => void; - +createFromParts: (parts: Array, withId: string) => void; + +sendOverSocket: (blob: Object, id: number) => void; + +createFromParts: (parts: Array, blobId: string) => void; +release: (blobId: string) => void; } diff --git a/Libraries/Blob/RCTBlobManager.mm b/Libraries/Blob/RCTBlobManager.mm index cb49a0facfff64..04aba9b637eb01 100755 --- a/Libraries/Blob/RCTBlobManager.mm +++ b/Libraries/Blob/RCTBlobManager.mm @@ -9,18 +9,15 @@ #import -#import #import #import #import #import - -#import "RCTBlobPlugins.h" #import "RCTBlobCollector.h" static NSString *const kBlobURIScheme = @"blob"; -@interface RCTBlobManager () +@interface RCTBlobManager () @end @@ -145,25 +142,25 @@ - (void)remove:(NSString *)blobId }); } -RCT_EXPORT_METHOD(addWebSocketHandler:(double)socketID) +RCT_EXPORT_METHOD(addWebSocketHandler:(nonnull NSNumber *)socketID) { dispatch_async(_bridge.webSocketModule.methodQueue, ^{ - [self->_bridge.webSocketModule setContentHandler:self forSocketID:[NSNumber numberWithDouble:socketID]]; + [self->_bridge.webSocketModule setContentHandler:self forSocketID:socketID]; }); } -RCT_EXPORT_METHOD(removeWebSocketHandler:(double)socketID) +RCT_EXPORT_METHOD(removeWebSocketHandler:(nonnull NSNumber *)socketID) { dispatch_async(_bridge.webSocketModule.methodQueue, ^{ - [self->_bridge.webSocketModule setContentHandler:nil forSocketID:[NSNumber numberWithDouble:socketID]]; + [self->_bridge.webSocketModule setContentHandler:nil forSocketID:socketID]; }); } // @lint-ignore FBOBJCUNTYPEDCOLLECTION1 -RCT_EXPORT_METHOD(sendOverSocket:(NSDictionary *)blob socketID:(double)socketID) +RCT_EXPORT_METHOD(sendOverSocket:(NSDictionary *)blob socketID:(nonnull NSNumber *)socketID) { dispatch_async(_bridge.webSocketModule.methodQueue, ^{ - [self->_bridge.webSocketModule sendData:[self resolve:blob] forSocketID:[NSNumber numberWithDouble:socketID]]; + [self->_bridge.webSocketModule sendData:[self resolve:blob] forSocketID:socketID]; }); } @@ -301,13 +298,4 @@ - (id)processWebsocketMessage:(id)message }; } -- (std::shared_ptr)getTurboModuleWithJsInvoker:(std::shared_ptr)jsInvoker -{ - return std::make_shared(self, jsInvoker); -} - @end - -Class RCTBlobManagerCls(void) { - return RCTBlobManager.class; -} diff --git a/Libraries/Blob/RCTBlobPlugins.mm b/Libraries/Blob/RCTBlobPlugins.mm deleted file mode 100644 index d06f40e5d21120..00000000000000 --- a/Libraries/Blob/RCTBlobPlugins.mm +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @generated by an internal plugin build system - */ - -#ifndef RN_DISABLE_OSS_PLUGIN_HEADER - -// OSS-compatibility layer - -#import "RCTBlobPlugins.h" - -#import -#import - -Class RCTBlobClassProvider(const char *name) { - static std::unordered_map sCoreModuleClassMap = { - {"FileReaderModule", RCTFileReaderModuleCls}, - {"BlobModule", RCTBlobManagerCls}, - }; - - auto p = sCoreModuleClassMap.find(name); - if (p != sCoreModuleClassMap.end()) { - auto classFunc = p->second; - return classFunc(); - } - return nil; -} - -#endif // RN_DISABLE_OSS_PLUGIN_HEADER diff --git a/Libraries/Blob/RCTFileReaderModule.mm b/Libraries/Blob/RCTFileReaderModule.m similarity index 82% rename from Libraries/Blob/RCTFileReaderModule.mm rename to Libraries/Blob/RCTFileReaderModule.m index fb2b4e081c4b86..50fae382019463 100644 --- a/Libraries/Blob/RCTFileReaderModule.mm +++ b/Libraries/Blob/RCTFileReaderModule.m @@ -8,16 +8,11 @@ #import -#import #import #import #import -#import "RCTBlobPlugins.h" - -@interface RCTFileReaderModule() -@end @implementation RCTFileReaderModule @@ -71,15 +66,4 @@ @implementation RCTFileReaderModule } } -- (std::shared_ptr)getTurboModuleWithJsInvoker: - (std::shared_ptr)jsInvoker -{ - return std::make_shared(self, jsInvoker); -} - @end - -Class RCTFileReaderModuleCls(void) -{ - return RCTFileReaderModule.class; -} diff --git a/Libraries/Blob/React-RCTBlob.podspec b/Libraries/Blob/React-RCTBlob.podspec index f6de78b101a675..225a23eb133164 100644 --- a/Libraries/Blob/React-RCTBlob.podspec +++ b/Libraries/Blob/React-RCTBlob.podspec @@ -17,9 +17,6 @@ else source[:tag] = "v#{version}" end -folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' -folly_version = '2018.10.22.00' - Pod::Spec.new do |s| s.name = "React-RCTBlob" s.version = version @@ -28,19 +25,12 @@ Pod::Spec.new do |s| s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2" } - s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source - s.source_files = "*.{m,mm}" + # RCTBlobCollector.h is not included in the React module as it has C++ code + s.source_files = "*.{m,mm}", "RCTBlobCollector.h" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" s.header_dir = "RCTBlob" - s.pod_target_xcconfig = { - "USE_HEADERMAP" => "YES", - "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Folly\"" - } - s.dependency "Folly", folly_version - s.dependency "FBReactNativeSpec", version s.dependency "React-Core/RCTBlobHeaders", version s.dependency "React-Core/RCTWebSocket", version s.dependency "React-RCTNetwork", version diff --git a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm index 3a0280683b5191..cd9384aadaabd2 100644 --- a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm @@ -624,11 +624,11 @@ + (RCTManagedPointer *)JS_NativeAsyncStorage_SpecGetAllKeysCallbackError:(id)jso } static facebook::jsi::Value __hostFunction_NativeBlobModuleSpecJSI_sendOverSocket(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "sendOverSocket", @selector(sendOverSocket:socketID:), args, count); + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "sendOverSocket", @selector(sendOverSocket:id:), args, count); } static facebook::jsi::Value __hostFunction_NativeBlobModuleSpecJSI_createFromParts(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "createFromParts", @selector(createFromParts:withId:), args, count); + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "createFromParts", @selector(createFromParts:blobId:), args, count); } static facebook::jsi::Value __hostFunction_NativeBlobModuleSpecJSI_release(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { diff --git a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h index c3fe3f35d86ab2..23bdff52e8b754 100644 --- a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h @@ -633,9 +633,9 @@ namespace JS { - (void)addWebSocketHandler:(double)id; - (void)removeWebSocketHandler:(double)id; - (void)sendOverSocket:(NSDictionary *)blob - socketID:(double)socketID; + id:(double)id; - (void)createFromParts:(NSArray *)parts - withId:(NSString *)withId; + blobId:(NSString *)blobId; - (void)release:(NSString *)blobId; - (facebook::react::ModuleConstants)constantsToExport; - (facebook::react::ModuleConstants)getConstants; diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 2dcfa4d7fd2093..0bb557e16fbadb 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -205,8 +205,6 @@ PODS: - React-RCTAnimation (1000.0.0): - React-Core/RCTAnimationHeaders (= 1000.0.0) - React-RCTBlob (1000.0.0): - - FBReactNativeSpec (= 1000.0.0) - - Folly (= 2018.10.22.00) - React-Core/RCTBlobHeaders (= 1000.0.0) - React-Core/RCTWebSocket (= 1000.0.0) - React-jsi (= 1000.0.0) @@ -371,7 +369,7 @@ SPEC CHECKSUMS: React-jsinspector: ea0a218071a11c3687cef2480580180caa6a64c0 React-RCTActionSheet: 090e7bd7c5774d919c47c4eeff78223a7fd8c19c React-RCTAnimation: 73d536fff417a101724d9529189c95a94263710c - React-RCTBlob: acd519b1d6ec5d66f98b7cf8e70d0cd76642426f + React-RCTBlob: 86017e0ba937b94445c5f680fef27ab831700fe7 React-RCTImage: 7f5c9bff34905f1bc216be512ba0ae68f872208a React-RCTLinking: d7d7f792e63a8d57380cecbb9b7a3b31f92d1bb6 React-RCTNetwork: c8f9d40297f35ea3792ea81866f33e8b45c25935