Skip to content

Commit

Permalink
Replace String with constants for Module names in Fb4aCoreInfraPackage
Browse files Browse the repository at this point in the history
Summary: Using constants is safer than using strings. More details at D12843649

Reviewed By: sahrens

Differential Revision: D8226521

fbshipit-source-id: 4c78c8dfe0bd658f46c8f81e50ceae9299fc6f3c
  • Loading branch information
axe-fb authored and facebook-github-bot committed Nov 8, 2018
1 parent 8d5d144 commit fe49809
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@ReactModule(name = JSDevSupport.MODULE_NAME)
public class JSDevSupport extends ReactContextBaseJavaModule {

static final String MODULE_NAME = "JSDevSupport";
public static final String MODULE_NAME = "JSDevSupport";

public static final int ERROR_CODE_EXCEPTION = 0;
public static final int ERROR_CODE_VIEW_NOT_FOUND = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
/**
* {@link NativeModule} that allows JS to set allowRTL and get isRTL status.
*/
@ReactModule(name = "I18nManager")
@ReactModule(name = I18nManagerModule.NAME)
public class I18nManagerModule extends ContextBaseJavaModule {

public static final String NAME = "I18nManager";

private final I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();

public I18nManagerModule(Context context) {
Expand All @@ -30,7 +32,7 @@ public I18nManagerModule(Context context) {

@Override
public String getName() {
return "I18nManager";
return NAME;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
import okhttp3.OkHttpClient;
Expand All @@ -38,9 +38,9 @@
import okhttp3.WebSocketListener;
import okio.ByteString;

@ReactModule(name = "WebSocketModule", hasConstants = false)
@ReactModule(name = WebSocketModule.NAME, hasConstants = false)
public final class WebSocketModule extends ReactContextBaseJavaModule {

public static final String NAME="WebSocketModule";
public interface ContentHandler {
void onMessage(String text, WritableMap params);

Expand All @@ -67,7 +67,7 @@ private void sendEvent(String eventName, WritableMap params) {

@Override
public String getName() {
return "WebSocketModule";
return NAME;
}

public void setContentHandler(final int id, final ContentHandler contentHandler) {
Expand Down

0 comments on commit fe49809

Please sign in to comment.