Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(android): Added new method to prepend InputStreams with JavaScript #7380

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -457,6 +457,20 @@ private WebResourceResponse handleLocalRequest(WebResourceRequest request, PathH
return null;
}

/**
* Prepends an {@code InputStream} with the JavaScript required by Capacitor.
* This method only changes the original {@code InputStream} if {@code WebView} does not
* support the {@code DOCUMENT_START_SCRIPT} feature.
* @param original the original {@code InputStream}
* @return the modified {@code InputStream}
*/
public InputStream getJavaScriptInjectedStream(InputStream original) {
if (jsInjector != null) {
return jsInjector.getInjectedStream(original);
}
return original;
}

/**
* Instead of reading files from the filesystem/assets, proxy through to the URL
* and let an external server handle it.
Expand Down