feat: android - set header and cookies also for loadAfterBefore
This commit is contained in:
parent
9075cc1c18
commit
5a8a2be76a
@ -187,12 +187,16 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
}
|
||||
final String target = t;
|
||||
final HashMap<String, String> features = parseFeature(args.optString(2));
|
||||
parseHeadersAndCookies(features);
|
||||
|
||||
LOG.d(LOG_TAG, "target = " + target);
|
||||
|
||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
setCookies(clearAllCache, clearSessionCache, cookies);
|
||||
|
||||
String result = "";
|
||||
// SELF
|
||||
if (SELF.equals(target)) {
|
||||
@ -290,7 +294,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
} else {
|
||||
((InAppBrowserClient)inAppWebView.getWebViewClient()).waitForBeforeload = false;
|
||||
}
|
||||
inAppWebView.loadUrl(url);
|
||||
inAppWebView.loadUrl(url,headers);
|
||||
|
||||
}
|
||||
});
|
||||
@ -397,6 +401,18 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
closeDialog();
|
||||
}
|
||||
|
||||
private void parseHeadersAndCookies(HashMap<String, String> features){
|
||||
String headersSet = features.get(HEADERS);
|
||||
if (headersSet != null) {
|
||||
headers = deserializeMapOption(headersSet);
|
||||
}
|
||||
|
||||
String cookiesSet = features.get(COOKIES);
|
||||
if (cookiesSet != null) {
|
||||
cookies = deserializeMapOption(cookiesSet);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject an object (script or style) into the InAppBrowser WebView.
|
||||
*
|
||||
@ -732,16 +748,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
if (fullscreenSet != null) {
|
||||
fullscreen = fullscreenSet.equals("yes") ? true : false;
|
||||
}
|
||||
|
||||
String headersSet = features.get(HEADERS);
|
||||
if (headersSet != null) {
|
||||
headers = deserializeMapOption(headersSet);
|
||||
}
|
||||
|
||||
String cookiesSet = features.get(COOKIES);
|
||||
if (cookiesSet != null) {
|
||||
cookies = deserializeMapOption(cookiesSet);
|
||||
}
|
||||
}
|
||||
|
||||
final CordovaWebView thatWebView = this.webView;
|
||||
@ -1093,8 +1099,6 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
}
|
||||
};
|
||||
|
||||
setCookies(clearAllCache, clearSessionCache, cookies);
|
||||
|
||||
this.cordova.getActivity().runOnUiThread(runnable);
|
||||
return "";
|
||||
}
|
||||
|
11
src/android/android.iml
Normal file
11
src/android/android.iml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" packagePrefix="org.apache.cordova.inappbrowser" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
Loading…
Reference in New Issue
Block a user