@@ -275,8 +275,12 @@ else if (action.equals("loadAfterBeforeload")) {
275
275
@ SuppressLint ("NewApi" )
276
276
@ Override
277
277
public void run () {
278
- currentClient .waitForBeforeload = false ;
279
- inAppWebView .setWebViewClient (currentClient );
278
+ if (android .os .Build .VERSION .SDK_INT < android .os .Build .VERSION_CODES .O ) {
279
+ currentClient .waitForBeforeload = false ;
280
+ inAppWebView .setWebViewClient (currentClient );
281
+ } else {
282
+ ((InAppBrowserClient )inAppWebView .getWebViewClient ()).waitForBeforeload = false ;
283
+ }
280
284
inAppWebView .loadUrl (url );
281
285
}
282
286
});
@@ -416,7 +420,7 @@ private void injectDeferredObject(String source, String jsWrapper) {
416
420
@ SuppressLint ("NewApi" )
417
421
@ Override
418
422
public void run () {
419
- if (Build .VERSION .SDK_INT < 19 ) {
423
+ if (Build .VERSION .SDK_INT < Build . VERSION_CODES . KITKAT ) {
420
424
// This action will have the side-effect of blurring the currently focused element
421
425
inAppWebView .loadUrl ("javascript:" + finalScriptToInject );
422
426
} else {
@@ -1083,7 +1087,7 @@ public void postMessage(String data) {
1083
1087
}
1084
1088
}
1085
1089
1086
- if (android .os .Build .VERSION .SDK_INT >= 17 ) {
1090
+ if (android .os .Build .VERSION .SDK_INT >= android . os . Build . VERSION_CODES . JELLY_BEAN_MR1 ) {
1087
1091
settings .setMediaPlaybackRequiresUserGesture (mediaPlaybackRequiresUserGesture );
1088
1092
inAppWebView .addJavascriptInterface (new JsObject (), "cordova_iab" );
1089
1093
}
@@ -1115,7 +1119,7 @@ public void postMessage(String data) {
1115
1119
}
1116
1120
1117
1121
// Enable Thirdparty Cookies on >=Android 5.0 device
1118
- if (android .os .Build .VERSION .SDK_INT >= 21 ) {
1122
+ if (android .os .Build .VERSION .SDK_INT >= android . os . Build . VERSION_CODES . LOLLIPOP ) {
1119
1123
CookieManager .getInstance ().setAcceptThirdPartyCookies (inAppWebView ,true );
1120
1124
}
1121
1125
@@ -1210,7 +1214,7 @@ private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Statu
1210
1214
*/
1211
1215
public void onActivityResult (int requestCode , int resultCode , Intent intent ) {
1212
1216
// For Android >= 5.0
1213
- if (Build .VERSION .SDK_INT >= 21 ) {
1217
+ if (Build .VERSION .SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) {
1214
1218
LOG .d (LOG_TAG , "onActivityResult (For Android >= 5.0)" );
1215
1219
// If RequestCode or Callback is Invalid
1216
1220
if (requestCode != FILECHOOSER_REQUESTCODE_LOLLIPOP || mUploadCallbackLollipop == null ) {
@@ -1283,7 +1287,7 @@ public boolean shouldOverrideUrlLoading(WebView webView, String url) {
1283
1287
* @param webView
1284
1288
* @param request
1285
1289
*/
1286
- @ TargetApi (24 )
1290
+ @ TargetApi (Build . VERSION_CODES . N )
1287
1291
@ Override
1288
1292
public boolean shouldOverrideUrlLoading (WebView webView , WebResourceRequest request ) {
1289
1293
return shouldOverrideUrlLoading (request .getUrl ().toString (), request .getMethod ());
@@ -1488,7 +1492,7 @@ public WebResourceResponse shouldInterceptRequest (final WebView view, String ur
1488
1492
* @param webView
1489
1493
* @param request
1490
1494
*/
1491
- @ TargetApi (21 )
1495
+ @ TargetApi (Build . VERSION_CODES . LOLLIPOP )
1492
1496
@ Override
1493
1497
public WebResourceResponse shouldInterceptRequest (WebView view , WebResourceRequest request ) {
1494
1498
return shouldInterceptRequest (request .getUrl ().toString (), super .shouldInterceptRequest (view , request ), request .getMethod ());
@@ -1539,12 +1543,12 @@ public void onPageFinished(WebView view, String url) {
1539
1543
super .onPageFinished (view , url );
1540
1544
1541
1545
// Set the namespace for postMessage()
1542
- if (Build .VERSION .SDK_INT >= 17 ) {
1546
+ if (Build .VERSION .SDK_INT >= android . os . Build . VERSION_CODES . JELLY_BEAN_MR1 ) {
1543
1547
injectDeferredObject ("window.webkit={messageHandlers:{cordova_iab:cordova_iab}}" , null );
1544
1548
}
1545
1549
1546
1550
// CB-10395 InAppBrowser's WebView not storing cookies reliable to local device storage
1547
- if (android .os .Build .VERSION .SDK_INT >= 21 ) {
1551
+ if (android .os .Build .VERSION .SDK_INT >= android . os . Build . VERSION_CODES . LOLLIPOP ) {
1548
1552
CookieManager .getInstance ().flush ();
1549
1553
} else {
1550
1554
CookieSyncManager .getInstance ().sync ();
0 commit comments