Skip to content

Commit 1d3542a

Browse files
Alessandro BassoAlessandro Basso
Alessandro Basso
authored and
Alessandro Basso
committed
Fix to previous commit
1 parent e53b701 commit 1d3542a

File tree

1 file changed

+4
-47
lines changed

1 file changed

+4
-47
lines changed

src/android/InAppBrowser.java

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ Licensed to the Apache Software Foundation (ASF) under one
3434
import android.graphics.PorterDuffColorFilter;
3535
import android.graphics.Color;
3636
import android.graphics.Rect;
37-
import android.net.http.SslError;
3837
import android.net.Uri;
3938
import android.os.Build;
4039
import android.os.Bundle;
@@ -53,7 +52,6 @@ Licensed to the Apache Software Foundation (ASF) under one
5352
import android.webkit.CookieSyncManager;
5453
import android.webkit.HttpAuthHandler;
5554
import android.webkit.JavascriptInterface;
56-
import android.webkit.SslErrorHandler;
5755
import android.webkit.ValueCallback;
5856
import android.webkit.WebChromeClient;
5957
import android.webkit.WebResourceRequest;
@@ -700,8 +698,9 @@ public String showWebPage(final String url, HashMap<String, String> features) {
700698
closeButtonColor = closeButtonColorSet;
701699
}
702700
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+
}
705704
String toolbarColorSet = features.get(TOOLBAR_COLOR);
706705
if (toolbarColorSet != null) {
707706
toolbarColor = android.graphics.Color.parseColor(toolbarColorSet);
@@ -1094,15 +1093,13 @@ public void postMessage(String data) {
10941093
// The height is reduced by 1 pixel to correct 1 pixel dip error on high resolution/density devices
10951094
int reducedHeightDip = (int) ((float) bottomReduceHeightBy * displayMetrics.density) - 1;
10961095

1097-
// Calculate visible display size necessary to determine the status bar height
1096+
// Calculate visible display size
10981097
// Note that the visible display height differs from the device height by the status bar height if the device does not have a notch
10991098
// In devices with a notch, they are the same
11001099
Rect rectangle = new Rect();
11011100
cordova.getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(rectangle);
11021101

1103-
// Usable space height = screen height - (status bar height = device height - visible display height) - reduced height from the bottom
11041102
// 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;
11061103
lp.height = rectangle.height() - reducedHeightDip;
11071104

11081105
// 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
15041501
}
15051502
}
15061503

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-
15471504
/**
15481505
* On received http auth request.
15491506
*/

0 commit comments

Comments
 (0)