Skip to content

Commit

Permalink
fix(android): Reset bridge on onPageStarted only (#4634)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored May 27, 2021
1 parent 6a22f03 commit 96e4830
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.getcapacitor;

import android.graphics.Bitmap;
import android.net.Uri;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
Expand Down Expand Up @@ -43,4 +44,10 @@ public void onPageFinished(WebView view, String url) {
}
}
}

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
bridge.reset();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ private WebResourceResponse handleLocalRequest(WebResourceRequest request, PathH

responseStream = jsInjector.getInjectedStream(responseStream);

bridge.reset();
int statusCode = getStatusCode(responseStream, handler.getStatusCode());
return new WebResourceResponse(
"text/html",
Expand Down Expand Up @@ -295,7 +294,6 @@ private WebResourceResponse handleLocalRequest(WebResourceRequest request, PathH
// TODO: Conjure up a bit more subtlety than this
if (ext.equals(".html")) {
responseStream = jsInjector.getInjectedStream(responseStream);
bridge.reset();
}

String mimeType = getMimeType(path, responseStream);
Expand Down Expand Up @@ -351,7 +349,6 @@ private WebResourceResponse handleProxyRequest(WebResourceRequest request, PathH
}
InputStream responseStream = conn.getInputStream();
responseStream = jsInjector.getInjectedStream(responseStream);
bridge.reset();
return new WebResourceResponse(
"text/html",
handler.getEncoding(),
Expand Down

0 comments on commit 96e4830

Please sign in to comment.