Skip to content

Commit

Permalink
Remove Deprecated TurboModuleManagerDelegate APIs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
RSNara authored and facebook-github-bot committed Apr 21, 2023
1 parent ac2a4d8 commit 6f10110
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,6 @@ public NativeModule getLegacyModule(String moduleName) {
return resolvedModule;
}

@Deprecated
@Nullable
@Override
public CxxModuleWrapper getLegacyCxxModule(String moduleName) {
return null;
}

@Override
public List<String> getEagerInitModuleNames() {
List<String> moduleNames = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*
* <p>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.
Expand Down

0 comments on commit 6f10110

Please sign in to comment.