@@ -269,8 +269,12 @@ else if (action.equals("loadAfterBeforeload")) {
269
269
@ SuppressLint ("NewApi" )
270
270
@ Override
271
271
public void run () {
272
- currentClient .waitForBeforeload = false ;
273
- inAppWebView .setWebViewClient (currentClient );
272
+ if (android .os .Build .VERSION .SDK_INT < android .os .Build .VERSION_CODES .O ) {
273
+ currentClient .waitForBeforeload = false ;
274
+ inAppWebView .setWebViewClient (currentClient );
275
+ } else {
276
+ ((InAppBrowserClient )inAppWebView .getWebViewClient ()).waitForBeforeload = false ;
277
+ }
274
278
inAppWebView .loadUrl (url );
275
279
}
276
280
});
@@ -410,7 +414,7 @@ private void injectDeferredObject(String source, String jsWrapper) {
410
414
@ SuppressLint ("NewApi" )
411
415
@ Override
412
416
public void run () {
413
- if (Build .VERSION .SDK_INT < 19 ) {
417
+ if (Build .VERSION .SDK_INT < Build . VERSION_CODES . KITKAT ) {
414
418
// This action will have the side-effect of blurring the currently focused element
415
419
inAppWebView .loadUrl ("javascript:" + finalScriptToInject );
416
420
} else {
@@ -1002,7 +1006,7 @@ public void postMessage(String data) {
1002
1006
}
1003
1007
}
1004
1008
1005
- if (android .os .Build .VERSION .SDK_INT >= 17 ) {
1009
+ if (android .os .Build .VERSION .SDK_INT >= android . os . Build . VERSION_CODES . JELLY_BEAN_MR1 ) {
1006
1010
settings .setMediaPlaybackRequiresUserGesture (mediaPlaybackRequiresUserGesture );
1007
1011
inAppWebView .addJavascriptInterface (new JsObject (), "cordova_iab" );
1008
1012
}
@@ -1034,7 +1038,7 @@ public void postMessage(String data) {
1034
1038
}
1035
1039
1036
1040
// Enable Thirdparty Cookies on >=Android 5.0 device
1037
- if (android .os .Build .VERSION .SDK_INT >= 21 ) {
1041
+ if (android .os .Build .VERSION .SDK_INT >= android . os . Build . VERSION_CODES . LOLLIPOP ) {
1038
1042
CookieManager .getInstance ().setAcceptThirdPartyCookies (inAppWebView ,true );
1039
1043
}
1040
1044
@@ -1128,7 +1132,7 @@ private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Statu
1128
1132
*/
1129
1133
public void onActivityResult (int requestCode , int resultCode , Intent intent ) {
1130
1134
// For Android >= 5.0
1131
- if (Build .VERSION .SDK_INT >= 21 ) {
1135
+ if (Build .VERSION .SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) {
1132
1136
LOG .d (LOG_TAG , "onActivityResult (For Android >= 5.0)" );
1133
1137
// If RequestCode or Callback is Invalid
1134
1138
if (requestCode != FILECHOOSER_REQUESTCODE_LOLLIPOP || mUploadCallbackLollipop == null ) {
@@ -1201,7 +1205,7 @@ public boolean shouldOverrideUrlLoading(WebView webView, String url) {
1201
1205
* @param webView
1202
1206
* @param request
1203
1207
*/
1204
- @ TargetApi (24 )
1208
+ @ TargetApi (Build . VERSION_CODES . N )
1205
1209
@ Override
1206
1210
public boolean shouldOverrideUrlLoading (WebView webView , WebResourceRequest request ) {
1207
1211
return shouldOverrideUrlLoading (request .getUrl ().toString (), request .getMethod ());
@@ -1373,7 +1377,7 @@ public WebResourceResponse shouldInterceptRequest (final WebView view, String ur
1373
1377
* @param webView
1374
1378
* @param request
1375
1379
*/
1376
- @ TargetApi (21 )
1380
+ @ TargetApi (Build . VERSION_CODES . LOLLIPOP )
1377
1381
@ Override
1378
1382
public WebResourceResponse shouldInterceptRequest (WebView view , WebResourceRequest request ) {
1379
1383
return shouldInterceptRequest (request .getUrl ().toString (), super .shouldInterceptRequest (view , request ), request .getMethod ());
@@ -1424,12 +1428,12 @@ public void onPageFinished(WebView view, String url) {
1424
1428
super .onPageFinished (view , url );
1425
1429
1426
1430
// Set the namespace for postMessage()
1427
- if (Build .VERSION .SDK_INT >= 17 ) {
1431
+ if (Build .VERSION .SDK_INT >= android . os . Build . VERSION_CODES . JELLY_BEAN_MR1 ) {
1428
1432
injectDeferredObject ("window.webkit={messageHandlers:{cordova_iab:cordova_iab}}" , null );
1429
1433
}
1430
1434
1431
1435
// CB-10395 InAppBrowser's WebView not storing cookies reliable to local device storage
1432
- if (android .os .Build .VERSION .SDK_INT >= 21 ) {
1436
+ if (android .os .Build .VERSION .SDK_INT >= android . os . Build . VERSION_CODES . LOLLIPOP ) {
1433
1437
CookieManager .getInstance ().flush ();
1434
1438
} else {
1435
1439
CookieSyncManager .getInstance ().sync ();
0 commit comments