mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Format Java code in xplat/js/react-native-github
Summary: This diff formats the Java class files inside xplat/js/react-native-github. Since google-java-format was enabled in D16071401 we want to codemode the existing code so that users don't have to deal with formatter lint noise at diff-time. ```arc f --paths-cmd 'hg files -I "**/*.java"'``` drop-conflicts Reviewed By: cpojer Differential Revision: D16071725 fbshipit-source-id: fc6e3852e45742c109f0c5ac4065d64201c74204
This commit is contained in:
committed by
Facebook Github Bot
parent
61e95e5cbf
commit
6c0f73b322
+22
-24
@@ -1,30 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.packagerconnection;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.modules.systeminfo.AndroidInfoHelpers;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import okio.ByteString;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* A client for packager that uses WebSocket connection.
|
||||
*/
|
||||
final public class JSPackagerClient implements ReconnectingWebSocket.MessageCallback {
|
||||
/** A client for packager that uses WebSocket connection. */
|
||||
public final class JSPackagerClient implements ReconnectingWebSocket.MessageCallback {
|
||||
private static final String TAG = JSPackagerClient.class.getSimpleName();
|
||||
private static final String PACKAGER_CONNECTION_URL_FORMAT = "ws://%s/message?device=%s&app=%s&context=%s";
|
||||
private static final String PACKAGER_CONNECTION_URL_FORMAT =
|
||||
"ws://%s/message?device=%s&app=%s&context=%s";
|
||||
private static final int PROTOCOL_VERSION = 2;
|
||||
|
||||
private class ResponderImpl implements Responder {
|
||||
@@ -62,23 +56,28 @@ final public class JSPackagerClient implements ReconnectingWebSocket.MessageCall
|
||||
private ReconnectingWebSocket mWebSocket;
|
||||
private Map<String, RequestHandler> mRequestHandlers;
|
||||
|
||||
public JSPackagerClient(String clientId, PackagerConnectionSettings settings, Map<String, RequestHandler> requestHandlers) {
|
||||
public JSPackagerClient(
|
||||
String clientId,
|
||||
PackagerConnectionSettings settings,
|
||||
Map<String, RequestHandler> requestHandlers) {
|
||||
this(clientId, settings, requestHandlers, null);
|
||||
}
|
||||
|
||||
public JSPackagerClient(
|
||||
String clientId, PackagerConnectionSettings settings,
|
||||
String clientId,
|
||||
PackagerConnectionSettings settings,
|
||||
Map<String, RequestHandler> requestHandlers,
|
||||
@Nullable ReconnectingWebSocket.ConnectionCallback connectionCallback) {
|
||||
super();
|
||||
|
||||
Uri.Builder builder = new Uri.Builder();
|
||||
builder.scheme("ws")
|
||||
.encodedAuthority(settings.getDebugServerHost())
|
||||
.appendPath("message")
|
||||
.appendQueryParameter("device", AndroidInfoHelpers.getFriendlyDeviceName())
|
||||
.appendQueryParameter("app", settings.getPackageName())
|
||||
.appendQueryParameter("clientid", clientId);
|
||||
builder
|
||||
.scheme("ws")
|
||||
.encodedAuthority(settings.getDebugServerHost())
|
||||
.appendPath("message")
|
||||
.appendQueryParameter("device", AndroidInfoHelpers.getFriendlyDeviceName())
|
||||
.appendQueryParameter("app", settings.getPackageName())
|
||||
.appendQueryParameter("clientid", clientId);
|
||||
String url = builder.build().toString();
|
||||
|
||||
mWebSocket = new ReconnectingWebSocket(url, this, connectionCallback);
|
||||
@@ -105,8 +104,7 @@ final public class JSPackagerClient implements ReconnectingWebSocket.MessageCall
|
||||
|
||||
if (version != PROTOCOL_VERSION) {
|
||||
FLog.e(
|
||||
TAG,
|
||||
"Message with incompatible or missing version of protocol received: " + version);
|
||||
TAG, "Message with incompatible or missing version of protocol received: " + version);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user