@capgo/capacitor-inappbrowser 8.7.4 → 8.7.6
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 +2 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/CapgoInAppBrowserPlugin.java +24 -2
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java +10 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/ProxyBridge.java +4 -5
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/ProxyRequestSupport.java +177 -2
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +119 -34
- package/dist/docs.json +28 -0
- package/dist/esm/definitions.d.ts +12 -0
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/InAppBrowserPlugin/InAppBrowserPlugin.swift +4 -2
- package/ios/Sources/InAppBrowserPlugin/ProxyBridge.swift +2 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1423,6 +1423,8 @@ And in the AndroidManifest.xml file:
|
|
|
1423
1423
|
| **`allowScreenshotsFromWebPage`** | <code>boolean</code> | Allows page JavaScript to call `window.mobileApp.takeScreenshot()`. Disabled by default so only the host app can trigger native screenshots through the plugin API. | <code>false</code> | 8.4.0 |
|
|
1424
1424
|
| **`captureConsoleLogs`** | <code>boolean</code> | Emits `consoleMessage` events for JavaScript `console.*` output coming from the managed page. Useful when the webview stays hidden and you still need page-level diagnostics. | <code>false</code> | 8.6.0 |
|
|
1425
1425
|
| **`persistWebViewData`** | <code>boolean</code> | Controls whether the webview should persist website data such as cache, cookies, local storage, IndexedDB, and session data. When false, iOS uses a non-persistent `WKWebsiteDataStore`. Android disables per-view cache and DOM/database storage where the system WebView supports it. Android cookies use the shared WebView cookie store, so call `clearAllBrowsingData()` to remove cookies and other global data. | <code>true</code> | 8.6.36 |
|
|
1426
|
+
| **`clientCertificate`** | <code>'none' \| 'prompt'</code> | Controls Android TLS client certificate prompts during HTTPS handshakes. Use `prompt` to show the system certificate picker; omit or use `none` to cancel silently (default). | <code>"none"</code> | 8.7.5 |
|
|
1427
|
+
| **`clientCertificatePrompt`** | <code>boolean</code> | | | |
|
|
1426
1428
|
| **`handleDownloads`** | <code>boolean</code> | Automatically handles downloads triggered inside the webview without requiring a custom JavaScript bridge. When enabled: - Standard attachment responses are written to a temporary file. - `blob:` downloads are also captured when the platform supports them. - Previewable files reopen inside the in-app browser when possible. - Other files are handed off to the native preview or viewer flow. - `downloadCompleted` and `downloadFailed` events notify the host app about the saved file. | <code>false</code> | 8.6.0 |
|
|
1427
1429
|
| **`shareDisclaimer`** | <code><a href="#disclaimeroptions">DisclaimerOptions</a></code> | Share options for the webview. When provided, shows a disclaimer dialog before sharing content. This is useful for: - Warning users about sharing sensitive information - Getting user consent before sharing - Explaining what will be shared - Complying with privacy regulations Note: shareSubject is required when using shareDisclaimer | | 0.1.0 |
|
|
1428
1430
|
| **`toolbarType`** | <code><a href="#toolbartype">ToolBarType</a></code> | Toolbar type determines the appearance and behavior of the browser's toolbar - "activity": Shows a simple toolbar with just a close button and share button - "navigation": Shows a full navigation toolbar with back/forward buttons - "blank": Shows no toolbar - "": Default toolbar with close button | <code>ToolBarType.DEFAULT</code> | 0.1.0 |
|
|
@@ -50,6 +50,8 @@ import java.util.Iterator;
|
|
|
50
50
|
import java.util.List;
|
|
51
51
|
import java.util.Map;
|
|
52
52
|
import java.util.UUID;
|
|
53
|
+
import java.util.concurrent.ExecutorService;
|
|
54
|
+
import java.util.concurrent.Executors;
|
|
53
55
|
import java.util.regex.Pattern;
|
|
54
56
|
import java.util.regex.PatternSyntaxException;
|
|
55
57
|
import org.json.JSONException;
|
|
@@ -66,8 +68,25 @@ import org.json.JSONObject;
|
|
|
66
68
|
)
|
|
67
69
|
public class CapgoInAppBrowserPlugin extends Plugin implements WebViewDialog.PermissionHandler {
|
|
68
70
|
|
|
71
|
+
private static final ExecutorService PROXY_RESPONSE_EXECUTOR = Executors.newFixedThreadPool(
|
|
72
|
+
Math.max(4, Runtime.getRuntime().availableProcessors()),
|
|
73
|
+
(runnable) -> {
|
|
74
|
+
Thread thread = new Thread(runnable, "CapgoInAppBrowser-ProxyResponse");
|
|
75
|
+
thread.setDaemon(true);
|
|
76
|
+
return thread;
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
|
|
69
80
|
private final String pluginVersion = "8.6.17";
|
|
70
81
|
|
|
82
|
+
private boolean resolveClientCertificatePrompt(PluginCall call) {
|
|
83
|
+
String mode = call.getString("clientCertificate");
|
|
84
|
+
if (mode == null) {
|
|
85
|
+
return Boolean.TRUE.equals(call.getBoolean("clientCertificatePrompt", false));
|
|
86
|
+
}
|
|
87
|
+
return "prompt".equalsIgnoreCase(mode);
|
|
88
|
+
}
|
|
89
|
+
|
|
71
90
|
public static final String CUSTOM_TAB_PACKAGE_NAME = "com.android.chrome"; // Change when in stable
|
|
72
91
|
private CustomTabsClient customTabsClient;
|
|
73
92
|
private CustomTabsSession currentSession;
|
|
@@ -1003,6 +1022,7 @@ public class CapgoInAppBrowserPlugin extends Plugin implements WebViewDialog.Per
|
|
|
1003
1022
|
options.setToolbarTextColor(call.getString("toolbarTextColor"));
|
|
1004
1023
|
options.setArrow(Boolean.TRUE.equals(call.getBoolean("showArrow", false)));
|
|
1005
1024
|
options.setIgnoreUntrustedSSLError(Boolean.TRUE.equals(call.getBoolean("ignoreUntrustedSSLError", false)));
|
|
1025
|
+
options.setClientCertificatePrompt(resolveClientCertificatePrompt(call));
|
|
1006
1026
|
options.setShowScreenshotButton(Boolean.TRUE.equals(call.getBoolean("showScreenshotButton", false)));
|
|
1007
1027
|
options.setAllowScreenshotsFromWebPage(Boolean.TRUE.equals(call.getBoolean("allowScreenshotsFromWebPage", false)));
|
|
1008
1028
|
options.setCaptureConsoleLogs(Boolean.TRUE.equals(call.getBoolean("captureConsoleLogs", false)));
|
|
@@ -1675,8 +1695,10 @@ public class CapgoInAppBrowserPlugin extends Plugin implements WebViewDialog.Per
|
|
|
1675
1695
|
return;
|
|
1676
1696
|
}
|
|
1677
1697
|
|
|
1678
|
-
|
|
1679
|
-
|
|
1698
|
+
PROXY_RESPONSE_EXECUTOR.execute(() -> {
|
|
1699
|
+
dialog.handleProxyResponse(requestId, decision);
|
|
1700
|
+
call.resolve();
|
|
1701
|
+
});
|
|
1680
1702
|
}
|
|
1681
1703
|
|
|
1682
1704
|
@PluginMethod
|
|
@@ -169,6 +169,7 @@ public class Options {
|
|
|
169
169
|
private String BackgroundColor;
|
|
170
170
|
private boolean ShowArrow;
|
|
171
171
|
private boolean ignoreUntrustedSSLError;
|
|
172
|
+
private boolean clientCertificatePrompt;
|
|
172
173
|
private String preShowScript;
|
|
173
174
|
private String toolbarTextColor;
|
|
174
175
|
private Pattern proxyRequestsPattern = null;
|
|
@@ -579,6 +580,14 @@ public class Options {
|
|
|
579
580
|
this.ignoreUntrustedSSLError = _ignoreUntrustedSSLError;
|
|
580
581
|
}
|
|
581
582
|
|
|
583
|
+
public boolean clientCertificatePrompt() {
|
|
584
|
+
return clientCertificatePrompt;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
public void setClientCertificatePrompt(boolean clientCertificatePrompt) {
|
|
588
|
+
this.clientCertificatePrompt = clientCertificatePrompt;
|
|
589
|
+
}
|
|
590
|
+
|
|
582
591
|
public String getPreShowScript() {
|
|
583
592
|
return preShowScript;
|
|
584
593
|
}
|
|
@@ -718,6 +727,7 @@ public class Options {
|
|
|
718
727
|
copy.setBackgroundColor(BackgroundColor);
|
|
719
728
|
copy.setArrow(ShowArrow);
|
|
720
729
|
copy.setIgnoreUntrustedSSLError(ignoreUntrustedSSLError);
|
|
730
|
+
copy.setClientCertificatePrompt(clientCertificatePrompt);
|
|
721
731
|
copy.setPreShowScript(preShowScript);
|
|
722
732
|
copy.setToolbarTextColor(toolbarTextColor);
|
|
723
733
|
copy.setProxyRequestsPattern(proxyRequestsPattern);
|
|
@@ -58,11 +58,10 @@ public class ProxyBridge {
|
|
|
58
58
|
if (requestId == null) {
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return storedRequest;
|
|
61
|
+
// Do not scan storedRequestOrder here: ConcurrentLinkedQueue.remove is O(n) and
|
|
62
|
+
// serializes parallel bridge-backed proxy requests. Stale queue ids are purged lazily
|
|
63
|
+
// in cleanupExpiredRequests().
|
|
64
|
+
return storedRequests.remove(requestId);
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
private void cleanupExpiredRequests(long now) {
|
|
@@ -3,6 +3,7 @@ package ee.forgr.capacitor_inappbrowser;
|
|
|
3
3
|
import com.getcapacitor.JSObject;
|
|
4
4
|
import java.io.IOException;
|
|
5
5
|
import java.net.URL;
|
|
6
|
+
import java.net.URLConnection;
|
|
6
7
|
import java.nio.charset.StandardCharsets;
|
|
7
8
|
import java.util.Base64;
|
|
8
9
|
import java.util.HashMap;
|
|
@@ -22,6 +23,8 @@ final class ProxyRequestSupport {
|
|
|
22
23
|
|
|
23
24
|
record ParsedResponseHeaders(Map<String, String> responseHeaders, List<String> cookieHeaders) {}
|
|
24
25
|
|
|
26
|
+
record ProxiedResponseMetadata(String contentType, Map<String, String> headers) {}
|
|
27
|
+
|
|
25
28
|
static final int SYNTHETIC_NATIVE_FAILURE_STATUS = 599;
|
|
26
29
|
static final String SYNTHETIC_NATIVE_FAILURE_HEADER = "X-Capgo-Proxy-Error";
|
|
27
30
|
|
|
@@ -59,7 +62,7 @@ final class ProxyRequestSupport {
|
|
|
59
62
|
private ProxyRequestSupport() {}
|
|
60
63
|
|
|
61
64
|
static boolean shouldInjectBridge(Options options) {
|
|
62
|
-
return options != null && options
|
|
65
|
+
return options != null && usesLegacyJsProxyMode(options);
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
static boolean usesLegacyJsProxyMode(Options options) {
|
|
@@ -109,6 +112,27 @@ final class ProxyRequestSupport {
|
|
|
109
112
|
return !usesLegacyJsProxyMode(options) || matchesProxyRequestsPattern(options.getProxyRequestsPattern(), requestUrl);
|
|
110
113
|
}
|
|
111
114
|
|
|
115
|
+
static boolean shouldBootstrapInitialProxyLoad(Options options) {
|
|
116
|
+
if (options == null || options.isPopupWindowMode()) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
String initialUrl = options.getUrl();
|
|
120
|
+
if (initialUrl == null || initialUrl.isBlank()) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
if (!options.shouldEnableNativeProxy()) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
if (shouldDelegateLegacyJsProxyRequest(options, initialUrl)) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
return shouldHandleNonBridgeRequest(options, initialUrl) && !usesLegacyJsProxyMode(options);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static boolean shouldReturnSyntheticNativeFailure(boolean bridgeBackedRequest, Options options, String requestUrl) {
|
|
133
|
+
return bridgeBackedRequest || shouldHandleNonBridgeRequest(options, requestUrl);
|
|
134
|
+
}
|
|
135
|
+
|
|
112
136
|
static boolean isBridgeMarkerRequestUrl(String requestUrl) {
|
|
113
137
|
if (requestUrl == null || requestUrl.isBlank()) {
|
|
114
138
|
return false;
|
|
@@ -405,16 +429,164 @@ final class ProxyRequestSupport {
|
|
|
405
429
|
return new WebResourceResponseMetadata(mimeType, encoding);
|
|
406
430
|
}
|
|
407
431
|
|
|
432
|
+
static ProxiedResponseMetadata normalizeProxiedResponseMetadata(
|
|
433
|
+
String contentType,
|
|
434
|
+
Map<String, String> responseHeaders,
|
|
435
|
+
String requestUrl
|
|
436
|
+
) {
|
|
437
|
+
Map<String, String> headers = responseHeaders != null ? new LinkedHashMap<>(responseHeaders) : new LinkedHashMap<>();
|
|
438
|
+
String headerContentType = findHeaderIgnoreCase(headers, "Content-Type");
|
|
439
|
+
String resolvedContentType = resolveProxiedContentType(firstNonEmpty(contentType, headerContentType), requestUrl);
|
|
440
|
+
if (resolvedContentType == null || resolvedContentType.isBlank()) {
|
|
441
|
+
resolvedContentType = "application/octet-stream";
|
|
442
|
+
}
|
|
443
|
+
if (!hasHeaderIgnoreCase(headers, "Content-Type")) {
|
|
444
|
+
headers.put("Content-Type", resolvedContentType);
|
|
445
|
+
}
|
|
446
|
+
return new ProxiedResponseMetadata(resolvedContentType, headers);
|
|
447
|
+
}
|
|
448
|
+
|
|
408
449
|
static WebResourceResponseMetadata resolveWebResourceResponseConstructorMetadata(
|
|
409
450
|
String contentType,
|
|
410
451
|
Map<String, String> responseHeaders
|
|
411
452
|
) {
|
|
412
|
-
|
|
453
|
+
String headerContentType = findHeaderIgnoreCase(responseHeaders, "Content-Type");
|
|
454
|
+
if (headerContentType != null && shouldDeferConstructorMimeTypeToContentTypeHeader(headerContentType)) {
|
|
413
455
|
return new WebResourceResponseMetadata(null, null);
|
|
414
456
|
}
|
|
415
457
|
return resolveWebResourceResponseMetadata(contentType, responseHeaders);
|
|
416
458
|
}
|
|
417
459
|
|
|
460
|
+
static String resolveProxiedContentType(String contentType, String requestUrl) {
|
|
461
|
+
String mimeOnly = extractMimeType(contentType);
|
|
462
|
+
if (mimeOnly != null && !mimeOnly.isBlank() && !isGenericProxiedMimeType(mimeOnly)) {
|
|
463
|
+
if (shouldNormalizeSvgContentType(requestUrl, mimeOnly)) {
|
|
464
|
+
return "image/svg+xml";
|
|
465
|
+
}
|
|
466
|
+
return contentType.trim();
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
String guessedContentType = guessContentTypeFromRequestUrl(requestUrl);
|
|
470
|
+
if (guessedContentType != null) {
|
|
471
|
+
return guessedContentType;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return contentType != null && !contentType.isBlank() ? contentType.trim() : null;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
static String guessContentTypeFromRequestUrl(String requestUrl) {
|
|
478
|
+
if (requestUrl == null || requestUrl.isBlank()) {
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
String fileName;
|
|
483
|
+
try {
|
|
484
|
+
fileName = new URL(requestUrl).getPath();
|
|
485
|
+
} catch (Exception error) {
|
|
486
|
+
return null;
|
|
487
|
+
}
|
|
488
|
+
if (fileName == null || fileName.isBlank()) {
|
|
489
|
+
return null;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
int slashIndex = fileName.lastIndexOf('/');
|
|
493
|
+
if (slashIndex >= 0) {
|
|
494
|
+
fileName = fileName.substring(slashIndex + 1);
|
|
495
|
+
}
|
|
496
|
+
if (fileName.isBlank()) {
|
|
497
|
+
return null;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
String guessedType = URLConnection.guessContentTypeFromName(fileName);
|
|
501
|
+
if (guessedType != null && !guessedType.isBlank()) {
|
|
502
|
+
return guessedType;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
int dotIndex = fileName.lastIndexOf('.');
|
|
506
|
+
if (dotIndex < 0 || dotIndex == fileName.length() - 1) {
|
|
507
|
+
return null;
|
|
508
|
+
}
|
|
509
|
+
String extension = fileName.substring(dotIndex + 1).toLowerCase(Locale.US);
|
|
510
|
+
return switch (extension) {
|
|
511
|
+
case "svg" -> "image/svg+xml";
|
|
512
|
+
case "png" -> "image/png";
|
|
513
|
+
case "jpg", "jpeg" -> "image/jpeg";
|
|
514
|
+
case "gif" -> "image/gif";
|
|
515
|
+
case "webp" -> "image/webp";
|
|
516
|
+
case "pdf" -> "application/pdf";
|
|
517
|
+
case "json" -> "application/json";
|
|
518
|
+
case "txt" -> "text/plain";
|
|
519
|
+
case "csv" -> "text/csv";
|
|
520
|
+
case "html", "htm" -> "text/html";
|
|
521
|
+
case "xhtml" -> "application/xhtml+xml";
|
|
522
|
+
default -> null;
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
private static boolean shouldNormalizeSvgContentType(String requestUrl, String mimeType) {
|
|
527
|
+
if (!"svg".equalsIgnoreCase(fileExtensionFromRequestUrl(requestUrl))) {
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
String normalizedMimeType = mimeType.toLowerCase(Locale.US);
|
|
531
|
+
return (
|
|
532
|
+
isGenericProxiedMimeType(normalizedMimeType) ||
|
|
533
|
+
"text/xml".equals(normalizedMimeType) ||
|
|
534
|
+
"application/xml".equals(normalizedMimeType)
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
private static String fileExtensionFromRequestUrl(String requestUrl) {
|
|
539
|
+
if (requestUrl == null || requestUrl.isBlank()) {
|
|
540
|
+
return "";
|
|
541
|
+
}
|
|
542
|
+
try {
|
|
543
|
+
String path = new URL(requestUrl).getPath();
|
|
544
|
+
if (path == null || path.isBlank()) {
|
|
545
|
+
return "";
|
|
546
|
+
}
|
|
547
|
+
int slashIndex = path.lastIndexOf('/');
|
|
548
|
+
String fileName = slashIndex >= 0 ? path.substring(slashIndex + 1) : path;
|
|
549
|
+
int dotIndex = fileName.lastIndexOf('.');
|
|
550
|
+
if (dotIndex < 0 || dotIndex == fileName.length() - 1) {
|
|
551
|
+
return "";
|
|
552
|
+
}
|
|
553
|
+
return fileName.substring(dotIndex + 1);
|
|
554
|
+
} catch (Exception error) {
|
|
555
|
+
return "";
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
private static String extractMimeType(String contentType) {
|
|
560
|
+
if (contentType == null || contentType.isBlank()) {
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
String mimeType = contentType.split(";")[0].trim();
|
|
564
|
+
return mimeType.isEmpty() ? null : mimeType;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
private static boolean isGenericProxiedMimeType(String mimeType) {
|
|
568
|
+
if (mimeType == null || mimeType.isBlank()) {
|
|
569
|
+
return true;
|
|
570
|
+
}
|
|
571
|
+
String normalizedMimeType = mimeType.trim().toLowerCase(Locale.US);
|
|
572
|
+
return (
|
|
573
|
+
normalizedMimeType.equals("application/octet-stream") ||
|
|
574
|
+
normalizedMimeType.equals("binary/octet-stream") ||
|
|
575
|
+
normalizedMimeType.equals("application/download") ||
|
|
576
|
+
normalizedMimeType.equals("application/x-download") ||
|
|
577
|
+
normalizedMimeType.equals("application/binary") ||
|
|
578
|
+
normalizedMimeType.equals("application/x-binary")
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
private static boolean shouldDeferConstructorMimeTypeToContentTypeHeader(String contentTypeHeader) {
|
|
583
|
+
String mimeType = extractMimeType(contentTypeHeader);
|
|
584
|
+
if (mimeType == null) {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
return mimeType.toLowerCase(Locale.US).startsWith("multipart/");
|
|
588
|
+
}
|
|
589
|
+
|
|
418
590
|
static ParsedResponseHeaders splitResponseHeaders(Map<String, List<String>> rawHeaders) {
|
|
419
591
|
Map<String, String> responseHeaders = new HashMap<>();
|
|
420
592
|
List<String> cookieHeaders = new java.util.ArrayList<>();
|
|
@@ -831,6 +1003,9 @@ final class ProxyRequestSupport {
|
|
|
831
1003
|
return false;
|
|
832
1004
|
}
|
|
833
1005
|
String normalizedMimeType = mimeType.trim().toLowerCase(Locale.US);
|
|
1006
|
+
if (normalizedMimeType.startsWith("image/")) {
|
|
1007
|
+
return false;
|
|
1008
|
+
}
|
|
834
1009
|
return (
|
|
835
1010
|
normalizedMimeType.startsWith("text/") ||
|
|
836
1011
|
normalizedMimeType.equals("application/json") ||
|
|
@@ -334,12 +334,13 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
334
334
|
private boolean datePickerInjected = false; // Track if we've injected date picker fixes
|
|
335
335
|
private final WebView capacitorWebView;
|
|
336
336
|
private String instanceId = "";
|
|
337
|
-
private final Map<String, ProxiedRequest> proxiedRequestsHashmap = new
|
|
337
|
+
private final Map<String, ProxiedRequest> proxiedRequestsHashmap = new ConcurrentHashMap<>();
|
|
338
338
|
private ProxyBridge proxyBridge;
|
|
339
339
|
private String proxyBridgeScript;
|
|
340
340
|
private String proxyAccessToken;
|
|
341
341
|
private final ExecutorService executorService = Executors.newCachedThreadPool();
|
|
342
342
|
private final Handler mainHandler = new Handler(Looper.getMainLooper());
|
|
343
|
+
private final AtomicBoolean cookieFlushScheduled = new AtomicBoolean(false);
|
|
343
344
|
private final Map<String, BlobDownloadSession> blobDownloadSessions = new ConcurrentHashMap<>();
|
|
344
345
|
private final Map<String, ClientCertificateIdentity> clientCertificateIdentities = new ConcurrentHashMap<>();
|
|
345
346
|
private int iconColor = Color.BLACK; // Default icon color
|
|
@@ -4766,6 +4767,30 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
4766
4767
|
return;
|
|
4767
4768
|
}
|
|
4768
4769
|
|
|
4770
|
+
String identityKey = clientCertificateIdentityKey(request.getHost(), request.getPort(), "https");
|
|
4771
|
+
ClientCertificateIdentity storedIdentity = clientCertificateIdentities.get(identityKey);
|
|
4772
|
+
if (storedIdentity != null) {
|
|
4773
|
+
try {
|
|
4774
|
+
request.proceed(storedIdentity.privateKey, storedIdentity.certificateChain);
|
|
4775
|
+
Log.i("InAppBrowser", "Proceeding with stored client certificate");
|
|
4776
|
+
return;
|
|
4777
|
+
} catch (Exception e) {
|
|
4778
|
+
Log.e("InAppBrowser", "Error proceeding with stored certificate: " + e.getMessage());
|
|
4779
|
+
clientCertificateIdentities.remove(identityKey);
|
|
4780
|
+
}
|
|
4781
|
+
}
|
|
4782
|
+
|
|
4783
|
+
boolean promptForCertificate = _options != null && _options.clientCertificatePrompt();
|
|
4784
|
+
if (!promptForCertificate) {
|
|
4785
|
+
try {
|
|
4786
|
+
request.cancel();
|
|
4787
|
+
} catch (Exception e) {
|
|
4788
|
+
Log.e("InAppBrowser", "Error canceling client cert request: " + e.getMessage());
|
|
4789
|
+
}
|
|
4790
|
+
Log.d("InAppBrowser", "Canceled optional client certificate request");
|
|
4791
|
+
return;
|
|
4792
|
+
}
|
|
4793
|
+
|
|
4769
4794
|
try {
|
|
4770
4795
|
Log.i("InAppBrowser", "Host: " + request.getHost());
|
|
4771
4796
|
Log.i("InAppBrowser", "Port: " + request.getPort());
|
|
@@ -4882,7 +4907,9 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
4882
4907
|
}
|
|
4883
4908
|
String initiatorUrl = request.getRequestHeaders().get("Referer");
|
|
4884
4909
|
if (initiatorUrl == null || initiatorUrl.isBlank()) {
|
|
4885
|
-
initiatorUrl =
|
|
4910
|
+
initiatorUrl = getWebViewUrlOrFallback(
|
|
4911
|
+
_options != null && _options.getUrl() != null ? _options.getUrl() : originalUrl
|
|
4912
|
+
);
|
|
4886
4913
|
}
|
|
4887
4914
|
String targetCookies = CookieManager.getInstance().getCookie(originalUrl);
|
|
4888
4915
|
if (
|
|
@@ -5003,7 +5030,7 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
5003
5030
|
nativeResponse = performNativeRequest(requestContext);
|
|
5004
5031
|
} catch (IOException error) {
|
|
5005
5032
|
Log.e("InAppBrowserProxy", "Native request failed for: " + requestContext.url, error);
|
|
5006
|
-
return
|
|
5033
|
+
return createProxiedNativeFailureResponse(requestContext.url, bridgeBackedRequest, error);
|
|
5007
5034
|
}
|
|
5008
5035
|
}
|
|
5009
5036
|
|
|
@@ -5016,7 +5043,7 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
5016
5043
|
redirectReplay = followRedirectForWebView(requestContext, nativeResponse, redirectsFollowed);
|
|
5017
5044
|
} catch (IOException error) {
|
|
5018
5045
|
Log.e("InAppBrowserProxy", "Native redirect replay failed for: " + requestContext.url, error);
|
|
5019
|
-
return
|
|
5046
|
+
return createProxiedNativeFailureResponse(requestContext.url, bridgeBackedRequest, error);
|
|
5020
5047
|
}
|
|
5021
5048
|
if (redirectReplay != null) {
|
|
5022
5049
|
requestContext = redirectReplay.requestContext;
|
|
@@ -5079,7 +5106,7 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
5079
5106
|
redirectReplay = followRedirectForWebView(requestContext, nativeResponse, redirectsFollowed);
|
|
5080
5107
|
} catch (IOException error) {
|
|
5081
5108
|
Log.e("InAppBrowserProxy", "Native redirect replay failed for: " + requestContext.url, error);
|
|
5082
|
-
return
|
|
5109
|
+
return createProxiedNativeFailureResponse(requestContext.url, bridgeBackedRequest, error);
|
|
5083
5110
|
}
|
|
5084
5111
|
if (redirectReplay != null) {
|
|
5085
5112
|
requestContext = redirectReplay.requestContext;
|
|
@@ -5259,8 +5286,13 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
5259
5286
|
if (view == null || _webView == null) {
|
|
5260
5287
|
return;
|
|
5261
5288
|
}
|
|
5262
|
-
|
|
5263
|
-
|
|
5289
|
+
if (request == null || !request.isForMainFrame()) {
|
|
5290
|
+
return;
|
|
5291
|
+
}
|
|
5292
|
+
if (_options.getCallbacks() != null) {
|
|
5293
|
+
_options.getCallbacks().pageLoadError();
|
|
5294
|
+
}
|
|
5295
|
+
if (!isInitialized) {
|
|
5264
5296
|
CharSequence description = error != null ? error.getDescription() : null;
|
|
5265
5297
|
String message = description != null ? "Initial page load failed: " + description : "Initial page load failed";
|
|
5266
5298
|
rejectOpenWebViewIfNeeded(message);
|
|
@@ -5514,9 +5546,7 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
5514
5546
|
shutdownExecutorServiceAsync();
|
|
5515
5547
|
|
|
5516
5548
|
// Clear any remaining proxied requests
|
|
5517
|
-
|
|
5518
|
-
proxiedRequestsHashmap.clear();
|
|
5519
|
-
}
|
|
5549
|
+
proxiedRequestsHashmap.clear();
|
|
5520
5550
|
|
|
5521
5551
|
try {
|
|
5522
5552
|
super.dismiss();
|
|
@@ -5744,10 +5774,29 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
5744
5774
|
}
|
|
5745
5775
|
|
|
5746
5776
|
private boolean shouldBootstrapInitialLegacyProxyLoad() {
|
|
5747
|
-
|
|
5748
|
-
|
|
5777
|
+
return ProxyRequestSupport.shouldBootstrapInitialProxyLoad(_options);
|
|
5778
|
+
}
|
|
5779
|
+
|
|
5780
|
+
private void loadInitialUrlDirect(Map<String, String> requestHeaders, String httpMethod, String httpBody) {
|
|
5781
|
+
if (_webView == null || _options == null) {
|
|
5782
|
+
return;
|
|
5749
5783
|
}
|
|
5750
|
-
|
|
5784
|
+
|
|
5785
|
+
Map<String, String> headers = requestHeaders != null ? requestHeaders : new HashMap<>();
|
|
5786
|
+
if (supportsRequestBody(httpMethod) && httpBody != null) {
|
|
5787
|
+
byte[] postData = httpBody.getBytes(StandardCharsets.UTF_8);
|
|
5788
|
+
_webView.postUrl(_options.getUrl(), postData);
|
|
5789
|
+
if (!headers.isEmpty()) {
|
|
5790
|
+
Log.w(
|
|
5791
|
+
"InAppBrowser",
|
|
5792
|
+
"Custom headers were provided but may not be sent with POST request. " +
|
|
5793
|
+
"Android WebView's postUrl method has limited header support."
|
|
5794
|
+
);
|
|
5795
|
+
}
|
|
5796
|
+
return;
|
|
5797
|
+
}
|
|
5798
|
+
|
|
5799
|
+
_webView.loadUrl(_options.getUrl(), headers);
|
|
5751
5800
|
}
|
|
5752
5801
|
|
|
5753
5802
|
private void loadInitialLegacyProxyContent(Map<String, String> requestHeaders, String httpMethod, String httpBody) {
|
|
@@ -5778,7 +5827,10 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
5778
5827
|
|
|
5779
5828
|
NativeResponseData responseData = proxyResult.responseData;
|
|
5780
5829
|
if (responseData == null || !canBootstrapHtmlResponse(responseData.contentType)) {
|
|
5781
|
-
|
|
5830
|
+
if (_webView == null) {
|
|
5831
|
+
return;
|
|
5832
|
+
}
|
|
5833
|
+
_webView.post(() -> loadInitialUrlDirect(initialHeaders, initialMethod, httpBody));
|
|
5782
5834
|
return;
|
|
5783
5835
|
}
|
|
5784
5836
|
|
|
@@ -5802,7 +5854,19 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
5802
5854
|
});
|
|
5803
5855
|
} catch (IOException error) {
|
|
5804
5856
|
Log.e("InAppBrowserProxy", "Initial legacy proxy bootstrap failed for: " + initialUrl, error);
|
|
5805
|
-
|
|
5857
|
+
if (_webView == null) {
|
|
5858
|
+
return;
|
|
5859
|
+
}
|
|
5860
|
+
String failureBody = new String(
|
|
5861
|
+
ProxyRequestSupport.createNativeRequestFailureBody(initialUrl, error),
|
|
5862
|
+
StandardCharsets.UTF_8
|
|
5863
|
+
);
|
|
5864
|
+
_webView.post(() -> {
|
|
5865
|
+
if (_webView == null) {
|
|
5866
|
+
return;
|
|
5867
|
+
}
|
|
5868
|
+
_webView.loadDataWithBaseURL(initialUrl, failureBody, "text/plain", "utf-8", initialUrl);
|
|
5869
|
+
});
|
|
5806
5870
|
}
|
|
5807
5871
|
});
|
|
5808
5872
|
}
|
|
@@ -5949,6 +6013,13 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
5949
6013
|
return response;
|
|
5950
6014
|
}
|
|
5951
6015
|
|
|
6016
|
+
private WebResourceResponse createProxiedNativeFailureResponse(String requestUrl, boolean bridgeBackedRequest, IOException error) {
|
|
6017
|
+
if (!ProxyRequestSupport.shouldReturnSyntheticNativeFailure(bridgeBackedRequest, _options, requestUrl)) {
|
|
6018
|
+
return null;
|
|
6019
|
+
}
|
|
6020
|
+
return createNativeFailureResponse(requestUrl, error);
|
|
6021
|
+
}
|
|
6022
|
+
|
|
5952
6023
|
private WebResourceResponse createNativeFailureResponse(String requestUrl, IOException error) {
|
|
5953
6024
|
NativeResponseData responseData = new NativeResponseData(
|
|
5954
6025
|
ProxyRequestSupport.SYNTHETIC_NATIVE_FAILURE_STATUS,
|
|
@@ -6111,7 +6182,13 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
6111
6182
|
contentType = conn.getContentType();
|
|
6112
6183
|
}
|
|
6113
6184
|
|
|
6114
|
-
|
|
6185
|
+
ProxyRequestSupport.ProxiedResponseMetadata normalizedResponse = ProxyRequestSupport.normalizeProxiedResponseMetadata(
|
|
6186
|
+
contentType,
|
|
6187
|
+
responseHeaders,
|
|
6188
|
+
requestContext.url
|
|
6189
|
+
);
|
|
6190
|
+
|
|
6191
|
+
return new NativeResponseData(status, normalizedResponse.contentType(), normalizedResponse.headers(), bodyBytes);
|
|
6115
6192
|
} finally {
|
|
6116
6193
|
conn.disconnect();
|
|
6117
6194
|
}
|
|
@@ -6131,15 +6208,22 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
6131
6208
|
wroteCookie = true;
|
|
6132
6209
|
}
|
|
6133
6210
|
if (wroteCookie) {
|
|
6134
|
-
|
|
6211
|
+
scheduleCookieFlush();
|
|
6135
6212
|
}
|
|
6136
6213
|
}
|
|
6137
6214
|
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
proxiedRequest = proxiedRequestsHashmap.get(requestId);
|
|
6215
|
+
private void scheduleCookieFlush() {
|
|
6216
|
+
if (!cookieFlushScheduled.compareAndSet(false, true)) {
|
|
6217
|
+
return;
|
|
6142
6218
|
}
|
|
6219
|
+
mainHandler.post(() -> {
|
|
6220
|
+
cookieFlushScheduled.set(false);
|
|
6221
|
+
CookieManager.getInstance().flush();
|
|
6222
|
+
});
|
|
6223
|
+
}
|
|
6224
|
+
|
|
6225
|
+
public void handleProxyResponse(String requestId, JSObject response) {
|
|
6226
|
+
ProxiedRequest proxiedRequest = proxiedRequestsHashmap.get(requestId);
|
|
6143
6227
|
if (proxiedRequest == null) {
|
|
6144
6228
|
Log.e("InAppBrowserProxy", "No pending request for id: " + requestId);
|
|
6145
6229
|
return;
|
|
@@ -6151,9 +6235,7 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
6151
6235
|
}
|
|
6152
6236
|
|
|
6153
6237
|
if (response == null) {
|
|
6154
|
-
|
|
6155
|
-
proxiedRequestsHashmap.remove(requestId);
|
|
6156
|
-
}
|
|
6238
|
+
proxiedRequestsHashmap.remove(requestId);
|
|
6157
6239
|
proxiedRequest.semaphore.release();
|
|
6158
6240
|
return;
|
|
6159
6241
|
}
|
|
@@ -6237,14 +6319,21 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
6237
6319
|
if (contentType == null) {
|
|
6238
6320
|
contentType = responseHeaders.get("Content-Type");
|
|
6239
6321
|
}
|
|
6240
|
-
|
|
6241
|
-
contentType
|
|
6242
|
-
|
|
6322
|
+
ProxyRequestSupport.ProxiedResponseMetadata normalizedResponse = ProxyRequestSupport.normalizeProxiedResponseMetadata(
|
|
6323
|
+
contentType,
|
|
6324
|
+
responseHeaders,
|
|
6325
|
+
proxiedRequest.requestContext != null ? proxiedRequest.requestContext.url : null
|
|
6326
|
+
);
|
|
6243
6327
|
|
|
6244
6328
|
if (status < 100 || status > 599) {
|
|
6245
6329
|
status = 200;
|
|
6246
6330
|
}
|
|
6247
|
-
proxiedRequest.nativeResponse = new NativeResponseData(
|
|
6331
|
+
proxiedRequest.nativeResponse = new NativeResponseData(
|
|
6332
|
+
status,
|
|
6333
|
+
normalizedResponse.contentType(),
|
|
6334
|
+
normalizedResponse.headers(),
|
|
6335
|
+
bodyBytes
|
|
6336
|
+
);
|
|
6248
6337
|
proxiedRequest.response = buildWebResourceResponse(proxiedRequest.nativeResponse);
|
|
6249
6338
|
}
|
|
6250
6339
|
} catch (IOException invalidBodyError) {
|
|
@@ -6255,17 +6344,13 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
6255
6344
|
}
|
|
6256
6345
|
}
|
|
6257
6346
|
|
|
6258
|
-
|
|
6259
|
-
proxiedRequestsHashmap.remove(requestId);
|
|
6260
|
-
}
|
|
6347
|
+
proxiedRequestsHashmap.remove(requestId);
|
|
6261
6348
|
proxiedRequest.semaphore.release();
|
|
6262
6349
|
}
|
|
6263
6350
|
|
|
6264
6351
|
@Override
|
|
6265
6352
|
public boolean hasPendingProxyRequest(String requestId) {
|
|
6266
|
-
|
|
6267
|
-
return proxiedRequestsHashmap.containsKey(requestId);
|
|
6268
|
-
}
|
|
6353
|
+
return proxiedRequestsHashmap.containsKey(requestId);
|
|
6269
6354
|
}
|
|
6270
6355
|
|
|
6271
6356
|
private void shareUrl() {
|
package/dist/docs.json
CHANGED
|
@@ -1453,6 +1453,34 @@
|
|
|
1453
1453
|
"complexTypes": [],
|
|
1454
1454
|
"type": "boolean | undefined"
|
|
1455
1455
|
},
|
|
1456
|
+
{
|
|
1457
|
+
"name": "clientCertificate",
|
|
1458
|
+
"tags": [
|
|
1459
|
+
{
|
|
1460
|
+
"text": "\"none\"",
|
|
1461
|
+
"name": "default"
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
"text": "8.7.5",
|
|
1465
|
+
"name": "since"
|
|
1466
|
+
}
|
|
1467
|
+
],
|
|
1468
|
+
"docs": "Controls Android TLS client certificate prompts during HTTPS handshakes.\nUse `prompt` to show the system certificate picker; omit or use `none` to cancel silently (default).",
|
|
1469
|
+
"complexTypes": [],
|
|
1470
|
+
"type": "'none' | 'prompt' | undefined"
|
|
1471
|
+
},
|
|
1472
|
+
{
|
|
1473
|
+
"name": "clientCertificatePrompt",
|
|
1474
|
+
"tags": [
|
|
1475
|
+
{
|
|
1476
|
+
"text": "Use `clientCertificate: \"prompt\"` instead.",
|
|
1477
|
+
"name": "deprecated"
|
|
1478
|
+
}
|
|
1479
|
+
],
|
|
1480
|
+
"docs": "",
|
|
1481
|
+
"complexTypes": [],
|
|
1482
|
+
"type": "boolean | undefined"
|
|
1483
|
+
},
|
|
1456
1484
|
{
|
|
1457
1485
|
"name": "handleDownloads",
|
|
1458
1486
|
"tags": [
|
|
@@ -664,6 +664,18 @@ export interface OpenWebViewOptions {
|
|
|
664
664
|
* @since 8.6.36
|
|
665
665
|
*/
|
|
666
666
|
persistWebViewData?: boolean;
|
|
667
|
+
/**
|
|
668
|
+
* Controls Android TLS client certificate prompts during HTTPS handshakes.
|
|
669
|
+
* Use `prompt` to show the system certificate picker; omit or use `none` to cancel silently (default).
|
|
670
|
+
*
|
|
671
|
+
* @default "none"
|
|
672
|
+
* @since 8.7.5
|
|
673
|
+
*/
|
|
674
|
+
clientCertificate?: 'none' | 'prompt';
|
|
675
|
+
/**
|
|
676
|
+
* @deprecated Use `clientCertificate: "prompt"` instead.
|
|
677
|
+
*/
|
|
678
|
+
clientCertificatePrompt?: boolean;
|
|
667
679
|
/**
|
|
668
680
|
* Automatically handles downloads triggered inside the webview without requiring a custom JavaScript bridge.
|
|
669
681
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAmEA,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;AAED,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,mCAAe,CAAA;IACf;;OAEG;IACH,iDAA6B,CAAA;AAC/B,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface UrlEvent {\n /**\n * Webview instance id.\n */\n id?: string;\n /**\n * Emit when the url changes\n *\n * @since 0.0.1\n */\n url: string;\n}\n\n/**\n * Event emitted when the managed webview intercepts a non-standard custom scheme\n * and hands it to the operating system.\n *\n * Standard OS-handled schemes such as `tel:`, `mailto:`, and `sms:` are excluded.\n *\n * @since 8.6.7\n */\nexport interface CustomSchemeInterceptedEvent {\n /**\n * Webview instance id.\n */\n id?: string;\n /**\n * Intercepted URL.\n */\n url: string;\n /**\n * Whether the operating system accepted the URL handoff.\n */\n opened: boolean;\n}\nexport interface BtnEvent {\n /**\n * Webview instance id.\n */\n id?: string;\n /**\n * Emit when a button is clicked.\n *\n * @since 0.0.1\n */\n url: string;\n}\n\nexport interface ButtonNearDoneEvent {\n /**\n * Webview instance id.\n *\n * @since 8.6.36\n */\n id: string;\n}\n\nexport type UrlChangeListener = (state: UrlEvent) => void;\nexport type ConfirmBtnListener = (state: BtnEvent) => void;\nexport type ButtonNearListener = (state: ButtonNearDoneEvent) => void;\nexport type CustomSchemeInterceptedListener = (state: CustomSchemeInterceptedEvent) => void;\n\nexport type WebViewPointerInputEventType = 'click' | 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel';\nexport type WebViewInputEventType = WebViewPointerInputEventType | 'scroll';\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 enum InvisibilityMode {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n AWARE = 'AWARE',\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n FAKE_VISIBLE = 'FAKE_VISIBLE',\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 /**\n * Target webview id.\n * When omitted, applies to all open webviews.\n */\n id?: string;\n url: string;\n}\n\nexport interface Credentials {\n username: string;\n password: string;\n}\n\nexport interface LayerOptions {\n /**\n * Target webview id. If omitted, targets the active webview.\n */\n id?: string;\n /**\n * Makes the Capacitor host WebView transparent while this native webview is behind it.\n *\n * @default true\n */\n transparentBackground?: boolean;\n}\n\nexport interface DispatchPointerInputEventOptions {\n /**\n * Target webview id. If omitted, targets the active webview.\n */\n id?: string;\n /**\n * Input event to dispatch to the webview.\n */\n type: WebViewPointerInputEventType;\n /**\n * X coordinate in CSS pixels from the webview's left edge.\n */\n x: number;\n /**\n * Y coordinate in CSS pixels from the webview's top edge.\n */\n y: number;\n}\n\nexport interface DispatchScrollInputEventOptions {\n /**\n * Target webview id. If omitted, targets the active webview.\n */\n id?: string;\n /**\n * Input event to dispatch to the webview.\n */\n type: 'scroll';\n /**\n * X coordinate in CSS pixels from the webview's left edge.\n */\n x: number;\n /**\n * Y coordinate in CSS pixels from the webview's top edge.\n */\n y: number;\n /**\n * Horizontal scroll delta in CSS pixels. Used when `type` is `scroll`.\n */\n deltaX: number;\n /**\n * Vertical scroll delta in CSS pixels. Used when `type` is `scroll`.\n */\n deltaY: number;\n}\n\nexport type DispatchInputEventOptions = DispatchPointerInputEventOptions | DispatchScrollInputEventOptions;\n\n/**\n * Represents an intercepted HTTP request from the in-app browser webview.\n *\n * Request and response bodies are base64-encoded when present.\n *\n * @since 8.6.0\n */\nexport interface ProxyRequest {\n requestId: string;\n phase: 'outbound' | 'inbound';\n url: string;\n method: string;\n headers: Record<string, string>;\n body: string | null;\n status?: number;\n responseHeaders?: Record<string, string>;\n responseBody?: string | null;\n webviewId: string;\n}\n\n/**\n * Response payload returned to native for a proxied request.\n *\n * The body must be base64-encoded.\n *\n * @since 8.6.0\n */\nexport interface ProxyResponse {\n body: string;\n status: number;\n headers: Record<string, string>;\n}\n\n/**\n * Request override returned to native for an outbound proxied request.\n *\n * The body must be base64-encoded when present.\n *\n * @since 8.6.0\n */\nexport interface ProxyRequestOverride {\n url: string;\n method?: string;\n headers?: Record<string, string>;\n body?: string | null;\n}\n\n/**\n * Event emitted when a web page opens a popup/new window.\n *\n * @since 8.6.0\n */\nexport interface PopupWindowEvent {\n /**\n * Popup webview instance id.\n */\n id: string;\n /**\n * Parent webview instance id.\n */\n parentId?: string;\n /**\n * Requested popup URL when available.\n */\n url?: string;\n /**\n * Whether the popup was presented immediately.\n */\n visible: boolean;\n}\n\n/**\n * Event emitted when JavaScript running inside the managed webview writes to the console.\n *\n * Enable this with `captureConsoleLogs: true` when opening the webview.\n *\n * @since 8.6.0\n */\nexport interface ConsoleMessageEvent {\n /**\n * Source webview instance id.\n */\n id?: string;\n /**\n * Console method or normalized severity.\n */\n level: 'log' | 'info' | 'warn' | 'error' | 'debug' | 'assert' | string;\n /**\n * Joined string representation of the console arguments.\n */\n message: string;\n /**\n * Script URL or page URL when available.\n */\n source?: string;\n /**\n * 1-based line number when available.\n */\n line?: number;\n /**\n * 1-based column number when available.\n */\n column?: number;\n /**\n * Optional subtype for runtime-originated errors on supported platforms.\n */\n kind?: string;\n}\n\n/**\n * Native handling mode used after a managed download finishes.\n *\n * @since 8.6.0\n */\nexport type DownloadHandledBy = 'inAppBrowser' | 'systemPreview' | 'external';\n\n/**\n * Event emitted after a managed download is saved locally.\n *\n * @since 8.6.0\n */\nexport interface DownloadCompletedEvent {\n /**\n * Source webview instance id.\n */\n id?: string;\n /**\n * Original URL that triggered the download when available.\n */\n sourceUrl?: string;\n /**\n * Saved filename.\n */\n fileName: string;\n /**\n * Resolved MIME type when available.\n */\n mimeType?: string;\n /**\n * Absolute native filesystem path to the saved file.\n */\n path: string;\n /**\n * `file://` URL pointing at the saved file.\n */\n localUrl: string;\n /**\n * How native handled the downloaded file after saving it.\n */\n handledBy: DownloadHandledBy;\n}\n\n/**\n * Event emitted when managed download handling fails.\n *\n * @since 8.6.0\n */\nexport interface DownloadFailedEvent {\n /**\n * Source webview instance id.\n */\n id?: string;\n /**\n * Original URL that triggered the download when available.\n */\n sourceUrl?: string;\n /**\n * Intended filename when known.\n */\n fileName?: string;\n /**\n * Resolved MIME type when available.\n */\n mimeType?: string;\n /**\n * Native error message.\n */\n error: string;\n}\n\n/**\n * Decision returned to native when handling a proxied request.\n *\n * @since 8.6.0\n */\nexport interface ProxyDecision {\n request?: ProxyRequestOverride | null;\n response?: ProxyResponse | null;\n cancel?: boolean;\n}\n\n/**\n * Native-first proxy rule used on Android and iOS.\n *\n * Any regex property that is omitted is treated as a wildcard.\n *\n * @since 8.6.0\n */\nexport interface NativeProxyRule {\n id?: string;\n urlRegex?: string;\n methodRegex?: string;\n headerRegex?: string;\n bodyRegex?: string;\n statusRegex?: string;\n responseHeaderRegex?: string;\n responseBodyRegex?: string;\n mainFrameOnly?: boolean;\n action: 'continue' | 'cancel' | 'delegateToJs';\n}\n\nexport type ProxyHandlerResult = Response | ProxyResponse | ProxyRequestOverride | ProxyDecision | null;\n\n/**\n * JavaScript callback used to handle proxied requests.\n *\n * Return a `Response`, `ProxyResponse`, `ProxyRequestOverride`, `ProxyDecision`,\n * or `null` to let native continue unchanged.\n *\n * @since 8.6.0\n */\nexport type ProxyHandler = (request: ProxyRequest) => ProxyHandlerResult | Promise<ProxyHandlerResult>;\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 // --- Chrome Custom Tab customization (Android only, ignored on iOS) ---\n\n /**\n * Toolbar background color in hex format (e.g., \"#1A1A2E\").\n * Applied to both light and dark color schemes.\n * Also sets the navigation bar color to match.\n * **Android only** — ignored on iOS.\n * @since 8.2.0\n */\n toolbarColor?: string;\n\n /**\n * Whether the URL bar should auto-hide when the user scrolls down.\n * The bar reappears on any upward scroll.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n urlBarHidingEnabled?: boolean;\n\n /**\n * Show the page's HTML <title> in the toolbar instead of the raw URL.\n * The true URL is still visible when the user taps the title area.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n showTitle?: boolean;\n\n /**\n * Replace the default \"X\" close icon with a back arrow.\n * Makes the Custom Tab feel like a native navigation push rather than a modal overlay.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n showArrow?: boolean;\n\n /**\n * Remove the share action from the overflow menu.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n disableShare?: boolean;\n\n /**\n * Hide the bookmark star icon in the overflow menu.\n * Uses an undocumented Chromium intent extra — may stop working on future Chrome updates.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n disableBookmark?: boolean;\n\n /**\n * Hide the download icon in the overflow menu.\n * Uses an undocumented Chromium intent extra — may stop working on future Chrome updates.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n disableDownload?: boolean;\n}\n\nexport interface OpenSecureWindowOptions {\n /**\n * The endpoint to open\n */\n authEndpoint: string;\n /**\n * The redirect URI to use for the openSecureWindow call.\n * This will be checked to make sure it matches the redirect URI after the window finishes the redirection.\n */\n redirectUri: string;\n /**\n * The name of the broadcast channel to listen to, relevant only for web\n */\n broadcastChannelName?: string;\n /**\n * If true, the browser session will be ephemeral (no cookies or browsing data are shared with the system browser).\n * On iOS, this sets `prefersEphemeralWebBrowserSession = true` on `ASWebAuthenticationSession`.\n * On Android, this enables Custom Tabs ephemeral browsing via `setEphemeralBrowsingEnabled(true)`.\n * @default false\n * @since 6.6.0\n */\n prefersEphemeralWebBrowserSession?: boolean;\n}\n\nexport interface OpenSecureWindowResponse {\n /**\n * The result of the openSecureWindow call\n */\n redirectedUri: string;\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 ScreenshotResult {\n /**\n * Image format used for the screenshot.\n */\n format: 'png';\n /**\n * MIME type of the generated screenshot.\n */\n mimeType: 'image/png';\n /**\n * Base64-encoded screenshot payload without the data URL prefix.\n */\n base64: string;\n /**\n * Data URL for direct use in HTML img tags or uploads.\n */\n dataUrl: string;\n /**\n * Screenshot width in pixels.\n */\n width: number;\n /**\n * Screenshot height in pixels.\n */\n height: number;\n}\n\nexport interface CloseWebviewOptions {\n /**\n * Target webview id to close. If omitted, closes the active webview.\n */\n id?: string;\n /**\n * Whether the webview closing is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\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 * HTTP method to use for the initial request.\n *\n * **Optional parameter - defaults to GET if not specified.**\n * Existing code that doesn't provide this parameter will continue to work unchanged with standard GET requests.\n *\n * When specified with 'POST', 'PUT', or 'PATCH' methods that support a body,\n * you can also provide a `body` parameter with the request payload.\n *\n * **Platform Notes:**\n * - iOS: Full support for all HTTP methods with headers\n * - Android: Custom headers may not be sent with POST/PUT/PATCH requests due to WebView limitations\n *\n * @since 8.2.0\n * @default \"GET\"\n * @example\n * method: \"POST\",\n * body: JSON.stringify({ token: \"auth-token\", data: \"value\" }),\n * headers: { \"Content-Type\": \"application/json\" }\n */\n method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | string;\n /**\n * HTTP body to send with the request when using POST, PUT, or other methods that support a body.\n * Should be a string (use JSON.stringify for JSON data).\n *\n * **Optional parameter - only used when `method` is specified and supports a request body.**\n * Omitting this parameter (or using GET method) results in standard behavior without a request body.\n *\n * @since 8.2.0\n * @example\n * method: \"POST\",\n * body: JSON.stringify({ username: \"user\", password: \"pass\" }),\n * headers: { \"Content-Type\": \"application/json\" }\n */\n body?: string;\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 * - `window.mobileApp.hide()` / `window.mobileApp.show()` when allowWebViewJsVisibilityControl is true in CapacitorConfig\n * - `window.mobileApp.takeScreenshot()` when `allowScreenshotsFromWebPage` is true\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 * Allows page JavaScript to call `window.mobileApp.takeScreenshot()`.\n * Disabled by default so only the host app can trigger native screenshots through the plugin API.\n *\n * @default false\n * @since 8.4.0\n */\n allowScreenshotsFromWebPage?: boolean;\n /**\n * Emits `consoleMessage` events for JavaScript `console.*` output coming from the managed page.\n * Useful when the webview stays hidden and you still need page-level diagnostics.\n *\n * @default false\n * @since 8.6.0\n */\n captureConsoleLogs?: boolean;\n /**\n * Controls whether the webview should persist website data such as cache, cookies, local storage,\n * IndexedDB, and session data.\n *\n * When false, iOS uses a non-persistent `WKWebsiteDataStore`. Android disables per-view cache and\n * DOM/database storage where the system WebView supports it. Android cookies use the shared\n * WebView cookie store, so call `clearAllBrowsingData()` to remove cookies and other global data.\n *\n * @default true\n * @since 8.6.36\n */\n persistWebViewData?: boolean;\n /**\n * Automatically handles downloads triggered inside the webview without requiring a custom JavaScript bridge.\n *\n * When 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.\n *\n * @default false\n * @since 8.6.0\n */\n handleDownloads?: boolean;\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, enables native navigation gestures within the webview.\n * - Android: Native back button navigates within webview history\n * - iOS: Enables swipe left/right gestures for back/forward navigation\n * @default false (Android), true (iOS - enabled by default)\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 * Promise timing: on Android, `openWebView()` resolves with the webview id when the webview is ready to be controlled\n * (immediately for hidden/immediate presentation, after the first page load when `isPresentAfterPageLoad` is `true`).\n * On iOS, the promise resolves with the id as soon as the native webview is created, even if presentation is deferred.\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 * closeModalURLPattern: a regex pattern to match against the current URL when the close button is pressed.\n * When provided along with closeModal: true, the close confirmation modal is only shown if the current URL matches this pattern.\n * If the current URL does not match, the browser closes immediately without showing the modal.\n * Requires closeModal to be true.\n * @since 7.2.0\n * @example\n * closeModal: true,\n * closeModalURLPattern: \".*checkout.*\"\n */\n closeModalURLPattern?: 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 * preShowScriptInjectionTime: controls when the preShowScript is injected.\n * - \"documentStart\": injects before any page JavaScript runs (good for polyfills like Firebase)\n * - \"pageLoad\": injects after page load (default, original behavior)\n * @since 7.26.0\n * @default \"pageLoad\"\n * @example\n * preShowScriptInjectionTime: \"documentStart\"\n */\n preShowScriptInjectionTime?: 'documentStart' | 'pageLoad';\n /**\n * Proxy interception mode.\n *\n * - `true`: legacy blanket mode, delegates all HTTP/HTTPS requests to JavaScript.\n * - `string`: Android-only regex mode kept for backward compatibility.\n *\n * Prefer `outboundProxyRules` and `inboundProxyRules` for native-first matching.\n *\n * @since 6.9.0\n */\n proxyRequests?: boolean | string;\n /**\n * Native-first outbound proxy rules.\n *\n * @since 8.6.0\n */\n outboundProxyRules?: NativeProxyRule[];\n /**\n * Native-first inbound proxy rules.\n *\n * @since 8.6.0\n */\n inboundProxyRules?: NativeProxyRule[];\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 * Shows a native screenshot button near the done/close button.\n * The button is hidden by default and captures the current viewport when tapped.\n * This option uses the same toolbar slot as `buttonNearDone` and is therefore incompatible with it.\n * The button is only shown when toolbarType is not \"activity\", \"navigation\", or \"blank\".\n *\n * @default false\n * @since 8.4.0\n */\n showScreenshotButton?: boolean;\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 * enableZoom: enables pinch-to-zoom gestures in the Android WebView.\n * When true, built-in zoom controls are enabled and the zoom buttons are hidden.\n * **Android only** — ignored on iOS where zoom is enabled by default.\n * @since 8.5.0\n * @default false\n * @example\n * enableZoom: true\n */\n enableZoom?: boolean;\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 * When true, HTTP and HTTPS links opened from `target=\"_blank\"` anchors stay in the current webview instead of spawning a popup or opening in the system browser.\n * By default, blank-target HTTP(S) links stay inside the plugin as managed popups that share cookies with the opener; enabling this option keeps everything in the same tab.\n * Custom schemes such as `tel:` and `mailto:` and authorized app links still prefer their native handlers unless `preventDeeplink` is enabled.\n *\n * @since 8.5.6\n * @default false\n * @example\n * openBlankTargetInWebView: true\n */\n openBlankTargetInWebView?: boolean;\n\n /**\n * List of base URLs whose hosts are treated as authorized App Links (Android) and Universal Links (iOS).\n *\n * - On both platforms, only HTTPS links whose host matches any entry in this list\n * will attempt to open via the corresponding native application.\n * - If the app is not installed or the system cannot handle the link, the URL\n * will continue loading inside the in-app browser.\n * - Matching is host-based (case-insensitive), ignoring the \"www.\" prefix.\n * - When `preventDeeplink` is enabled, all external handling is blocked regardless of this list.\n *\n * @example\n * ```ts\n * [\"https://example.com\", \"https://subdomain.app.io\"]\n * ```\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 * If false, the webView will extend behind the status bar for true full-screen immersive content.\n * When true (default), respects the safe area at the top of the screen.\n * Works independently of toolbarType - use for full-screen video players, games, or immersive web apps.\n * @since 8.2.0\n * @default true\n * @example\n * enabledSafeTopMargin: false // Full screen, extends behind status bar\n */\n enabledSafeTopMargin?: boolean;\n\n /**\n * When true, applies the system status bar inset as the WebView top margin on Android.\n * Keeps the legacy 0px margin by default for apps that handle padding themselves.\n * @default false\n * @example\n * useTopInset: true\n */\n useTopInset?: 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 /**\n * Opens popup windows created by the page in hidden mode.\n * Hidden popup windows can still be controlled with `executeScript`, `postMessage`, `show`, and `close`.\n * Listen to `popupWindowOpened` to capture the popup id, then call `show({ id })` only if you want to reveal it.\n *\n * @default false\n * @since 8.6.0\n * @example\n * hiddenPopupWindow: true\n */\n hiddenPopupWindow?: boolean;\n\n /**\n * blockedHosts: List of host patterns that should be blocked from loading in the InAppBrowser's internal navigations.\n * Any request inside WebView to a URL with a host matching any of these patterns will be blocked.\n * Supports wildcard patterns like:\n * - \"*.example.com\" to block all subdomains\n * - \"www.example.*\" to block wildcard domain extensions\n *\n * @since 7.17.0\n * @default []\n * @example\n * blockedHosts: [\"*.tracking.com\", \"ads.example.com\"]\n */\n blockedHosts?: string[];\n\n /**\n * Width of the webview in pixels.\n * If not set, webview will be fullscreen width.\n * @default undefined (fullscreen)\n * @example\n * width: 400\n */\n width?: number;\n\n /**\n * Height of the webview in pixels.\n * If not set, webview will be fullscreen height.\n * @default undefined (fullscreen)\n * @example\n * height: 600\n */\n height?: number;\n\n /**\n * X position of the webview in pixels from the left edge.\n * Only effective when width is set.\n * @default 0\n * @example\n * x: 50\n */\n x?: number;\n\n /**\n * Y position of the webview in pixels from the top edge.\n * Only effective when height is set.\n * @default 0\n * @example\n * y: 100\n */\n y?: number;\n\n /**\n * Places the native browser behind the Capacitor host WebView.\n * Make the app background transparent to reveal it, or rely on `transparentBackground` to clear the host WebView.\n *\n * @default false\n */\n toBack?: boolean;\n\n /**\n * When `toBack` is true, makes the Capacitor host WebView transparent so the native browser can be seen behind Ionic content.\n * Ignored when the browser is in front.\n *\n * @default true\n */\n transparentBackground?: boolean;\n\n /**\n * Disables the bounce (overscroll) effect on iOS WebView.\n * When enabled, prevents the rubber band scrolling effect when users scroll beyond content boundaries.\n * This is useful for:\n * - Creating a more native, app-like experience\n * - Preventing accidental overscroll states\n * - Avoiding issues when keyboard opens/closes\n *\n * Note: This option only affects iOS. Android does not have this bounce effect by default.\n *\n * @since 8.0.2\n * @default false\n * @example\n * disableOverscroll: true\n */\n disableOverscroll?: boolean;\n\n /**\n * Opens the webview in hidden mode (not visible to user but fully functional).\n * When hidden, the webview loads and executes JavaScript but is not displayed.\n * All control methods (executeScript, postMessage, setUrl, etc.) work while hidden.\n * Use close() to clean up the hidden webview when done.\n *\n * @since 8.0.7\n * @default false\n * @example\n * hidden: true\n */\n hidden?: boolean;\n\n /**\n * Controls how a hidden webview reports its visibility and size.\n * - AWARE: webview is aware it's hidden (dimensions may be zero).\n * - FAKE_VISIBLE: webview is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n *\n * @default InvisibilityMode.AWARE\n * @example\n * invisibilityMode: InvisibilityMode.FAKE_VISIBLE\n */\n invisibilityMode?: InvisibilityMode;\n}\n\nexport interface DimensionOptions {\n /**\n * Width of the webview in pixels\n */\n width?: number;\n /**\n * Height of the webview in pixels\n */\n height?: number;\n /**\n * X position from the left edge in pixels\n */\n x?: number;\n /**\n * Y position from the top edge in pixels\n */\n y?: number;\n}\n\nexport interface InAppBrowserPlugin {\n /**\n * Navigates back in the WebView's history if possible\n *\n * @since 7.21.0\n * @returns Promise that resolves with true if navigation was possible, false otherwise\n */\n goBack(options?: { id?: string }): Promise<{ canGoBack: boolean }>;\n\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 * When `id` is omitted, applies to all open webviews.\n *\n * @since 0.5.0\n */\n clearCookies(options: ClearCookieOptions): Promise<any>;\n /**\n * Clear all cookies\n * When `id` is omitted, applies to all open webviews.\n *\n * @since 6.5.0\n */\n clearAllCookies(options?: { id?: string }): Promise<any>;\n\n /**\n * Clear cache\n * When `id` is omitted, applies to all open webviews.\n *\n * @since 6.5.0\n */\n clearCache(options?: { id?: string }): Promise<any>;\n\n /**\n * Clear all browsing data from the default store and any opened managed webviews.\n *\n * This removes cookies, disk cache, memory cache, local storage, session storage, IndexedDB,\n * WebSQL where supported, form data, and HTTP auth data where the platform exposes it.\n *\n * @since 8.6.36\n */\n clearAllBrowsingData(): 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 * When `id` is omitted, closes the active webview.\n */\n close(options?: CloseWebviewOptions): Promise<any>;\n /**\n * Hide the webview without closing it.\n * Use show() to bring it back.\n * When `id` is omitted, targets the active webview.\n *\n * @since 8.0.8\n */\n hide(options?: { id?: string }): Promise<void>;\n /**\n * Show a previously hidden webview.\n * When `id` is omitted, targets the active webview.\n *\n * @since 8.0.8\n */\n show(options?: { id?: string }): Promise<void>;\n /**\n * Moves the native browser behind the Capacitor host WebView.\n * Use `dispatchInputEvent()` to forward overlay gestures to the browser while it is behind the app UI.\n */\n sendToBack(options?: LayerOptions): Promise<void>;\n /**\n * Moves a browser that was behind the host WebView back to the front.\n * When `id` is omitted, targets the active webview.\n */\n bringToFront(options?: { id?: string }): Promise<void>;\n /**\n * Dispatches a click, touch, or scroll event to a managed browser.\n * Coordinates are relative to the browser viewport in CSS pixels.\n */\n dispatchInputEvent(options: DispatchInputEventOptions): Promise<void>;\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 * - `window.mobileApp.takeScreenshot()` when `allowScreenshotsFromWebPage` is true\n *\n * Promise timing differs by platform when `isPresentAfterPageLoad` is used.\n * Android resolves with `{ id }` after the dialog is ready to control, while iOS resolves with `{ id }` immediately after creating the native webview.\n *\n * @returns Promise that resolves with the created webview id.\n * @since 0.1.0\n */\n openWebView(options: OpenWebViewOptions): Promise<{ id: string }>;\n /**\n * Injects JavaScript code into the InAppBrowser window.\n * When `id` is omitted, executes in all open webviews.\n */\n executeScript(options: { code: string; id?: 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 * When `id` is omitted, broadcasts to all open webviews.\n */\n postMessage(options: { detail: Record<string, any>; id?: string }): Promise<void>;\n /**\n * Captures the current webview viewport as a PNG screenshot.\n * When `id` is omitted, targets the active webview.\n */\n takeScreenshot(options?: { id?: string }): Promise<ScreenshotResult>;\n /**\n * Sets the URL of the webview.\n * When `id` is omitted, targets the active webview.\n */\n setUrl(options: { url: string; id?: string }): Promise<any>;\n /**\n * Listen for url change, only for openWebView\n *\n * @since 0.0.1\n */\n addListener(eventName: 'urlChangeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n\n /**\n * Listen for buttonNearDone clicks.\n *\n * The event payload contains the webview `id`.\n *\n * @since 0.0.1\n */\n addListener(eventName: 'buttonNearDoneClick', listenerFunc: ButtonNearListener): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(eventName: 'closeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required,\n * works with openWebView shareDisclaimer and closeModal\n *\n * @since 0.0.1\n */\n addListener(eventName: 'confirmBtnClicked', listenerFunc: ConfirmBtnListener): 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: { id?: string; detail?: Record<string, any>; rawMessage?: string }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered whenever a screenshot is captured from the plugin API,\n * the native screenshot button, or the injected JavaScript bridge.\n */\n addListener(\n eventName: 'screenshotTaken',\n listenerFunc: (event: ScreenshotResult & { id?: string }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page is loaded\n */\n addListener(\n eventName: 'browserPageLoaded',\n listenerFunc: (event: { id?: string }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(\n eventName: 'pageLoadError',\n listenerFunc: (event: { id?: string }) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when the webview intercepts a non-standard custom scheme\n * and hands it to the operating system.\n *\n * Standard OS-handled schemes such as `tel:`, `mailto:`, and `sms:` are excluded.\n *\n * @since 8.6.7\n */\n addListener(\n eventName: 'customSchemeIntercepted',\n listenerFunc: CustomSchemeInterceptedListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered after native download handling saves a file locally.\n * Enable this with `handleDownloads: true` when opening the webview.\n *\n * @since 8.6.0\n */\n addListener(\n eventName: 'downloadCompleted',\n listenerFunc: (event: DownloadCompletedEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when native download handling fails.\n * Enable this with `handleDownloads: true` when opening the webview.\n *\n * @since 8.6.0\n */\n addListener(\n eventName: 'downloadFailed',\n listenerFunc: (event: DownloadFailedEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered whenever a page opens a popup/new window.\n * Use the returned popup id with `executeScript`, `postMessage`, `show`, `hide`, and `close`.\n *\n * @since 8.6.0\n */\n addListener(\n eventName: 'popupWindowOpened',\n listenerFunc: (event: PopupWindowEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Listen for proxied requests delegated by the native runtime.\n * Prefer `addProxyHandler()` instead of calling this directly.\n *\n * @since 8.6.0\n */\n addListener(eventName: 'proxyRequest', listenerFunc: (event: ProxyRequest) => void): Promise<PluginListenerHandle>;\n /**\n * Listen for JavaScript console output emitted by the managed page.\n * Enable this with `captureConsoleLogs: true` when opening the webview.\n *\n * @since 8.6.0\n */\n addListener(\n eventName: 'consoleMessage',\n listenerFunc: (event: ConsoleMessageEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Internal method used by `addProxyHandler()` to send a proxy decision back to native.\n * Forward the original `phase` when replying to a manual `proxyRequest` listener.\n *\n * @since 8.6.0\n */\n handleProxyRequest(options: {\n requestId: string;\n decision?: ProxyDecision | null;\n response?: ProxyResponse | null;\n webviewId?: string;\n phase?: 'outbound' | 'inbound';\n }): Promise<void>;\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(options?: { id?: string }): Promise<any>;\n\n /**\n * Update the dimensions of the webview.\n * Allows changing the size and position of the webview at runtime.\n * When `id` is omitted, targets the active webview.\n *\n * @param options Dimension options (width, height, x, y)\n * @returns Promise that resolves when dimensions are updated\n */\n updateDimensions(options: DimensionOptions & { id?: string }): Promise<void>;\n\n /**\n * Sets the enabled safe top margin of the webview at runtime.\n * When `id` is omitted, targets the active webview.\n * On Web, this method is a no-op and resolves without changing layout.\n */\n setEnabledSafeTopMargin(options: { enabled: boolean; id?: string }): Promise<void>;\n\n /**\n * Sets the enabled safe bottom margin of the webview at runtime.\n * When `id` is omitted, targets the active webview.\n * On Web, this method is a no-op and resolves without changing layout.\n */\n setEnabledSafeBottomMargin(options: { enabled: boolean; id?: string }): Promise<void>;\n\n /**\n * Opens a secured window for OAuth2 authentication.\n * For web, you should have the code in the redirected page to use a broadcast channel to send the redirected url to the app\n * Something like:\n * ```html\n * <html>\n * <head></head>\n * <body>\n * <script>\n * const searchParams = new URLSearchParams(location.search)\n * if (searchParams.has(\"code\")) {\n * new BroadcastChannel(\"my-channel-name\").postMessage(location.href);\n * window.close();\n * }\n * </script>\n * </body>\n * </html>\n * ```\n * For mobile, you should have a redirect uri that opens the app, something like: `myapp://oauth_callback/`\n * And make sure to register it in the app's info.plist:\n * ```xml\n * <key>CFBundleURLTypes</key>\n * <array>\n * <dict>\n * <key>CFBundleURLSchemes</key>\n * <array>\n * <string>myapp</string>\n * </array>\n * </dict>\n * </array>\n * ```\n * And in the AndroidManifest.xml file:\n * ```xml\n * <activity>\n * <intent-filter>\n * <action android:name=\"android.intent.action.VIEW\" />\n * <category android:name=\"android.intent.category.DEFAULT\" />\n * <category android:name=\"android.intent.category.BROWSABLE\" />\n * <data android:host=\"oauth_callback\" android:scheme=\"myapp\" />\n * </intent-filter>\n * </activity>\n * ```\n * @param options - the options for the openSecureWindow call\n */\n openSecureWindow(options: OpenSecureWindowOptions): Promise<OpenSecureWindowResponse>;\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 * Hide the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)\n *\n * @since 8.0.8\n */\n hide(): void;\n\n /**\n * Show the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)\n *\n * @since 8.0.8\n */\n show(): void;\n\n /**\n * Capture the current WebView viewport as a PNG screenshot.\n * Requires `allowScreenshotsFromWebPage` to be enabled when opening the webview.\n *\n * @since 8.4.0\n */\n takeScreenshot(): Promise<ScreenshotResult>;\n };\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAmEA,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;AAED,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,mCAAe,CAAA;IACf;;OAEG;IACH,iDAA6B,CAAA;AAC/B,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface UrlEvent {\n /**\n * Webview instance id.\n */\n id?: string;\n /**\n * Emit when the url changes\n *\n * @since 0.0.1\n */\n url: string;\n}\n\n/**\n * Event emitted when the managed webview intercepts a non-standard custom scheme\n * and hands it to the operating system.\n *\n * Standard OS-handled schemes such as `tel:`, `mailto:`, and `sms:` are excluded.\n *\n * @since 8.6.7\n */\nexport interface CustomSchemeInterceptedEvent {\n /**\n * Webview instance id.\n */\n id?: string;\n /**\n * Intercepted URL.\n */\n url: string;\n /**\n * Whether the operating system accepted the URL handoff.\n */\n opened: boolean;\n}\nexport interface BtnEvent {\n /**\n * Webview instance id.\n */\n id?: string;\n /**\n * Emit when a button is clicked.\n *\n * @since 0.0.1\n */\n url: string;\n}\n\nexport interface ButtonNearDoneEvent {\n /**\n * Webview instance id.\n *\n * @since 8.6.36\n */\n id: string;\n}\n\nexport type UrlChangeListener = (state: UrlEvent) => void;\nexport type ConfirmBtnListener = (state: BtnEvent) => void;\nexport type ButtonNearListener = (state: ButtonNearDoneEvent) => void;\nexport type CustomSchemeInterceptedListener = (state: CustomSchemeInterceptedEvent) => void;\n\nexport type WebViewPointerInputEventType = 'click' | 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel';\nexport type WebViewInputEventType = WebViewPointerInputEventType | 'scroll';\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 enum InvisibilityMode {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n AWARE = 'AWARE',\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n FAKE_VISIBLE = 'FAKE_VISIBLE',\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 /**\n * Target webview id.\n * When omitted, applies to all open webviews.\n */\n id?: string;\n url: string;\n}\n\nexport interface Credentials {\n username: string;\n password: string;\n}\n\nexport interface LayerOptions {\n /**\n * Target webview id. If omitted, targets the active webview.\n */\n id?: string;\n /**\n * Makes the Capacitor host WebView transparent while this native webview is behind it.\n *\n * @default true\n */\n transparentBackground?: boolean;\n}\n\nexport interface DispatchPointerInputEventOptions {\n /**\n * Target webview id. If omitted, targets the active webview.\n */\n id?: string;\n /**\n * Input event to dispatch to the webview.\n */\n type: WebViewPointerInputEventType;\n /**\n * X coordinate in CSS pixels from the webview's left edge.\n */\n x: number;\n /**\n * Y coordinate in CSS pixels from the webview's top edge.\n */\n y: number;\n}\n\nexport interface DispatchScrollInputEventOptions {\n /**\n * Target webview id. If omitted, targets the active webview.\n */\n id?: string;\n /**\n * Input event to dispatch to the webview.\n */\n type: 'scroll';\n /**\n * X coordinate in CSS pixels from the webview's left edge.\n */\n x: number;\n /**\n * Y coordinate in CSS pixels from the webview's top edge.\n */\n y: number;\n /**\n * Horizontal scroll delta in CSS pixels. Used when `type` is `scroll`.\n */\n deltaX: number;\n /**\n * Vertical scroll delta in CSS pixels. Used when `type` is `scroll`.\n */\n deltaY: number;\n}\n\nexport type DispatchInputEventOptions = DispatchPointerInputEventOptions | DispatchScrollInputEventOptions;\n\n/**\n * Represents an intercepted HTTP request from the in-app browser webview.\n *\n * Request and response bodies are base64-encoded when present.\n *\n * @since 8.6.0\n */\nexport interface ProxyRequest {\n requestId: string;\n phase: 'outbound' | 'inbound';\n url: string;\n method: string;\n headers: Record<string, string>;\n body: string | null;\n status?: number;\n responseHeaders?: Record<string, string>;\n responseBody?: string | null;\n webviewId: string;\n}\n\n/**\n * Response payload returned to native for a proxied request.\n *\n * The body must be base64-encoded.\n *\n * @since 8.6.0\n */\nexport interface ProxyResponse {\n body: string;\n status: number;\n headers: Record<string, string>;\n}\n\n/**\n * Request override returned to native for an outbound proxied request.\n *\n * The body must be base64-encoded when present.\n *\n * @since 8.6.0\n */\nexport interface ProxyRequestOverride {\n url: string;\n method?: string;\n headers?: Record<string, string>;\n body?: string | null;\n}\n\n/**\n * Event emitted when a web page opens a popup/new window.\n *\n * @since 8.6.0\n */\nexport interface PopupWindowEvent {\n /**\n * Popup webview instance id.\n */\n id: string;\n /**\n * Parent webview instance id.\n */\n parentId?: string;\n /**\n * Requested popup URL when available.\n */\n url?: string;\n /**\n * Whether the popup was presented immediately.\n */\n visible: boolean;\n}\n\n/**\n * Event emitted when JavaScript running inside the managed webview writes to the console.\n *\n * Enable this with `captureConsoleLogs: true` when opening the webview.\n *\n * @since 8.6.0\n */\nexport interface ConsoleMessageEvent {\n /**\n * Source webview instance id.\n */\n id?: string;\n /**\n * Console method or normalized severity.\n */\n level: 'log' | 'info' | 'warn' | 'error' | 'debug' | 'assert' | string;\n /**\n * Joined string representation of the console arguments.\n */\n message: string;\n /**\n * Script URL or page URL when available.\n */\n source?: string;\n /**\n * 1-based line number when available.\n */\n line?: number;\n /**\n * 1-based column number when available.\n */\n column?: number;\n /**\n * Optional subtype for runtime-originated errors on supported platforms.\n */\n kind?: string;\n}\n\n/**\n * Native handling mode used after a managed download finishes.\n *\n * @since 8.6.0\n */\nexport type DownloadHandledBy = 'inAppBrowser' | 'systemPreview' | 'external';\n\n/**\n * Event emitted after a managed download is saved locally.\n *\n * @since 8.6.0\n */\nexport interface DownloadCompletedEvent {\n /**\n * Source webview instance id.\n */\n id?: string;\n /**\n * Original URL that triggered the download when available.\n */\n sourceUrl?: string;\n /**\n * Saved filename.\n */\n fileName: string;\n /**\n * Resolved MIME type when available.\n */\n mimeType?: string;\n /**\n * Absolute native filesystem path to the saved file.\n */\n path: string;\n /**\n * `file://` URL pointing at the saved file.\n */\n localUrl: string;\n /**\n * How native handled the downloaded file after saving it.\n */\n handledBy: DownloadHandledBy;\n}\n\n/**\n * Event emitted when managed download handling fails.\n *\n * @since 8.6.0\n */\nexport interface DownloadFailedEvent {\n /**\n * Source webview instance id.\n */\n id?: string;\n /**\n * Original URL that triggered the download when available.\n */\n sourceUrl?: string;\n /**\n * Intended filename when known.\n */\n fileName?: string;\n /**\n * Resolved MIME type when available.\n */\n mimeType?: string;\n /**\n * Native error message.\n */\n error: string;\n}\n\n/**\n * Decision returned to native when handling a proxied request.\n *\n * @since 8.6.0\n */\nexport interface ProxyDecision {\n request?: ProxyRequestOverride | null;\n response?: ProxyResponse | null;\n cancel?: boolean;\n}\n\n/**\n * Native-first proxy rule used on Android and iOS.\n *\n * Any regex property that is omitted is treated as a wildcard.\n *\n * @since 8.6.0\n */\nexport interface NativeProxyRule {\n id?: string;\n urlRegex?: string;\n methodRegex?: string;\n headerRegex?: string;\n bodyRegex?: string;\n statusRegex?: string;\n responseHeaderRegex?: string;\n responseBodyRegex?: string;\n mainFrameOnly?: boolean;\n action: 'continue' | 'cancel' | 'delegateToJs';\n}\n\nexport type ProxyHandlerResult = Response | ProxyResponse | ProxyRequestOverride | ProxyDecision | null;\n\n/**\n * JavaScript callback used to handle proxied requests.\n *\n * Return a `Response`, `ProxyResponse`, `ProxyRequestOverride`, `ProxyDecision`,\n * or `null` to let native continue unchanged.\n *\n * @since 8.6.0\n */\nexport type ProxyHandler = (request: ProxyRequest) => ProxyHandlerResult | Promise<ProxyHandlerResult>;\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 // --- Chrome Custom Tab customization (Android only, ignored on iOS) ---\n\n /**\n * Toolbar background color in hex format (e.g., \"#1A1A2E\").\n * Applied to both light and dark color schemes.\n * Also sets the navigation bar color to match.\n * **Android only** — ignored on iOS.\n * @since 8.2.0\n */\n toolbarColor?: string;\n\n /**\n * Whether the URL bar should auto-hide when the user scrolls down.\n * The bar reappears on any upward scroll.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n urlBarHidingEnabled?: boolean;\n\n /**\n * Show the page's HTML <title> in the toolbar instead of the raw URL.\n * The true URL is still visible when the user taps the title area.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n showTitle?: boolean;\n\n /**\n * Replace the default \"X\" close icon with a back arrow.\n * Makes the Custom Tab feel like a native navigation push rather than a modal overlay.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n showArrow?: boolean;\n\n /**\n * Remove the share action from the overflow menu.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n disableShare?: boolean;\n\n /**\n * Hide the bookmark star icon in the overflow menu.\n * Uses an undocumented Chromium intent extra — may stop working on future Chrome updates.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n disableBookmark?: boolean;\n\n /**\n * Hide the download icon in the overflow menu.\n * Uses an undocumented Chromium intent extra — may stop working on future Chrome updates.\n * **Android only** — ignored on iOS.\n * @default false\n * @since 8.2.0\n */\n disableDownload?: boolean;\n}\n\nexport interface OpenSecureWindowOptions {\n /**\n * The endpoint to open\n */\n authEndpoint: string;\n /**\n * The redirect URI to use for the openSecureWindow call.\n * This will be checked to make sure it matches the redirect URI after the window finishes the redirection.\n */\n redirectUri: string;\n /**\n * The name of the broadcast channel to listen to, relevant only for web\n */\n broadcastChannelName?: string;\n /**\n * If true, the browser session will be ephemeral (no cookies or browsing data are shared with the system browser).\n * On iOS, this sets `prefersEphemeralWebBrowserSession = true` on `ASWebAuthenticationSession`.\n * On Android, this enables Custom Tabs ephemeral browsing via `setEphemeralBrowsingEnabled(true)`.\n * @default false\n * @since 6.6.0\n */\n prefersEphemeralWebBrowserSession?: boolean;\n}\n\nexport interface OpenSecureWindowResponse {\n /**\n * The result of the openSecureWindow call\n */\n redirectedUri: string;\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 ScreenshotResult {\n /**\n * Image format used for the screenshot.\n */\n format: 'png';\n /**\n * MIME type of the generated screenshot.\n */\n mimeType: 'image/png';\n /**\n * Base64-encoded screenshot payload without the data URL prefix.\n */\n base64: string;\n /**\n * Data URL for direct use in HTML img tags or uploads.\n */\n dataUrl: string;\n /**\n * Screenshot width in pixels.\n */\n width: number;\n /**\n * Screenshot height in pixels.\n */\n height: number;\n}\n\nexport interface CloseWebviewOptions {\n /**\n * Target webview id to close. If omitted, closes the active webview.\n */\n id?: string;\n /**\n * Whether the webview closing is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\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 * HTTP method to use for the initial request.\n *\n * **Optional parameter - defaults to GET if not specified.**\n * Existing code that doesn't provide this parameter will continue to work unchanged with standard GET requests.\n *\n * When specified with 'POST', 'PUT', or 'PATCH' methods that support a body,\n * you can also provide a `body` parameter with the request payload.\n *\n * **Platform Notes:**\n * - iOS: Full support for all HTTP methods with headers\n * - Android: Custom headers may not be sent with POST/PUT/PATCH requests due to WebView limitations\n *\n * @since 8.2.0\n * @default \"GET\"\n * @example\n * method: \"POST\",\n * body: JSON.stringify({ token: \"auth-token\", data: \"value\" }),\n * headers: { \"Content-Type\": \"application/json\" }\n */\n method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | string;\n /**\n * HTTP body to send with the request when using POST, PUT, or other methods that support a body.\n * Should be a string (use JSON.stringify for JSON data).\n *\n * **Optional parameter - only used when `method` is specified and supports a request body.**\n * Omitting this parameter (or using GET method) results in standard behavior without a request body.\n *\n * @since 8.2.0\n * @example\n * method: \"POST\",\n * body: JSON.stringify({ username: \"user\", password: \"pass\" }),\n * headers: { \"Content-Type\": \"application/json\" }\n */\n body?: string;\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 * - `window.mobileApp.hide()` / `window.mobileApp.show()` when allowWebViewJsVisibilityControl is true in CapacitorConfig\n * - `window.mobileApp.takeScreenshot()` when `allowScreenshotsFromWebPage` is true\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 * Allows page JavaScript to call `window.mobileApp.takeScreenshot()`.\n * Disabled by default so only the host app can trigger native screenshots through the plugin API.\n *\n * @default false\n * @since 8.4.0\n */\n allowScreenshotsFromWebPage?: boolean;\n /**\n * Emits `consoleMessage` events for JavaScript `console.*` output coming from the managed page.\n * Useful when the webview stays hidden and you still need page-level diagnostics.\n *\n * @default false\n * @since 8.6.0\n */\n captureConsoleLogs?: boolean;\n /**\n * Controls whether the webview should persist website data such as cache, cookies, local storage,\n * IndexedDB, and session data.\n *\n * When false, iOS uses a non-persistent `WKWebsiteDataStore`. Android disables per-view cache and\n * DOM/database storage where the system WebView supports it. Android cookies use the shared\n * WebView cookie store, so call `clearAllBrowsingData()` to remove cookies and other global data.\n *\n * @default true\n * @since 8.6.36\n */\n persistWebViewData?: boolean;\n /**\n * Controls Android TLS client certificate prompts during HTTPS handshakes.\n * Use `prompt` to show the system certificate picker; omit or use `none` to cancel silently (default).\n *\n * @default \"none\"\n * @since 8.7.5\n */\n clientCertificate?: 'none' | 'prompt';\n /**\n * @deprecated Use `clientCertificate: \"prompt\"` instead.\n */\n clientCertificatePrompt?: boolean;\n /**\n * Automatically handles downloads triggered inside the webview without requiring a custom JavaScript bridge.\n *\n * When 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.\n *\n * @default false\n * @since 8.6.0\n */\n handleDownloads?: boolean;\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, enables native navigation gestures within the webview.\n * - Android: Native back button navigates within webview history\n * - iOS: Enables swipe left/right gestures for back/forward navigation\n * @default false (Android), true (iOS - enabled by default)\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 * Promise timing: on Android, `openWebView()` resolves with the webview id when the webview is ready to be controlled\n * (immediately for hidden/immediate presentation, after the first page load when `isPresentAfterPageLoad` is `true`).\n * On iOS, the promise resolves with the id as soon as the native webview is created, even if presentation is deferred.\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 * closeModalURLPattern: a regex pattern to match against the current URL when the close button is pressed.\n * When provided along with closeModal: true, the close confirmation modal is only shown if the current URL matches this pattern.\n * If the current URL does not match, the browser closes immediately without showing the modal.\n * Requires closeModal to be true.\n * @since 7.2.0\n * @example\n * closeModal: true,\n * closeModalURLPattern: \".*checkout.*\"\n */\n closeModalURLPattern?: 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 * preShowScriptInjectionTime: controls when the preShowScript is injected.\n * - \"documentStart\": injects before any page JavaScript runs (good for polyfills like Firebase)\n * - \"pageLoad\": injects after page load (default, original behavior)\n * @since 7.26.0\n * @default \"pageLoad\"\n * @example\n * preShowScriptInjectionTime: \"documentStart\"\n */\n preShowScriptInjectionTime?: 'documentStart' | 'pageLoad';\n /**\n * Proxy interception mode.\n *\n * - `true`: legacy blanket mode, delegates all HTTP/HTTPS requests to JavaScript.\n * - `string`: Android-only regex mode kept for backward compatibility.\n *\n * Prefer `outboundProxyRules` and `inboundProxyRules` for native-first matching.\n *\n * @since 6.9.0\n */\n proxyRequests?: boolean | string;\n /**\n * Native-first outbound proxy rules.\n *\n * @since 8.6.0\n */\n outboundProxyRules?: NativeProxyRule[];\n /**\n * Native-first inbound proxy rules.\n *\n * @since 8.6.0\n */\n inboundProxyRules?: NativeProxyRule[];\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 * Shows a native screenshot button near the done/close button.\n * The button is hidden by default and captures the current viewport when tapped.\n * This option uses the same toolbar slot as `buttonNearDone` and is therefore incompatible with it.\n * The button is only shown when toolbarType is not \"activity\", \"navigation\", or \"blank\".\n *\n * @default false\n * @since 8.4.0\n */\n showScreenshotButton?: boolean;\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 * enableZoom: enables pinch-to-zoom gestures in the Android WebView.\n * When true, built-in zoom controls are enabled and the zoom buttons are hidden.\n * **Android only** — ignored on iOS where zoom is enabled by default.\n * @since 8.5.0\n * @default false\n * @example\n * enableZoom: true\n */\n enableZoom?: boolean;\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 * When true, HTTP and HTTPS links opened from `target=\"_blank\"` anchors stay in the current webview instead of spawning a popup or opening in the system browser.\n * By default, blank-target HTTP(S) links stay inside the plugin as managed popups that share cookies with the opener; enabling this option keeps everything in the same tab.\n * Custom schemes such as `tel:` and `mailto:` and authorized app links still prefer their native handlers unless `preventDeeplink` is enabled.\n *\n * @since 8.5.6\n * @default false\n * @example\n * openBlankTargetInWebView: true\n */\n openBlankTargetInWebView?: boolean;\n\n /**\n * List of base URLs whose hosts are treated as authorized App Links (Android) and Universal Links (iOS).\n *\n * - On both platforms, only HTTPS links whose host matches any entry in this list\n * will attempt to open via the corresponding native application.\n * - If the app is not installed or the system cannot handle the link, the URL\n * will continue loading inside the in-app browser.\n * - Matching is host-based (case-insensitive), ignoring the \"www.\" prefix.\n * - When `preventDeeplink` is enabled, all external handling is blocked regardless of this list.\n *\n * @example\n * ```ts\n * [\"https://example.com\", \"https://subdomain.app.io\"]\n * ```\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 * If false, the webView will extend behind the status bar for true full-screen immersive content.\n * When true (default), respects the safe area at the top of the screen.\n * Works independently of toolbarType - use for full-screen video players, games, or immersive web apps.\n * @since 8.2.0\n * @default true\n * @example\n * enabledSafeTopMargin: false // Full screen, extends behind status bar\n */\n enabledSafeTopMargin?: boolean;\n\n /**\n * When true, applies the system status bar inset as the WebView top margin on Android.\n * Keeps the legacy 0px margin by default for apps that handle padding themselves.\n * @default false\n * @example\n * useTopInset: true\n */\n useTopInset?: 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 /**\n * Opens popup windows created by the page in hidden mode.\n * Hidden popup windows can still be controlled with `executeScript`, `postMessage`, `show`, and `close`.\n * Listen to `popupWindowOpened` to capture the popup id, then call `show({ id })` only if you want to reveal it.\n *\n * @default false\n * @since 8.6.0\n * @example\n * hiddenPopupWindow: true\n */\n hiddenPopupWindow?: boolean;\n\n /**\n * blockedHosts: List of host patterns that should be blocked from loading in the InAppBrowser's internal navigations.\n * Any request inside WebView to a URL with a host matching any of these patterns will be blocked.\n * Supports wildcard patterns like:\n * - \"*.example.com\" to block all subdomains\n * - \"www.example.*\" to block wildcard domain extensions\n *\n * @since 7.17.0\n * @default []\n * @example\n * blockedHosts: [\"*.tracking.com\", \"ads.example.com\"]\n */\n blockedHosts?: string[];\n\n /**\n * Width of the webview in pixels.\n * If not set, webview will be fullscreen width.\n * @default undefined (fullscreen)\n * @example\n * width: 400\n */\n width?: number;\n\n /**\n * Height of the webview in pixels.\n * If not set, webview will be fullscreen height.\n * @default undefined (fullscreen)\n * @example\n * height: 600\n */\n height?: number;\n\n /**\n * X position of the webview in pixels from the left edge.\n * Only effective when width is set.\n * @default 0\n * @example\n * x: 50\n */\n x?: number;\n\n /**\n * Y position of the webview in pixels from the top edge.\n * Only effective when height is set.\n * @default 0\n * @example\n * y: 100\n */\n y?: number;\n\n /**\n * Places the native browser behind the Capacitor host WebView.\n * Make the app background transparent to reveal it, or rely on `transparentBackground` to clear the host WebView.\n *\n * @default false\n */\n toBack?: boolean;\n\n /**\n * When `toBack` is true, makes the Capacitor host WebView transparent so the native browser can be seen behind Ionic content.\n * Ignored when the browser is in front.\n *\n * @default true\n */\n transparentBackground?: boolean;\n\n /**\n * Disables the bounce (overscroll) effect on iOS WebView.\n * When enabled, prevents the rubber band scrolling effect when users scroll beyond content boundaries.\n * This is useful for:\n * - Creating a more native, app-like experience\n * - Preventing accidental overscroll states\n * - Avoiding issues when keyboard opens/closes\n *\n * Note: This option only affects iOS. Android does not have this bounce effect by default.\n *\n * @since 8.0.2\n * @default false\n * @example\n * disableOverscroll: true\n */\n disableOverscroll?: boolean;\n\n /**\n * Opens the webview in hidden mode (not visible to user but fully functional).\n * When hidden, the webview loads and executes JavaScript but is not displayed.\n * All control methods (executeScript, postMessage, setUrl, etc.) work while hidden.\n * Use close() to clean up the hidden webview when done.\n *\n * @since 8.0.7\n * @default false\n * @example\n * hidden: true\n */\n hidden?: boolean;\n\n /**\n * Controls how a hidden webview reports its visibility and size.\n * - AWARE: webview is aware it's hidden (dimensions may be zero).\n * - FAKE_VISIBLE: webview is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n *\n * @default InvisibilityMode.AWARE\n * @example\n * invisibilityMode: InvisibilityMode.FAKE_VISIBLE\n */\n invisibilityMode?: InvisibilityMode;\n}\n\nexport interface DimensionOptions {\n /**\n * Width of the webview in pixels\n */\n width?: number;\n /**\n * Height of the webview in pixels\n */\n height?: number;\n /**\n * X position from the left edge in pixels\n */\n x?: number;\n /**\n * Y position from the top edge in pixels\n */\n y?: number;\n}\n\nexport interface InAppBrowserPlugin {\n /**\n * Navigates back in the WebView's history if possible\n *\n * @since 7.21.0\n * @returns Promise that resolves with true if navigation was possible, false otherwise\n */\n goBack(options?: { id?: string }): Promise<{ canGoBack: boolean }>;\n\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 * When `id` is omitted, applies to all open webviews.\n *\n * @since 0.5.0\n */\n clearCookies(options: ClearCookieOptions): Promise<any>;\n /**\n * Clear all cookies\n * When `id` is omitted, applies to all open webviews.\n *\n * @since 6.5.0\n */\n clearAllCookies(options?: { id?: string }): Promise<any>;\n\n /**\n * Clear cache\n * When `id` is omitted, applies to all open webviews.\n *\n * @since 6.5.0\n */\n clearCache(options?: { id?: string }): Promise<any>;\n\n /**\n * Clear all browsing data from the default store and any opened managed webviews.\n *\n * This removes cookies, disk cache, memory cache, local storage, session storage, IndexedDB,\n * WebSQL where supported, form data, and HTTP auth data where the platform exposes it.\n *\n * @since 8.6.36\n */\n clearAllBrowsingData(): 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 * When `id` is omitted, closes the active webview.\n */\n close(options?: CloseWebviewOptions): Promise<any>;\n /**\n * Hide the webview without closing it.\n * Use show() to bring it back.\n * When `id` is omitted, targets the active webview.\n *\n * @since 8.0.8\n */\n hide(options?: { id?: string }): Promise<void>;\n /**\n * Show a previously hidden webview.\n * When `id` is omitted, targets the active webview.\n *\n * @since 8.0.8\n */\n show(options?: { id?: string }): Promise<void>;\n /**\n * Moves the native browser behind the Capacitor host WebView.\n * Use `dispatchInputEvent()` to forward overlay gestures to the browser while it is behind the app UI.\n */\n sendToBack(options?: LayerOptions): Promise<void>;\n /**\n * Moves a browser that was behind the host WebView back to the front.\n * When `id` is omitted, targets the active webview.\n */\n bringToFront(options?: { id?: string }): Promise<void>;\n /**\n * Dispatches a click, touch, or scroll event to a managed browser.\n * Coordinates are relative to the browser viewport in CSS pixels.\n */\n dispatchInputEvent(options: DispatchInputEventOptions): Promise<void>;\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 * - `window.mobileApp.takeScreenshot()` when `allowScreenshotsFromWebPage` is true\n *\n * Promise timing differs by platform when `isPresentAfterPageLoad` is used.\n * Android resolves with `{ id }` after the dialog is ready to control, while iOS resolves with `{ id }` immediately after creating the native webview.\n *\n * @returns Promise that resolves with the created webview id.\n * @since 0.1.0\n */\n openWebView(options: OpenWebViewOptions): Promise<{ id: string }>;\n /**\n * Injects JavaScript code into the InAppBrowser window.\n * When `id` is omitted, executes in all open webviews.\n */\n executeScript(options: { code: string; id?: 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 * When `id` is omitted, broadcasts to all open webviews.\n */\n postMessage(options: { detail: Record<string, any>; id?: string }): Promise<void>;\n /**\n * Captures the current webview viewport as a PNG screenshot.\n * When `id` is omitted, targets the active webview.\n */\n takeScreenshot(options?: { id?: string }): Promise<ScreenshotResult>;\n /**\n * Sets the URL of the webview.\n * When `id` is omitted, targets the active webview.\n */\n setUrl(options: { url: string; id?: string }): Promise<any>;\n /**\n * Listen for url change, only for openWebView\n *\n * @since 0.0.1\n */\n addListener(eventName: 'urlChangeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n\n /**\n * Listen for buttonNearDone clicks.\n *\n * The event payload contains the webview `id`.\n *\n * @since 0.0.1\n */\n addListener(eventName: 'buttonNearDoneClick', listenerFunc: ButtonNearListener): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(eventName: 'closeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required,\n * works with openWebView shareDisclaimer and closeModal\n *\n * @since 0.0.1\n */\n addListener(eventName: 'confirmBtnClicked', listenerFunc: ConfirmBtnListener): 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: { id?: string; detail?: Record<string, any>; rawMessage?: string }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered whenever a screenshot is captured from the plugin API,\n * the native screenshot button, or the injected JavaScript bridge.\n */\n addListener(\n eventName: 'screenshotTaken',\n listenerFunc: (event: ScreenshotResult & { id?: string }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page is loaded\n */\n addListener(\n eventName: 'browserPageLoaded',\n listenerFunc: (event: { id?: string }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(\n eventName: 'pageLoadError',\n listenerFunc: (event: { id?: string }) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when the webview intercepts a non-standard custom scheme\n * and hands it to the operating system.\n *\n * Standard OS-handled schemes such as `tel:`, `mailto:`, and `sms:` are excluded.\n *\n * @since 8.6.7\n */\n addListener(\n eventName: 'customSchemeIntercepted',\n listenerFunc: CustomSchemeInterceptedListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered after native download handling saves a file locally.\n * Enable this with `handleDownloads: true` when opening the webview.\n *\n * @since 8.6.0\n */\n addListener(\n eventName: 'downloadCompleted',\n listenerFunc: (event: DownloadCompletedEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when native download handling fails.\n * Enable this with `handleDownloads: true` when opening the webview.\n *\n * @since 8.6.0\n */\n addListener(\n eventName: 'downloadFailed',\n listenerFunc: (event: DownloadFailedEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered whenever a page opens a popup/new window.\n * Use the returned popup id with `executeScript`, `postMessage`, `show`, `hide`, and `close`.\n *\n * @since 8.6.0\n */\n addListener(\n eventName: 'popupWindowOpened',\n listenerFunc: (event: PopupWindowEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Listen for proxied requests delegated by the native runtime.\n * Prefer `addProxyHandler()` instead of calling this directly.\n *\n * @since 8.6.0\n */\n addListener(eventName: 'proxyRequest', listenerFunc: (event: ProxyRequest) => void): Promise<PluginListenerHandle>;\n /**\n * Listen for JavaScript console output emitted by the managed page.\n * Enable this with `captureConsoleLogs: true` when opening the webview.\n *\n * @since 8.6.0\n */\n addListener(\n eventName: 'consoleMessage',\n listenerFunc: (event: ConsoleMessageEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Internal method used by `addProxyHandler()` to send a proxy decision back to native.\n * Forward the original `phase` when replying to a manual `proxyRequest` listener.\n *\n * @since 8.6.0\n */\n handleProxyRequest(options: {\n requestId: string;\n decision?: ProxyDecision | null;\n response?: ProxyResponse | null;\n webviewId?: string;\n phase?: 'outbound' | 'inbound';\n }): Promise<void>;\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(options?: { id?: string }): Promise<any>;\n\n /**\n * Update the dimensions of the webview.\n * Allows changing the size and position of the webview at runtime.\n * When `id` is omitted, targets the active webview.\n *\n * @param options Dimension options (width, height, x, y)\n * @returns Promise that resolves when dimensions are updated\n */\n updateDimensions(options: DimensionOptions & { id?: string }): Promise<void>;\n\n /**\n * Sets the enabled safe top margin of the webview at runtime.\n * When `id` is omitted, targets the active webview.\n * On Web, this method is a no-op and resolves without changing layout.\n */\n setEnabledSafeTopMargin(options: { enabled: boolean; id?: string }): Promise<void>;\n\n /**\n * Sets the enabled safe bottom margin of the webview at runtime.\n * When `id` is omitted, targets the active webview.\n * On Web, this method is a no-op and resolves without changing layout.\n */\n setEnabledSafeBottomMargin(options: { enabled: boolean; id?: string }): Promise<void>;\n\n /**\n * Opens a secured window for OAuth2 authentication.\n * For web, you should have the code in the redirected page to use a broadcast channel to send the redirected url to the app\n * Something like:\n * ```html\n * <html>\n * <head></head>\n * <body>\n * <script>\n * const searchParams = new URLSearchParams(location.search)\n * if (searchParams.has(\"code\")) {\n * new BroadcastChannel(\"my-channel-name\").postMessage(location.href);\n * window.close();\n * }\n * </script>\n * </body>\n * </html>\n * ```\n * For mobile, you should have a redirect uri that opens the app, something like: `myapp://oauth_callback/`\n * And make sure to register it in the app's info.plist:\n * ```xml\n * <key>CFBundleURLTypes</key>\n * <array>\n * <dict>\n * <key>CFBundleURLSchemes</key>\n * <array>\n * <string>myapp</string>\n * </array>\n * </dict>\n * </array>\n * ```\n * And in the AndroidManifest.xml file:\n * ```xml\n * <activity>\n * <intent-filter>\n * <action android:name=\"android.intent.action.VIEW\" />\n * <category android:name=\"android.intent.category.DEFAULT\" />\n * <category android:name=\"android.intent.category.BROWSABLE\" />\n * <data android:host=\"oauth_callback\" android:scheme=\"myapp\" />\n * </intent-filter>\n * </activity>\n * ```\n * @param options - the options for the openSecureWindow call\n */\n openSecureWindow(options: OpenSecureWindowOptions): Promise<OpenSecureWindowResponse>;\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 * Hide the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)\n *\n * @since 8.0.8\n */\n hide(): void;\n\n /**\n * Show the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)\n *\n * @since 8.0.8\n */\n show(): void;\n\n /**\n * Capture the current WebView viewport as a PNG screenshot.\n * Requires `allowScreenshotsFromWebPage` to be enabled when opening the webview.\n *\n * @since 8.4.0\n */\n takeScreenshot(): Promise<ScreenshotResult>;\n };\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
|
@@ -98,7 +98,7 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
98
98
|
case aware = "AWARE"
|
|
99
99
|
case fakeVisible = "FAKE_VISIBLE"
|
|
100
100
|
}
|
|
101
|
-
private let pluginVersion: String = "8.7.
|
|
101
|
+
private let pluginVersion: String = "8.7.6"
|
|
102
102
|
public let identifier = "CapgoInAppBrowserPlugin"
|
|
103
103
|
public let jsName = "CapgoInAppBrowser"
|
|
104
104
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -2129,7 +2129,9 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
2129
2129
|
responseDict = dict
|
|
2130
2130
|
}
|
|
2131
2131
|
|
|
2132
|
-
|
|
2132
|
+
DispatchQueue.global(qos: .userInitiated).async { [proxyHandler] in
|
|
2133
|
+
proxyHandler.handleResponse(requestId: requestId, phase: phase, responseData: responseDict)
|
|
2134
|
+
}
|
|
2133
2135
|
call.resolve()
|
|
2134
2136
|
}
|
|
2135
2137
|
|
|
@@ -51,11 +51,8 @@ public final class ProxyBridge {
|
|
|
51
51
|
func getAndRemove(requestId: String) -> ProxyBridgeStoredRequest? {
|
|
52
52
|
lock.lock()
|
|
53
53
|
defer { lock.unlock() }
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
storedRequestOrder.removeAll { $0 == requestId }
|
|
58
|
-
return storedRequest
|
|
54
|
+
// Avoid O(n) queue scans on every parallel bridge request; stale ids are purged lazily.
|
|
55
|
+
return storedRequests.removeValue(forKey: requestId)
|
|
59
56
|
}
|
|
60
57
|
|
|
61
58
|
private func cleanupExpiredRequests(now: Date) {
|