From a35e9d0b547b62b1a6d71cf86f343e8bdef489e7 Mon Sep 17 00:00:00 2001 From: Nikolay Demyankov Date: Wed, 20 Jan 2016 21:15:06 +0100 Subject: [PATCH] Fix for https://github.com/nordnet/cordova-hot-code-push/issues/93 . --- .../src/com/nordnetab/chcp/main/HotCodePushPlugin.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/android/src/com/nordnetab/chcp/main/HotCodePushPlugin.java b/src/android/src/com/nordnetab/chcp/main/HotCodePushPlugin.java index d65f7c98..a92a9768 100644 --- a/src/android/src/com/nordnetab/chcp/main/HotCodePushPlugin.java +++ b/src/android/src/com/nordnetab/chcp/main/HotCodePushPlugin.java @@ -72,6 +72,7 @@ public class HotCodePushPlugin extends CordovaPlugin { private Handler handler; private boolean isPluginReadyForWork; + private boolean dontReloadOnStart; // region Plugin lifecycle @@ -103,7 +104,7 @@ public void initialize(final CordovaInterface cordova, final CordovaWebView webV public void onStart() { super.onStart(); - EventBus eventBus = EventBus.getDefault(); + final EventBus eventBus = EventBus.getDefault(); if (!eventBus.isRegistered(this)) { eventBus.register(this); } @@ -112,11 +113,15 @@ public void onStart() { // if not - install it isPluginReadyForWork = isPluginReadyForWork(); if (!isPluginReadyForWork) { + dontReloadOnStart = true; installWwwFolder(); return; } - redirectToLocalStorageIndexPage(); + // reload only if we on local storage + if (!dontReloadOnStart && webView.getUrl().startsWith(LOCAL_ASSETS_FOLDER)) { + redirectToLocalStorageIndexPage(); + } // install update if there is anything to install if (chcpXmlConfig.isAutoInstallIsAllowed() &&