@capgo/inappbrowser 8.1.3 → 8.1.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.
@@ -50,7 +50,7 @@ import org.json.JSONObject;
50
50
  )
51
51
  public class InAppBrowserPlugin extends Plugin implements WebViewDialog.PermissionHandler {
52
52
 
53
- private final String pluginVersion = "8.1.3";
53
+ private final String pluginVersion = "8.1.4";
54
54
 
55
55
  public static final String CUSTOM_TAB_PACKAGE_NAME = "com.android.chrome"; // Change when in stable
56
56
  private CustomTabsClient customTabsClient;
@@ -1138,13 +1138,20 @@ public class WebViewDialog extends Dialog {
1138
1138
  // Apply system insets to WebView content view (compatible with all Android versions)
1139
1139
  ViewCompat.setOnApplyWindowInsetsListener(_webView, (v, windowInsets) -> {
1140
1140
  Insets bars = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
1141
+ Insets navigationBars = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars());
1142
+ Insets systemGestures = windowInsets.getInsets(WindowInsetsCompat.Type.systemGestures());
1143
+ Insets mandatoryGestures = windowInsets.getInsets(WindowInsetsCompat.Type.mandatorySystemGestures());
1141
1144
  Insets ime = windowInsets.getInsets(WindowInsetsCompat.Type.ime());
1142
1145
  Boolean keyboardVisible = windowInsets.isVisible(WindowInsetsCompat.Type.ime());
1143
1146
 
1144
1147
  ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
1145
1148
 
1146
1149
  // Apply safe margin inset to bottom margin if enabled in options or fallback to 0px
1147
- int navBottom = _options.getEnabledSafeMargin() ? bars.bottom : 0;
1150
+ int safeBottomInset = Math.max(
1151
+ bars.bottom,
1152
+ Math.max(navigationBars.bottom, Math.max(systemGestures.bottom, mandatoryGestures.bottom))
1153
+ );
1154
+ int navBottom = _options.getEnabledSafeMargin() ? safeBottomInset : 0;
1148
1155
 
1149
1156
  // Apply top inset only if useTopInset option is enabled or fallback to 0px
1150
1157
  int navTop = _options.getUseTopInset() ? bars.top : 0;
@@ -1161,6 +1168,7 @@ public class WebViewDialog extends Dialog {
1161
1168
 
1162
1169
  return WindowInsetsCompat.CONSUMED;
1163
1170
  });
1171
+ ViewCompat.requestApplyInsets(_webView);
1164
1172
 
1165
1173
  // Handle window decoration - version-specific handling
1166
1174
  if (getWindow() != null) {
@@ -2977,20 +2985,8 @@ public class WebViewDialog extends Dialog {
2977
2985
  }
2978
2986
  }
2979
2987
 
2980
- // Shutdown executor service safely
2981
- if (executorService != null && !executorService.isShutdown()) {
2982
- try {
2983
- executorService.shutdown();
2984
- if (!executorService.awaitTermination(500, TimeUnit.MILLISECONDS)) {
2985
- executorService.shutdownNow();
2986
- }
2987
- } catch (InterruptedException e) {
2988
- Thread.currentThread().interrupt();
2989
- executorService.shutdownNow();
2990
- } catch (Exception e) {
2991
- Log.e("InAppBrowser", "Error shutting down executor: " + e.getMessage());
2992
- }
2993
- }
2988
+ // Shutdown executor service asynchronously to avoid blocking UI thread
2989
+ shutdownExecutorServiceAsync();
2994
2990
 
2995
2991
  // Clear any remaining proxied requests
2996
2992
  synchronized (proxiedRequestsHashmap) {
@@ -3004,6 +3000,30 @@ public class WebViewDialog extends Dialog {
3004
3000
  }
3005
3001
  }
3006
3002
 
3003
+ private void shutdownExecutorServiceAsync() {
3004
+ if (executorService.isShutdown()) {
3005
+ return;
3006
+ }
3007
+ Thread shutdownThread = new Thread(
3008
+ () -> {
3009
+ try {
3010
+ executorService.shutdown();
3011
+ if (!executorService.awaitTermination(500, TimeUnit.MILLISECONDS)) {
3012
+ executorService.shutdownNow();
3013
+ }
3014
+ } catch (InterruptedException e) {
3015
+ Thread.currentThread().interrupt();
3016
+ executorService.shutdownNow();
3017
+ } catch (Exception e) {
3018
+ Log.e("InAppBrowser", "Error shutting down executor: " + e.getMessage());
3019
+ }
3020
+ },
3021
+ "InAppBrowser-ExecutorShutdown"
3022
+ );
3023
+ shutdownThread.setDaemon(true);
3024
+ shutdownThread.start();
3025
+ }
3026
+
3007
3027
  public void addProxiedRequest(String key, ProxiedRequest request) {
3008
3028
  synchronized (proxiedRequestsHashmap) {
3009
3029
  proxiedRequestsHashmap.put(key, request);
@@ -28,7 +28,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
28
28
  case aware = "AWARE"
29
29
  case fakeVisible = "FAKE_VISIBLE"
30
30
  }
31
- private let pluginVersion: String = "8.1.3"
31
+ private let pluginVersion: String = "8.1.4"
32
32
  public let identifier = "InAppBrowserPlugin"
33
33
  public let jsName = "InAppBrowser"
34
34
  public let pluginMethods: [CAPPluginMethod] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/inappbrowser",
3
- "version": "8.1.3",
3
+ "version": "8.1.4",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",