react-native-webview-bootpay 13.8.2 → 13.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,6 +34,12 @@ import kr.co.bootpay.webview.events.TopShouldStartLoadWithRequestEvent;
34
34
 
35
35
  import java.util.concurrent.atomic.AtomicReference;
36
36
 
37
+
38
+ import android.app.AlertDialog;
39
+ import android.content.DialogInterface;
40
+ import android.content.Intent;
41
+ import android.widget.Toast;
42
+
37
43
  public class BPCWebViewClient extends WebViewClient {
38
44
  private static String TAG = "BPCWebViewClient";
39
45
  protected static final int SHOULD_OVERRIDE_URL_LOADING_TIMEOUT = 250;
@@ -170,11 +176,11 @@ public class BPCWebViewClient extends WebViewClient {
170
176
  // Undesired behavior: Return value of WebView.getUrl() may be the current URL instead of the failing URL.
171
177
  handler.cancel();
172
178
 
173
- if (!topWindowUrl.equalsIgnoreCase(failingUrl)) {
174
- // If error is not due to top-level navigation, then do not call onReceivedError()
175
- Log.w(TAG, "Resource blocked from loading due to SSL error. Blocked URL: "+failingUrl);
176
- return;
177
- }
179
+ // if (!topWindowUrl.equalsIgnoreCase(failingUrl)) {
180
+ // // If error is not due to top-level navigation, then do not call onReceivedError()
181
+ // Log.w(TAG, "Resource blocked from loading due to SSL error. Blocked URL: "+failingUrl);
182
+ // return;
183
+ // }
178
184
 
179
185
  int code = error.getPrimaryError();
180
186
  String description = "";
@@ -213,6 +219,37 @@ public class BPCWebViewClient extends WebViewClient {
213
219
  description,
214
220
  failingUrl
215
221
  );
222
+ alertSSLError(webView, handler, error);
223
+ }
224
+
225
+ void alertSSLError(WebView view, SslErrorHandler handler, SslError error) {
226
+ // for SSLErrorHandler
227
+ AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
228
+ builder.setTitle("SSL Connection Error");
229
+ builder.setMessage("Your device's Android version is outdated and may not securely connect to our service. To continue using the app securely, please update your device's operating system. If you choose to proceed without updating, it may expose you to security vulnerabilities.");
230
+ builder.setPositiveButton("Update", new DialogInterface.OnClickListener() {
231
+ @Override
232
+ public void onClick(DialogInterface dialog, int which) {
233
+ // Redirect the user to the system update settings
234
+
235
+
236
+ Intent intent = new Intent("android.settings.SYSTEM_UPDATE_SETTINGS");
237
+ if (intent.resolveActivity(view.getContext().getPackageManager()) != null) {
238
+ view.getContext().startActivity(intent);
239
+ } else {
240
+ // If the device does not support system update settings intent
241
+ Toast.makeText(view.getContext(), "System update option not available. Please check your device settings manually.", Toast.LENGTH_LONG).show();
242
+ }
243
+ }
244
+ });
245
+ builder.setNeutralButton("Cancel", new DialogInterface.OnClickListener() {
246
+ @Override
247
+ public void onClick(DialogInterface dialog, int which) {
248
+ handler.cancel();
249
+ }
250
+ });
251
+ AlertDialog dialog = builder.create();
252
+ dialog.show();
216
253
  }
217
254
 
218
255
  @Override
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "Thibault Malbranche <malbranche.thibault@gmail.com>"
12
12
  ],
13
13
  "license": "MIT",
14
- "version": "13.8.2",
14
+ "version": "13.8.4",
15
15
  "homepage": "https://github.com/bootpay/react-native-webview-bootpay",
16
16
  "scripts": {
17
17
  "android": "react-native run-android",