diff --git a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm index 8fcd18e133b..a7ee310ec0f 100644 --- a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm @@ -822,22 +822,6 @@ namespace facebook { } // namespace react } // namespace facebook -namespace facebook { - namespace react { - - static facebook::jsi::Value __hostFunction_NativeDatePickerAndroidSpecJSI_open(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "open", @selector(open:resolve:reject:), args, count); - } - - NativeDatePickerAndroidSpecJSI::NativeDatePickerAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms) - : ObjCTurboModule(params) { - - methodMap_["open"] = MethodMetadata {1, __hostFunction_NativeDatePickerAndroidSpecJSI_open}; - - } - } // namespace react -} // namespace facebook - namespace facebook { namespace react { @@ -1038,34 +1022,6 @@ namespace facebook { } } // namespace react } // namespace facebook -@implementation RCTCxxConvert (NativeDialogManagerAndroid_DialogOptions) -+ (RCTManagedPointer *)JS_NativeDialogManagerAndroid_DialogOptions:(id)json -{ - return facebook::react::managedPointer(json); -} -@end -namespace facebook { - namespace react { - - static facebook::jsi::Value __hostFunction_NativeDialogManagerAndroidSpecJSI_showAlert(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "showAlert", @selector(showAlert:onError:onAction:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeDialogManagerAndroidSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); - } - - NativeDialogManagerAndroidSpecJSI::NativeDialogManagerAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms) - : ObjCTurboModule(params) { - - methodMap_["showAlert"] = MethodMetadata {3, __hostFunction_NativeDialogManagerAndroidSpecJSI_showAlert}; - setMethodArgConversionSelector(@"showAlert", 0, @"JS_NativeDialogManagerAndroid_DialogOptions:"); - - methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeDialogManagerAndroidSpecJSI_getConstants}; - - } - } // namespace react -} // namespace facebook @implementation RCTCxxConvert (NativeExceptionsManager_StackFrame) + (RCTManagedPointer *)JS_NativeExceptionsManager_StackFrame:(id)json { @@ -1286,50 +1242,6 @@ namespace facebook { } // namespace react } // namespace facebook -namespace facebook { - namespace react { - - static facebook::jsi::Value __hostFunction_NativeImageLoaderAndroidSpecJSI_abortRequest(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "abortRequest", @selector(abortRequest:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeImageLoaderAndroidSpecJSI_getSize(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "getSize", @selector(getSize:resolve:reject:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeImageLoaderAndroidSpecJSI_getSizeWithHeaders(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "getSizeWithHeaders", @selector(getSizeWithHeaders:headers:resolve:reject:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeImageLoaderAndroidSpecJSI_prefetchImage(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "prefetchImage", @selector(prefetchImage:requestId:resolve:reject:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeImageLoaderAndroidSpecJSI_queryCache(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "queryCache", @selector(queryCache:resolve:reject:), args, count); - } - - NativeImageLoaderAndroidSpecJSI::NativeImageLoaderAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms) - : ObjCTurboModule(params) { - - methodMap_["abortRequest"] = MethodMetadata {1, __hostFunction_NativeImageLoaderAndroidSpecJSI_abortRequest}; - - - methodMap_["getSize"] = MethodMetadata {1, __hostFunction_NativeImageLoaderAndroidSpecJSI_getSize}; - - - methodMap_["getSizeWithHeaders"] = MethodMetadata {2, __hostFunction_NativeImageLoaderAndroidSpecJSI_getSizeWithHeaders}; - - - methodMap_["prefetchImage"] = MethodMetadata {2, __hostFunction_NativeImageLoaderAndroidSpecJSI_prefetchImage}; - - - methodMap_["queryCache"] = MethodMetadata {1, __hostFunction_NativeImageLoaderAndroidSpecJSI_queryCache}; - - } - } // namespace react -} // namespace facebook - namespace facebook { namespace react { @@ -1429,22 +1341,6 @@ namespace facebook { } // namespace react } // namespace facebook -namespace facebook { - namespace react { - - static facebook::jsi::Value __hostFunction_NativeImageStoreAndroidSpecJSI_getBase64ForTag(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getBase64ForTag", @selector(getBase64ForTag:successCallback:errorCallback:), args, count); - } - - NativeImageStoreAndroidSpecJSI::NativeImageStoreAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms) - : ObjCTurboModule(params) { - - methodMap_["getBase64ForTag"] = MethodMetadata {3, __hostFunction_NativeImageStoreAndroidSpecJSI_getBase64ForTag}; - - } - } // namespace react -} // namespace facebook - namespace facebook { namespace react { @@ -1482,50 +1378,6 @@ namespace facebook { } // namespace react } // namespace facebook -namespace facebook { - namespace react { - - static facebook::jsi::Value __hostFunction_NativeIntentAndroidSpecJSI_getInitialURL(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "getInitialURL", @selector(getInitialURL:reject:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeIntentAndroidSpecJSI_canOpenURL(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "canOpenURL", @selector(canOpenURL:resolve:reject:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeIntentAndroidSpecJSI_openURL(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "openURL", @selector(openURL:resolve:reject:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeIntentAndroidSpecJSI_openSettings(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "openSettings", @selector(openSettings:reject:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeIntentAndroidSpecJSI_sendIntent(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "sendIntent", @selector(sendIntent:extras:resolve:reject:), args, count); - } - - NativeIntentAndroidSpecJSI::NativeIntentAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms) - : ObjCTurboModule(params) { - - methodMap_["getInitialURL"] = MethodMetadata {0, __hostFunction_NativeIntentAndroidSpecJSI_getInitialURL}; - - - methodMap_["canOpenURL"] = MethodMetadata {1, __hostFunction_NativeIntentAndroidSpecJSI_canOpenURL}; - - - methodMap_["openURL"] = MethodMetadata {1, __hostFunction_NativeIntentAndroidSpecJSI_openURL}; - - - methodMap_["openSettings"] = MethodMetadata {0, __hostFunction_NativeIntentAndroidSpecJSI_openSettings}; - - - methodMap_["sendIntent"] = MethodMetadata {2, __hostFunction_NativeIntentAndroidSpecJSI_sendIntent}; - - } - } // namespace react -} // namespace facebook - namespace facebook { namespace react { @@ -1707,50 +1559,6 @@ namespace facebook { } } // namespace react } // namespace facebook - -namespace facebook { - namespace react { - - static facebook::jsi::Value __hostFunction_NativeNetworkingAndroidSpecJSI_sendRequest(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "sendRequest", @selector(sendRequest:url:requestId:headers:data:responseType:useIncrementalUpdates:timeout:withCredentials:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeNetworkingAndroidSpecJSI_abortRequest(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "abortRequest", @selector(abortRequest:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeNetworkingAndroidSpecJSI_clearCookies(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "clearCookies", @selector(clearCookies:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeNetworkingAndroidSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeNetworkingAndroidSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); - } - - NativeNetworkingAndroidSpecJSI::NativeNetworkingAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms) - : ObjCTurboModule(params) { - - methodMap_["sendRequest"] = MethodMetadata {9, __hostFunction_NativeNetworkingAndroidSpecJSI_sendRequest}; - - - methodMap_["abortRequest"] = MethodMetadata {1, __hostFunction_NativeNetworkingAndroidSpecJSI_abortRequest}; - - - methodMap_["clearCookies"] = MethodMetadata {1, __hostFunction_NativeNetworkingAndroidSpecJSI_clearCookies}; - - - methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeNetworkingAndroidSpecJSI_addListener}; - - - methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeNetworkingAndroidSpecJSI_removeListeners}; - - } - } // namespace react -} // namespace facebook @implementation RCTCxxConvert (NativeNetworkingIOS_SpecSendRequestQuery) + (RCTManagedPointer *)JS_NativeNetworkingIOS_SpecSendRequestQuery:(id)json { @@ -1801,66 +1609,6 @@ namespace facebook { } // namespace react } // namespace facebook -namespace facebook { - namespace react { - - static facebook::jsi::Value __hostFunction_NativePermissionsAndroidSpecJSI_checkPermission(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "checkPermission", @selector(checkPermission:resolve:reject:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativePermissionsAndroidSpecJSI_requestPermission(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "requestPermission", @selector(requestPermission:resolve:reject:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativePermissionsAndroidSpecJSI_shouldShowRequestPermissionRationale(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "shouldShowRequestPermissionRationale", @selector(shouldShowRequestPermissionRationale:resolve:reject:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativePermissionsAndroidSpecJSI_requestMultiplePermissions(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "requestMultiplePermissions", @selector(requestMultiplePermissions:resolve:reject:), args, count); - } - - NativePermissionsAndroidSpecJSI::NativePermissionsAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms) - : ObjCTurboModule(params) { - - methodMap_["checkPermission"] = MethodMetadata {1, __hostFunction_NativePermissionsAndroidSpecJSI_checkPermission}; - - - methodMap_["requestPermission"] = MethodMetadata {1, __hostFunction_NativePermissionsAndroidSpecJSI_requestPermission}; - - - methodMap_["shouldShowRequestPermissionRationale"] = MethodMetadata {1, __hostFunction_NativePermissionsAndroidSpecJSI_shouldShowRequestPermissionRationale}; - - - methodMap_["requestMultiplePermissions"] = MethodMetadata {1, __hostFunction_NativePermissionsAndroidSpecJSI_requestMultiplePermissions}; - - } - } // namespace react -} // namespace facebook - -namespace facebook { - namespace react { - - static facebook::jsi::Value __hostFunction_NativePlatformConstantsAndroidSpecJSI_getAndroidID(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, StringKind, "getAndroidID", @selector(getAndroidID), args, count); - } - - static facebook::jsi::Value __hostFunction_NativePlatformConstantsAndroidSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); - } - - NativePlatformConstantsAndroidSpecJSI::NativePlatformConstantsAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms) - : ObjCTurboModule(params) { - - methodMap_["getAndroidID"] = MethodMetadata {0, __hostFunction_NativePlatformConstantsAndroidSpecJSI_getAndroidID}; - - - methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativePlatformConstantsAndroidSpecJSI_getConstants}; - - } - } // namespace react -} // namespace facebook - namespace facebook { namespace react { @@ -2145,50 +1893,6 @@ namespace facebook { } // namespace react } // namespace facebook -namespace facebook { - namespace react { - - static facebook::jsi::Value __hostFunction_NativeStatusBarManagerAndroidSpecJSI_setColor(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setColor", @selector(setColor:animated:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeStatusBarManagerAndroidSpecJSI_setTranslucent(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setTranslucent", @selector(setTranslucent:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeStatusBarManagerAndroidSpecJSI_setStyle(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setStyle", @selector(setStyle:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeStatusBarManagerAndroidSpecJSI_setHidden(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setHidden", @selector(setHidden:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeStatusBarManagerAndroidSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); - } - - NativeStatusBarManagerAndroidSpecJSI::NativeStatusBarManagerAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms) - : ObjCTurboModule(params) { - - methodMap_["setColor"] = MethodMetadata {2, __hostFunction_NativeStatusBarManagerAndroidSpecJSI_setColor}; - - - methodMap_["setTranslucent"] = MethodMetadata {1, __hostFunction_NativeStatusBarManagerAndroidSpecJSI_setTranslucent}; - - - methodMap_["setStyle"] = MethodMetadata {1, __hostFunction_NativeStatusBarManagerAndroidSpecJSI_setStyle}; - - - methodMap_["setHidden"] = MethodMetadata {1, __hostFunction_NativeStatusBarManagerAndroidSpecJSI_setHidden}; - - - methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeStatusBarManagerAndroidSpecJSI_getConstants}; - - } - } // namespace react -} // namespace facebook - namespace facebook { namespace react { @@ -2277,43 +1981,6 @@ namespace facebook { } // namespace react } // namespace facebook -namespace facebook { - namespace react { - - static facebook::jsi::Value __hostFunction_NativeToastAndroidSpecJSI_show(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "show", @selector(show:duration:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeToastAndroidSpecJSI_showWithGravity(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "showWithGravity", @selector(showWithGravity:duration:gravity:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeToastAndroidSpecJSI_showWithGravityAndOffset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "showWithGravityAndOffset", @selector(showWithGravityAndOffset:duration:gravity:xOffset:yOffset:), args, count); - } - - static facebook::jsi::Value __hostFunction_NativeToastAndroidSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); - } - - NativeToastAndroidSpecJSI::NativeToastAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms) - : ObjCTurboModule(params) { - - methodMap_["show"] = MethodMetadata {2, __hostFunction_NativeToastAndroidSpecJSI_show}; - - - methodMap_["showWithGravity"] = MethodMetadata {3, __hostFunction_NativeToastAndroidSpecJSI_showWithGravity}; - - - methodMap_["showWithGravityAndOffset"] = MethodMetadata {5, __hostFunction_NativeToastAndroidSpecJSI_showWithGravityAndOffset}; - - - methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeToastAndroidSpecJSI_getConstants}; - - } - } // namespace react -} // namespace facebook - namespace facebook { namespace react { diff --git a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h index 2dfcd10b7cd..f1ddf2a9def 100644 --- a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h @@ -569,25 +569,6 @@ namespace facebook { } // namespace react } // namespace facebook -@protocol NativeDatePickerAndroidSpec - -- (void)open:(NSDictionary *)options - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; - -@end -namespace facebook { - namespace react { - /** - * ObjC++ class for module 'NativeDatePickerAndroid' - */ - class JSI_EXPORT NativeDatePickerAndroidSpecJSI : public ObjCTurboModule { - public: - NativeDatePickerAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms); - }; - } // namespace react -} // namespace facebook - @protocol NativeDevLoadingViewSpec - (void)showMessage:(NSString *)message @@ -827,78 +808,6 @@ namespace facebook { }; } // namespace react } // namespace facebook -namespace JS { - namespace NativeDialogManagerAndroid { - struct DialogOptions { - NSString *title() const; - NSString *message() const; - NSString *buttonPositive() const; - NSString *buttonNegative() const; - NSString *buttonNeutral() const; - folly::Optional> items() const; - folly::Optional cancelable() const; - - DialogOptions(NSDictionary *const v) : _v(v) {} - private: - NSDictionary *_v; - }; - } -} - -@interface RCTCxxConvert (NativeDialogManagerAndroid_DialogOptions) -+ (RCTManagedPointer *)JS_NativeDialogManagerAndroid_DialogOptions:(id)json; -@end -namespace JS { - namespace NativeDialogManagerAndroid { - struct Constants { - - struct Builder { - struct Input { - RCTRequired buttonClicked; - RCTRequired dismissed; - RCTRequired buttonPositive; - RCTRequired buttonNegative; - RCTRequired buttonNeutral; - }; - - /** Initialize with a set of values */ - Builder(const Input i); - /** Initialize with an existing Constants */ - Builder(Constants i); - /** Builds the object. Generally used only by the infrastructure. */ - NSDictionary *buildUnsafeRawValue() const { return _factory(); }; - private: - NSDictionary *(^_factory)(void); - }; - - static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } - NSDictionary *unsafeRawValue() const { return _v; } - private: - Constants(NSDictionary *const v) : _v(v) {} - NSDictionary *_v; - }; - } -} -@protocol NativeDialogManagerAndroidSpec - -- (void)showAlert:(JS::NativeDialogManagerAndroid::DialogOptions &)config - onError:(RCTResponseSenderBlock)onError - onAction:(RCTResponseSenderBlock)onAction; -- (facebook::react::ModuleConstants)constantsToExport; -- (facebook::react::ModuleConstants)getConstants; - -@end -namespace facebook { - namespace react { - /** - * ObjC++ class for module 'NativeDialogManagerAndroid' - */ - class JSI_EXPORT NativeDialogManagerAndroidSpecJSI : public ObjCTurboModule { - public: - NativeDialogManagerAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms); - }; - } // namespace react -} // namespace facebook namespace JS { namespace NativeExceptionsManager { struct StackFrame { @@ -1179,37 +1088,6 @@ namespace facebook { } // namespace react } // namespace facebook -@protocol NativeImageLoaderAndroidSpec - -- (void)abortRequest:(double)requestId; -- (void)getSize:(NSString *)uri - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; -- (void)getSizeWithHeaders:(NSString *)uri - headers:(NSDictionary *)headers - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; -- (void)prefetchImage:(NSString *)uri - requestId:(double)requestId - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; -- (void)queryCache:(NSArray *)uris - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; - -@end -namespace facebook { - namespace react { - /** - * ObjC++ class for module 'NativeImageLoaderAndroid' - */ - class JSI_EXPORT NativeImageLoaderAndroidSpecJSI : public ObjCTurboModule { - public: - NativeImageLoaderAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms); - }; - } // namespace react -} // namespace facebook - @protocol NativeImageLoaderIOSSpec - (void)getSize:(NSString *)uri @@ -1296,25 +1174,6 @@ namespace facebook { } // namespace react } // namespace facebook -@protocol NativeImageStoreAndroidSpec - -- (void)getBase64ForTag:(NSString *)uri - successCallback:(RCTResponseSenderBlock)successCallback - errorCallback:(RCTResponseSenderBlock)errorCallback; - -@end -namespace facebook { - namespace react { - /** - * ObjC++ class for module 'NativeImageStoreAndroid' - */ - class JSI_EXPORT NativeImageStoreAndroidSpecJSI : public ObjCTurboModule { - public: - NativeImageStoreAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms); - }; - } // namespace react -} // namespace facebook - @protocol NativeImageStoreIOSSpec - (void)getBase64ForTag:(NSString *)uri @@ -1340,36 +1199,6 @@ namespace facebook { } // namespace react } // namespace facebook -@protocol NativeIntentAndroidSpec - -- (void)getInitialURL:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; -- (void)canOpenURL:(NSString *)url - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; -- (void)openURL:(NSString *)url - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; -- (void)openSettings:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; -- (void)sendIntent:(NSString *)action - extras:(NSArray * _Nullable)extras - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; - -@end -namespace facebook { - namespace react { - /** - * ObjC++ class for module 'NativeIntentAndroid' - */ - class JSI_EXPORT NativeIntentAndroidSpecJSI : public ObjCTurboModule { - public: - NativeIntentAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms); - }; - } // namespace react -} // namespace facebook - @protocol NativeJSCHeapCaptureSpec - (void)captureComplete:(NSString *)path @@ -1536,35 +1365,6 @@ namespace facebook { }; } // namespace react } // namespace facebook - -@protocol NativeNetworkingAndroidSpec - -- (void)sendRequest:(NSString *)method - url:(NSString *)url - requestId:(double)requestId - headers:(NSArray *)headers - data:(NSDictionary *)data - responseType:(NSString *)responseType -useIncrementalUpdates:(BOOL)useIncrementalUpdates - timeout:(double)timeout - withCredentials:(BOOL)withCredentials; -- (void)abortRequest:(double)requestId; -- (void)clearCookies:(RCTResponseSenderBlock)callback; -- (void)addListener:(NSString *)eventName; -- (void)removeListeners:(double)count; - -@end -namespace facebook { - namespace react { - /** - * ObjC++ class for module 'NativeNetworkingAndroid' - */ - class JSI_EXPORT NativeNetworkingAndroidSpecJSI : public ObjCTurboModule { - public: - NativeNetworkingAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms); - }; - } // namespace react -} // namespace facebook namespace JS { namespace NativeNetworkingIOS { struct SpecSendRequestQuery { @@ -1608,119 +1408,6 @@ namespace facebook { }; } // namespace react } // namespace facebook - -@protocol NativePermissionsAndroidSpec - -- (void)checkPermission:(NSString *)permission - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; -- (void)requestPermission:(NSString *)permission - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; -- (void)shouldShowRequestPermissionRationale:(NSString *)permission - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; -- (void)requestMultiplePermissions:(NSArray *)permissions - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject; - -@end -namespace facebook { - namespace react { - /** - * ObjC++ class for module 'NativePermissionsAndroid' - */ - class JSI_EXPORT NativePermissionsAndroidSpecJSI : public ObjCTurboModule { - public: - NativePermissionsAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms); - }; - } // namespace react -} // namespace facebook -namespace JS { - namespace NativePlatformConstantsAndroid { - struct ConstantsReactNativeVersion { - - struct Builder { - struct Input { - RCTRequired major; - RCTRequired minor; - RCTRequired patch; - RCTRequired> prerelease; - }; - - /** Initialize with a set of values */ - Builder(const Input i); - /** Initialize with an existing ConstantsReactNativeVersion */ - Builder(ConstantsReactNativeVersion i); - /** Builds the object. Generally used only by the infrastructure. */ - NSDictionary *buildUnsafeRawValue() const { return _factory(); }; - private: - NSDictionary *(^_factory)(void); - }; - - static ConstantsReactNativeVersion fromUnsafeRawValue(NSDictionary *const v) { return {v}; } - NSDictionary *unsafeRawValue() const { return _v; } - private: - ConstantsReactNativeVersion(NSDictionary *const v) : _v(v) {} - NSDictionary *_v; - }; - } -} -namespace JS { - namespace NativePlatformConstantsAndroid { - struct Constants { - - struct Builder { - struct Input { - RCTRequired isTesting; - RCTRequired reactNativeVersion; - RCTRequired Version; - RCTRequired Release; - RCTRequired Serial; - RCTRequired Fingerprint; - RCTRequired Model; - NSString *ServerHost; - RCTRequired uiMode; - RCTRequired Brand; - RCTRequired Manufacturer; - }; - - /** Initialize with a set of values */ - Builder(const Input i); - /** Initialize with an existing Constants */ - Builder(Constants i); - /** Builds the object. Generally used only by the infrastructure. */ - NSDictionary *buildUnsafeRawValue() const { return _factory(); }; - private: - NSDictionary *(^_factory)(void); - }; - - static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } - NSDictionary *unsafeRawValue() const { return _v; } - private: - Constants(NSDictionary *const v) : _v(v) {} - NSDictionary *_v; - }; - } -} -@protocol NativePlatformConstantsAndroidSpec - -- (NSString *)getAndroidID; -- (facebook::react::ModuleConstants)constantsToExport; -- (facebook::react::ModuleConstants)getConstants; - -@end -namespace facebook { - namespace react { - /** - * ObjC++ class for module 'NativePlatformConstantsAndroid' - */ - class JSI_EXPORT NativePlatformConstantsAndroidSpecJSI : public ObjCTurboModule { - public: - NativePlatformConstantsAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms); - }; - } // namespace react -} // namespace facebook namespace JS { namespace NativePlatformConstantsIOS { struct ConstantsReactNativeVersion { @@ -2059,56 +1746,6 @@ namespace facebook { }; } // namespace react } // namespace facebook -namespace JS { - namespace NativeStatusBarManagerAndroid { - struct Constants { - - struct Builder { - struct Input { - RCTRequired HEIGHT; - RCTRequired DEFAULT_BACKGROUND_COLOR; - }; - - /** Initialize with a set of values */ - Builder(const Input i); - /** Initialize with an existing Constants */ - Builder(Constants i); - /** Builds the object. Generally used only by the infrastructure. */ - NSDictionary *buildUnsafeRawValue() const { return _factory(); }; - private: - NSDictionary *(^_factory)(void); - }; - - static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } - NSDictionary *unsafeRawValue() const { return _v; } - private: - Constants(NSDictionary *const v) : _v(v) {} - NSDictionary *_v; - }; - } -} -@protocol NativeStatusBarManagerAndroidSpec - -- (void)setColor:(double)color - animated:(BOOL)animated; -- (void)setTranslucent:(BOOL)translucent; -- (void)setStyle:(NSString * _Nullable)statusBarStyle; -- (void)setHidden:(BOOL)hidden; -- (facebook::react::ModuleConstants)constantsToExport; -- (facebook::react::ModuleConstants)getConstants; - -@end -namespace facebook { - namespace react { - /** - * ObjC++ class for module 'NativeStatusBarManagerAndroid' - */ - class JSI_EXPORT NativeStatusBarManagerAndroidSpecJSI : public ObjCTurboModule { - public: - NativeStatusBarManagerAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms); - }; - } // namespace react -} // namespace facebook namespace JS { namespace NativeStatusBarManagerIOS { struct Constants { @@ -2184,64 +1821,6 @@ namespace facebook { }; } // namespace react } // namespace facebook -namespace JS { - namespace NativeToastAndroid { - struct Constants { - - struct Builder { - struct Input { - RCTRequired SHORT; - RCTRequired LONG; - RCTRequired TOP; - RCTRequired BOTTOM; - RCTRequired CENTER; - }; - - /** Initialize with a set of values */ - Builder(const Input i); - /** Initialize with an existing Constants */ - Builder(Constants i); - /** Builds the object. Generally used only by the infrastructure. */ - NSDictionary *buildUnsafeRawValue() const { return _factory(); }; - private: - NSDictionary *(^_factory)(void); - }; - - static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } - NSDictionary *unsafeRawValue() const { return _v; } - private: - Constants(NSDictionary *const v) : _v(v) {} - NSDictionary *_v; - }; - } -} -@protocol NativeToastAndroidSpec - -- (void)show:(NSString *)message - duration:(double)duration; -- (void)showWithGravity:(NSString *)message - duration:(double)duration - gravity:(double)gravity; -- (void)showWithGravityAndOffset:(NSString *)message - duration:(double)duration - gravity:(double)gravity - xOffset:(double)xOffset - yOffset:(double)yOffset; -- (facebook::react::ModuleConstants)constantsToExport; -- (facebook::react::ModuleConstants)getConstants; - -@end -namespace facebook { - namespace react { - /** - * ObjC++ class for module 'NativeToastAndroid' - */ - class JSI_EXPORT NativeToastAndroidSpecJSI : public ObjCTurboModule { - public: - NativeToastAndroidSpecJSI(const ObjCTurboModule::InitParams ¶ms); - }; - } // namespace react -} // namespace facebook @protocol NativeVibrationSpec @@ -2533,7 +2112,6 @@ inline JS::NativeBlobModule::Constants::Builder::Builder(Constants i) : _factory - inline JS::NativeDeviceInfo::DisplayMetrics::Builder::Builder(const Input i) : _factory(^{ NSMutableDictionary *d = [NSMutableDictionary new]; auto width = i.width.get(); @@ -2592,58 +2170,6 @@ inline JS::NativeDeviceInfo::Constants::Builder::Builder(const Input i) : _facto inline JS::NativeDeviceInfo::Constants::Builder::Builder(Constants i) : _factory(^{ return i.unsafeRawValue(); }) {} -inline NSString *JS::NativeDialogManagerAndroid::DialogOptions::title() const -{ - id const p = _v[@"title"]; - return RCTBridgingToOptionalString(p); -} -inline NSString *JS::NativeDialogManagerAndroid::DialogOptions::message() const -{ - id const p = _v[@"message"]; - return RCTBridgingToOptionalString(p); -} -inline NSString *JS::NativeDialogManagerAndroid::DialogOptions::buttonPositive() const -{ - id const p = _v[@"buttonPositive"]; - return RCTBridgingToOptionalString(p); -} -inline NSString *JS::NativeDialogManagerAndroid::DialogOptions::buttonNegative() const -{ - id const p = _v[@"buttonNegative"]; - return RCTBridgingToOptionalString(p); -} -inline NSString *JS::NativeDialogManagerAndroid::DialogOptions::buttonNeutral() const -{ - id const p = _v[@"buttonNeutral"]; - return RCTBridgingToOptionalString(p); -} -inline folly::Optional> JS::NativeDialogManagerAndroid::DialogOptions::items() const -{ - id const p = _v[@"items"]; - return RCTBridgingToOptionalVec(p, ^NSString *(id itemValue_0) { return RCTBridgingToString(itemValue_0); }); -} -inline folly::Optional JS::NativeDialogManagerAndroid::DialogOptions::cancelable() const -{ - id const p = _v[@"cancelable"]; - return RCTBridgingToOptionalBool(p); -} -inline JS::NativeDialogManagerAndroid::Constants::Builder::Builder(const Input i) : _factory(^{ - NSMutableDictionary *d = [NSMutableDictionary new]; - auto buttonClicked = i.buttonClicked.get(); - d[@"buttonClicked"] = buttonClicked; - auto dismissed = i.dismissed.get(); - d[@"dismissed"] = dismissed; - auto buttonPositive = i.buttonPositive.get(); - d[@"buttonPositive"] = @(buttonPositive); - auto buttonNegative = i.buttonNegative.get(); - d[@"buttonNegative"] = @(buttonNegative); - auto buttonNeutral = i.buttonNeutral.get(); - d[@"buttonNeutral"] = @(buttonNeutral); - return d; -}) {} -inline JS::NativeDialogManagerAndroid::Constants::Builder::Builder(Constants i) : _factory(^{ - return i.unsafeRawValue(); -}) {} inline folly::Optional JS::NativeExceptionsManager::StackFrame::column() const { id const p = _v[@"column"]; @@ -2788,7 +2314,6 @@ inline folly::Optional JS::NativeImageEditor::Options::allowExternalStorag return RCTBridgingToOptionalBool(p); } - inline bool JS::NativeImagePickerIOS::SpecOpenCameraDialogConfig::unmirrorFrontFacingCamera() const { id const p = _v[@"unmirrorFrontFacingCamera"]; @@ -2812,8 +2337,6 @@ inline bool JS::NativeImagePickerIOS::SpecOpenSelectDialogConfig::showVideos() c - - inline JS::NativeJSDevSupport::Constants::Builder::Builder(const Input i) : _factory(^{ NSMutableDictionary *d = [NSMutableDictionary new]; auto ERROR_CODE_EXCEPTION = i.ERROR_CODE_EXCEPTION.get(); @@ -2829,7 +2352,6 @@ inline JS::NativeJSDevSupport::Constants::Builder::Builder(Constants i) : _facto - inline NSString *JS::NativeNetworkingIOS::SpecSendRequestQuery::method() const { id const p = _v[@"method"]; @@ -2870,51 +2392,6 @@ inline bool JS::NativeNetworkingIOS::SpecSendRequestQuery::withCredentials() con id const p = _v[@"withCredentials"]; return RCTBridgingToBool(p); } - -inline JS::NativePlatformConstantsAndroid::ConstantsReactNativeVersion::Builder::Builder(const Input i) : _factory(^{ - NSMutableDictionary *d = [NSMutableDictionary new]; - auto major = i.major.get(); - d[@"major"] = @(major); - auto minor = i.minor.get(); - d[@"minor"] = @(minor); - auto patch = i.patch.get(); - d[@"patch"] = @(patch); - auto prerelease = i.prerelease.get(); - d[@"prerelease"] = prerelease.hasValue() ? @((double)prerelease.value()) : nil; - return d; -}) {} -inline JS::NativePlatformConstantsAndroid::ConstantsReactNativeVersion::Builder::Builder(ConstantsReactNativeVersion i) : _factory(^{ - return i.unsafeRawValue(); -}) {} -inline JS::NativePlatformConstantsAndroid::Constants::Builder::Builder(const Input i) : _factory(^{ - NSMutableDictionary *d = [NSMutableDictionary new]; - auto isTesting = i.isTesting.get(); - d[@"isTesting"] = @(isTesting); - auto reactNativeVersion = i.reactNativeVersion.get(); - d[@"reactNativeVersion"] = reactNativeVersion.buildUnsafeRawValue(); - auto Version = i.Version.get(); - d[@"Version"] = @(Version); - auto Release = i.Release.get(); - d[@"Release"] = Release; - auto Serial = i.Serial.get(); - d[@"Serial"] = Serial; - auto Fingerprint = i.Fingerprint.get(); - d[@"Fingerprint"] = Fingerprint; - auto Model = i.Model.get(); - d[@"Model"] = Model; - auto ServerHost = i.ServerHost; - d[@"ServerHost"] = ServerHost; - auto uiMode = i.uiMode.get(); - d[@"uiMode"] = uiMode; - auto Brand = i.Brand.get(); - d[@"Brand"] = Brand; - auto Manufacturer = i.Manufacturer.get(); - d[@"Manufacturer"] = Manufacturer; - return d; -}) {} -inline JS::NativePlatformConstantsAndroid::Constants::Builder::Builder(Constants i) : _factory(^{ - return i.unsafeRawValue(); -}) {} inline JS::NativePlatformConstantsIOS::ConstantsReactNativeVersion::Builder::Builder(const Input i) : _factory(^{ NSMutableDictionary *d = [NSMutableDictionary new]; auto major = i.major.get(); @@ -3040,17 +2517,6 @@ inline JS::NativeSourceCode::Constants::Builder::Builder(const Input i) : _facto inline JS::NativeSourceCode::Constants::Builder::Builder(Constants i) : _factory(^{ return i.unsafeRawValue(); }) {} -inline JS::NativeStatusBarManagerAndroid::Constants::Builder::Builder(const Input i) : _factory(^{ - NSMutableDictionary *d = [NSMutableDictionary new]; - auto HEIGHT = i.HEIGHT.get(); - d[@"HEIGHT"] = @(HEIGHT); - auto DEFAULT_BACKGROUND_COLOR = i.DEFAULT_BACKGROUND_COLOR.get(); - d[@"DEFAULT_BACKGROUND_COLOR"] = @(DEFAULT_BACKGROUND_COLOR); - return d; -}) {} -inline JS::NativeStatusBarManagerAndroid::Constants::Builder::Builder(Constants i) : _factory(^{ - return i.unsafeRawValue(); -}) {} inline JS::NativeStatusBarManagerIOS::Constants::Builder::Builder(const Input i) : _factory(^{ NSMutableDictionary *d = [NSMutableDictionary new]; auto HEIGHT = i.HEIGHT.get(); @@ -3063,23 +2529,6 @@ inline JS::NativeStatusBarManagerIOS::Constants::Builder::Builder(Constants i) : return i.unsafeRawValue(); }) {} -inline JS::NativeToastAndroid::Constants::Builder::Builder(const Input i) : _factory(^{ - NSMutableDictionary *d = [NSMutableDictionary new]; - auto SHORT = i.SHORT.get(); - d[@"SHORT"] = @(SHORT); - auto LONG = i.LONG.get(); - d[@"LONG"] = @(LONG); - auto TOP = i.TOP.get(); - d[@"TOP"] = @(TOP); - auto BOTTOM = i.BOTTOM.get(); - d[@"BOTTOM"] = @(BOTTOM); - auto CENTER = i.CENTER.get(); - d[@"CENTER"] = @(CENTER); - return d; -}) {} -inline JS::NativeToastAndroid::Constants::Builder::Builder(Constants i) : _factory(^{ - return i.unsafeRawValue(); -}) {} inline id _Nullable JS::NativeWebSocketModule::SpecConnectOptions::headers() const { diff --git a/packages/react-native-codegen/android/gradlePlugin-build/gradlePlugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java b/packages/react-native-codegen/android/gradlePlugin-build/gradlePlugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java index b27a4e0ee6a..422317a7873 100644 --- a/packages/react-native-codegen/android/gradlePlugin-build/gradlePlugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java +++ b/packages/react-native-codegen/android/gradlePlugin-build/gradlePlugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java @@ -73,6 +73,16 @@ public final class SchemaJsonParser { return; } + if (jsModule.has("excludedPlatforms")) { + final JsonArray excludedPlatforms = jsModule.getAsJsonArray("excludedPlatforms"); + for (JsonElement p : excludedPlatforms) { + if (p.getAsString().equals("android")) { + // This module is not for Android. + return; + } + } + } + final Type parsedType = parseNativeModule( // TODO (T71955395): NativeModule spec type name does not diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js index c41701ded47..8a35a0b5061 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js @@ -282,8 +282,12 @@ module.exports = { Object.keys(nativeModules).forEach(codegenModuleName => { const { aliases, + excludedPlatforms, spec: {properties}, } = nativeModules[codegenModuleName]; + if (excludedPlatforms != null && excludedPlatforms.includes('android')) { + return; + } const resolveAlias = createAliasResolver(aliases); const className = `${codegenModuleName}Spec`; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js index 8e62fbbb448..4a30a0b25c1 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js @@ -334,6 +334,14 @@ module.exports = { const nativeModules = getModules(schema); const modules = Object.keys(nativeModules) + .filter(codegenModuleName => { + const module = nativeModules[codegenModuleName]; + return !( + module.excludedPlatforms != null && + module.excludedPlatforms.includes('android') + ); + }) + .sort() .map(codegenModuleName => { const { aliases, @@ -374,6 +382,25 @@ module.exports = { .join('\n'); const moduleLookup = Object.keys(nativeModules) + .filter(codegenModuleName => { + const module = nativeModules[codegenModuleName]; + return !( + module.excludedPlatforms != null && + module.excludedPlatforms.includes('android') + ); + }) + .sort((a, b) => { + const moduleA = nativeModules[a]; + const moduleB = nativeModules[b]; + const nameA = moduleA.moduleNames[0]; + const nameB = moduleB.moduleNames[0]; + if (nameA < nameB) { + return -1; + } else if (nameA > nameB) { + return 1; + } + return 0; + }) .map(codegenModuleName => { const {moduleNames} = nativeModules[codegenModuleName]; return moduleNames diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js index dd6f3b21fd2..9be43efbd6f 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js @@ -89,6 +89,14 @@ module.exports = { ): FilesOutput { const nativeModules = getModules(schema); const modules = Object.keys(nativeModules) + .filter(codegenModuleName => { + const module = nativeModules[codegenModuleName]; + return !( + module.excludedPlatforms != null && + module.excludedPlatforms.includes('android') + ); + }) + .sort() .map(codegenModuleName => moduleSpecTemplate.replace( /::_CODEGEN_MODULE_NAME_::/g, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js index 52a8ec84fd1..9c9eca23950 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js @@ -125,8 +125,12 @@ module.exports = { for (const codegenModuleName of codegenModuleNames) { const { aliases, + excludedPlatforms, spec: {properties}, } = nativeModules[codegenModuleName]; + if (excludedPlatforms != null && excludedPlatforms.includes('iOS')) { + continue; + } const resolveAlias = createAliasResolver(aliases); const structCollector = new StructCollector(); diff --git a/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js index 59d6f18c5ce..17d2f010804 100644 --- a/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js @@ -1191,6 +1191,7 @@ const REAL_MODULE_EXAMPLE: SchemaType = { ], }, moduleNames: ['ImagePickerIOS'], + excludedPlatforms: ['android'], }, NativeExceptionsManager: { type: 'NativeModule', diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap index 63734de9f31..8f0c4bd09e9 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap @@ -154,37 +154,6 @@ public abstract class NativeCameraRollManagerSpec extends ReactContextBaseJavaMo @ReactMethod public abstract void deletePhotos(ReadableArray assets, Promise promise); } -", - "NativeImagePickerIOSSpec.java" => " -/** - * 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 codegen project: GenerateModuleJavaSpec.js - * - * @nolint - */ - -package com.facebook.fbreact.specs.beta; - -import com.facebook.react.bridge.Callback; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; -import com.facebook.react.bridge.ReactModuleWithSpec; -import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.turbomodule.core.interfaces.TurboModule; - -public abstract class NativeImagePickerIOSSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { - public NativeImagePickerIOSSpec(ReactApplicationContext reactContext) { - super(reactContext); - } - - @ReactMethod - public abstract void openCameraDialog(ReadableMap config, Callback successCallback, Callback cancelCallback); -} ", "NativeExceptionsManagerSpec.java" => " /** diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap index cff000d41f0..30df29b8c30 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap @@ -173,15 +173,6 @@ NativeCameraRollManagerSpecJSI::NativeCameraRollManagerSpecJSI(const JavaTurboMo methodMap_[\\"deletePhotos\\"] = MethodMetadata {1, __hostFunction_NativeCameraRollManagerSpecJSI_deletePhotos}; } -static facebook::jsi::Value __hostFunction_NativeImagePickerIOSSpecJSI_openCameraDialog(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \\"openCameraDialog\\", \\"(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/Callback;)V\\", args, count); -} - -NativeImagePickerIOSSpecJSI::NativeImagePickerIOSSpecJSI(const JavaTurboModule::InitParams ¶ms) - : JavaTurboModule(params) { - methodMap_[\\"openCameraDialog\\"] = MethodMetadata {3, __hostFunction_NativeImagePickerIOSSpecJSI_openCameraDialog}; -} - static facebook::jsi::Value __hostFunction_NativeExceptionsManagerSpecJSI_reportFatalException(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \\"reportFatalException\\", \\"(Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;D)V\\", args, count); } @@ -215,9 +206,6 @@ std::shared_ptr REAL_MODULE_EXAMPLE_ModuleProvider(const std::strin if (moduleName == \\"CameraRollManager\\") { return std::make_shared(params); } - if (moduleName == \\"ImagePickerIOS\\") { - return std::make_shared(params); - } if (moduleName == \\"ExceptionsManager\\") { return std::make_shared(params); } diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap index 21a61920292..2230ec994d9 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap @@ -227,14 +227,6 @@ public: NativeCameraRollManagerSpecJSI(const JavaTurboModule::InitParams ¶ms); }; -/** - * JNI C++ class for module 'NativeImagePickerIOS' - */ -class JSI_EXPORT NativeImagePickerIOSSpecJSI : public JavaTurboModule { -public: - NativeImagePickerIOSSpecJSI(const JavaTurboModule::InitParams ¶ms); -}; - /** * JNI C++ class for module 'NativeExceptionsManager' */