Skip to content

Commit

Permalink
fix(android): live reload not working when using adb reverse (#4141)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Feb 8, 2021
1 parent 29c7a1e commit 9d7bf79
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) {
return null;
}

if (isLocalFile(loadingUrl) || loadingUrl.getHost().equalsIgnoreCase(bridge.getHost()) || (bridge.getServerUrl() == null && !bridge.getAppAllowNavigationMask().matches(loadingUrl.getHost()))) {
if (isLocalFile(loadingUrl) || isMainUrl(loadingUrl) || !isAllowedUrl(loadingUrl)) {
Logger.debug("Handling local request: " + request.getUrl().toString());
return handleLocalRequest(request, handler);
} else {
Expand All @@ -188,6 +188,14 @@ private boolean isLocalFile(Uri uri) {
return false;
}

private boolean isMainUrl(Uri loadingUrl) {
return (bridge.getServerUrl() == null && loadingUrl.getHost().equalsIgnoreCase(bridge.getHost()));
}

private boolean isAllowedUrl(Uri loadingUrl) {
return !(bridge.getServerUrl() == null && !bridge.getAppAllowNavigationMask().matches(loadingUrl.getHost()));
}

private WebResourceResponse handleLocalRequest(WebResourceRequest request, PathHandler handler) {
String path = request.getUrl().getPath();

Expand Down

0 comments on commit 9d7bf79

Please sign in to comment.