From 6f10110555694ec659a87f41b65ca12ee044d908 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Fri, 21 Apr 2023 16:37:04 -0700 Subject: [PATCH] Remove Deprecated TurboModuleManagerDelegate APIs Summary: This deprecated API makes TurboModuleManager's module creation algorithm harder to follow. Let's remove it. Changelog: [Android][Removed] - Remove TurboModuleManagerDelegate.getLegacyCxxModule Reviewed By: mdvacca Differential Revision: D45158031 fbshipit-source-id: f72af3d62e51a4c8427d41975f51d1c9dd31c6c8 --- .../ReactPackageTurboModuleManagerDelegate.java | 7 ------- .../turbomodule/core/TurboModuleManager.java | 16 +--------------- .../core/TurboModuleManagerDelegate.java | 11 ----------- 3 files changed, 1 insertion(+), 33 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java index 5724d131342e18..5fa8f08e097663 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java @@ -219,13 +219,6 @@ public NativeModule getLegacyModule(String moduleName) { return resolvedModule; } - @Deprecated - @Nullable - @Override - public CxxModuleWrapper getLegacyCxxModule(String moduleName) { - return null; - } - @Override public List getEagerInitModuleNames() { List moduleNames = new ArrayList<>(); diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java index 2d2f4e0dffb0d0..18a104a452fd09 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java @@ -75,21 +75,7 @@ public TurboModuleManager( mTurboModuleProvider = delegate == null ? nullProvider - : moduleName -> { - NativeModule module = (NativeModule) delegate.getModule(moduleName); - if (module == null) { - CxxModuleWrapper legacyCxxModule = delegate.getLegacyCxxModule(moduleName); - - if (legacyCxxModule != null) { - // TurboModuleManagerDelegate.getLegacyCxxModule() must always return TurboModules - Assertions.assertCondition( - legacyCxxModule instanceof TurboModule, - "CxxModuleWrapper \"" + moduleName + "\" is not a TurboModule"); - return legacyCxxModule; - } - } - return module; - }; + : moduleName -> (NativeModule) delegate.getModule(moduleName); mLegacyModuleProvider = delegate == null || !shouldCreateLegacyModules() diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManagerDelegate.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManagerDelegate.java index 0a55f1faf9ee70..8d87981021f3da 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManagerDelegate.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManagerDelegate.java @@ -10,7 +10,6 @@ import androidx.annotation.Nullable; import com.facebook.jni.HybridData; import com.facebook.proguard.annotations.DoNotStrip; -import com.facebook.react.bridge.CxxModuleWrapper; import com.facebook.react.bridge.NativeModule; import com.facebook.react.turbomodule.core.interfaces.TurboModule; import com.facebook.soloader.SoLoader; @@ -39,16 +38,6 @@ protected TurboModuleManagerDelegate() { @Nullable public abstract TurboModule getModule(String moduleName); - /** - * Create and return a CxxModuleWrapper NativeModule with name `moduleName`. If `moduleName` isn't - * a CxxModule, return null. CxxModuleWrapper must implement TurboModule. - * - *

Deprecated. Please just return your CxxModuleWrappers from getModule. - */ - @Deprecated - @Nullable - public abstract CxxModuleWrapper getLegacyCxxModule(String moduleName); - /** * Create an return a legacy NativeModule with name `moduleName`. If `moduleName` is a * TurboModule, return null.