strip off RK/RCT prefix from NativeModules

Reviewed By: javache

Differential Revision: D4487530

fbshipit-source-id: ea16720dc15e490267ad244c43ea9d237f81e353
This commit is contained in:
Aaron Chiu 2017-01-31 04:49:58 -08:00 committed by Facebook Github Bot
parent b6f494c313
commit 29616e3122
11 changed files with 41 additions and 21 deletions

View File

@ -65,7 +65,7 @@ public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
@Override
public final String getName() {
return "RCTNetworking";
return "Networking";
}
private void fireReactCallback(

View File

@ -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

View File

@ -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;
}
/**

View File

@ -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<String> 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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