ionic-team / ionic-team/cordova-plugin-ionic-webview

2.x Codepush Android Race Condition Error

Open
#180 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
493
Forks
410
PR merge metrics
No merged PRs in 30d

Description

Using latest ionic webview + lastest code-push plugins results in updates not persisting after close.

I did some digging and I couldn't find a real solution. What I did find though is the following block of code in IonicWebViewEngine.java causes the issue:

```
@Override public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
String launchUrl = parser.getLaunchUrl();
if (!launchUrl.contains("http") && url.equals(launchUrl)) {
view.stopLoading();
view.loadUrl(CDV_LOCAL_SERVER);
}
}
```

The code above basically kills the load of the code-pushed index.html page and results in a reload of the app home screen. To work around it I commended out the stop loading and load url lines.

Needs a better fix, and I am not sure what that is. The request that causes this to run happens before the code-push page is loaded. I couldn't capture if I was trying to load a code-push page first and then prevent this code from running.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.