@capgo/capacitor-inappbrowser 8.18.1 → 8.20.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 +126 -5
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/CapgoInAppBrowserPlugin.java +75 -3
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/FullscreenWindowState.java +72 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java +21 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +238 -21
- package/android/src/main/res/drawable/ic_fullscreen_exit.xml +10 -0
- package/android/src/main/res/layout/fullscreen_exit_button.xml +24 -0
- package/android/src/main/res/values/fullscreen_exit.xml +10 -0
- package/android/src/main/res/values/strings.xml +1 -0
- package/android/src/main/res/xml/fullscreen_exit_shape.xml +6 -0
- package/dist/docs.json +129 -1
- package/dist/esm/definitions.d.ts +78 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +9 -0
- package/dist/esm/web.js +11 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +11 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +11 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/InAppBrowserPlugin/BrowserFullscreenSupport.swift +178 -0
- package/ios/Sources/InAppBrowserPlugin/DownloadPreviewSupport.swift +28 -0
- package/ios/Sources/InAppBrowserPlugin/InAppBrowserPlugin.swift +90 -4
- package/ios/Sources/InAppBrowserPlugin/WKWebViewController.swift +40 -7
- package/package.json +2 -2
package/dist/docs.json
CHANGED
|
@@ -399,6 +399,30 @@
|
|
|
399
399
|
],
|
|
400
400
|
"slug": "addlistenerurlchangeevent-"
|
|
401
401
|
},
|
|
402
|
+
{
|
|
403
|
+
"name": "addListener",
|
|
404
|
+
"signature": "(eventName: 'fullscreenChange', listenerFunc: (event: FullscreenChangeEvent) => void) => Promise<PluginListenerHandle>",
|
|
405
|
+
"parameters": [
|
|
406
|
+
{
|
|
407
|
+
"name": "eventName",
|
|
408
|
+
"docs": "",
|
|
409
|
+
"type": "'fullscreenChange'"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"name": "listenerFunc",
|
|
413
|
+
"docs": "",
|
|
414
|
+
"type": "(event: FullscreenChangeEvent) => void"
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
418
|
+
"tags": [],
|
|
419
|
+
"docs": "Listen for applied fullscreen changes, including startup entry, the native exit button,\nAndroid Back, and native lifecycle cleanup. Register before opening to observe startup entry.\nRepeated requests for the current state do not emit duplicate events.\nThis event describes host-controlled fullscreen, not HTML/video fullscreen.",
|
|
420
|
+
"complexTypes": [
|
|
421
|
+
"PluginListenerHandle",
|
|
422
|
+
"FullscreenChangeEvent"
|
|
423
|
+
],
|
|
424
|
+
"slug": "addlistenerfullscreenchange-"
|
|
425
|
+
},
|
|
402
426
|
{
|
|
403
427
|
"name": "addListener",
|
|
404
428
|
"signature": "(eventName: 'buttonNearDoneClick', listenerFunc: ButtonNearListener) => Promise<PluginListenerHandle>",
|
|
@@ -926,6 +950,38 @@
|
|
|
926
950
|
],
|
|
927
951
|
"slug": "updatedimensions"
|
|
928
952
|
},
|
|
953
|
+
{
|
|
954
|
+
"name": "setFullscreen",
|
|
955
|
+
"signature": "(options: { enabled: boolean; id?: string; }) => Promise<void>",
|
|
956
|
+
"parameters": [
|
|
957
|
+
{
|
|
958
|
+
"name": "options",
|
|
959
|
+
"docs": "",
|
|
960
|
+
"type": "{ enabled: boolean; id?: string | undefined; }"
|
|
961
|
+
}
|
|
962
|
+
],
|
|
963
|
+
"returns": "Promise<void>",
|
|
964
|
+
"tags": [],
|
|
965
|
+
"docs": "Enter or exit immersive fullscreen without recreating or reloading the webview.\nWhen `id` is omitted, targets the active webview. Repeated calls are idempotent.\nEntry requires a visible, frontmost, full-size `openWebView` on iOS or Android.\nMissing webviews, invalid arguments, custom dimensions, behind-host presentations,\nand the Web platform reject. Use the opening `fullscreen` option for an initially hidden webview.\nDisabling also cancels any pending fullscreen-at-launch request.\n\nNative exit controls, backgrounding, hiding, closing, cross-origin navigation, and renderer\ntermination restore the original chrome even when host JavaScript cannot respond.",
|
|
966
|
+
"complexTypes": [],
|
|
967
|
+
"slug": "setfullscreen"
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
"name": "getFullscreen",
|
|
971
|
+
"signature": "(options?: { id?: string | undefined; } | undefined) => Promise<{ enabled: boolean; }>",
|
|
972
|
+
"parameters": [
|
|
973
|
+
{
|
|
974
|
+
"name": "options",
|
|
975
|
+
"docs": "",
|
|
976
|
+
"type": "{ id?: string | undefined; } | undefined"
|
|
977
|
+
}
|
|
978
|
+
],
|
|
979
|
+
"returns": "Promise<{ enabled: boolean; }>",
|
|
980
|
+
"tags": [],
|
|
981
|
+
"docs": "Read the applied host-controlled fullscreen state of an `openWebView`.\nWhen `id` is omitted, targets the active webview. Initially hidden fullscreen webviews\nreport `false` until their first presentation. Missing webviews and Web usage reject.\nHTML/video fullscreen does not change this value.",
|
|
982
|
+
"complexTypes": [],
|
|
983
|
+
"slug": "getfullscreen"
|
|
984
|
+
},
|
|
929
985
|
{
|
|
930
986
|
"name": "setEnabledSafeTopMargin",
|
|
931
987
|
"signature": "(options: { enabled: boolean; id?: string; }) => Promise<void>",
|
|
@@ -1400,6 +1456,22 @@
|
|
|
1400
1456
|
"tags": [],
|
|
1401
1457
|
"methods": [],
|
|
1402
1458
|
"properties": [
|
|
1459
|
+
{
|
|
1460
|
+
"name": "fullscreen",
|
|
1461
|
+
"tags": [
|
|
1462
|
+
{
|
|
1463
|
+
"text": "false",
|
|
1464
|
+
"name": "default"
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
"text": "fullscreen: true,\ntoolbarType: ToolBarType.NAVIGATION // Restored when the user exits fullscreen",
|
|
1468
|
+
"name": "example"
|
|
1469
|
+
}
|
|
1470
|
+
],
|
|
1471
|
+
"docs": "Present this webview in immersive fullscreen from its first visible frame.\nHides native navigation and system bars and provides a native exit-fullscreen button.\nThe same webview, page state, cookies, and history are retained on entry and exit.\nExiting restores the configured toolbar and safe-area settings.\n\nApplies before presentation, including when `isPresentAfterPageLoad` is true.\nWith `hidden: true`, waits for the first `show()` without changing the host's system bars.\nSubsequent hide/show or background/resume cycles do not re-enter fullscreen automatically.\nOnly supported on iOS and Android for full-size, frontmost `openWebView` presentations.\nCustom dimensions and `toBack: true` are unsupported. The Web implementation rejects `true`.\nPermission prompts, if needed, are the host application's responsibility.",
|
|
1472
|
+
"complexTypes": [],
|
|
1473
|
+
"type": "boolean | undefined"
|
|
1474
|
+
},
|
|
1403
1475
|
{
|
|
1404
1476
|
"name": "url",
|
|
1405
1477
|
"tags": [
|
|
@@ -1684,10 +1756,28 @@
|
|
|
1684
1756
|
"name": "since"
|
|
1685
1757
|
}
|
|
1686
1758
|
],
|
|
1687
|
-
"docs": "Automatically handles downloads triggered inside the webview without requiring a custom JavaScript bridge.\n\nWhen enabled:\n- Standard attachment responses are written to a temporary file.\n- `blob:` downloads are also captured when the platform supports them.\n- Previewable files reopen inside the in-app browser when possible.\n- Other files are handed off to the native preview or viewer flow.\n- `downloadCompleted` and `downloadFailed` events notify the host app about the saved file.",
|
|
1759
|
+
"docs": "Automatically handles downloads triggered inside the webview without requiring a custom JavaScript bridge.\n\nWhen enabled:\n- Standard attachment responses are written to a temporary file.\n- `blob:` downloads are also captured when the platform supports them.\n- Previewable files reopen inside the in-app browser when possible (see `downloadPreview`).\n- Other files are handed off to the native preview or viewer flow.\n- `downloadCompleted` and `downloadFailed` events notify the host app about the saved file.",
|
|
1688
1760
|
"complexTypes": [],
|
|
1689
1761
|
"type": "boolean | undefined"
|
|
1690
1762
|
},
|
|
1763
|
+
{
|
|
1764
|
+
"name": "downloadPreview",
|
|
1765
|
+
"tags": [
|
|
1766
|
+
{
|
|
1767
|
+
"text": "\"inAppBrowser\"",
|
|
1768
|
+
"name": "default"
|
|
1769
|
+
},
|
|
1770
|
+
{
|
|
1771
|
+
"text": "8.19.0",
|
|
1772
|
+
"name": "since"
|
|
1773
|
+
}
|
|
1774
|
+
],
|
|
1775
|
+
"docs": "Controls where managed downloads are previewed after saving.\n\n- `'inAppBrowser'` (default): Reopens previewable files (PDF, images, text, JSON) inside the same webview.\n- `'systemPreview'`: Opens the system Quick Look preview with share and Save to Files actions. iOS only; ignored on Android.\n\nRequires `handleDownloads: true`.",
|
|
1776
|
+
"complexTypes": [
|
|
1777
|
+
"DownloadPreview"
|
|
1778
|
+
],
|
|
1779
|
+
"type": "DownloadPreview"
|
|
1780
|
+
},
|
|
1691
1781
|
{
|
|
1692
1782
|
"name": "shareDisclaimer",
|
|
1693
1783
|
"tags": [
|
|
@@ -2960,6 +3050,29 @@
|
|
|
2960
3050
|
}
|
|
2961
3051
|
]
|
|
2962
3052
|
},
|
|
3053
|
+
{
|
|
3054
|
+
"name": "FullscreenChangeEvent",
|
|
3055
|
+
"slug": "fullscreenchangeevent",
|
|
3056
|
+
"docs": "A change to host-controlled fullscreen; independent of HTML/video fullscreen.",
|
|
3057
|
+
"tags": [],
|
|
3058
|
+
"methods": [],
|
|
3059
|
+
"properties": [
|
|
3060
|
+
{
|
|
3061
|
+
"name": "id",
|
|
3062
|
+
"tags": [],
|
|
3063
|
+
"docs": "Webview instance id.",
|
|
3064
|
+
"complexTypes": [],
|
|
3065
|
+
"type": "string"
|
|
3066
|
+
},
|
|
3067
|
+
{
|
|
3068
|
+
"name": "enabled",
|
|
3069
|
+
"tags": [],
|
|
3070
|
+
"docs": "Whether fullscreen is currently applied to the visible webview.",
|
|
3071
|
+
"complexTypes": [],
|
|
3072
|
+
"type": "boolean"
|
|
3073
|
+
}
|
|
3074
|
+
]
|
|
3075
|
+
},
|
|
2963
3076
|
{
|
|
2964
3077
|
"name": "ButtonNearDoneEvent",
|
|
2965
3078
|
"slug": "buttonneardoneevent",
|
|
@@ -3861,6 +3974,21 @@
|
|
|
3861
3974
|
}
|
|
3862
3975
|
]
|
|
3863
3976
|
},
|
|
3977
|
+
{
|
|
3978
|
+
"name": "DownloadPreview",
|
|
3979
|
+
"slug": "downloadpreview",
|
|
3980
|
+
"docs": "Where managed downloads are previewed after saving.",
|
|
3981
|
+
"types": [
|
|
3982
|
+
{
|
|
3983
|
+
"text": "'inAppBrowser'",
|
|
3984
|
+
"complexTypes": []
|
|
3985
|
+
},
|
|
3986
|
+
{
|
|
3987
|
+
"text": "'systemPreview'",
|
|
3988
|
+
"complexTypes": []
|
|
3989
|
+
}
|
|
3990
|
+
]
|
|
3991
|
+
},
|
|
3864
3992
|
{
|
|
3865
3993
|
"name": "PreferredContentMode",
|
|
3866
3994
|
"slug": "preferredcontentmode",
|
|
@@ -11,6 +11,13 @@ export interface UrlEvent {
|
|
|
11
11
|
*/
|
|
12
12
|
url: string;
|
|
13
13
|
}
|
|
14
|
+
/** A change to host-controlled fullscreen; independent of HTML/video fullscreen. */
|
|
15
|
+
export interface FullscreenChangeEvent {
|
|
16
|
+
/** Webview instance id. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Whether fullscreen is currently applied to the visible webview. */
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
}
|
|
14
21
|
/**
|
|
15
22
|
* Event emitted when the managed webview intercepts a non-standard custom scheme
|
|
16
23
|
* and hands it to the operating system.
|
|
@@ -331,6 +338,12 @@ export interface ConsoleMessageEvent {
|
|
|
331
338
|
* @since 8.6.0
|
|
332
339
|
*/
|
|
333
340
|
export type DownloadHandledBy = 'inAppBrowser' | 'systemPreview' | 'external';
|
|
341
|
+
/**
|
|
342
|
+
* Where managed downloads are previewed after saving.
|
|
343
|
+
*
|
|
344
|
+
* @since 8.19.0
|
|
345
|
+
*/
|
|
346
|
+
export type DownloadPreview = 'inAppBrowser' | 'systemPreview';
|
|
334
347
|
/**
|
|
335
348
|
* Event emitted after a managed download is saved locally.
|
|
336
349
|
*
|
|
@@ -614,6 +627,25 @@ export interface CloseWebviewOptions {
|
|
|
614
627
|
isAnimated?: boolean;
|
|
615
628
|
}
|
|
616
629
|
export interface OpenWebViewOptions {
|
|
630
|
+
/**
|
|
631
|
+
* Present this webview in immersive fullscreen from its first visible frame.
|
|
632
|
+
* Hides native navigation and system bars and provides a native exit-fullscreen button.
|
|
633
|
+
* The same webview, page state, cookies, and history are retained on entry and exit.
|
|
634
|
+
* Exiting restores the configured toolbar and safe-area settings.
|
|
635
|
+
*
|
|
636
|
+
* Applies before presentation, including when `isPresentAfterPageLoad` is true.
|
|
637
|
+
* With `hidden: true`, waits for the first `show()` without changing the host's system bars.
|
|
638
|
+
* Subsequent hide/show or background/resume cycles do not re-enter fullscreen automatically.
|
|
639
|
+
* Only supported on iOS and Android for full-size, frontmost `openWebView` presentations.
|
|
640
|
+
* Custom dimensions and `toBack: true` are unsupported. The Web implementation rejects `true`.
|
|
641
|
+
* Permission prompts, if needed, are the host application's responsibility.
|
|
642
|
+
*
|
|
643
|
+
* @default false
|
|
644
|
+
* @example
|
|
645
|
+
* fullscreen: true,
|
|
646
|
+
* toolbarType: ToolBarType.NAVIGATION // Restored when the user exits fullscreen
|
|
647
|
+
*/
|
|
648
|
+
fullscreen?: boolean;
|
|
617
649
|
/**
|
|
618
650
|
* Target URL to load.
|
|
619
651
|
*
|
|
@@ -822,7 +854,7 @@ export interface OpenWebViewOptions {
|
|
|
822
854
|
* When enabled:
|
|
823
855
|
* - Standard attachment responses are written to a temporary file.
|
|
824
856
|
* - `blob:` downloads are also captured when the platform supports them.
|
|
825
|
-
* - Previewable files reopen inside the in-app browser when possible.
|
|
857
|
+
* - Previewable files reopen inside the in-app browser when possible (see `downloadPreview`).
|
|
826
858
|
* - Other files are handed off to the native preview or viewer flow.
|
|
827
859
|
* - `downloadCompleted` and `downloadFailed` events notify the host app about the saved file.
|
|
828
860
|
*
|
|
@@ -830,6 +862,18 @@ export interface OpenWebViewOptions {
|
|
|
830
862
|
* @since 8.6.0
|
|
831
863
|
*/
|
|
832
864
|
handleDownloads?: boolean;
|
|
865
|
+
/**
|
|
866
|
+
* Controls where managed downloads are previewed after saving.
|
|
867
|
+
*
|
|
868
|
+
* - `'inAppBrowser'` (default): Reopens previewable files (PDF, images, text, JSON) inside the same webview.
|
|
869
|
+
* - `'systemPreview'`: Opens the system Quick Look preview with share and Save to Files actions. iOS only; ignored on Android.
|
|
870
|
+
*
|
|
871
|
+
* Requires `handleDownloads: true`.
|
|
872
|
+
*
|
|
873
|
+
* @default "inAppBrowser"
|
|
874
|
+
* @since 8.19.0
|
|
875
|
+
*/
|
|
876
|
+
downloadPreview?: DownloadPreview;
|
|
833
877
|
/**
|
|
834
878
|
* Share options for the webview. When provided, shows a disclaimer dialog before sharing content.
|
|
835
879
|
* This is useful for:
|
|
@@ -1632,6 +1676,13 @@ export interface InAppBrowserPlugin {
|
|
|
1632
1676
|
* @since 0.0.1
|
|
1633
1677
|
*/
|
|
1634
1678
|
addListener(eventName: 'urlChangeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;
|
|
1679
|
+
/**
|
|
1680
|
+
* Listen for applied fullscreen changes, including startup entry, the native exit button,
|
|
1681
|
+
* Android Back, and native lifecycle cleanup. Register before opening to observe startup entry.
|
|
1682
|
+
* Repeated requests for the current state do not emit duplicate events.
|
|
1683
|
+
* This event describes host-controlled fullscreen, not HTML/video fullscreen.
|
|
1684
|
+
*/
|
|
1685
|
+
addListener(eventName: 'fullscreenChange', listenerFunc: (event: FullscreenChangeEvent) => void): Promise<PluginListenerHandle>;
|
|
1635
1686
|
/**
|
|
1636
1687
|
* Listen for buttonNearDone clicks.
|
|
1637
1688
|
*
|
|
@@ -1790,6 +1841,32 @@ export interface InAppBrowserPlugin {
|
|
|
1790
1841
|
updateDimensions(options: DimensionOptions & {
|
|
1791
1842
|
id?: string;
|
|
1792
1843
|
}): Promise<void>;
|
|
1844
|
+
/**
|
|
1845
|
+
* Enter or exit immersive fullscreen without recreating or reloading the webview.
|
|
1846
|
+
* When `id` is omitted, targets the active webview. Repeated calls are idempotent.
|
|
1847
|
+
* Entry requires a visible, frontmost, full-size `openWebView` on iOS or Android.
|
|
1848
|
+
* Missing webviews, invalid arguments, custom dimensions, behind-host presentations,
|
|
1849
|
+
* and the Web platform reject. Use the opening `fullscreen` option for an initially hidden webview.
|
|
1850
|
+
* Disabling also cancels any pending fullscreen-at-launch request.
|
|
1851
|
+
*
|
|
1852
|
+
* Native exit controls, backgrounding, hiding, closing, cross-origin navigation, and renderer
|
|
1853
|
+
* termination restore the original chrome even when host JavaScript cannot respond.
|
|
1854
|
+
*/
|
|
1855
|
+
setFullscreen(options: {
|
|
1856
|
+
enabled: boolean;
|
|
1857
|
+
id?: string;
|
|
1858
|
+
}): Promise<void>;
|
|
1859
|
+
/**
|
|
1860
|
+
* Read the applied host-controlled fullscreen state of an `openWebView`.
|
|
1861
|
+
* When `id` is omitted, targets the active webview. Initially hidden fullscreen webviews
|
|
1862
|
+
* report `false` until their first presentation. Missing webviews and Web usage reject.
|
|
1863
|
+
* HTML/video fullscreen does not change this value.
|
|
1864
|
+
*/
|
|
1865
|
+
getFullscreen(options?: {
|
|
1866
|
+
id?: string;
|
|
1867
|
+
}): Promise<{
|
|
1868
|
+
enabled: boolean;
|
|
1869
|
+
}>;
|
|
1793
1870
|
/**
|
|
1794
1871
|
* Sets the enabled safe top margin of the webview at runtime.
|
|
1795
1872
|
* When `id` is omitted, targets the active webview.
|