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