@capgo/inappbrowser 7.15.2 → 7.16.0

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.
package/README.md CHANGED
@@ -35,18 +35,6 @@ InAppBrowser.openWebView({
35
35
  });
36
36
  ```
37
37
 
38
- To create a webView with a custom safe bottom margin:
39
-
40
- ```js
41
- import { InAppBrowser } from '@capgo/inappbrowser'
42
-
43
- InAppBrowser.openWebView({
44
- url: "YOUR_URL",
45
- enabledSafeBottomMargin: true,
46
- safeBottomMargin: 30 // Custom 30px margin
47
- });
48
- ```
49
-
50
38
  Web platform is not supported. Use `window.open` instead.
51
39
 
52
40
 
@@ -577,7 +565,6 @@ Reload the current web page.
577
565
  | **`preventDeeplink`** | <code>boolean</code> | preventDeeplink: if true, the deeplink will not be opened, if false the deeplink will be opened when clicked on the link. on IOS each schema need to be added to info.plist file under LSApplicationQueriesSchemes when false to make it work. | <code>false</code> | 0.1.0 |
578
566
  | **`authorizedAppLinks`** | <code>string[]</code> | List of URL base patterns that should be treated as authorized App Links, Android only. Only links starting with any of these base URLs will be opened in the InAppBrowser. | <code>[]</code> | 7.12.0 |
579
567
  | **`enabledSafeBottomMargin`** | <code>boolean</code> | If true, the webView will not take the full height and will have a 20px margin at the bottom. This creates a safe margin area outside the browser view. | <code>false</code> | 7.13.0 |
580
- | **`safeBottomMargin`** | <code>number</code> | Custom safe margin value in pixels. Only used when enabledSafeBottomMargin is true. If not specified, defaults to 20px. | <code>20</code> | 7.13.0 |
581
568
  | **`enableGooglePaySupport`** | <code>boolean</code> | enableGooglePaySupport: if true, enables support for Google Pay popups and Payment Request API. This fixes OR_BIBED_15 errors by allowing popup windows and configuring Cross-Origin-Opener-Policy. Only enable this if you need Google Pay functionality as it allows popup windows. When enabled: - Allows popup windows for Google Pay authentication - Sets proper CORS headers for Payment Request API - Enables multiple window support in WebView - Configures secure context for payment processing | <code>false</code> | 7.13.0 |
582
569
 
583
570
 
@@ -659,59 +659,6 @@ public class InAppBrowserPlugin
659
659
  Boolean.TRUE.equals(call.getBoolean("enabledSafeBottomMargin", false))
660
660
  );
661
661
 
662
- // Set safeBottomMargin option with proper handling
663
- try {
664
- // Try multiple ways to get the safeBottomMargin value
665
- Integer safeBottomMarginValue = null;
666
-
667
- // First try as integer
668
- if (call.hasOption("safeBottomMargin")) {
669
- safeBottomMarginValue = call.getInt("safeBottomMargin");
670
- Log.d(
671
- "InAppBrowser",
672
- "safeBottomMargin from getInt(): " + safeBottomMarginValue
673
- );
674
- }
675
-
676
- // If that didn't work, try as double and convert to int
677
- if (safeBottomMarginValue == null && call.hasOption("safeBottomMargin")) {
678
- Double safeBottomMarginDouble = call.getDouble("safeBottomMargin");
679
- if (safeBottomMarginDouble != null) {
680
- safeBottomMarginValue = safeBottomMarginDouble.intValue();
681
- Log.d(
682
- "InAppBrowser",
683
- "safeBottomMargin from getDouble(): " +
684
- safeBottomMarginDouble +
685
- " -> " +
686
- safeBottomMarginValue
687
- );
688
- }
689
- }
690
-
691
- if (safeBottomMarginValue != null && safeBottomMarginValue > 0) {
692
- options.setSafeMargin(safeBottomMarginValue);
693
- Log.d(
694
- "InAppBrowser",
695
- "Custom safeBottomMargin set to: " + safeBottomMarginValue
696
- );
697
- } else {
698
- // Keep default value (20) from Options class
699
- Log.d(
700
- "InAppBrowser",
701
- "Using default safeBottomMargin: " + options.getSafeMargin()
702
- );
703
- }
704
- } catch (Exception e) {
705
- Log.e(
706
- "InAppBrowser",
707
- "Error setting safeBottomMargin: " + e.getMessage()
708
- );
709
- Log.d(
710
- "InAppBrowser",
711
- "Using default safeBottomMargin: " + options.getSafeMargin()
712
- );
713
- }
714
-
715
662
  // options.getToolbarItemTypes().add(ToolbarItemType.RELOAD); TODO: fix this
716
663
  options.setCallbacks(
717
664
  new WebViewCallbacks() {
@@ -181,7 +181,6 @@ public class Options {
181
181
  private boolean preventDeeplink = false;
182
182
  private List<String> authorizedAppLinks = new ArrayList<>();
183
183
  private boolean enabledSafeBottomMargin = false;
184
- private int safeBottomMargin = 20; // Default safe margin in pixels
185
184
  private boolean enableGooglePaySupport = false;
186
185
 
187
186
  public int getTextZoom() {
@@ -208,14 +207,6 @@ public class Options {
208
207
  this.enabledSafeBottomMargin = enabledSafeBottomMargin;
209
208
  }
210
209
 
211
- public int getSafeMargin() {
212
- return safeBottomMargin;
213
- }
214
-
215
- public void setSafeMargin(int safeBottomMargin) {
216
- this.safeBottomMargin = safeBottomMargin;
217
- }
218
-
219
210
  public Pattern getProxyRequestsPattern() {
220
211
  return proxyRequestsPattern;
221
212
  }
@@ -374,28 +374,6 @@ public class WebViewDialog extends Dialog {
374
374
 
375
375
  this._webView = findViewById(R.id.browser_view);
376
376
 
377
- // Apply safe margin if enabled
378
- if (_options.getEnabledSafeMargin()) {
379
- WebView webView = findViewById(R.id.browser_view);
380
-
381
- if (webView != null) {
382
- // Use custom safe margin value from options (defaults to 20)
383
- int marginHeightDp = _options.getSafeMargin();
384
- float density = _context.getResources().getDisplayMetrics().density;
385
- int marginHeightPx = (int) (marginHeightDp * density);
386
-
387
- View parentContainer = findViewById(android.R.id.content);
388
- if (parentContainer != null) {
389
- parentContainer.setPadding(
390
- parentContainer.getPaddingLeft(),
391
- parentContainer.getPaddingTop(),
392
- parentContainer.getPaddingRight(),
393
- parentContainer.getPaddingBottom() + marginHeightPx
394
- );
395
- }
396
- }
397
- }
398
-
399
377
  // Apply insets to fix edge-to-edge issues on Android 15+
400
378
  applyInsets();
401
379
 
@@ -1147,6 +1125,23 @@ public class WebViewDialog extends Dialog {
1147
1125
  mlp.rightMargin = insets.right;
1148
1126
  v.setLayoutParams(mlp);
1149
1127
 
1128
+ // Apply safe area padding to parent container if enabled
1129
+ if (_options.getEnabledSafeMargin()) {
1130
+ View parentContainer = findViewById(android.R.id.content);
1131
+ if (parentContainer != null) {
1132
+ Log.d(
1133
+ "InAppBrowser",
1134
+ "Applying bottom safe area padding: " + insets.bottom
1135
+ );
1136
+ parentContainer.setPadding(
1137
+ parentContainer.getPaddingLeft(),
1138
+ parentContainer.getPaddingTop(),
1139
+ parentContainer.getPaddingRight(),
1140
+ insets.bottom
1141
+ );
1142
+ }
1143
+ }
1144
+
1150
1145
  return WindowInsetsCompat.CONSUMED;
1151
1146
  });
1152
1147
 
package/dist/docs.json CHANGED
@@ -1102,26 +1102,6 @@
1102
1102
  "complexTypes": [],
1103
1103
  "type": "boolean | undefined"
1104
1104
  },
1105
- {
1106
- "name": "safeBottomMargin",
1107
- "tags": [
1108
- {
1109
- "text": "7.13.0",
1110
- "name": "since"
1111
- },
1112
- {
1113
- "text": "20",
1114
- "name": "default"
1115
- },
1116
- {
1117
- "text": "safeBottomMargin: 30",
1118
- "name": "example"
1119
- }
1120
- ],
1121
- "docs": "Custom safe margin value in pixels. Only used when enabledSafeBottomMargin is true.\nIf not specified, defaults to 20px.",
1122
- "complexTypes": [],
1123
- "type": "number | undefined"
1124
- },
1125
1105
  {
1126
1106
  "name": "enableGooglePaySupport",
1127
1107
  "tags": [
@@ -425,15 +425,6 @@ export interface OpenWebViewOptions {
425
425
  * enabledSafeBottomMargin: true
426
426
  */
427
427
  enabledSafeBottomMargin?: boolean;
428
- /**
429
- * Custom safe margin value in pixels. Only used when enabledSafeBottomMargin is true.
430
- * If not specified, defaults to 20px.
431
- * @since 7.13.0
432
- * @default 20
433
- * @example
434
- * safeBottomMargin: 30
435
- */
436
- safeBottomMargin?: number;
437
428
  /**
438
429
  * enableGooglePaySupport: if true, enables support for Google Pay popups and Payment Request API.
439
430
  * This fixes OR_BIBED_15 errors by allowing popup windows and configuring Cross-Origin-Opener-Policy.
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,CAAN,IAAY,WAqBX;AArBD,WAAY,WAAW;IACrB;;;OAGG;IACH,oCAAqB,CAAA;IACrB;;;OAGG;IACH,kCAAmB,CAAA;IACnB;;;OAGG;IACH,wCAAyB,CAAA;IACzB;;;OAGG;IACH,8BAAe,CAAA;AACjB,CAAC,EArBW,WAAW,KAAX,WAAW,QAqBtB","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface UrlEvent {\n /**\n * Emit when the url changes\n *\n * @since 0.0.1\n */\n url: string;\n}\nexport interface BtnEvent {\n /**\n * Emit when a button is clicked.\n *\n * @since 0.0.1\n */\n url: string;\n}\n\nexport type UrlChangeListener = (state: UrlEvent) => void;\nexport type ConfirmBtnListener = (state: BtnEvent) => void;\nexport type ButtonNearListener = (state: object) => void;\n\nexport enum BackgroundColor {\n WHITE = \"white\",\n BLACK = \"black\",\n}\nexport enum ToolBarType {\n /**\n * Shows a simple toolbar with just a close button and share button\n * @since 0.1.0\n */\n ACTIVITY = \"activity\",\n /**\n * Shows a simple toolbar with just a close button\n * @since 7.6.8\n */\n COMPACT = \"compact\",\n /**\n * Shows a full navigation toolbar with back/forward buttons\n * @since 0.1.0\n */\n NAVIGATION = \"navigation\",\n /**\n * Shows no toolbar\n * @since 0.1.0\n */\n BLANK = \"blank\",\n}\n\nexport interface Headers {\n [key: string]: string;\n}\n\nexport interface GetCookieOptions {\n url: string;\n includeHttpOnly?: boolean;\n}\n\nexport interface ClearCookieOptions {\n url: string;\n}\n\nexport interface Credentials {\n username: string;\n password: string;\n}\n\nexport interface OpenOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n */\n url: string;\n /**\n * if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * if true the deeplink will not be opened, if false the deeplink will be opened when clicked on the link\n * @since 0.1.0\n */\n preventDeeplink?: boolean;\n}\n\nexport interface DisclaimerOptions {\n /**\n * Title of the disclaimer dialog\n * @default \"Title\"\n */\n title: string;\n /**\n * Message shown in the disclaimer dialog\n * @default \"Message\"\n */\n message: string;\n /**\n * Text for the confirm button\n * @default \"Confirm\"\n */\n confirmBtn: string;\n /**\n * Text for the cancel button\n * @default \"Cancel\"\n */\n cancelBtn: string;\n}\n\nexport interface OpenWebViewOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n * @example \"https://capgo.app\"\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n * @example\n * headers: {\n * 'Custom-Header': 'test-value',\n * 'Authorization': 'Bearer test-token'\n * }\n * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/\n */\n headers?: Headers;\n /**\n * Credentials to send with the request and all subsequent requests for the same host.\n * @since 6.1.0\n * @example\n * credentials: {\n * username: 'test-user',\n * password: 'test-pass'\n * }\n * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/\n */\n credentials?: Credentials;\n /**\n * materialPicker: if true, uses Material Design theme for date and time pickers on Android.\n * This improves the appearance of HTML date inputs to use modern Material Design UI instead of the old style pickers.\n * @since 7.4.1\n * @default false\n * @example\n * materialPicker: true\n * Test URL: https://show-picker.glitch.me/demo.html\n */\n materialPicker?: boolean;\n /**\n * JavaScript Interface:\n * The webview automatically injects a JavaScript interface providing:\n * - `window.mobileApp.close()`: Closes the webview from JavaScript\n * - `window.mobileApp.postMessage(obj)`: Sends a message to the app (listen via \"messageFromWebview\" event)\n *\n * @example\n * // In your webpage loaded in the webview:\n * document.getElementById('closeBtn').addEventListener('click', () => {\n * window.mobileApp.close();\n * });\n *\n * // Send data to the app\n * window.mobileApp.postMessage({ action: 'login', data: { user: 'test' }});\n *\n * @since 6.10.0\n */\n jsInterface?: never; // This property doesn't exist, it's just for documentation\n /**\n * Share options for the webview. When provided, shows a disclaimer dialog before sharing content.\n * This is useful for:\n * - Warning users about sharing sensitive information\n * - Getting user consent before sharing\n * - Explaining what will be shared\n * - Complying with privacy regulations\n *\n * Note: shareSubject is required when using shareDisclaimer\n * @since 0.1.0\n * @example\n * shareDisclaimer: {\n * title: 'Disclaimer',\n * message: 'This is a test disclaimer',\n * confirmBtn: 'Accept',\n * cancelBtn: 'Decline'\n * }\n * Test URL: https://capgo.app\n */\n shareDisclaimer?: DisclaimerOptions;\n /**\n * Toolbar type determines the appearance and behavior of the browser's toolbar\n * - \"activity\": Shows a simple toolbar with just a close button and share button\n * - \"navigation\": Shows a full navigation toolbar with back/forward buttons\n * - \"blank\": Shows no toolbar\n * - \"\": Default toolbar with close button\n * @since 0.1.0\n * @default ToolBarType.DEFAULT\n * @example\n * toolbarType: ToolBarType.ACTIVITY,\n * title: 'Activity Toolbar Test'\n * Test URL: https://capgo.app\n */\n toolbarType?: ToolBarType;\n /**\n * Subject text for sharing. Required when using shareDisclaimer.\n * This text will be used as the subject line when sharing content.\n * @since 0.1.0\n * @example \"Share this page\"\n */\n shareSubject?: string;\n /**\n * Title of the browser\n * @since 0.1.0\n * @default 'New Window'\n * @example \"Camera Test\"\n */\n title?: string;\n /**\n * Background color of the browser\n * @since 0.1.0\n * @default BackgroundColor.BLACK\n */\n backgroundColor?: BackgroundColor;\n /**\n * If true, active the native navigation within the webview, Android only\n * @default false\n * @example\n * activeNativeNavigationForWebview: true,\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n activeNativeNavigationForWebview?: boolean;\n /**\n * Disable the possibility to go back on native application,\n * useful to force user to stay on the webview, Android only\n * @default false\n * @example\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n disableGoBackOnNativeApplication?: boolean;\n /**\n * Open url in a new window fullscreen\n * isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n * @default false\n * @example\n * isPresentAfterPageLoad: true,\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * Whether the website in the webview is inspectable or not, ios only\n * @default false\n */\n isInspectable?: boolean;\n /**\n * Whether the webview opening is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\n /**\n * Shows a reload button that reloads the web page\n * @since 1.0.15\n * @default false\n * @example\n * showReloadButton: true\n * Test URL: https://capgo.app\n */\n showReloadButton?: boolean;\n /**\n * CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.\n * @since 1.1.0\n * @default false\n * @example\n * closeModal: true,\n * closeModalTitle: 'Close Window',\n * closeModalDescription: 'Are you sure you want to close?',\n * closeModalOk: 'Yes, close',\n * closeModalCancel: 'No, stay'\n * Test URL: https://capgo.app\n */\n closeModal?: boolean;\n /**\n * CloseModalTitle: title of the confirm when user clicks on close button\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalTitle?: string;\n /**\n * CloseModalDescription: description of the confirm when user clicks on close button\n * @since 1.1.0\n * @default 'Are you sure you want to close this window?'\n */\n closeModalDescription?: string;\n /**\n * CloseModalOk: text of the confirm button when user clicks on close button\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalOk?: string;\n /**\n * CloseModalCancel: text of the cancel button when user clicks on close button\n * @since 1.1.0\n * @default 'Cancel'\n */\n closeModalCancel?: string;\n /**\n * visibleTitle: if true the website title would be shown else shown empty\n * @since 1.2.5\n * @default true\n */\n visibleTitle?: boolean;\n /**\n * toolbarColor: color of the toolbar in hex format\n * @since 1.2.5\n * @default '#ffffff'\n * @example\n * toolbarColor: '#FF5733'\n * Test URL: https://capgo.app\n */\n toolbarColor?: string;\n /**\n * toolbarTextColor: color of the buttons and title in the toolbar in hex format\n * When set, it overrides the automatic light/dark mode detection for text color\n * @since 6.10.0\n * @default calculated based on toolbarColor brightness\n * @example\n * toolbarTextColor: '#FFFFFF'\n * Test URL: https://capgo.app\n */\n toolbarTextColor?: string;\n /**\n * showArrow: if true an arrow would be shown instead of cross for closing the window\n * @since 1.2.5\n * @default false\n * @example\n * showArrow: true\n * Test URL: https://capgo.app\n */\n showArrow?: boolean;\n /**\n * ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website.\n * @since 6.1.0\n * @default false\n */\n ignoreUntrustedSSLError?: boolean;\n /**\n * preShowScript: if isPresentAfterPageLoad is true and this variable is set the plugin will inject a script before showing the browser.\n * This script will be run in an async context. The plugin will wait for the script to finish (max 10 seconds)\n * @since 6.6.0\n * @example\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n preShowScript?: string;\n /**\n * proxyRequests is a regex expression. Please see [this pr](https://github.com/Cap-go/capacitor-inappbrowser/pull/222) for more info. (Android only)\n * @since 6.9.0\n */\n proxyRequests?: string;\n /**\n * buttonNearDone allows for a creation of a custom button near the done/close button.\n * The button is only shown when toolbarType is not \"activity\", \"navigation\", or \"blank\".\n *\n * For Android:\n * - iconType must be \"asset\"\n * - icon path should be in the public folder (e.g. \"monkey.svg\")\n * - width and height are optional, defaults to 48dp\n * - button is positioned at the end of toolbar with 8dp margin\n *\n * For iOS:\n * - iconType can be \"sf-symbol\" or \"asset\"\n * - for sf-symbol, icon should be the symbol name\n * - for asset, icon should be the asset name\n * @since 6.7.0\n * @example\n * buttonNearDone: {\n * ios: {\n * iconType: 'sf-symbol',\n * icon: 'star.fill'\n * },\n * android: {\n * iconType: 'asset',\n * icon: 'public/monkey.svg',\n * width: 24,\n * height: 24\n * }\n * }\n * Test URL: https://capgo.app\n */\n buttonNearDone?: {\n ios: {\n iconType: \"sf-symbol\" | \"asset\";\n icon: string;\n };\n android: {\n iconType: \"asset\" | \"vector\";\n icon: string;\n width?: number;\n height?: number;\n };\n };\n /**\n * textZoom: sets the text zoom of the page in percent.\n * Allows users to increase or decrease the text size for better readability.\n * @since 7.6.0\n * @default 100\n * @example\n * textZoom: 120\n * Test URL: https://capgo.app\n */\n textZoom?: number;\n /**\n * preventDeeplink: if true, the deeplink will not be opened, if false the deeplink will be opened when clicked on the link. on IOS each schema need to be added to info.plist file under LSApplicationQueriesSchemes when false to make it work.\n * @since 0.1.0\n * @default false\n * @example\n * preventDeeplink: true\n * Test URL: https://aasa-tester.capgo.app/\n */\n preventDeeplink?: boolean;\n\n /**\n * List of URL base patterns that should be treated as authorized App Links, Android only.\n * Only links starting with any of these base URLs will be opened in the InAppBrowser.\n *\n * @since 7.12.0\n * @default []\n */\n authorizedAppLinks?: string[];\n\n /**\n * If true, the webView will not take the full height and will have a 20px margin at the bottom.\n * This creates a safe margin area outside the browser view.\n * @since 7.13.0\n * @default false\n * @example\n * enabledSafeBottomMargin: true\n */\n enabledSafeBottomMargin?: boolean;\n\n /**\n * Custom safe margin value in pixels. Only used when enabledSafeBottomMargin is true.\n * If not specified, defaults to 20px.\n * @since 7.13.0\n * @default 20\n * @example\n * safeBottomMargin: 30\n */\n safeBottomMargin?: number;\n /**\n * enableGooglePaySupport: if true, enables support for Google Pay popups and Payment Request API.\n * This fixes OR_BIBED_15 errors by allowing popup windows and configuring Cross-Origin-Opener-Policy.\n * Only enable this if you need Google Pay functionality as it allows popup windows.\n *\n * When enabled:\n * - Allows popup windows for Google Pay authentication\n * - Sets proper CORS headers for Payment Request API\n * - Enables multiple window support in WebView\n * - Configures secure context for payment processing\n *\n * @since 7.13.0\n * @default false\n * @example\n * enableGooglePaySupport: true\n * Test URL: https://developers.google.com/pay/api/web/guides/tutorial\n */\n enableGooglePaySupport?: boolean;\n}\n\nexport interface InAppBrowserPlugin {\n /**\n * Open url in a new window fullscreen, on android it use chrome custom tabs, on ios it use SFSafariViewController\n *\n * @since 0.1.0\n */\n open(options: OpenOptions): Promise<any>;\n\n /**\n * Clear cookies of url\n *\n * @since 0.5.0\n */\n clearCookies(options: ClearCookieOptions): Promise<any>;\n /**\n * Clear all cookies\n *\n * @since 6.5.0\n */\n clearAllCookies(): Promise<any>;\n\n /**\n * Clear cache\n *\n * @since 6.5.0\n */\n clearCache(): Promise<any>;\n\n /**\n * Get cookies for a specific URL.\n * @param options The options, including the URL to get cookies for.\n * @returns A promise that resolves with the cookies.\n */\n getCookies(options: GetCookieOptions): Promise<Record<string, string>>;\n /**\n * Close the webview.\n */\n close(): Promise<any>;\n /**\n * Open url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc.\n *\n * JavaScript Interface:\n * When you open a webview with this method, a JavaScript interface is automatically injected that provides:\n * - `window.mobileApp.close()`: Closes the webview from JavaScript\n * - `window.mobileApp.postMessage({detail: {message: 'myMessage'}})`: Sends a message from the webview to the app, detail object is the data you want to send to the webview\n *\n * @since 0.1.0\n */\n openWebView(options: OpenWebViewOptions): Promise<any>;\n /**\n * Injects JavaScript code into the InAppBrowser window.\n */\n executeScript({ code }: { code: string }): Promise<void>;\n /**\n * Sends an event to the webview(inappbrowser). you can listen to this event in the inappbrowser JS with window.addEventListener(\"messageFromNative\", listenerFunc: (event: Record<string, any>) => void)\n * detail is the data you want to send to the webview, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, so no functions or other non-JSON-serializable types are allowed.\n */\n postMessage(options: { detail: Record<string, any> }): Promise<void>;\n /**\n * Sets the URL of the webview.\n */\n setUrl(options: { url: string }): Promise<any>;\n /**\n * Listen for url change, only for openWebView\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"urlChangeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n\n addListener(\n eventName: \"buttonNearDoneClick\",\n listenerFunc: ButtonNearListener,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(\n eventName: \"closeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"confirmBtnClicked\",\n listenerFunc: ConfirmBtnListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when event is sent from webview(inappbrowser), to send an event to the main app use window.mobileApp.postMessage({ \"detail\": { \"message\": \"myMessage\" } })\n * detail is the data you want to send to the main app, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, no functions or other non-JSON-serializable types are allowed.\n *\n * This method is inject at runtime in the webview\n */\n addListener(\n eventName: \"messageFromWebview\",\n listenerFunc: (event: { detail: Record<string, any> }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page is loaded\n */\n addListener(\n eventName: \"browserPageLoaded\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(\n eventName: \"pageLoadError\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Reload the current web page.\n *\n * @since 1.0.0\n */\n reload(): Promise<any>;\n}\n\n/**\n * JavaScript APIs available in the InAppBrowser WebView.\n *\n * These APIs are automatically injected into all webpages loaded in the InAppBrowser WebView.\n *\n * @example\n * // Closing the webview from JavaScript\n * window.mobileApp.close();\n *\n * // Sending a message from webview to the native app\n * window.mobileApp.postMessage({ key: 'value' });\n *\n * @since 6.10.0\n */\nexport interface InAppBrowserWebViewAPIs {\n /**\n * mobileApp - Global object injected into the WebView providing communication with the native app\n */\n mobileApp: {\n /**\n * Close the WebView from JavaScript\n *\n * @example\n * // Add a button to close the webview\n * const closeButton = document.createElement('button');\n * closeButton.textContent = 'Close WebView';\n * closeButton.addEventListener('click', () => {\n * window.mobileApp.close();\n * });\n * document.body.appendChild(closeButton);\n *\n * @since 6.10.0\n */\n close(): void;\n\n /**\n * Send a message from the WebView to the native app\n * The native app can listen for these messages with the \"messageFromWebview\" event\n *\n * @param message Object to send to the native app\n * @example\n * // Send data to native app\n * window.mobileApp.postMessage({\n * action: 'dataSubmitted',\n * data: { username: 'test', email: 'test@example.com' }\n * });\n *\n * @since 6.10.0\n */\n postMessage(message: Record<string, any>): void;\n };\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,CAAN,IAAY,WAqBX;AArBD,WAAY,WAAW;IACrB;;;OAGG;IACH,oCAAqB,CAAA;IACrB;;;OAGG;IACH,kCAAmB,CAAA;IACnB;;;OAGG;IACH,wCAAyB,CAAA;IACzB;;;OAGG;IACH,8BAAe,CAAA;AACjB,CAAC,EArBW,WAAW,KAAX,WAAW,QAqBtB","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface UrlEvent {\n /**\n * Emit when the url changes\n *\n * @since 0.0.1\n */\n url: string;\n}\nexport interface BtnEvent {\n /**\n * Emit when a button is clicked.\n *\n * @since 0.0.1\n */\n url: string;\n}\n\nexport type UrlChangeListener = (state: UrlEvent) => void;\nexport type ConfirmBtnListener = (state: BtnEvent) => void;\nexport type ButtonNearListener = (state: object) => void;\n\nexport enum BackgroundColor {\n WHITE = \"white\",\n BLACK = \"black\",\n}\nexport enum ToolBarType {\n /**\n * Shows a simple toolbar with just a close button and share button\n * @since 0.1.0\n */\n ACTIVITY = \"activity\",\n /**\n * Shows a simple toolbar with just a close button\n * @since 7.6.8\n */\n COMPACT = \"compact\",\n /**\n * Shows a full navigation toolbar with back/forward buttons\n * @since 0.1.0\n */\n NAVIGATION = \"navigation\",\n /**\n * Shows no toolbar\n * @since 0.1.0\n */\n BLANK = \"blank\",\n}\n\nexport interface Headers {\n [key: string]: string;\n}\n\nexport interface GetCookieOptions {\n url: string;\n includeHttpOnly?: boolean;\n}\n\nexport interface ClearCookieOptions {\n url: string;\n}\n\nexport interface Credentials {\n username: string;\n password: string;\n}\n\nexport interface OpenOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n */\n url: string;\n /**\n * if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * if true the deeplink will not be opened, if false the deeplink will be opened when clicked on the link\n * @since 0.1.0\n */\n preventDeeplink?: boolean;\n}\n\nexport interface DisclaimerOptions {\n /**\n * Title of the disclaimer dialog\n * @default \"Title\"\n */\n title: string;\n /**\n * Message shown in the disclaimer dialog\n * @default \"Message\"\n */\n message: string;\n /**\n * Text for the confirm button\n * @default \"Confirm\"\n */\n confirmBtn: string;\n /**\n * Text for the cancel button\n * @default \"Cancel\"\n */\n cancelBtn: string;\n}\n\nexport interface OpenWebViewOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n * @example \"https://capgo.app\"\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n * @example\n * headers: {\n * 'Custom-Header': 'test-value',\n * 'Authorization': 'Bearer test-token'\n * }\n * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/\n */\n headers?: Headers;\n /**\n * Credentials to send with the request and all subsequent requests for the same host.\n * @since 6.1.0\n * @example\n * credentials: {\n * username: 'test-user',\n * password: 'test-pass'\n * }\n * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/\n */\n credentials?: Credentials;\n /**\n * materialPicker: if true, uses Material Design theme for date and time pickers on Android.\n * This improves the appearance of HTML date inputs to use modern Material Design UI instead of the old style pickers.\n * @since 7.4.1\n * @default false\n * @example\n * materialPicker: true\n * Test URL: https://show-picker.glitch.me/demo.html\n */\n materialPicker?: boolean;\n /**\n * JavaScript Interface:\n * The webview automatically injects a JavaScript interface providing:\n * - `window.mobileApp.close()`: Closes the webview from JavaScript\n * - `window.mobileApp.postMessage(obj)`: Sends a message to the app (listen via \"messageFromWebview\" event)\n *\n * @example\n * // In your webpage loaded in the webview:\n * document.getElementById('closeBtn').addEventListener('click', () => {\n * window.mobileApp.close();\n * });\n *\n * // Send data to the app\n * window.mobileApp.postMessage({ action: 'login', data: { user: 'test' }});\n *\n * @since 6.10.0\n */\n jsInterface?: never; // This property doesn't exist, it's just for documentation\n /**\n * Share options for the webview. When provided, shows a disclaimer dialog before sharing content.\n * This is useful for:\n * - Warning users about sharing sensitive information\n * - Getting user consent before sharing\n * - Explaining what will be shared\n * - Complying with privacy regulations\n *\n * Note: shareSubject is required when using shareDisclaimer\n * @since 0.1.0\n * @example\n * shareDisclaimer: {\n * title: 'Disclaimer',\n * message: 'This is a test disclaimer',\n * confirmBtn: 'Accept',\n * cancelBtn: 'Decline'\n * }\n * Test URL: https://capgo.app\n */\n shareDisclaimer?: DisclaimerOptions;\n /**\n * Toolbar type determines the appearance and behavior of the browser's toolbar\n * - \"activity\": Shows a simple toolbar with just a close button and share button\n * - \"navigation\": Shows a full navigation toolbar with back/forward buttons\n * - \"blank\": Shows no toolbar\n * - \"\": Default toolbar with close button\n * @since 0.1.0\n * @default ToolBarType.DEFAULT\n * @example\n * toolbarType: ToolBarType.ACTIVITY,\n * title: 'Activity Toolbar Test'\n * Test URL: https://capgo.app\n */\n toolbarType?: ToolBarType;\n /**\n * Subject text for sharing. Required when using shareDisclaimer.\n * This text will be used as the subject line when sharing content.\n * @since 0.1.0\n * @example \"Share this page\"\n */\n shareSubject?: string;\n /**\n * Title of the browser\n * @since 0.1.0\n * @default 'New Window'\n * @example \"Camera Test\"\n */\n title?: string;\n /**\n * Background color of the browser\n * @since 0.1.0\n * @default BackgroundColor.BLACK\n */\n backgroundColor?: BackgroundColor;\n /**\n * If true, active the native navigation within the webview, Android only\n * @default false\n * @example\n * activeNativeNavigationForWebview: true,\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n activeNativeNavigationForWebview?: boolean;\n /**\n * Disable the possibility to go back on native application,\n * useful to force user to stay on the webview, Android only\n * @default false\n * @example\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n disableGoBackOnNativeApplication?: boolean;\n /**\n * Open url in a new window fullscreen\n * isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n * @default false\n * @example\n * isPresentAfterPageLoad: true,\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * Whether the website in the webview is inspectable or not, ios only\n * @default false\n */\n isInspectable?: boolean;\n /**\n * Whether the webview opening is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\n /**\n * Shows a reload button that reloads the web page\n * @since 1.0.15\n * @default false\n * @example\n * showReloadButton: true\n * Test URL: https://capgo.app\n */\n showReloadButton?: boolean;\n /**\n * CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.\n * @since 1.1.0\n * @default false\n * @example\n * closeModal: true,\n * closeModalTitle: 'Close Window',\n * closeModalDescription: 'Are you sure you want to close?',\n * closeModalOk: 'Yes, close',\n * closeModalCancel: 'No, stay'\n * Test URL: https://capgo.app\n */\n closeModal?: boolean;\n /**\n * CloseModalTitle: title of the confirm when user clicks on close button\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalTitle?: string;\n /**\n * CloseModalDescription: description of the confirm when user clicks on close button\n * @since 1.1.0\n * @default 'Are you sure you want to close this window?'\n */\n closeModalDescription?: string;\n /**\n * CloseModalOk: text of the confirm button when user clicks on close button\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalOk?: string;\n /**\n * CloseModalCancel: text of the cancel button when user clicks on close button\n * @since 1.1.0\n * @default 'Cancel'\n */\n closeModalCancel?: string;\n /**\n * visibleTitle: if true the website title would be shown else shown empty\n * @since 1.2.5\n * @default true\n */\n visibleTitle?: boolean;\n /**\n * toolbarColor: color of the toolbar in hex format\n * @since 1.2.5\n * @default '#ffffff'\n * @example\n * toolbarColor: '#FF5733'\n * Test URL: https://capgo.app\n */\n toolbarColor?: string;\n /**\n * toolbarTextColor: color of the buttons and title in the toolbar in hex format\n * When set, it overrides the automatic light/dark mode detection for text color\n * @since 6.10.0\n * @default calculated based on toolbarColor brightness\n * @example\n * toolbarTextColor: '#FFFFFF'\n * Test URL: https://capgo.app\n */\n toolbarTextColor?: string;\n /**\n * showArrow: if true an arrow would be shown instead of cross for closing the window\n * @since 1.2.5\n * @default false\n * @example\n * showArrow: true\n * Test URL: https://capgo.app\n */\n showArrow?: boolean;\n /**\n * ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website.\n * @since 6.1.0\n * @default false\n */\n ignoreUntrustedSSLError?: boolean;\n /**\n * preShowScript: if isPresentAfterPageLoad is true and this variable is set the plugin will inject a script before showing the browser.\n * This script will be run in an async context. The plugin will wait for the script to finish (max 10 seconds)\n * @since 6.6.0\n * @example\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n preShowScript?: string;\n /**\n * proxyRequests is a regex expression. Please see [this pr](https://github.com/Cap-go/capacitor-inappbrowser/pull/222) for more info. (Android only)\n * @since 6.9.0\n */\n proxyRequests?: string;\n /**\n * buttonNearDone allows for a creation of a custom button near the done/close button.\n * The button is only shown when toolbarType is not \"activity\", \"navigation\", or \"blank\".\n *\n * For Android:\n * - iconType must be \"asset\"\n * - icon path should be in the public folder (e.g. \"monkey.svg\")\n * - width and height are optional, defaults to 48dp\n * - button is positioned at the end of toolbar with 8dp margin\n *\n * For iOS:\n * - iconType can be \"sf-symbol\" or \"asset\"\n * - for sf-symbol, icon should be the symbol name\n * - for asset, icon should be the asset name\n * @since 6.7.0\n * @example\n * buttonNearDone: {\n * ios: {\n * iconType: 'sf-symbol',\n * icon: 'star.fill'\n * },\n * android: {\n * iconType: 'asset',\n * icon: 'public/monkey.svg',\n * width: 24,\n * height: 24\n * }\n * }\n * Test URL: https://capgo.app\n */\n buttonNearDone?: {\n ios: {\n iconType: \"sf-symbol\" | \"asset\";\n icon: string;\n };\n android: {\n iconType: \"asset\" | \"vector\";\n icon: string;\n width?: number;\n height?: number;\n };\n };\n /**\n * textZoom: sets the text zoom of the page in percent.\n * Allows users to increase or decrease the text size for better readability.\n * @since 7.6.0\n * @default 100\n * @example\n * textZoom: 120\n * Test URL: https://capgo.app\n */\n textZoom?: number;\n /**\n * preventDeeplink: if true, the deeplink will not be opened, if false the deeplink will be opened when clicked on the link. on IOS each schema need to be added to info.plist file under LSApplicationQueriesSchemes when false to make it work.\n * @since 0.1.0\n * @default false\n * @example\n * preventDeeplink: true\n * Test URL: https://aasa-tester.capgo.app/\n */\n preventDeeplink?: boolean;\n\n /**\n * List of URL base patterns that should be treated as authorized App Links, Android only.\n * Only links starting with any of these base URLs will be opened in the InAppBrowser.\n *\n * @since 7.12.0\n * @default []\n */\n authorizedAppLinks?: string[];\n\n /**\n * If true, the webView will not take the full height and will have a 20px margin at the bottom.\n * This creates a safe margin area outside the browser view.\n * @since 7.13.0\n * @default false\n * @example\n * enabledSafeBottomMargin: true\n */\n enabledSafeBottomMargin?: boolean;\n\n /**\n * enableGooglePaySupport: if true, enables support for Google Pay popups and Payment Request API.\n * This fixes OR_BIBED_15 errors by allowing popup windows and configuring Cross-Origin-Opener-Policy.\n * Only enable this if you need Google Pay functionality as it allows popup windows.\n *\n * When enabled:\n * - Allows popup windows for Google Pay authentication\n * - Sets proper CORS headers for Payment Request API\n * - Enables multiple window support in WebView\n * - Configures secure context for payment processing\n *\n * @since 7.13.0\n * @default false\n * @example\n * enableGooglePaySupport: true\n * Test URL: https://developers.google.com/pay/api/web/guides/tutorial\n */\n enableGooglePaySupport?: boolean;\n}\n\nexport interface InAppBrowserPlugin {\n /**\n * Open url in a new window fullscreen, on android it use chrome custom tabs, on ios it use SFSafariViewController\n *\n * @since 0.1.0\n */\n open(options: OpenOptions): Promise<any>;\n\n /**\n * Clear cookies of url\n *\n * @since 0.5.0\n */\n clearCookies(options: ClearCookieOptions): Promise<any>;\n /**\n * Clear all cookies\n *\n * @since 6.5.0\n */\n clearAllCookies(): Promise<any>;\n\n /**\n * Clear cache\n *\n * @since 6.5.0\n */\n clearCache(): Promise<any>;\n\n /**\n * Get cookies for a specific URL.\n * @param options The options, including the URL to get cookies for.\n * @returns A promise that resolves with the cookies.\n */\n getCookies(options: GetCookieOptions): Promise<Record<string, string>>;\n /**\n * Close the webview.\n */\n close(): Promise<any>;\n /**\n * Open url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc.\n *\n * JavaScript Interface:\n * When you open a webview with this method, a JavaScript interface is automatically injected that provides:\n * - `window.mobileApp.close()`: Closes the webview from JavaScript\n * - `window.mobileApp.postMessage({detail: {message: 'myMessage'}})`: Sends a message from the webview to the app, detail object is the data you want to send to the webview\n *\n * @since 0.1.0\n */\n openWebView(options: OpenWebViewOptions): Promise<any>;\n /**\n * Injects JavaScript code into the InAppBrowser window.\n */\n executeScript({ code }: { code: string }): Promise<void>;\n /**\n * Sends an event to the webview(inappbrowser). you can listen to this event in the inappbrowser JS with window.addEventListener(\"messageFromNative\", listenerFunc: (event: Record<string, any>) => void)\n * detail is the data you want to send to the webview, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, so no functions or other non-JSON-serializable types are allowed.\n */\n postMessage(options: { detail: Record<string, any> }): Promise<void>;\n /**\n * Sets the URL of the webview.\n */\n setUrl(options: { url: string }): Promise<any>;\n /**\n * Listen for url change, only for openWebView\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"urlChangeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n\n addListener(\n eventName: \"buttonNearDoneClick\",\n listenerFunc: ButtonNearListener,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(\n eventName: \"closeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"confirmBtnClicked\",\n listenerFunc: ConfirmBtnListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when event is sent from webview(inappbrowser), to send an event to the main app use window.mobileApp.postMessage({ \"detail\": { \"message\": \"myMessage\" } })\n * detail is the data you want to send to the main app, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, no functions or other non-JSON-serializable types are allowed.\n *\n * This method is inject at runtime in the webview\n */\n addListener(\n eventName: \"messageFromWebview\",\n listenerFunc: (event: { detail: Record<string, any> }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page is loaded\n */\n addListener(\n eventName: \"browserPageLoaded\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(\n eventName: \"pageLoadError\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Reload the current web page.\n *\n * @since 1.0.0\n */\n reload(): Promise<any>;\n}\n\n/**\n * JavaScript APIs available in the InAppBrowser WebView.\n *\n * These APIs are automatically injected into all webpages loaded in the InAppBrowser WebView.\n *\n * @example\n * // Closing the webview from JavaScript\n * window.mobileApp.close();\n *\n * // Sending a message from webview to the native app\n * window.mobileApp.postMessage({ key: 'value' });\n *\n * @since 6.10.0\n */\nexport interface InAppBrowserWebViewAPIs {\n /**\n * mobileApp - Global object injected into the WebView providing communication with the native app\n */\n mobileApp: {\n /**\n * Close the WebView from JavaScript\n *\n * @example\n * // Add a button to close the webview\n * const closeButton = document.createElement('button');\n * closeButton.textContent = 'Close WebView';\n * closeButton.addEventListener('click', () => {\n * window.mobileApp.close();\n * });\n * document.body.appendChild(closeButton);\n *\n * @since 6.10.0\n */\n close(): void;\n\n /**\n * Send a message from the WebView to the native app\n * The native app can listen for these messages with the \"messageFromWebview\" event\n *\n * @param message Object to send to the native app\n * @example\n * // Send data to native app\n * window.mobileApp.postMessage({\n * action: 'dataSubmitted',\n * data: { username: 'test', email: 'test@example.com' }\n * });\n *\n * @since 6.10.0\n */\n postMessage(message: Record<string, any>): void;\n };\n}\n"]}
@@ -291,7 +291,6 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
291
291
  let preventDeeplink = call.getBool("preventDeeplink", false)
292
292
  let isAnimated = call.getBool("isAnimated", true)
293
293
  let enabledSafeBottomMargin = call.getBool("enabledSafeBottomMargin", false)
294
- let safeBottomMargin = call.getDouble("safeBottomMargin", 20.0)
295
294
 
296
295
  // Validate preShowScript requires isPresentAfterPageLoad
297
296
  if call.getString("preShowScript") != nil && !call.getBool("isPresentAfterPageLoad", false) {
@@ -364,7 +363,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
364
363
  return
365
364
  }
366
365
 
367
- self.webViewController = WKWebViewController.init(url: url, headers: headers, isInspectable: isInspectable, credentials: credentials, preventDeeplink: preventDeeplink, blankNavigationTab: toolbarType == "blank", enabledSafeBottomMargin: enabledSafeBottomMargin, safeBottomMargin: safeBottomMargin)
366
+ self.webViewController = WKWebViewController.init(url: url, headers: headers, isInspectable: isInspectable, credentials: credentials, preventDeeplink: preventDeeplink, blankNavigationTab: toolbarType == "blank", enabledSafeBottomMargin: enabledSafeBottomMargin)
368
367
 
369
368
  guard let webViewController = self.webViewController else {
370
369
  call.reject("Failed to initialize WebViewController")
@@ -695,7 +694,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
695
694
  return
696
695
  }
697
696
 
698
- self.webViewController = WKWebViewController.init(url: url, headers: headers, isInspectable: isInspectable, credentials: credentials, preventDeeplink: preventDeeplink, blankNavigationTab: true, enabledSafeBottomMargin: false, safeBottomMargin: 20.0)
697
+ self.webViewController = WKWebViewController.init(url: url, headers: headers, isInspectable: isInspectable, credentials: credentials, preventDeeplink: preventDeeplink, blankNavigationTab: true, enabledSafeBottomMargin: false)
699
698
 
700
699
  guard let webViewController = self.webViewController else {
701
700
  call.reject("Failed to initialize WebViewController")
@@ -76,11 +76,10 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
76
76
  self.initWebview(isInspectable: isInspectable)
77
77
  }
78
78
 
79
- public init(url: URL, headers: [String: String], isInspectable: Bool, credentials: WKWebViewCredentials? = nil, preventDeeplink: Bool, blankNavigationTab: Bool, enabledSafeBottomMargin: Bool, safeBottomMargin: CGFloat) {
79
+ public init(url: URL, headers: [String: String], isInspectable: Bool, credentials: WKWebViewCredentials? = nil, preventDeeplink: Bool, blankNavigationTab: Bool, enabledSafeBottomMargin: Bool) {
80
80
  super.init(nibName: nil, bundle: nil)
81
81
  self.blankNavigationTab = blankNavigationTab
82
82
  self.enabledSafeBottomMargin = enabledSafeBottomMargin
83
- self.safeBottomMargin = safeBottomMargin
84
83
  self.source = .remote(url)
85
84
  self.credentials = credentials
86
85
  self.setHeaders(headers: headers)
@@ -117,7 +116,6 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
117
116
  var blankNavigationTab: Bool = false
118
117
  var capacitorStatusBar: UIView?
119
118
  var enabledSafeBottomMargin: Bool = false
120
- var safeBottomMargin: CGFloat = 20.0 // Default safe margin in points
121
119
 
122
120
  internal var preShowSemaphore: DispatchSemaphore?
123
121
  internal var preShowError: String?
@@ -635,25 +633,19 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
635
633
 
636
634
  // Then set up constraints
637
635
  webView.translatesAutoresizingMaskIntoConstraints = false
636
+ var bottomPadding = self.view.bottomAnchor
638
637
 
639
638
  if self.enabledSafeBottomMargin {
640
- // Add custom safe margin when enabled
641
- NSLayoutConstraint.activate([
642
- webView.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor),
643
- webView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
644
- webView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
645
- webView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: -self.safeBottomMargin)
646
- ])
647
- } else {
648
- // Normal full height layout
649
- NSLayoutConstraint.activate([
650
- webView.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor),
651
- webView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
652
- webView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
653
- webView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor)
654
- ])
639
+ bottomPadding = self.view.safeAreaLayoutGuide.bottomAnchor
655
640
  }
656
641
 
642
+ NSLayoutConstraint.activate([
643
+ webView.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor),
644
+ webView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
645
+ webView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
646
+ webView.bottomAnchor.constraint(equalTo: bottomPadding)
647
+ ])
648
+
657
649
  webView.uiDelegate = self
658
650
  webView.navigationDelegate = self
659
651
 
@@ -667,28 +659,9 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
667
659
  webView.addObserver(self, forKeyPath: #keyPath(WKWebView.url), options: .new, context: nil)
668
660
 
669
661
  if !self.blankNavigationTab {
670
- // For non-blank navigation tab, we need to handle enabledSafeBottomMargin differently
671
- if self.enabledSafeBottomMargin {
672
- // Create a container view to hold the webView with margin
673
- let containerView = UIView()
674
- containerView.translatesAutoresizingMaskIntoConstraints = false
675
- self.view = containerView
676
-
677
- // Add webView to container
678
- containerView.addSubview(webView)
679
- webView.translatesAutoresizingMaskIntoConstraints = false
680
-
681
- // Set constraints with custom safe margin
682
- NSLayoutConstraint.activate([
683
- webView.topAnchor.constraint(equalTo: containerView.topAnchor),
684
- webView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
685
- webView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
686
- webView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: -self.safeBottomMargin)
687
- ])
688
- } else {
689
- // Normal behavior - webView is the entire view
690
- self.view = webView
691
- }
662
+ self.view.addSubview(webView)
663
+ // Then set up constraints
664
+ webView.translatesAutoresizingMaskIntoConstraints = false
692
665
  }
693
666
  self.webView = webView
694
667
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/inappbrowser",
3
- "version": "7.15.2",
3
+ "version": "7.16.0",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",