mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Make Android connect to the inspector proxy
Summary: Maintains a single persistent connection to the packager for the inspector. It supports getting the available pages and connecting to them. Reviewed By: foghina Differential Revision: D4088690 fbshipit-source-id: 0c445225f5a3de573b199e7868c8693b78f45729
This commit is contained in:
committed by
Facebook Github Bot
parent
655fe2796a
commit
18184a83f1
@@ -3,10 +3,13 @@
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.jni.HybridData;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
|
||||
@DoNotStrip
|
||||
public class Inspector {
|
||||
@@ -17,11 +20,21 @@ public class Inspector {
|
||||
private final HybridData mHybridData;
|
||||
|
||||
public static List<Page> getPages() {
|
||||
return Arrays.asList(instance().getPagesNative());
|
||||
try {
|
||||
return Arrays.asList(instance().getPagesNative());
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
FLog.e(ReactConstants.TAG, "Inspector doesn't work in open source yet", e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
public static LocalConnection connect(int pageId, RemoteConnection remote) {
|
||||
return instance().connectNative(pageId, remote);
|
||||
try {
|
||||
return instance().connectNative(pageId, remote);
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
FLog.e(ReactConstants.TAG, "Inspector doesn't work in open source yet", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static native Inspector instance();
|
||||
|
||||
Reference in New Issue
Block a user