Skip to content

Commit 6e44356

Browse files
davidaureliofacebook-github-bot
authored andcommitted
Clean up DevServerHelper
Summary: - Makes methods private that are not used elsewhere - Moves a method to `DevSupportManagerImpl` - Removes unused methods Reviewed By: pakoito Differential Revision: D6900907 fbshipit-source-id: c8d9f748effd396fe610f0d4d87e0bc388e155d6
1 parent 644123a commit 6e44356

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
*/
6565
public class DevServerHelper {
6666
public static final String RELOAD_APP_EXTRA_JS_PROXY = "jsproxy";
67-
private static final String RELOAD_APP_ACTION_SUFFIX = ".RELOAD_APP_ACTION";
6867

6968
private static final String BUNDLE_URL_FORMAT =
7069
"http://%s/%s.%s?platform=android&dev=%s&minify=%s";
@@ -75,7 +74,6 @@ public class DevServerHelper {
7574
"http://%s/onchange";
7675
private static final String WEBSOCKET_PROXY_URL_FORMAT = "ws://%s/debugger-proxy?role=client";
7776
private static final String PACKAGER_STATUS_URL_FORMAT = "http://%s/status";
78-
private static final String HEAP_CAPTURE_UPLOAD_URL_FORMAT = "http://%s/jscheapcaptureupload";
7977
private static final String INSPECTOR_DEVICE_URL_FORMAT = "http://%s/inspector/device?name=%s&app=%s";
8078
private static final String INSPECTOR_ATTACH_URL_FORMAT = "http://%s/nuclide/attach-debugger-nuclide?title=%s&app=%s&device=%s";
8179
private static final String SYMBOLICATE_URL_FORMAT = "http://%s/symbolicate";
@@ -246,12 +244,6 @@ protected Void doInBackground(Void... params) {
246244
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
247245
}
248246

249-
public void sendEventToAllConnections(String event) {
250-
if (mInspectorPackagerConnection != null) {
251-
mInspectorPackagerConnection.sendEventToAllConnections(event);
252-
}
253-
}
254-
255247
public void disableDebugger() {
256248
if (mInspectorPackagerConnection != null) {
257249
mInspectorPackagerConnection.sendEventToAllConnections(DEBUGGER_MSG_DISABLE);
@@ -370,26 +362,14 @@ public void onResponse(Call call, final Response response) throws IOException {
370362
});
371363
}
372364

373-
/** Intent action for reloading the JS */
374-
public static String getReloadAppAction(Context context) {
375-
return context.getPackageName() + RELOAD_APP_ACTION_SUFFIX;
376-
}
377-
378365
public String getWebsocketProxyURL() {
379366
return String.format(
380367
Locale.US,
381368
WEBSOCKET_PROXY_URL_FORMAT,
382369
mSettings.getPackagerConnectionSettings().getDebugServerHost());
383370
}
384371

385-
public String getHeapCaptureUploadUrl() {
386-
return String.format(
387-
Locale.US,
388-
HEAP_CAPTURE_UPLOAD_URL_FORMAT,
389-
mSettings.getPackagerConnectionSettings().getDebugServerHost());
390-
}
391-
392-
public String getInspectorDeviceUrl() {
372+
private String getInspectorDeviceUrl() {
393373
return String.format(
394374
Locale.US,
395375
INSPECTOR_DEVICE_URL_FORMAT,
@@ -398,7 +378,7 @@ public String getInspectorDeviceUrl() {
398378
mPackageName);
399379
}
400380

401-
public String getInspectorAttachUrl(String title) {
381+
private String getInspectorAttachUrl(String title) {
402382
return String.format(
403383
Locale.US,
404384
INSPECTOR_ATTACH_URL_FORMAT,

ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ public class DevSupportManagerImpl implements
115115
private static final int JAVA_ERROR_COOKIE = -1;
116116
private static final int JSEXCEPTION_ERROR_COOKIE = -1;
117117
private static final String JS_BUNDLE_FILE_NAME = "ReactNativeDevBundle.js";
118+
private static final String RELOAD_APP_ACTION_SUFFIX = ".RELOAD_APP_ACTION";
119+
118120
private enum ErrorType {
119121
JS,
120122
NATIVE
@@ -246,7 +248,7 @@ public void onShake() {
246248
@Override
247249
public void onReceive(Context context, Intent intent) {
248250
String action = intent.getAction();
249-
if (DevServerHelper.getReloadAppAction(context).equals(action)) {
251+
if (getReloadAppAction(context).equals(action)) {
250252
if (intent.getBooleanExtra(DevServerHelper.RELOAD_APP_EXTRA_JS_PROXY, false)) {
251253
mDevSettings.setRemoteJSDebugEnabled(true);
252254
mDevServerHelper.launchJSDevtools();
@@ -1134,7 +1136,7 @@ private void reload() {
11341136
// register reload app broadcast receiver
11351137
if (!mIsReceiverRegistered) {
11361138
IntentFilter filter = new IntentFilter();
1137-
filter.addAction(DevServerHelper.getReloadAppAction(mApplicationContext));
1139+
filter.addAction(getReloadAppAction(mApplicationContext));
11381140
mApplicationContext.registerReceiver(mReloadAppBroadcastReceiver, filter);
11391141
mIsReceiverRegistered = true;
11401142
}
@@ -1187,4 +1189,8 @@ public void onServerContentChanged() {
11871189
}
11881190
}
11891191

1192+
/** Intent action for reloading the JS */
1193+
private static String getReloadAppAction(Context context) {
1194+
return context.getPackageName() + RELOAD_APP_ACTION_SUFFIX;
1195+
}
11901196
}

0 commit comments

Comments
 (0)