diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java index fa1554bda002f4..9697c4da7e8132 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java @@ -22,8 +22,6 @@ import com.facebook.react.R; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.common.ReactConstants; -import java.net.MalformedURLException; -import java.net.URL; import java.util.Locale; /** Controller to display loading messages on top of the screen. All methods are thread safe. */ @@ -55,34 +53,6 @@ public void run() { }); } - public void showForUrl(String url) { - Context context = getContext(); - if (context == null) { - return; - } - - URL parsedURL; - try { - parsedURL = new URL(url); - } catch (MalformedURLException e) { - FLog.e(ReactConstants.TAG, "Bundle url format is invalid. \n\n" + e.toString()); - return; - } - - int port = parsedURL.getPort() != -1 ? parsedURL.getPort() : parsedURL.getDefaultPort(); - showMessage( - context.getString(R.string.catalyst_loading_from_url, parsedURL.getHost() + ":" + port)); - } - - public void showForRemoteJSEnabled() { - Context context = getContext(); - if (context == null) { - return; - } - - showMessage(context.getString(R.string.catalyst_debug_connecting)); - } - public void updateProgress( final @Nullable String status, final @Nullable Integer done, final @Nullable Integer total) { if (!sEnabled) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java index 0141e70c3eb69b..2bf304a6b1ea4c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java @@ -752,13 +752,34 @@ protected ReactInstanceDevHelper getReactInstanceDevHelper() { @UiThread private void showDevLoadingViewForUrl(String bundleUrl) { - mDevLoadingViewController.showForUrl(bundleUrl); + if (mApplicationContext == null) { + return; + } + + URL parsedURL; + + try { + parsedURL = new URL(bundleUrl); + } catch (MalformedURLException e) { + FLog.e(ReactConstants.TAG, "Bundle url format is invalid. \n\n" + e.toString()); + return; + } + + int port = parsedURL.getPort() != -1 ? parsedURL.getPort() : parsedURL.getDefaultPort(); + mDevLoadingViewController.showMessage( + mApplicationContext.getString( + R.string.catalyst_loading_from_url, parsedURL.getHost() + ":" + port)); mDevLoadingViewVisible = true; } @UiThread protected void showDevLoadingViewForRemoteJSEnabled() { - mDevLoadingViewController.showForRemoteJSEnabled(); + if (mApplicationContext == null) { + return; + } + + mDevLoadingViewController.showMessage( + mApplicationContext.getString(R.string.catalyst_debug_connecting)); mDevLoadingViewVisible = true; }