diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/NetworkRecordingModuleMock.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/NetworkRecordingModuleMock.java index 4c0b68b6d..204d7de72 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/NetworkRecordingModuleMock.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/NetworkRecordingModuleMock.java @@ -65,7 +65,7 @@ public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule { @Override public final String getName() { - return "RCTNetworking"; + return "Networking"; } private void fireReactCallback( diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/appstate/AppStateModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/appstate/AppStateModule.java index 16f4e70d7..78be38352 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/appstate/AppStateModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/appstate/AppStateModule.java @@ -19,10 +19,12 @@ import com.facebook.react.bridge.WritableMap; import com.facebook.react.module.annotations.ReactModule; import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter; -@ReactModule(name = "AppState") +@ReactModule(name = AppStateModule.NAME) public class AppStateModule extends ReactContextBaseJavaModule implements LifecycleEventListener { + protected static final String NAME = "AppState"; + public static final String APP_STATE_ACTIVE = "active"; public static final String APP_STATE_BACKGROUND = "background"; @@ -34,7 +36,7 @@ public class AppStateModule extends ReactContextBaseJavaModule @Override public String getName() { - return "AppState"; + return NAME; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/camera/CameraRollManager.java b/ReactAndroid/src/main/java/com/facebook/react/modules/camera/CameraRollManager.java index 6216f1038..b5ab6569c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/camera/CameraRollManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/camera/CameraRollManager.java @@ -56,9 +56,11 @@ import com.facebook.react.module.annotations.ReactModule; * {@link NativeModule} that allows JS to interact with the photos on the device (i.e. * {@link MediaStore.Images}). */ -@ReactModule(name = "RKCameraRollManager") +@ReactModule(name = CameraRollManager.NAME) public class CameraRollManager extends ReactContextBaseJavaModule { + protected static final String NAME = "CameraRollManager"; + private static final String ERROR_UNABLE_TO_LOAD = "E_UNABLE_TO_LOAD"; private static final String ERROR_UNABLE_TO_LOAD_PERMISSION = "E_UNABLE_TO_LOAD_PERMISSION"; private static final String ERROR_UNABLE_TO_SAVE = "E_UNABLE_TO_SAVE"; @@ -100,7 +102,7 @@ public class CameraRollManager extends ReactContextBaseJavaModule { @Override public String getName() { - return "RKCameraRollManager"; + return NAME; } /** diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/camera/ImageEditingManager.java b/ReactAndroid/src/main/java/com/facebook/react/modules/camera/ImageEditingManager.java index b7534a0a8..507f9c0b5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/camera/ImageEditingManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/camera/ImageEditingManager.java @@ -52,9 +52,11 @@ import com.facebook.react.module.annotations.ReactModule; /** * Native module that provides image cropping functionality. */ -@ReactModule(name = "RKImageEditingManager") +@ReactModule(name = ImageEditingManager.NAME) public class ImageEditingManager extends ReactContextBaseJavaModule { + protected static final String NAME = "ImageEditingManager"; + private static final List LOCAL_URI_PREFIXES = Arrays.asList( "file://", "content://"); @@ -98,7 +100,7 @@ public class ImageEditingManager extends ReactContextBaseJavaModule { @Override public String getName() { - return "RKImageEditingManager"; + return NAME; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java index 4f516b424..b1a82a482 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java @@ -23,9 +23,11 @@ import com.facebook.react.common.JavascriptException; import com.facebook.react.common.ReactConstants; import com.facebook.react.module.annotations.ReactModule; -@ReactModule(name = "RKExceptionsManager") +@ReactModule(name = ExceptionsManagerModule.NAME) public class ExceptionsManagerModule extends BaseJavaModule { + protected static final String NAME = "ExceptionsManager"; + static private final Pattern mJsModuleIdPattern = Pattern.compile("(?:^|[/\\\\])(\\d+\\.js)$"); private final DevSupportManager mDevSupportManager; @@ -35,7 +37,7 @@ public class ExceptionsManagerModule extends BaseJavaModule { @Override public String getName() { - return "RKExceptionsManager"; + return NAME; } // If the file name of a stack frame is numeric (+ ".js"), we assume it's a lazily injected module diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java index 092f34e61..9ac738dc2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java @@ -44,10 +44,12 @@ import com.facebook.react.uimanager.ReactChoreographer; /** * Native module for JS timer execution. Timers fire on frame boundaries. */ -@ReactModule(name = "RCTTiming", supportsWebWorkers = true) +@ReactModule(name = Timing.NAME, supportsWebWorkers = true) public final class Timing extends ReactContextBaseJavaModule implements LifecycleEventListener, OnExecutorUnregisteredListener, HeadlessJsTaskEventListener { + protected static final String NAME = "Timing"; + // These timing contants should be kept in sync with the ones in `JSTimersExecution.js`. // The minimum time in milliseconds left in the frame to call idle callbacks. private static final float IDLE_CALLBACK_FRAME_DEADLINE_MS = 1.f; @@ -349,7 +351,7 @@ public final class Timing extends ReactContextBaseJavaModule implements Lifecycl @Override public String getName() { - return "RCTTiming"; + return NAME; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java index a85ce4977..bfccb4804 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java @@ -29,9 +29,11 @@ import com.facebook.react.module.annotations.ReactModule; * Module that records debug information during transitions (animated navigation events such as * going from one screen to another). */ -@ReactModule(name = "AnimationsDebugModule") +@ReactModule(name = AnimationsDebugModule.NAME) public class AnimationsDebugModule extends ReactContextBaseJavaModule { + protected static final String NAME = "AnimationsDebugModule"; + private @Nullable FpsDebugFrameCallback mFrameCallback; private @Nullable final DeveloperSettings mCatalystSettings; @@ -44,7 +46,7 @@ public class AnimationsDebugModule extends ReactContextBaseJavaModule { @Override public String getName() { - return "AnimationsDebugModule"; + return NAME; } @ReactMethod diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java index d738f348b..51b9c208f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java @@ -22,9 +22,11 @@ import com.facebook.react.module.annotations.ReactModule; /** * Module that exposes the URL to the source code map (used for exception stack trace parsing) to JS */ -@ReactModule(name = "RCTSourceCode") +@ReactModule(name = SourceCodeModule.NAME) public class SourceCodeModule extends BaseJavaModule { + public static final String NAME = "SourceCode"; + private final ReactContext mReactContext; public SourceCodeModule(ReactContext reactContext) { @@ -33,7 +35,7 @@ public class SourceCodeModule extends BaseJavaModule { @Override public String getName() { - return "RCTSourceCode"; + return NAME; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java index 80f8513a5..03d709a0a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java @@ -51,9 +51,11 @@ import okio.ByteString; /** * Implements the XMLHttpRequest JavaScript interface. */ -@ReactModule(name = "RCTNetworking", supportsWebWorkers = true) +@ReactModule(name = NetworkingModule.NAME, supportsWebWorkers = true) public final class NetworkingModule extends ReactContextBaseJavaModule { + protected static final String NAME = "Networking"; + private static final String CONTENT_ENCODING_HEADER_NAME = "content-encoding"; private static final String CONTENT_TYPE_HEADER_NAME = "content-type"; private static final String REQUEST_BODY_KEY_STRING = "string"; @@ -141,7 +143,7 @@ public final class NetworkingModule extends ReactContextBaseJavaModule { @Override public String getName() { - return "RCTNetworking"; + return NAME; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageModule.java index 7ccee315b..5fdcbeb48 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageModule.java @@ -33,10 +33,12 @@ import static com.facebook.react.modules.storage.ReactDatabaseSupplier.KEY_COLUM import static com.facebook.react.modules.storage.ReactDatabaseSupplier.TABLE_CATALYST; import static com.facebook.react.modules.storage.ReactDatabaseSupplier.VALUE_COLUMN; -@ReactModule(name = "AsyncSQLiteDBStorage") +@ReactModule(name = AsyncStorageModule.NAME) public final class AsyncStorageModule extends ReactContextBaseJavaModule implements ModuleDataCleaner.Cleanable { + protected static final String NAME = "AsyncSQLiteDBStorage"; + // SQL variable number limit, defined by SQLITE_LIMIT_VARIABLE_NUMBER: // https://raw.githubusercontent.com/android/platform_external_sqlite/master/dist/sqlite3.c private static final int MAX_SQL_KEYS = 999; @@ -51,7 +53,7 @@ public final class AsyncStorageModule @Override public String getName() { - return "AsyncSQLiteDBStorage"; + return NAME; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java index a83a48a21..cd004430e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java @@ -72,10 +72,12 @@ import static com.facebook.react.bridge.ReactMarkerConstants.UI_MANAGER_MODULE_C * consider implementing a pool * TODO(5483063): Don't dispatch the view hierarchy at the end of a batch if no UI changes occurred */ -@ReactModule(name = "RKUIManager") +@ReactModule(name = UIManagerModule.NAME) public class UIManagerModule extends ReactContextBaseJavaModule implements OnBatchCompleteListener, LifecycleEventListener, PerformanceCounter, NativeModuleLogger { + protected static final String NAME = "UIManager"; + // Keep in sync with ReactIOSTagHandles JS module - see that file for an explanation on why the // increment here is 10 private static final int ROOT_VIEW_TAG_INCREMENT = 10; @@ -114,7 +116,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements @Override public String getName() { - return "RKUIManager"; + return NAME; } @Override