@capgo/inappbrowser 7.10.4 → 7.10.7

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.
@@ -253,17 +253,28 @@ public class InAppBrowserPlugin
253
253
  call.reject("Invalid URL");
254
254
  return;
255
255
  }
256
+
257
+ if (webViewDialog == null) {
258
+ call.reject("WebView is not initialized");
259
+ return;
260
+ }
261
+
256
262
  currentUrl = url;
257
263
  this.getActivity()
258
264
  .runOnUiThread(
259
265
  new Runnable() {
260
266
  @Override
261
267
  public void run() {
262
- if (webViewDialog != null) {
263
- webViewDialog.setUrl(url);
264
- call.resolve();
265
- } else {
266
- call.reject("WebView is not initialized");
268
+ try {
269
+ if (webViewDialog != null) {
270
+ webViewDialog.setUrl(url);
271
+ call.resolve();
272
+ } else {
273
+ call.reject("WebView is not initialized");
274
+ }
275
+ } catch (Exception e) {
276
+ Log.e("InAppBrowser", "Error setting URL: " + e.getMessage());
277
+ call.reject("Failed to set URL: " + e.getMessage());
267
278
  }
268
279
  }
269
280
  }
@@ -401,11 +412,19 @@ public class InAppBrowserPlugin
401
412
  new Runnable() {
402
413
  @Override
403
414
  public void run() {
404
- if (webViewDialog != null) {
405
- webViewDialog.executeScript(scriptToRun.toString());
406
- call.resolve();
407
- } else {
408
- call.reject("WebView is not initialized");
415
+ try {
416
+ if (webViewDialog != null) {
417
+ webViewDialog.executeScript(scriptToRun.toString());
418
+ call.resolve();
419
+ } else {
420
+ call.reject("WebView is not initialized");
421
+ }
422
+ } catch (Exception e) {
423
+ Log.e(
424
+ "InAppBrowser",
425
+ "Error clearing cookies: " + e.getMessage()
426
+ );
427
+ call.reject("Failed to clear cookies: " + e.getMessage());
409
428
  }
410
429
  }
411
430
  }
@@ -774,20 +793,34 @@ public class InAppBrowserPlugin
774
793
  @PluginMethod
775
794
  public void executeScript(PluginCall call) {
776
795
  String script = call.getString("code");
777
- if (script == null || TextUtils.isEmpty(script)) {
778
- call.reject("No script to run");
796
+ if (script == null || script.trim().isEmpty()) {
797
+ call.reject("Script is required");
798
+ return;
799
+ }
800
+
801
+ if (webViewDialog == null) {
802
+ call.reject("WebView is not initialized");
779
803
  return;
780
804
  }
805
+
781
806
  this.getActivity()
782
807
  .runOnUiThread(
783
808
  new Runnable() {
784
809
  @Override
785
810
  public void run() {
786
- if (webViewDialog != null) {
787
- webViewDialog.executeScript(script);
788
- call.resolve();
789
- } else {
790
- call.reject("WebView is not initialized");
811
+ try {
812
+ if (webViewDialog != null) {
813
+ webViewDialog.executeScript(script);
814
+ call.resolve();
815
+ } else {
816
+ call.reject("WebView is not initialized");
817
+ }
818
+ } catch (Exception e) {
819
+ Log.e(
820
+ "InAppBrowser",
821
+ "Error executing script: " + e.getMessage()
822
+ );
823
+ call.reject("Failed to execute script: " + e.getMessage());
791
824
  }
792
825
  }
793
826
  }
@@ -834,28 +867,80 @@ public class InAppBrowserPlugin
834
867
 
835
868
  @PluginMethod
836
869
  public void close(PluginCall call) {
870
+ if (webViewDialog == null) {
871
+ // Fallback: try to bring main activity to foreground
872
+ try {
873
+ Intent intent = new Intent(
874
+ getContext(),
875
+ getBridge().getActivity().getClass()
876
+ );
877
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
878
+ getContext().startActivity(intent);
879
+ call.resolve();
880
+ } catch (Exception e) {
881
+ Log.e(
882
+ "InAppBrowser",
883
+ "Error bringing main activity to foreground: " + e.getMessage()
884
+ );
885
+ call.reject(
886
+ "WebView is not initialized and failed to restore main activity"
887
+ );
888
+ }
889
+ return;
890
+ }
891
+
837
892
  this.getActivity()
838
893
  .runOnUiThread(
839
894
  new Runnable() {
840
895
  @Override
841
896
  public void run() {
842
- if (webViewDialog != null) {
843
- String currentUrl = webViewDialog.getUrl();
844
- notifyListeners(
845
- "closeEvent",
846
- new JSObject().put("url", currentUrl)
847
- );
848
- webViewDialog.dismiss();
849
- webViewDialog = null;
850
- } else {
851
- Intent intent = new Intent(
852
- getContext(),
853
- getBridge().getActivity().getClass()
854
- );
855
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
856
- getContext().startActivity(intent);
897
+ try {
898
+ if (webViewDialog != null) {
899
+ String currentUrl = "";
900
+ try {
901
+ currentUrl = webViewDialog.getUrl();
902
+ if (currentUrl == null) {
903
+ currentUrl = "";
904
+ }
905
+ } catch (Exception e) {
906
+ Log.e(
907
+ "InAppBrowser",
908
+ "Error getting URL before close: " + e.getMessage()
909
+ );
910
+ currentUrl = "";
911
+ }
912
+
913
+ // Notify listeners about the close event
914
+ notifyListeners(
915
+ "closeEvent",
916
+ new JSObject().put("url", currentUrl)
917
+ );
918
+
919
+ webViewDialog.dismiss();
920
+ webViewDialog = null;
921
+ call.resolve();
922
+ } else {
923
+ // Secondary fallback inside UI thread
924
+ try {
925
+ Intent intent = new Intent(
926
+ getContext(),
927
+ getBridge().getActivity().getClass()
928
+ );
929
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
930
+ getContext().startActivity(intent);
931
+ call.resolve();
932
+ } catch (Exception e) {
933
+ Log.e(
934
+ "InAppBrowser",
935
+ "Error in secondary fallback: " + e.getMessage()
936
+ );
937
+ call.reject("WebView is not initialized");
938
+ }
939
+ }
940
+ } catch (Exception e) {
941
+ Log.e("InAppBrowser", "Error closing WebView: " + e.getMessage());
942
+ call.reject("Failed to close WebView: " + e.getMessage());
857
943
  }
858
- call.resolve();
859
944
  }
860
945
  }
861
946
  );
@@ -160,6 +160,15 @@ public class WebViewDialog extends Dialog {
160
160
  Log.e("InAppBrowser", "Received empty message from WebView");
161
161
  return;
162
162
  }
163
+
164
+ if (_options == null || _options.getCallbacks() == null) {
165
+ Log.e(
166
+ "InAppBrowser",
167
+ "Cannot handle postMessage - options or callbacks are null"
168
+ );
169
+ return;
170
+ }
171
+
163
172
  _options.getCallbacks().javascriptCallback(message);
164
173
  } catch (Exception e) {
165
174
  Log.e("InAppBrowser", "Error in postMessage: " + e.getMessage());
@@ -170,19 +179,35 @@ public class WebViewDialog extends Dialog {
170
179
  public void close() {
171
180
  try {
172
181
  // close webview safely
173
- if (activity != null) {
174
- activity.runOnUiThread(() -> {
175
- try {
176
- String currentUrl = _webView != null ? _webView.getUrl() : "";
177
- dismiss();
178
- if (_options != null && _options.getCallbacks() != null) {
179
- _options.getCallbacks().closeEvent(currentUrl);
182
+ if (activity == null) {
183
+ Log.e("InAppBrowser", "Cannot close - activity is null");
184
+ return;
185
+ }
186
+
187
+ activity.runOnUiThread(() -> {
188
+ try {
189
+ String currentUrl = "";
190
+ if (_webView != null) {
191
+ try {
192
+ currentUrl = _webView.getUrl();
193
+ if (currentUrl == null) {
194
+ currentUrl = "";
195
+ }
196
+ } catch (Exception e) {
197
+ Log.e("InAppBrowser", "Error getting URL: " + e.getMessage());
198
+ currentUrl = "";
180
199
  }
181
- } catch (Exception e) {
182
- Log.e("InAppBrowser", "Error closing WebView: " + e.getMessage());
183
200
  }
184
- });
185
- }
201
+
202
+ dismiss();
203
+
204
+ if (_options != null && _options.getCallbacks() != null) {
205
+ _options.getCallbacks().closeEvent(currentUrl);
206
+ }
207
+ } catch (Exception e) {
208
+ Log.e("InAppBrowser", "Error closing WebView: " + e.getMessage());
209
+ }
210
+ });
186
211
  } catch (Exception e) {
187
212
  Log.e("InAppBrowser", "Error in close: " + e.getMessage());
188
213
  }
@@ -853,6 +878,18 @@ public class WebViewDialog extends Dialog {
853
878
  _webView.requestFocus();
854
879
  _webView.requestFocusFromTouch();
855
880
 
881
+ // Inject JavaScript interface early to ensure it's available immediately
882
+ // This complements the injection in onPageFinished and doUpdateVisitedHistory
883
+ _webView.post(() -> {
884
+ if (_webView != null) {
885
+ injectJavaScriptInterface();
886
+ Log.d(
887
+ "InAppBrowser",
888
+ "JavaScript interface injected early after URL load"
889
+ );
890
+ }
891
+ });
892
+
856
893
  setupToolbar();
857
894
  setWebViewClient();
858
895
 
@@ -1102,28 +1139,84 @@ public class WebViewDialog extends Dialog {
1102
1139
 
1103
1140
  private void injectJavaScriptInterface() {
1104
1141
  if (_webView == null) {
1142
+ Log.w(
1143
+ "InAppBrowser",
1144
+ "Cannot inject JavaScript interface - WebView is null"
1145
+ );
1105
1146
  return;
1106
1147
  }
1107
- String script =
1108
- "if (!window.mobileApp) { " +
1109
- " window.mobileApp = { " +
1110
- " postMessage: function(message) { " +
1111
- " if (window.AndroidInterface) { " +
1112
- " window.AndroidInterface.postMessage(JSON.stringify(message)); " +
1113
- " } " +
1114
- " }, " +
1115
- " close: function() { " +
1116
- " window.AndroidInterface.close(); " +
1117
- " } " +
1118
- " }; " +
1119
- "} " +
1120
- // Override the window.print function to use our PrintInterface
1121
- "window.print = function() { " +
1122
- " if (window.PrintInterface) { " +
1123
- " window.PrintInterface.print(); " +
1124
- " } " +
1125
- "};";
1126
- _webView.evaluateJavascript(script, null);
1148
+
1149
+ try {
1150
+ String script =
1151
+ "(function() {" +
1152
+ " if (window.AndroidInterface) {" +
1153
+ " // Create mobileApp object for backward compatibility" +
1154
+ " if (!window.mobileApp) {" +
1155
+ " window.mobileApp = {" +
1156
+ " postMessage: function(message) {" +
1157
+ " try {" +
1158
+ " var msg = typeof message === 'string' ? message : JSON.stringify(message);" +
1159
+ " window.AndroidInterface.postMessage(msg);" +
1160
+ " } catch(e) {" +
1161
+ " console.error('Error in mobileApp.postMessage:', e);" +
1162
+ " }" +
1163
+ " }," +
1164
+ " close: function() {" +
1165
+ " try {" +
1166
+ " window.AndroidInterface.close();" +
1167
+ " } catch(e) {" +
1168
+ " console.error('Error in mobileApp.close:', e);" +
1169
+ " }" +
1170
+ " }" +
1171
+ " };" +
1172
+ " }" +
1173
+ " // Also provide direct window methods for convenience" +
1174
+ " window.postMessage = function(data) {" +
1175
+ " try {" +
1176
+ " var message = typeof data === 'string' ? data : JSON.stringify(data);" +
1177
+ " window.AndroidInterface.postMessage(message);" +
1178
+ " } catch(e) {" +
1179
+ " console.error('Error in postMessage:', e);" +
1180
+ " }" +
1181
+ " };" +
1182
+ " window.close = function() {" +
1183
+ " try {" +
1184
+ " window.AndroidInterface.close();" +
1185
+ " } catch(e) {" +
1186
+ " console.error('Error in close:', e);" +
1187
+ " }" +
1188
+ " };" +
1189
+ " }" +
1190
+ " // Override window.print function to use our PrintInterface" +
1191
+ " if (window.PrintInterface) {" +
1192
+ " window.print = function() {" +
1193
+ " try {" +
1194
+ " window.PrintInterface.print();" +
1195
+ " } catch(e) {" +
1196
+ " console.error('Error in print:', e);" +
1197
+ " }" +
1198
+ " };" +
1199
+ " }" +
1200
+ "})();";
1201
+
1202
+ _webView.post(() -> {
1203
+ if (_webView != null) {
1204
+ try {
1205
+ _webView.evaluateJavascript(script, null);
1206
+ } catch (Exception e) {
1207
+ Log.e(
1208
+ "InAppBrowser",
1209
+ "Error injecting JavaScript interface: " + e.getMessage()
1210
+ );
1211
+ }
1212
+ }
1213
+ });
1214
+ } catch (Exception e) {
1215
+ Log.e(
1216
+ "InAppBrowser",
1217
+ "Error preparing JavaScript interface: " + e.getMessage()
1218
+ );
1219
+ }
1127
1220
  }
1128
1221
 
1129
1222
  private void injectPreShowScript() {
@@ -1350,21 +1443,29 @@ public class WebViewDialog extends Dialog {
1350
1443
 
1351
1444
  public void reload() {
1352
1445
  if (_webView == null) {
1446
+ Log.w("InAppBrowser", "Cannot reload - WebView is null");
1353
1447
  return;
1354
1448
  }
1355
- // First stop any ongoing loading
1356
- _webView.stopLoading();
1357
-
1358
- // Check if there's a URL to reload
1359
- String currentUrl = _webView.getUrl();
1360
- if (currentUrl != null) {
1361
- // Reload the current page
1362
- _webView.reload();
1363
- Log.d("InAppBrowser", "Reloading page: " + currentUrl);
1364
- } else if (_options != null && _options.getUrl() != null) {
1365
- // If webView URL is null but we have an initial URL, load that
1366
- setUrl(_options.getUrl());
1367
- Log.d("InAppBrowser", "Loading initial URL: " + _options.getUrl());
1449
+
1450
+ try {
1451
+ // First stop any ongoing loading
1452
+ _webView.stopLoading();
1453
+
1454
+ // Check if there's a URL to reload
1455
+ String currentUrl = _webView.getUrl();
1456
+ if (currentUrl != null && !currentUrl.equals("about:blank")) {
1457
+ // Reload the current page
1458
+ _webView.reload();
1459
+ Log.d("InAppBrowser", "Reloading page: " + currentUrl);
1460
+ } else if (_options != null && _options.getUrl() != null) {
1461
+ // If webView URL is null but we have an initial URL, load that
1462
+ setUrl(_options.getUrl());
1463
+ Log.d("InAppBrowser", "Loading initial URL: " + _options.getUrl());
1464
+ } else {
1465
+ Log.w("InAppBrowser", "Cannot reload - no valid URL available");
1466
+ }
1467
+ } catch (Exception e) {
1468
+ Log.e("InAppBrowser", "Error during reload: " + e.getMessage());
1368
1469
  }
1369
1470
  }
1370
1471
 
@@ -1379,30 +1480,53 @@ public class WebViewDialog extends Dialog {
1379
1480
  }
1380
1481
 
1381
1482
  public void executeScript(String script) {
1382
- if (_webView != null) {
1483
+ if (_webView == null) {
1484
+ Log.w("InAppBrowser", "Cannot execute script - WebView is null");
1485
+ return;
1486
+ }
1487
+
1488
+ if (script == null || script.trim().isEmpty()) {
1489
+ Log.w("InAppBrowser", "Cannot execute empty script");
1490
+ return;
1491
+ }
1492
+
1493
+ try {
1383
1494
  _webView.evaluateJavascript(script, null);
1495
+ } catch (Exception e) {
1496
+ Log.e("InAppBrowser", "Error executing script: " + e.getMessage());
1384
1497
  }
1385
1498
  }
1386
1499
 
1387
1500
  public void setUrl(String url) {
1388
1501
  if (_webView == null) {
1502
+ Log.w("InAppBrowser", "Cannot set URL - WebView is null");
1389
1503
  return;
1390
1504
  }
1391
- Map<String, String> requestHeaders = new HashMap<>();
1392
- if (_options.getHeaders() != null) {
1393
- Iterator<String> keys = _options.getHeaders().keys();
1394
- while (keys.hasNext()) {
1395
- String key = keys.next();
1396
- if (TextUtils.equals(key.toLowerCase(), "user-agent")) {
1397
- _webView
1398
- .getSettings()
1399
- .setUserAgentString(_options.getHeaders().getString(key));
1400
- } else {
1401
- requestHeaders.put(key, _options.getHeaders().getString(key));
1505
+
1506
+ if (url == null || url.trim().isEmpty()) {
1507
+ Log.w("InAppBrowser", "Cannot set empty URL");
1508
+ return;
1509
+ }
1510
+
1511
+ try {
1512
+ Map<String, String> requestHeaders = new HashMap<>();
1513
+ if (_options.getHeaders() != null) {
1514
+ Iterator<String> keys = _options.getHeaders().keys();
1515
+ while (keys.hasNext()) {
1516
+ String key = keys.next();
1517
+ if (TextUtils.equals(key.toLowerCase(), "user-agent")) {
1518
+ _webView
1519
+ .getSettings()
1520
+ .setUserAgentString(_options.getHeaders().getString(key));
1521
+ } else {
1522
+ requestHeaders.put(key, _options.getHeaders().getString(key));
1523
+ }
1402
1524
  }
1403
1525
  }
1526
+ _webView.loadUrl(url, requestHeaders);
1527
+ } catch (Exception e) {
1528
+ Log.e("InAppBrowser", "Error setting URL: " + e.getMessage());
1404
1529
  }
1405
- _webView.loadUrl(url, requestHeaders);
1406
1530
  }
1407
1531
 
1408
1532
  private void setTitle(String newTitleText) {
@@ -2459,38 +2583,93 @@ public class WebViewDialog extends Dialog {
2459
2583
 
2460
2584
  @Override
2461
2585
  public void dismiss() {
2586
+ // First, stop any ongoing operations and disable further interactions
2462
2587
  if (_webView != null) {
2463
- // Reset file inputs to prevent WebView from caching them
2464
- _webView.evaluateJavascript(
2465
- "(function() {" +
2466
- " var inputs = document.querySelectorAll('input[type=\"file\"]');" +
2467
- " for (var i = 0; i < inputs.length; i++) {" +
2468
- " inputs[i].value = '';" +
2469
- " }" +
2470
- " return true;" +
2471
- "})();",
2472
- null
2473
- );
2588
+ try {
2589
+ // Stop loading first to prevent any ongoing operations
2590
+ _webView.stopLoading();
2474
2591
 
2475
- _webView.loadUrl("about:blank");
2476
- _webView.onPause();
2477
- _webView.removeAllViews();
2478
- _webView.destroy();
2479
- _webView = null;
2592
+ // Clear any pending callbacks to prevent memory leaks
2593
+ if (mFilePathCallback != null) {
2594
+ mFilePathCallback.onReceiveValue(null);
2595
+ mFilePathCallback = null;
2596
+ }
2597
+ tempCameraUri = null;
2598
+
2599
+ // Clear file inputs for security/privacy before destroying WebView
2600
+ try {
2601
+ _webView.evaluateJavascript(
2602
+ "(function() {" +
2603
+ " try {" +
2604
+ " var inputs = document.querySelectorAll('input[type=\"file\"]');" +
2605
+ " for (var i = 0; i < inputs.length; i++) {" +
2606
+ " inputs[i].value = '';" +
2607
+ " }" +
2608
+ " return true;" +
2609
+ " } catch(e) {" +
2610
+ " console.log('Error clearing file inputs:', e);" +
2611
+ " return false;" +
2612
+ " }" +
2613
+ "})();",
2614
+ null
2615
+ );
2616
+ } catch (Exception e) {
2617
+ Log.w(
2618
+ "InAppBrowser",
2619
+ "Could not clear file inputs (WebView may be in invalid state): " +
2620
+ e.getMessage()
2621
+ );
2622
+ }
2623
+
2624
+ // Remove JavaScript interfaces before destroying
2625
+ _webView.removeJavascriptInterface("AndroidInterface");
2626
+ _webView.removeJavascriptInterface("PreShowScriptInterface");
2627
+ _webView.removeJavascriptInterface("PrintInterface");
2628
+
2629
+ // Load blank page and cleanup
2630
+ _webView.loadUrl("about:blank");
2631
+ _webView.onPause();
2632
+ _webView.removeAllViews();
2633
+ _webView.destroy();
2634
+ _webView = null;
2635
+ } catch (Exception e) {
2636
+ Log.e(
2637
+ "InAppBrowser",
2638
+ "Error during WebView cleanup: " + e.getMessage()
2639
+ );
2640
+ // Force set to null even if cleanup failed
2641
+ _webView = null;
2642
+ }
2480
2643
  }
2481
2644
 
2645
+ // Shutdown executor service safely
2482
2646
  if (executorService != null && !executorService.isShutdown()) {
2483
- executorService.shutdown();
2484
2647
  try {
2648
+ executorService.shutdown();
2485
2649
  if (!executorService.awaitTermination(500, TimeUnit.MILLISECONDS)) {
2486
2650
  executorService.shutdownNow();
2487
2651
  }
2488
2652
  } catch (InterruptedException e) {
2653
+ Thread.currentThread().interrupt();
2489
2654
  executorService.shutdownNow();
2655
+ } catch (Exception e) {
2656
+ Log.e(
2657
+ "InAppBrowser",
2658
+ "Error shutting down executor: " + e.getMessage()
2659
+ );
2490
2660
  }
2491
2661
  }
2492
2662
 
2493
- super.dismiss();
2663
+ // Clear any remaining proxied requests
2664
+ synchronized (proxiedRequestsHashmap) {
2665
+ proxiedRequestsHashmap.clear();
2666
+ }
2667
+
2668
+ try {
2669
+ super.dismiss();
2670
+ } catch (Exception e) {
2671
+ Log.e("InAppBrowser", "Error dismissing dialog: " + e.getMessage());
2672
+ }
2494
2673
  }
2495
2674
 
2496
2675
  public void addProxiedRequest(String key, ProxiedRequest request) {
@@ -2561,7 +2740,15 @@ public class WebViewDialog extends Dialog {
2561
2740
  }
2562
2741
 
2563
2742
  private void injectDatePickerFixes() {
2564
- if (_webView == null || datePickerInjected) {
2743
+ if (_webView == null) {
2744
+ Log.w(
2745
+ "InAppBrowser",
2746
+ "Cannot inject date picker fixes - WebView is null"
2747
+ );
2748
+ return;
2749
+ }
2750
+
2751
+ if (datePickerInjected) {
2565
2752
  return;
2566
2753
  }
2567
2754
 
@@ -2571,29 +2758,43 @@ public class WebViewDialog extends Dialog {
2571
2758
  String script =
2572
2759
  """
2573
2760
  (function() {
2574
- // Find all date inputs
2575
- const dateInputs = document.querySelectorAll('input[type="date"]');
2576
- dateInputs.forEach(input => {
2577
- // Ensure change events propagate correctly
2578
- let lastValue = input.value;
2579
- input.addEventListener('change', () => {
2580
- if (input.value !== lastValue) {
2581
- lastValue = input.value;
2582
- // Dispatch an input event to ensure frameworks detect the change
2583
- input.dispatchEvent(new Event('input', { bubbles: true }));
2584
- }
2761
+ try {
2762
+ // Find all date inputs
2763
+ const dateInputs = document.querySelectorAll('input[type="date"]');
2764
+ dateInputs.forEach(input => {
2765
+ // Ensure change events propagate correctly
2766
+ let lastValue = input.value;
2767
+ input.addEventListener('change', () => {
2768
+ try {
2769
+ if (input.value !== lastValue) {
2770
+ lastValue = input.value;
2771
+ // Dispatch an input event to ensure frameworks detect the change
2772
+ input.dispatchEvent(new Event('input', { bubbles: true }));
2773
+ }
2774
+ } catch(e) {
2775
+ console.error('Error in date input change handler:', e);
2776
+ }
2777
+ });
2585
2778
  });
2586
- });
2779
+ } catch(e) {
2780
+ console.error('Error applying date picker fixes:', e);
2781
+ }
2587
2782
  })();""";
2588
2783
 
2589
2784
  // Execute the script in the WebView
2590
2785
  _webView.post(() -> {
2591
2786
  if (_webView != null) {
2592
- _webView.evaluateJavascript(script, null);
2787
+ try {
2788
+ _webView.evaluateJavascript(script, null);
2789
+ Log.d("InAppBrowser", "Applied minimal date picker fixes");
2790
+ } catch (Exception e) {
2791
+ Log.e(
2792
+ "InAppBrowser",
2793
+ "Error injecting date picker fixes: " + e.getMessage()
2794
+ );
2795
+ }
2593
2796
  }
2594
2797
  });
2595
-
2596
- Log.d("InAppBrowser", "Applied minimal date picker fixes");
2597
2798
  }
2598
2799
 
2599
2800
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/inappbrowser",
3
- "version": "7.10.4",
3
+ "version": "7.10.7",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",