@@ -34,7 +34,6 @@ Licensed to the Apache Software Foundation (ASF) under one
34
34
import android .graphics .PorterDuffColorFilter ;
35
35
import android .graphics .Color ;
36
36
import android .graphics .Rect ;
37
- import android .net .http .SslError ;
38
37
import android .net .Uri ;
39
38
import android .os .Build ;
40
39
import android .os .Bundle ;
@@ -53,7 +52,6 @@ Licensed to the Apache Software Foundation (ASF) under one
53
52
import android .webkit .CookieSyncManager ;
54
53
import android .webkit .HttpAuthHandler ;
55
54
import android .webkit .JavascriptInterface ;
56
- import android .webkit .SslErrorHandler ;
57
55
import android .webkit .ValueCallback ;
58
56
import android .webkit .WebChromeClient ;
59
57
import android .webkit .WebResourceRequest ;
@@ -700,8 +698,9 @@ public String showWebPage(final String url, HashMap<String, String> features) {
700
698
closeButtonColor = closeButtonColorSet ;
701
699
}
702
700
String leftToRightSet = features .get (LEFT_TO_RIGHT );
703
- leftToRight = leftToRightSet != null && leftToRightSet .equals ("yes" );
704
-
701
+ if (leftToRightSet != null ) {
702
+ leftToRight = leftToRightSet .equals ("yes" ) ? true : false ;
703
+ }
705
704
String toolbarColorSet = features .get (TOOLBAR_COLOR );
706
705
if (toolbarColorSet != null ) {
707
706
toolbarColor = android .graphics .Color .parseColor (toolbarColorSet );
@@ -1094,15 +1093,13 @@ public void postMessage(String data) {
1094
1093
// The height is reduced by 1 pixel to correct 1 pixel dip error on high resolution/density devices
1095
1094
int reducedHeightDip = (int ) ((float ) bottomReduceHeightBy * displayMetrics .density ) - 1 ;
1096
1095
1097
- // Calculate visible display size necessary to determine the status bar height
1096
+ // Calculate visible display size
1098
1097
// Note that the visible display height differs from the device height by the status bar height if the device does not have a notch
1099
1098
// In devices with a notch, they are the same
1100
1099
Rect rectangle = new Rect ();
1101
1100
cordova .getActivity ().getWindow ().getDecorView ().getWindowVisibleDisplayFrame (rectangle );
1102
1101
1103
- // Usable space height = screen height - (status bar height = device height - visible display height) - reduced height from the bottom
1104
1102
// Note that device height - visible display height is zero in devices with a notch, non zero on other devices
1105
- //lp.height = displayMetrics.heightPixels - (displayMetrics.heightPixels - rectangle.height()) - reducedHeightDip;
1106
1103
lp .height = rectangle .height () - reducedHeightDip ;
1107
1104
1108
1105
// Make sure the dialog is aligned to the bottom of the status bar as it is centered by default
@@ -1504,46 +1501,6 @@ public void onReceivedError(WebView view, int errorCode, String description, Str
1504
1501
}
1505
1502
}
1506
1503
1507
- @ Override
1508
- public void onReceivedSslError (WebView view , SslErrorHandler handler , SslError error ) {
1509
- super .onReceivedSslError (view , handler , error );
1510
- try {
1511
- JSONObject obj = new JSONObject ();
1512
- obj .put ("type" , LOAD_ERROR_EVENT );
1513
- obj .put ("url" , error .getUrl ());
1514
- obj .put ("code" , 0 );
1515
- obj .put ("sslerror" , error .getPrimaryError ());
1516
- String message ;
1517
- switch (error .getPrimaryError ()) {
1518
- case SslError .SSL_DATE_INVALID :
1519
- message = "The date of the certificate is invalid" ;
1520
- break ;
1521
- case SslError .SSL_EXPIRED :
1522
- message = "The certificate has expired" ;
1523
- break ;
1524
- case SslError .SSL_IDMISMATCH :
1525
- message = "Hostname mismatch" ;
1526
- break ;
1527
- default :
1528
- case SslError .SSL_INVALID :
1529
- message = "A generic error occurred" ;
1530
- break ;
1531
- case SslError .SSL_NOTYETVALID :
1532
- message = "The certificate is not yet valid" ;
1533
- break ;
1534
- case SslError .SSL_UNTRUSTED :
1535
- message = "The certificate authority is not trusted" ;
1536
- break ;
1537
- }
1538
- obj .put ("message" , message );
1539
-
1540
- sendUpdate (obj , true , PluginResult .Status .ERROR );
1541
- } catch (JSONException ex ) {
1542
- LOG .d (LOG_TAG , "Should never happen" );
1543
- }
1544
- handler .cancel ();
1545
- }
1546
-
1547
1504
/**
1548
1505
* On received http auth request.
1549
1506
*/
0 commit comments