Skip to content

Commit

Permalink
On Android, onLoadStarted doesn't always fire #12
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Oct 17, 2018
1 parent 4a5be79 commit 4e53bdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-webview-utils",
"version": "2.0.3",
"version": "3.0.0",
"description": "Add custom headers to a NativeScript WebView. Perhaps more utils later.",
"main": "webview-utils",
"typings": "index.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion src/webview-utils.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ export class WebViewUtils extends android.webkit.WebViewClient {
if (isHttpRequest && !headersAdded) {
++this.startEventCount;
this._view.android.loadUrl(url, this.getAdditionalHeadersForUrl(url));
if (WebViewUtils.wv) {
onLoadStarted(WebViewUtils.wv, url, undefined);
}
} else if (!isHttpRequest || (headersAdded && WebViewUtils.wv)) {
if (!isHttpRequest || ++this.startEventCount === 2) {
if (!isHttpRequest || ++this.startEventCount === 1) {
onLoadStarted(WebViewUtils.wv, url, undefined);
}
}
Expand Down

0 comments on commit 4e53bdb

Please sign in to comment.