File tree Expand file tree Collapse file tree 2 files changed +23
-32
lines changed
ReactAndroid/src/main/java/com/facebook/react/devsupport Expand file tree Collapse file tree 2 files changed +23
-32
lines changed Original file line number Diff line number Diff line change 2222import com .facebook .react .R ;
2323import com .facebook .react .bridge .UiThreadUtil ;
2424import com .facebook .react .common .ReactConstants ;
25- import java .net .MalformedURLException ;
26- import java .net .URL ;
2725import java .util .Locale ;
2826
2927/** Controller to display loading messages on top of the screen. All methods are thread safe. */
@@ -55,34 +53,6 @@ public void run() {
5553 });
5654 }
5755
58- public void showForUrl (String url ) {
59- Context context = getContext ();
60- if (context == null ) {
61- return ;
62- }
63-
64- URL parsedURL ;
65- try {
66- parsedURL = new URL (url );
67- } catch (MalformedURLException e ) {
68- FLog .e (ReactConstants .TAG , "Bundle url format is invalid. \n \n " + e .toString ());
69- return ;
70- }
71-
72- int port = parsedURL .getPort () != -1 ? parsedURL .getPort () : parsedURL .getDefaultPort ();
73- showMessage (
74- context .getString (R .string .catalyst_loading_from_url , parsedURL .getHost () + ":" + port ));
75- }
76-
77- public void showForRemoteJSEnabled () {
78- Context context = getContext ();
79- if (context == null ) {
80- return ;
81- }
82-
83- showMessage (context .getString (R .string .catalyst_debug_connecting ));
84- }
85-
8656 public void updateProgress (
8757 final @ Nullable String status , final @ Nullable Integer done , final @ Nullable Integer total ) {
8858 if (!sEnabled ) {
Original file line number Diff line number Diff line change @@ -752,13 +752,34 @@ protected ReactInstanceDevHelper getReactInstanceDevHelper() {
752752
753753 @ UiThread
754754 private void showDevLoadingViewForUrl (String bundleUrl ) {
755- mDevLoadingViewController .showForUrl (bundleUrl );
755+ if (mApplicationContext == null ) {
756+ return ;
757+ }
758+
759+ URL parsedURL ;
760+
761+ try {
762+ parsedURL = new URL (bundleUrl );
763+ } catch (MalformedURLException e ) {
764+ FLog .e (ReactConstants .TAG , "Bundle url format is invalid. \n \n " + e .toString ());
765+ return ;
766+ }
767+
768+ int port = parsedURL .getPort () != -1 ? parsedURL .getPort () : parsedURL .getDefaultPort ();
769+ mDevLoadingViewController .showMessage (
770+ mApplicationContext .getString (
771+ R .string .catalyst_loading_from_url , parsedURL .getHost () + ":" + port ));
756772 mDevLoadingViewVisible = true ;
757773 }
758774
759775 @ UiThread
760776 protected void showDevLoadingViewForRemoteJSEnabled () {
761- mDevLoadingViewController .showForRemoteJSEnabled ();
777+ if (mApplicationContext == null ) {
778+ return ;
779+ }
780+
781+ mDevLoadingViewController .showMessage (
782+ mApplicationContext .getString (R .string .catalyst_debug_connecting ));
762783 mDevLoadingViewVisible = true ;
763784 }
764785
You can’t perform that action at this time.
0 commit comments