Add app name to PageInfo

Reviewed By: dcaspi

Differential Revision: D5436099

fbshipit-source-id: 73be706fbb36fe7c16b206de7ca3ba0cc3fa019b
This commit is contained in:
Paco Estevez Garcia 2017-07-19 11:38:49 -07:00 committed by Facebook Github Bot
parent 3103258ca0
commit 90fad3c68b
4 changed files with 10 additions and 4 deletions

View File

@ -133,6 +133,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
NSDictionary *jsonPage = @{
@"id": [@(page.id) stringValue],
@"title": page.title,
@"app": [[NSBundle mainBundle] bundleIdentifier],
};
[array addObject:jsonPage];
}

View File

@ -109,6 +109,7 @@ public class DevServerHelper {
private final OkHttpClient mClient;
private final Handler mRestartOnChangePollingHandler;
private final BundleDownloader mBundleDownloader;
private final String mPackageName;
private boolean mOnChangePollingEnabled;
private @Nullable JSPackagerClient mPackagerClient;
@ -116,7 +117,7 @@ public class DevServerHelper {
private @Nullable OkHttpClient mOnChangePollingClient;
private @Nullable OnServerContentChangeListener mOnServerContentChangeListener;
public DevServerHelper(DevInternalSettings settings) {
public DevServerHelper(DevInternalSettings settings, String packageName) {
mSettings = settings;
mClient = new OkHttpClient.Builder()
.connectTimeout(HTTP_CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS)
@ -126,6 +127,7 @@ public class DevServerHelper {
mBundleDownloader = new BundleDownloader(mClient);
mRestartOnChangePollingHandler = new Handler();
mPackageName = packageName;
}
public void openPackagerConnection(
@ -196,7 +198,7 @@ public class DevServerHelper {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
mInspectorPackagerConnection = new InspectorPackagerConnection(getInspectorDeviceUrl());
mInspectorPackagerConnection = new InspectorPackagerConnection(getInspectorDeviceUrl(), mPackageName);
mInspectorPackagerConnection.connect();
return null;
}

View File

@ -197,7 +197,7 @@ public class DevSupportManagerImpl implements
mApplicationContext = applicationContext;
mJSAppBundleName = packagerPathForJSBundleName;
mDevSettings = new DevInternalSettings(applicationContext, this);
mDevServerHelper = new DevServerHelper(mDevSettings);
mDevServerHelper = new DevServerHelper(mDevSettings, mApplicationContext.getPackageName());
mBundleDownloadListener = devBundleDownloadListener;
// Prepare shake gesture detector (will be started/stopped from #reload)

View File

@ -31,10 +31,12 @@ public class InspectorPackagerConnection {
private final Connection mConnection;
private final Map<String, Inspector.LocalConnection> mInspectorConnections;
private final String mPackageName;
public InspectorPackagerConnection(String url) {
public InspectorPackagerConnection(String url, String packageName) {
mConnection = new Connection(url);
mInspectorConnections = new HashMap<>();
mPackageName = packageName;
}
public void connect() {
@ -145,6 +147,7 @@ public class InspectorPackagerConnection {
JSONObject jsonPage = new JSONObject();
jsonPage.put("id", String.valueOf(page.getId()));
jsonPage.put("title", page.getTitle());
jsonPage.put("app", mPackageName);
array.put(jsonPage);
}
return array;