Commit 3714f36 1 parent fa78a96 commit 3714f36 Copy full SHA for 3714f36
File tree 3 files changed +35
-3
lines changed
ReactAndroid/src/main/java/com/facebook/react/devsupport
3 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ private enum ErrorType {
140
140
private @ Nullable ErrorType mLastErrorType ;
141
141
private @ Nullable DevBundleDownloadListener mBundleDownloadListener ;
142
142
private @ Nullable List <ErrorCustomizer > mErrorCustomizers ;
143
+ private @ Nullable PackagerLocationCustomizer mPackagerLocationCustomizer ;
143
144
144
145
private InspectorPackagerConnection .BundleStatus mBundleStatus ;
145
146
@@ -877,8 +878,19 @@ public void handleReloadJS() {
877
878
}
878
879
879
880
@ Override
880
- public void isPackagerRunning (PackagerStatusCallback callback ) {
881
- mDevServerHelper .isPackagerRunning (callback );
881
+ public void isPackagerRunning (final PackagerStatusCallback callback ) {
882
+ Runnable checkPackagerRunning =
883
+ new Runnable () {
884
+ @ Override
885
+ public void run () {
886
+ mDevServerHelper .isPackagerRunning (callback );
887
+ }
888
+ };
889
+ if (mPackagerLocationCustomizer != null ) {
890
+ mPackagerLocationCustomizer .run (checkPackagerRunning );
891
+ } else {
892
+ checkPackagerRunning .run ();
893
+ }
882
894
}
883
895
884
896
@ Override
@@ -1240,4 +1252,9 @@ private void reload() {
1240
1252
private static String getReloadAppAction (Context context ) {
1241
1253
return context .getPackageName () + RELOAD_APP_ACTION_SUFFIX ;
1242
1254
}
1255
+
1256
+ @ Override
1257
+ public void setPackagerLocationCustomizer (PackagerLocationCustomizer packagerLocationCustomizer ) {
1258
+ mPackagerLocationCustomizer = packagerLocationCustomizer ;
1259
+ }
1243
1260
}
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ public void handleReloadJS() {}
130
130
public void reloadJSFromServer (String bundleURL ) {}
131
131
132
132
@ Override
133
- public void isPackagerRunning (PackagerStatusCallback callback ) {}
133
+ public void isPackagerRunning (final PackagerStatusCallback callback ) {}
134
134
135
135
@ Override
136
136
public @ Nullable File downloadBundleResourceFromUrlSync (
@@ -151,6 +151,10 @@ public void isPackagerRunning(PackagerStatusCallback callback) {}
151
151
@ Override
152
152
public void registerErrorCustomizer (ErrorCustomizer errorCustomizer ) {}
153
153
154
+ @ Override
155
+ public void setPackagerLocationCustomizer (
156
+ PackagerLocationCustomizer packagerLocationCustomizer ) {}
157
+
154
158
@ Override
155
159
public void handleException (Exception e ) {
156
160
mDefaultNativeModuleCallExceptionHandler .handleException (e );
Original file line number Diff line number Diff line change @@ -89,4 +89,15 @@ public interface DevSupportManager extends NativeModuleCallExceptionHandler {
89
89
StackFrame [] getLastErrorStack ();
90
90
91
91
void registerErrorCustomizer (ErrorCustomizer errorCustomizer );
92
+
93
+ /**
94
+ * The PackagerLocationCustomizer allows you to have a dynamic packager location that is
95
+ * determined right before loading the packager. Your customizer must call |callback|, as loading
96
+ * will be blocked waiting for it to resolve.
97
+ */
98
+ public interface PackagerLocationCustomizer {
99
+ void run (Runnable callback );
100
+ }
101
+
102
+ void setPackagerLocationCustomizer (PackagerLocationCustomizer packagerLocationCustomizer );
92
103
}
You can’t perform that action at this time.
0 commit comments