@capgo/capacitor-inappbrowser 8.6.16 → 8.6.18
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/android/src/main/java/ee/forgr/capacitor_inappbrowser/CapgoInAppBrowserPlugin.java +1820 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +3 -1806
- package/dist/esm/index.js +20 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/plugin.cjs.js +19 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +19 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/InAppBrowserPlugin/InAppBrowserPlugin.swift +16 -7
- package/ios/Sources/InAppBrowserPlugin/ProxySchemeHandler.swift +2 -2
- package/ios/Sources/InAppBrowserPlugin/WKWebViewController.swift +87 -51
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
|
-
import { registerPlugin } from '@capacitor/core';
|
|
2
|
-
const
|
|
1
|
+
import { Capacitor, registerPlugin } from '@capacitor/core';
|
|
2
|
+
const CAPGO_PLUGIN_NAME = 'CapgoInAppBrowser';
|
|
3
|
+
const PREVIOUS_PLUGIN_NAME = 'InAppBrowser';
|
|
4
|
+
function resolvePluginName() {
|
|
5
|
+
if (!Capacitor.isNativePlatform()) {
|
|
6
|
+
return CAPGO_PLUGIN_NAME;
|
|
7
|
+
}
|
|
8
|
+
if (Capacitor.isPluginAvailable(CAPGO_PLUGIN_NAME)) {
|
|
9
|
+
return CAPGO_PLUGIN_NAME;
|
|
10
|
+
}
|
|
11
|
+
if (Capacitor.isPluginAvailable(PREVIOUS_PLUGIN_NAME)) {
|
|
12
|
+
return PREVIOUS_PLUGIN_NAME;
|
|
13
|
+
}
|
|
14
|
+
console.warn(`[InAppBrowser] Neither '${CAPGO_PLUGIN_NAME}' nor '${PREVIOUS_PLUGIN_NAME}' native plugin detected. ` +
|
|
15
|
+
'Ensure @capgo/capacitor-inappbrowser native code is installed.');
|
|
16
|
+
return CAPGO_PLUGIN_NAME;
|
|
17
|
+
}
|
|
18
|
+
const inAppBrowserImplementations = {
|
|
3
19
|
web: () => import('./web').then((m) => new m.InAppBrowserWeb()),
|
|
4
|
-
}
|
|
20
|
+
};
|
|
21
|
+
const InAppBrowser = registerPlugin(resolvePluginName(), inAppBrowserImplementations);
|
|
5
22
|
function arrayBufferToBase64(buffer) {
|
|
6
23
|
const bytes = new Uint8Array(buffer);
|
|
7
24
|
let binary = '';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAW5D,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAC9C,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAE5C,SAAS,iBAAiB;IACxB,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAE,CAAC;QAClC,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACnD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,EAAE,CAAC;QACtD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,IAAI,CACV,2BAA2B,iBAAiB,UAAU,oBAAoB,4BAA4B;QACpG,gEAAgE,CACnE,CAAC;IACF,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,MAAM,2BAA2B,GAAG;IAClC,GAAG,EAAE,GAAG,EAAE,CAAC,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AAO,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { Capacitor, registerPlugin } from '@capacitor/core';\nimport type { PluginListenerHandle } from '@capacitor/core';\n\nimport type {\n InAppBrowserPlugin,\n ProxyDecision,\n ProxyHandler,\n ProxyRequestOverride,\n ProxyResponse,\n} from './definitions';\n\nconst CAPGO_PLUGIN_NAME = 'CapgoInAppBrowser';\nconst PREVIOUS_PLUGIN_NAME = 'InAppBrowser';\n\nfunction resolvePluginName(): string {\n if (!Capacitor.isNativePlatform()) {\n return CAPGO_PLUGIN_NAME;\n }\n\n if (Capacitor.isPluginAvailable(CAPGO_PLUGIN_NAME)) {\n return CAPGO_PLUGIN_NAME;\n }\n\n if (Capacitor.isPluginAvailable(PREVIOUS_PLUGIN_NAME)) {\n return PREVIOUS_PLUGIN_NAME;\n }\n\n console.warn(\n `[InAppBrowser] Neither '${CAPGO_PLUGIN_NAME}' nor '${PREVIOUS_PLUGIN_NAME}' native plugin detected. ` +\n 'Ensure @capgo/capacitor-inappbrowser native code is installed.',\n );\n return CAPGO_PLUGIN_NAME;\n}\n\nconst inAppBrowserImplementations = {\n web: () => import('./web').then((m) => new m.InAppBrowserWeb()),\n};\n\nconst InAppBrowser = registerPlugin<InAppBrowserPlugin>(resolvePluginName(), inAppBrowserImplementations);\n\nfunction arrayBufferToBase64(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n}\n\nfunction headersToRecord(headers: Headers): Record<string, string> {\n const result: Record<string, string> = {};\n headers.forEach((value, key) => {\n result[key] = value;\n });\n return result;\n}\n\nfunction errorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n if (typeof error === 'string') {\n return error;\n }\n if (error && typeof error === 'object' && 'message' in error && typeof error.message === 'string') {\n return error.message;\n }\n return String(error);\n}\n\nfunction isStaleProxyResponseError(error: unknown): boolean {\n const message = errorMessage(error);\n return message.includes('No proxy handler found') || message.includes('Target WebView not found for proxy request');\n}\n\nfunction isProxyResponse(value: unknown): value is ProxyResponse {\n return (\n value !== null &&\n typeof value === 'object' &&\n 'status' in value &&\n 'headers' in value &&\n !(value instanceof Response)\n );\n}\n\nfunction isProxyRequestOverride(value: unknown): value is ProxyRequestOverride {\n return value !== null && typeof value === 'object' && 'url' in value && !(value instanceof Response);\n}\n\nfunction isProxyDecision(value: unknown): value is ProxyDecision {\n return (\n value !== null && typeof value === 'object' && ('request' in value || 'response' in value || 'cancel' in value)\n );\n}\n\nasync function sendProxyDecision(\n requestId: string,\n webviewId: string | undefined,\n decision: ProxyDecision | null,\n phase: 'outbound' | 'inbound',\n): Promise<void> {\n try {\n await InAppBrowser.handleProxyRequest({\n requestId,\n webviewId,\n decision,\n phase,\n } as Parameters<typeof InAppBrowser.handleProxyRequest>[0]);\n } catch (error) {\n if (isStaleProxyResponseError(error)) {\n return;\n }\n throw error;\n }\n}\n\nconst addProxyHandler = (callback: ProxyHandler): Promise<PluginListenerHandle> => {\n return InAppBrowser.addListener('proxyRequest', async (event) => {\n let decision: ProxyDecision | null = null;\n\n try {\n const result = await callback(event);\n if (result === null) {\n decision = null;\n } else if (isProxyDecision(result)) {\n decision = result;\n } else if (isProxyRequestOverride(result)) {\n decision = { request: result };\n } else if (isProxyResponse(result)) {\n decision = { response: result };\n } else {\n const cloned = result.clone();\n const buffer = await cloned.arrayBuffer();\n decision = {\n response: {\n body: arrayBufferToBase64(buffer),\n status: result.status,\n headers: headersToRecord(result.headers),\n },\n };\n }\n } catch (_error) {\n decision = null;\n }\n\n await sendProxyDecision(event.requestId, event.webviewId, decision, event.phase);\n });\n};\n\nexport * from './definitions';\nexport { InAppBrowser, addProxyHandler };\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -42,9 +42,26 @@ exports.InvisibilityMode = void 0;
|
|
|
42
42
|
InvisibilityMode["FAKE_VISIBLE"] = "FAKE_VISIBLE";
|
|
43
43
|
})(exports.InvisibilityMode || (exports.InvisibilityMode = {}));
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const CAPGO_PLUGIN_NAME = 'CapgoInAppBrowser';
|
|
46
|
+
const PREVIOUS_PLUGIN_NAME = 'InAppBrowser';
|
|
47
|
+
function resolvePluginName() {
|
|
48
|
+
if (!core.Capacitor.isNativePlatform()) {
|
|
49
|
+
return CAPGO_PLUGIN_NAME;
|
|
50
|
+
}
|
|
51
|
+
if (core.Capacitor.isPluginAvailable(CAPGO_PLUGIN_NAME)) {
|
|
52
|
+
return CAPGO_PLUGIN_NAME;
|
|
53
|
+
}
|
|
54
|
+
if (core.Capacitor.isPluginAvailable(PREVIOUS_PLUGIN_NAME)) {
|
|
55
|
+
return PREVIOUS_PLUGIN_NAME;
|
|
56
|
+
}
|
|
57
|
+
console.warn(`[InAppBrowser] Neither '${CAPGO_PLUGIN_NAME}' nor '${PREVIOUS_PLUGIN_NAME}' native plugin detected. ` +
|
|
58
|
+
'Ensure @capgo/capacitor-inappbrowser native code is installed.');
|
|
59
|
+
return CAPGO_PLUGIN_NAME;
|
|
60
|
+
}
|
|
61
|
+
const inAppBrowserImplementations = {
|
|
46
62
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.InAppBrowserWeb()),
|
|
47
|
-
}
|
|
63
|
+
};
|
|
64
|
+
const InAppBrowser = core.registerPlugin(resolvePluginName(), inAppBrowserImplementations);
|
|
48
65
|
function arrayBufferToBase64(buffer) {
|
|
49
66
|
const bytes = new Uint8Array(buffer);
|
|
50
67
|
let binary = '';
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n /**\n * Shows a simple toolbar with just a close button and share button\n * @since 0.1.0\n */\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n /**\n * Shows a simple toolbar with just a close button\n * @since 7.6.8\n */\n ToolBarType[\"COMPACT\"] = \"compact\";\n /**\n * Shows a full navigation toolbar with back/forward buttons\n * @since 0.1.0\n */\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n /**\n * Shows no toolbar\n * @since 0.1.0\n */\n ToolBarType[\"BLANK\"] = \"blank\";\n})(ToolBarType || (ToolBarType = {}));\nexport var InvisibilityMode;\n(function (InvisibilityMode) {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n InvisibilityMode[\"AWARE\"] = \"AWARE\";\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n InvisibilityMode[\"FAKE_VISIBLE\"] = \"FAKE_VISIBLE\";\n})(InvisibilityMode || (InvisibilityMode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst InAppBrowser = registerPlugin('InAppBrowser', {\n web: () => import('./web').then((m) => new m.InAppBrowserWeb()),\n});\nfunction arrayBufferToBase64(buffer) {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n}\nfunction headersToRecord(headers) {\n const result = {};\n headers.forEach((value, key) => {\n result[key] = value;\n });\n return result;\n}\nfunction errorMessage(error) {\n if (error instanceof Error) {\n return error.message;\n }\n if (typeof error === 'string') {\n return error;\n }\n if (error && typeof error === 'object' && 'message' in error && typeof error.message === 'string') {\n return error.message;\n }\n return String(error);\n}\nfunction isStaleProxyResponseError(error) {\n const message = errorMessage(error);\n return message.includes('No proxy handler found') || message.includes('Target WebView not found for proxy request');\n}\nfunction isProxyResponse(value) {\n return (value !== null &&\n typeof value === 'object' &&\n 'status' in value &&\n 'headers' in value &&\n !(value instanceof Response));\n}\nfunction isProxyRequestOverride(value) {\n return value !== null && typeof value === 'object' && 'url' in value && !(value instanceof Response);\n}\nfunction isProxyDecision(value) {\n return (value !== null && typeof value === 'object' && ('request' in value || 'response' in value || 'cancel' in value));\n}\nasync function sendProxyDecision(requestId, webviewId, decision, phase) {\n try {\n await InAppBrowser.handleProxyRequest({\n requestId,\n webviewId,\n decision,\n phase,\n });\n }\n catch (error) {\n if (isStaleProxyResponseError(error)) {\n return;\n }\n throw error;\n }\n}\nconst addProxyHandler = (callback) => {\n return InAppBrowser.addListener('proxyRequest', async (event) => {\n let decision = null;\n try {\n const result = await callback(event);\n if (result === null) {\n decision = null;\n }\n else if (isProxyDecision(result)) {\n decision = result;\n }\n else if (isProxyRequestOverride(result)) {\n decision = { request: result };\n }\n else if (isProxyResponse(result)) {\n decision = { response: result };\n }\n else {\n const cloned = result.clone();\n const buffer = await cloned.arrayBuffer();\n decision = {\n response: {\n body: arrayBufferToBase64(buffer),\n status: result.status,\n headers: headersToRecord(result.headers),\n },\n };\n }\n }\n catch (_error) {\n decision = null;\n }\n await sendProxyDecision(event.requestId, event.webviewId, decision, event.phase);\n });\n};\nexport * from './definitions';\nexport { InAppBrowser, addProxyHandler };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class InAppBrowserWeb extends WebPlugin {\n clearAllCookies() {\n console.log('clearAllCookies');\n return Promise.resolve();\n }\n clearCache() {\n console.log('clearCache');\n return Promise.resolve();\n }\n async open(options) {\n console.log('open', options);\n return options;\n }\n async clearCookies(options) {\n console.log('cleanCookies', options);\n return;\n }\n async getCookies(options) {\n // Web implementation to get cookies\n return options;\n }\n async openWebView(options) {\n console.log('openWebView', options);\n return options;\n }\n async executeScript({ code }) {\n console.log('code', code);\n return code;\n }\n async close(options) {\n console.log('close', options);\n return;\n }\n async hide(options) {\n console.log('hide', options);\n return;\n }\n async show(options) {\n console.log('show', options);\n return;\n }\n async setUrl(options) {\n console.log('setUrl', options.url);\n return;\n }\n async reload(options) {\n console.log('reload', options);\n return;\n }\n async postMessage(options) {\n console.log('postMessage', options);\n return options;\n }\n async takeScreenshot(options) {\n console.log('takeScreenshot not supported on web', options);\n throw this.unimplemented('Screenshots are not supported on web.');\n }\n async goBack() {\n console.log('goBack');\n return;\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n async updateDimensions(options) {\n console.log('updateDimensions', options);\n // Web platform doesn't support dimension control\n return;\n }\n async handleProxyRequest(options) {\n console.log('handleProxyRequest not supported on web', options);\n return;\n }\n async setEnabledSafeTopMargin(options) {\n console.log('setEnabledSafeTopMargin not supported on web', options);\n return;\n }\n async setEnabledSafeBottomMargin(options) {\n console.log('setEnabledSafeBottomMargin not supported on web', options);\n return;\n }\n async openSecureWindow(options) {\n const w = 600;\n const h = 550;\n const settings = [\n ['width', w],\n ['height', h],\n ['left', screen.width / 2 - w / 2],\n ['top', screen.height / 2 - h / 2],\n ]\n .map((x) => x.join('='))\n .join(',');\n const popup = window.open(options.authEndpoint, 'Authorization', settings);\n if (!popup) {\n throw new Error('Failed to open secure window');\n }\n if (typeof popup.focus === 'function') {\n popup.focus();\n }\n return new Promise((resolve, reject) => {\n const bc = new BroadcastChannel(options.broadcastChannelName || 'oauth-channel');\n bc.addEventListener('message', (event) => {\n if (event.data.startsWith(options.redirectUri)) {\n bc.close();\n resolve({ redirectedUri: event.data });\n }\n else {\n bc.close();\n reject(new Error('Redirect URI does not match, expected ' + options.redirectUri + ' but got ' + event.data));\n }\n });\n setTimeout(() => {\n bc.close();\n reject(new Error('The sign-in flow timed out'));\n }, 5 * 60000);\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","InvisibilityMode","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;AACtC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;AACtC,CAAC,EAAEA,uBA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1B,gBAAgB,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAC/D,YAAY,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;AACzB,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n /**\n * Shows a simple toolbar with just a close button and share button\n * @since 0.1.0\n */\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n /**\n * Shows a simple toolbar with just a close button\n * @since 7.6.8\n */\n ToolBarType[\"COMPACT\"] = \"compact\";\n /**\n * Shows a full navigation toolbar with back/forward buttons\n * @since 0.1.0\n */\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n /**\n * Shows no toolbar\n * @since 0.1.0\n */\n ToolBarType[\"BLANK\"] = \"blank\";\n})(ToolBarType || (ToolBarType = {}));\nexport var InvisibilityMode;\n(function (InvisibilityMode) {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n InvisibilityMode[\"AWARE\"] = \"AWARE\";\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n InvisibilityMode[\"FAKE_VISIBLE\"] = \"FAKE_VISIBLE\";\n})(InvisibilityMode || (InvisibilityMode = {}));\n//# sourceMappingURL=definitions.js.map","import { Capacitor, registerPlugin } from '@capacitor/core';\nconst CAPGO_PLUGIN_NAME = 'CapgoInAppBrowser';\nconst PREVIOUS_PLUGIN_NAME = 'InAppBrowser';\nfunction resolvePluginName() {\n if (!Capacitor.isNativePlatform()) {\n return CAPGO_PLUGIN_NAME;\n }\n if (Capacitor.isPluginAvailable(CAPGO_PLUGIN_NAME)) {\n return CAPGO_PLUGIN_NAME;\n }\n if (Capacitor.isPluginAvailable(PREVIOUS_PLUGIN_NAME)) {\n return PREVIOUS_PLUGIN_NAME;\n }\n console.warn(`[InAppBrowser] Neither '${CAPGO_PLUGIN_NAME}' nor '${PREVIOUS_PLUGIN_NAME}' native plugin detected. ` +\n 'Ensure @capgo/capacitor-inappbrowser native code is installed.');\n return CAPGO_PLUGIN_NAME;\n}\nconst inAppBrowserImplementations = {\n web: () => import('./web').then((m) => new m.InAppBrowserWeb()),\n};\nconst InAppBrowser = registerPlugin(resolvePluginName(), inAppBrowserImplementations);\nfunction arrayBufferToBase64(buffer) {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n}\nfunction headersToRecord(headers) {\n const result = {};\n headers.forEach((value, key) => {\n result[key] = value;\n });\n return result;\n}\nfunction errorMessage(error) {\n if (error instanceof Error) {\n return error.message;\n }\n if (typeof error === 'string') {\n return error;\n }\n if (error && typeof error === 'object' && 'message' in error && typeof error.message === 'string') {\n return error.message;\n }\n return String(error);\n}\nfunction isStaleProxyResponseError(error) {\n const message = errorMessage(error);\n return message.includes('No proxy handler found') || message.includes('Target WebView not found for proxy request');\n}\nfunction isProxyResponse(value) {\n return (value !== null &&\n typeof value === 'object' &&\n 'status' in value &&\n 'headers' in value &&\n !(value instanceof Response));\n}\nfunction isProxyRequestOverride(value) {\n return value !== null && typeof value === 'object' && 'url' in value && !(value instanceof Response);\n}\nfunction isProxyDecision(value) {\n return (value !== null && typeof value === 'object' && ('request' in value || 'response' in value || 'cancel' in value));\n}\nasync function sendProxyDecision(requestId, webviewId, decision, phase) {\n try {\n await InAppBrowser.handleProxyRequest({\n requestId,\n webviewId,\n decision,\n phase,\n });\n }\n catch (error) {\n if (isStaleProxyResponseError(error)) {\n return;\n }\n throw error;\n }\n}\nconst addProxyHandler = (callback) => {\n return InAppBrowser.addListener('proxyRequest', async (event) => {\n let decision = null;\n try {\n const result = await callback(event);\n if (result === null) {\n decision = null;\n }\n else if (isProxyDecision(result)) {\n decision = result;\n }\n else if (isProxyRequestOverride(result)) {\n decision = { request: result };\n }\n else if (isProxyResponse(result)) {\n decision = { response: result };\n }\n else {\n const cloned = result.clone();\n const buffer = await cloned.arrayBuffer();\n decision = {\n response: {\n body: arrayBufferToBase64(buffer),\n status: result.status,\n headers: headersToRecord(result.headers),\n },\n };\n }\n }\n catch (_error) {\n decision = null;\n }\n await sendProxyDecision(event.requestId, event.webviewId, decision, event.phase);\n });\n};\nexport * from './definitions';\nexport { InAppBrowser, addProxyHandler };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class InAppBrowserWeb extends WebPlugin {\n clearAllCookies() {\n console.log('clearAllCookies');\n return Promise.resolve();\n }\n clearCache() {\n console.log('clearCache');\n return Promise.resolve();\n }\n async open(options) {\n console.log('open', options);\n return options;\n }\n async clearCookies(options) {\n console.log('cleanCookies', options);\n return;\n }\n async getCookies(options) {\n // Web implementation to get cookies\n return options;\n }\n async openWebView(options) {\n console.log('openWebView', options);\n return options;\n }\n async executeScript({ code }) {\n console.log('code', code);\n return code;\n }\n async close(options) {\n console.log('close', options);\n return;\n }\n async hide(options) {\n console.log('hide', options);\n return;\n }\n async show(options) {\n console.log('show', options);\n return;\n }\n async setUrl(options) {\n console.log('setUrl', options.url);\n return;\n }\n async reload(options) {\n console.log('reload', options);\n return;\n }\n async postMessage(options) {\n console.log('postMessage', options);\n return options;\n }\n async takeScreenshot(options) {\n console.log('takeScreenshot not supported on web', options);\n throw this.unimplemented('Screenshots are not supported on web.');\n }\n async goBack() {\n console.log('goBack');\n return;\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n async updateDimensions(options) {\n console.log('updateDimensions', options);\n // Web platform doesn't support dimension control\n return;\n }\n async handleProxyRequest(options) {\n console.log('handleProxyRequest not supported on web', options);\n return;\n }\n async setEnabledSafeTopMargin(options) {\n console.log('setEnabledSafeTopMargin not supported on web', options);\n return;\n }\n async setEnabledSafeBottomMargin(options) {\n console.log('setEnabledSafeBottomMargin not supported on web', options);\n return;\n }\n async openSecureWindow(options) {\n const w = 600;\n const h = 550;\n const settings = [\n ['width', w],\n ['height', h],\n ['left', screen.width / 2 - w / 2],\n ['top', screen.height / 2 - h / 2],\n ]\n .map((x) => x.join('='))\n .join(',');\n const popup = window.open(options.authEndpoint, 'Authorization', settings);\n if (!popup) {\n throw new Error('Failed to open secure window');\n }\n if (typeof popup.focus === 'function') {\n popup.focus();\n }\n return new Promise((resolve, reject) => {\n const bc = new BroadcastChannel(options.broadcastChannelName || 'oauth-channel');\n bc.addEventListener('message', (event) => {\n if (event.data.startsWith(options.redirectUri)) {\n bc.close();\n resolve({ redirectedUri: event.data });\n }\n else {\n bc.close();\n reject(new Error('Redirect URI does not match, expected ' + options.redirectUri + ' but got ' + event.data));\n }\n });\n setTimeout(() => {\n bc.close();\n reject(new Error('The sign-in flow timed out'));\n }, 5 * 60000);\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","InvisibilityMode","Capacitor","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;AACtC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;AACtC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;AAClCC;AACX,CAAC,UAAU,WAAW,EAAE;AACxB;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU;AACxC;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,SAAS,CAAC,GAAG,SAAS;AACtC;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,YAAY,CAAC,GAAG,YAAY;AAC5C;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;AA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oBAAoB,EAAE,CAAC,KAAK,EAAE;AAC9B,oBAAoB,MAAM,CAAC,IAAI,KAAK,CAAC,wCAAwC,GAAG,OAAO,CAAC,WAAW,GAAG,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;AAChI,gBAAgB;AAChB,YAAY,CAAC,CAAC;AACd,YAAY,UAAU,CAAC,MAAM;AAC7B,gBAAgB,EAAE,CAAC,KAAK,EAAE;AAC1B,gBAAgB,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAC/D,YAAY,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;AACzB,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ;;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -41,9 +41,26 @@ var capacitorInAppBrowser = (function (exports, core) {
|
|
|
41
41
|
InvisibilityMode["FAKE_VISIBLE"] = "FAKE_VISIBLE";
|
|
42
42
|
})(exports.InvisibilityMode || (exports.InvisibilityMode = {}));
|
|
43
43
|
|
|
44
|
-
const
|
|
44
|
+
const CAPGO_PLUGIN_NAME = 'CapgoInAppBrowser';
|
|
45
|
+
const PREVIOUS_PLUGIN_NAME = 'InAppBrowser';
|
|
46
|
+
function resolvePluginName() {
|
|
47
|
+
if (!core.Capacitor.isNativePlatform()) {
|
|
48
|
+
return CAPGO_PLUGIN_NAME;
|
|
49
|
+
}
|
|
50
|
+
if (core.Capacitor.isPluginAvailable(CAPGO_PLUGIN_NAME)) {
|
|
51
|
+
return CAPGO_PLUGIN_NAME;
|
|
52
|
+
}
|
|
53
|
+
if (core.Capacitor.isPluginAvailable(PREVIOUS_PLUGIN_NAME)) {
|
|
54
|
+
return PREVIOUS_PLUGIN_NAME;
|
|
55
|
+
}
|
|
56
|
+
console.warn(`[InAppBrowser] Neither '${CAPGO_PLUGIN_NAME}' nor '${PREVIOUS_PLUGIN_NAME}' native plugin detected. ` +
|
|
57
|
+
'Ensure @capgo/capacitor-inappbrowser native code is installed.');
|
|
58
|
+
return CAPGO_PLUGIN_NAME;
|
|
59
|
+
}
|
|
60
|
+
const inAppBrowserImplementations = {
|
|
45
61
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.InAppBrowserWeb()),
|
|
46
|
-
}
|
|
62
|
+
};
|
|
63
|
+
const InAppBrowser = core.registerPlugin(resolvePluginName(), inAppBrowserImplementations);
|
|
47
64
|
function arrayBufferToBase64(buffer) {
|
|
48
65
|
const bytes = new Uint8Array(buffer);
|
|
49
66
|
let binary = '';
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n /**\n * Shows a simple toolbar with just a close button and share button\n * @since 0.1.0\n */\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n /**\n * Shows a simple toolbar with just a close button\n * @since 7.6.8\n */\n ToolBarType[\"COMPACT\"] = \"compact\";\n /**\n * Shows a full navigation toolbar with back/forward buttons\n * @since 0.1.0\n */\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n /**\n * Shows no toolbar\n * @since 0.1.0\n */\n ToolBarType[\"BLANK\"] = \"blank\";\n})(ToolBarType || (ToolBarType = {}));\nexport var InvisibilityMode;\n(function (InvisibilityMode) {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n InvisibilityMode[\"AWARE\"] = \"AWARE\";\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n InvisibilityMode[\"FAKE_VISIBLE\"] = \"FAKE_VISIBLE\";\n})(InvisibilityMode || (InvisibilityMode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst InAppBrowser = registerPlugin('InAppBrowser', {\n web: () => import('./web').then((m) => new m.InAppBrowserWeb()),\n});\nfunction arrayBufferToBase64(buffer) {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n}\nfunction headersToRecord(headers) {\n const result = {};\n headers.forEach((value, key) => {\n result[key] = value;\n });\n return result;\n}\nfunction errorMessage(error) {\n if (error instanceof Error) {\n return error.message;\n }\n if (typeof error === 'string') {\n return error;\n }\n if (error && typeof error === 'object' && 'message' in error && typeof error.message === 'string') {\n return error.message;\n }\n return String(error);\n}\nfunction isStaleProxyResponseError(error) {\n const message = errorMessage(error);\n return message.includes('No proxy handler found') || message.includes('Target WebView not found for proxy request');\n}\nfunction isProxyResponse(value) {\n return (value !== null &&\n typeof value === 'object' &&\n 'status' in value &&\n 'headers' in value &&\n !(value instanceof Response));\n}\nfunction isProxyRequestOverride(value) {\n return value !== null && typeof value === 'object' && 'url' in value && !(value instanceof Response);\n}\nfunction isProxyDecision(value) {\n return (value !== null && typeof value === 'object' && ('request' in value || 'response' in value || 'cancel' in value));\n}\nasync function sendProxyDecision(requestId, webviewId, decision, phase) {\n try {\n await InAppBrowser.handleProxyRequest({\n requestId,\n webviewId,\n decision,\n phase,\n });\n }\n catch (error) {\n if (isStaleProxyResponseError(error)) {\n return;\n }\n throw error;\n }\n}\nconst addProxyHandler = (callback) => {\n return InAppBrowser.addListener('proxyRequest', async (event) => {\n let decision = null;\n try {\n const result = await callback(event);\n if (result === null) {\n decision = null;\n }\n else if (isProxyDecision(result)) {\n decision = result;\n }\n else if (isProxyRequestOverride(result)) {\n decision = { request: result };\n }\n else if (isProxyResponse(result)) {\n decision = { response: result };\n }\n else {\n const cloned = result.clone();\n const buffer = await cloned.arrayBuffer();\n decision = {\n response: {\n body: arrayBufferToBase64(buffer),\n status: result.status,\n headers: headersToRecord(result.headers),\n },\n };\n }\n }\n catch (_error) {\n decision = null;\n }\n await sendProxyDecision(event.requestId, event.webviewId, decision, event.phase);\n });\n};\nexport * from './definitions';\nexport { InAppBrowser, addProxyHandler };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class InAppBrowserWeb extends WebPlugin {\n clearAllCookies() {\n console.log('clearAllCookies');\n return Promise.resolve();\n }\n clearCache() {\n console.log('clearCache');\n return Promise.resolve();\n }\n async open(options) {\n console.log('open', options);\n return options;\n }\n async clearCookies(options) {\n console.log('cleanCookies', options);\n return;\n }\n async getCookies(options) {\n // Web implementation to get cookies\n return options;\n }\n async openWebView(options) {\n console.log('openWebView', options);\n return options;\n }\n async executeScript({ code }) {\n console.log('code', code);\n return code;\n }\n async close(options) {\n console.log('close', options);\n return;\n }\n async hide(options) {\n console.log('hide', options);\n return;\n }\n async show(options) {\n console.log('show', options);\n return;\n }\n async setUrl(options) {\n console.log('setUrl', options.url);\n return;\n }\n async reload(options) {\n console.log('reload', options);\n return;\n }\n async postMessage(options) {\n console.log('postMessage', options);\n return options;\n }\n async takeScreenshot(options) {\n console.log('takeScreenshot not supported on web', options);\n throw this.unimplemented('Screenshots are not supported on web.');\n }\n async goBack() {\n console.log('goBack');\n return;\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n async updateDimensions(options) {\n console.log('updateDimensions', options);\n // Web platform doesn't support dimension control\n return;\n }\n async handleProxyRequest(options) {\n console.log('handleProxyRequest not supported on web', options);\n return;\n }\n async setEnabledSafeTopMargin(options) {\n console.log('setEnabledSafeTopMargin not supported on web', options);\n return;\n }\n async setEnabledSafeBottomMargin(options) {\n console.log('setEnabledSafeBottomMargin not supported on web', options);\n return;\n }\n async openSecureWindow(options) {\n const w = 600;\n const h = 550;\n const settings = [\n ['width', w],\n ['height', h],\n ['left', screen.width / 2 - w / 2],\n ['top', screen.height / 2 - h / 2],\n ]\n .map((x) => x.join('='))\n .join(',');\n const popup = window.open(options.authEndpoint, 'Authorization', settings);\n if (!popup) {\n throw new Error('Failed to open secure window');\n }\n if (typeof popup.focus === 'function') {\n popup.focus();\n }\n return new Promise((resolve, reject) => {\n const bc = new BroadcastChannel(options.broadcastChannelName || 'oauth-channel');\n bc.addEventListener('message', (event) => {\n if (event.data.startsWith(options.redirectUri)) {\n bc.close();\n resolve({ redirectedUri: event.data });\n }\n else {\n bc.close();\n reject(new Error('Redirect URI does not match, expected ' + options.redirectUri + ' but got ' + event.data));\n }\n });\n setTimeout(() => {\n bc.close();\n reject(new Error('The sign-in flow timed out'));\n }, 5 * 60000);\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","InvisibilityMode","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,eAAe,EAAE;IAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;IACtC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;IACtC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;AAClCC;IACX,CAAC,UAAU,WAAW,EAAE;IACxB;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU;IACxC;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,SAAS,CAAC,GAAG,SAAS;IACtC;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,YAAY,CAAC,GAAG,YAAY;IAC5C;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;IAClC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;AAC1BC;IACX,CAAC,UAAU,gBAAgB,EAAE;IAC7B;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO;IACvC;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,cAAc;IACrD,CAAC,EAAEA,wBAAgB,KAAKA,wBAAgB,GAAG,EAAE,CAAC,CAAC;;ACrC1C,UAAC,YAAY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E,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,KAAK;IACtD,gBAAgB,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;IAChE,oBAAoB,EAAE,CAAC,KAAK,EAAE;IAC9B,oBAAoB,OAAO,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1D,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB,EAAE,CAAC,KAAK,EAAE;IAC9B,oBAAoB,MAAM,CAAC,IAAI,KAAK,CAAC,wCAAwC,GAAG,OAAO,CAAC,WAAW,GAAG,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAChI,gBAAgB;IAChB,YAAY,CAAC,CAAC;IACd,YAAY,UAAU,CAAC,MAAM;IAC7B,gBAAgB,EAAE,CAAC,KAAK,EAAE;IAC1B,gBAAgB,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC/D,YAAY,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;IACzB,QAAQ,CAAC,CAAC;IACV,IAAI;IACJ;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n /**\n * Shows a simple toolbar with just a close button and share button\n * @since 0.1.0\n */\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n /**\n * Shows a simple toolbar with just a close button\n * @since 7.6.8\n */\n ToolBarType[\"COMPACT\"] = \"compact\";\n /**\n * Shows a full navigation toolbar with back/forward buttons\n * @since 0.1.0\n */\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n /**\n * Shows no toolbar\n * @since 0.1.0\n */\n ToolBarType[\"BLANK\"] = \"blank\";\n})(ToolBarType || (ToolBarType = {}));\nexport var InvisibilityMode;\n(function (InvisibilityMode) {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n InvisibilityMode[\"AWARE\"] = \"AWARE\";\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n InvisibilityMode[\"FAKE_VISIBLE\"] = \"FAKE_VISIBLE\";\n})(InvisibilityMode || (InvisibilityMode = {}));\n//# sourceMappingURL=definitions.js.map","import { Capacitor, registerPlugin } from '@capacitor/core';\nconst CAPGO_PLUGIN_NAME = 'CapgoInAppBrowser';\nconst PREVIOUS_PLUGIN_NAME = 'InAppBrowser';\nfunction resolvePluginName() {\n if (!Capacitor.isNativePlatform()) {\n return CAPGO_PLUGIN_NAME;\n }\n if (Capacitor.isPluginAvailable(CAPGO_PLUGIN_NAME)) {\n return CAPGO_PLUGIN_NAME;\n }\n if (Capacitor.isPluginAvailable(PREVIOUS_PLUGIN_NAME)) {\n return PREVIOUS_PLUGIN_NAME;\n }\n console.warn(`[InAppBrowser] Neither '${CAPGO_PLUGIN_NAME}' nor '${PREVIOUS_PLUGIN_NAME}' native plugin detected. ` +\n 'Ensure @capgo/capacitor-inappbrowser native code is installed.');\n return CAPGO_PLUGIN_NAME;\n}\nconst inAppBrowserImplementations = {\n web: () => import('./web').then((m) => new m.InAppBrowserWeb()),\n};\nconst InAppBrowser = registerPlugin(resolvePluginName(), inAppBrowserImplementations);\nfunction arrayBufferToBase64(buffer) {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n}\nfunction headersToRecord(headers) {\n const result = {};\n headers.forEach((value, key) => {\n result[key] = value;\n });\n return result;\n}\nfunction errorMessage(error) {\n if (error instanceof Error) {\n return error.message;\n }\n if (typeof error === 'string') {\n return error;\n }\n if (error && typeof error === 'object' && 'message' in error && typeof error.message === 'string') {\n return error.message;\n }\n return String(error);\n}\nfunction isStaleProxyResponseError(error) {\n const message = errorMessage(error);\n return message.includes('No proxy handler found') || message.includes('Target WebView not found for proxy request');\n}\nfunction isProxyResponse(value) {\n return (value !== null &&\n typeof value === 'object' &&\n 'status' in value &&\n 'headers' in value &&\n !(value instanceof Response));\n}\nfunction isProxyRequestOverride(value) {\n return value !== null && typeof value === 'object' && 'url' in value && !(value instanceof Response);\n}\nfunction isProxyDecision(value) {\n return (value !== null && typeof value === 'object' && ('request' in value || 'response' in value || 'cancel' in value));\n}\nasync function sendProxyDecision(requestId, webviewId, decision, phase) {\n try {\n await InAppBrowser.handleProxyRequest({\n requestId,\n webviewId,\n decision,\n phase,\n });\n }\n catch (error) {\n if (isStaleProxyResponseError(error)) {\n return;\n }\n throw error;\n }\n}\nconst addProxyHandler = (callback) => {\n return InAppBrowser.addListener('proxyRequest', async (event) => {\n let decision = null;\n try {\n const result = await callback(event);\n if (result === null) {\n decision = null;\n }\n else if (isProxyDecision(result)) {\n decision = result;\n }\n else if (isProxyRequestOverride(result)) {\n decision = { request: result };\n }\n else if (isProxyResponse(result)) {\n decision = { response: result };\n }\n else {\n const cloned = result.clone();\n const buffer = await cloned.arrayBuffer();\n decision = {\n response: {\n body: arrayBufferToBase64(buffer),\n status: result.status,\n headers: headersToRecord(result.headers),\n },\n };\n }\n }\n catch (_error) {\n decision = null;\n }\n await sendProxyDecision(event.requestId, event.webviewId, decision, event.phase);\n });\n};\nexport * from './definitions';\nexport { InAppBrowser, addProxyHandler };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class InAppBrowserWeb extends WebPlugin {\n clearAllCookies() {\n console.log('clearAllCookies');\n return Promise.resolve();\n }\n clearCache() {\n console.log('clearCache');\n return Promise.resolve();\n }\n async open(options) {\n console.log('open', options);\n return options;\n }\n async clearCookies(options) {\n console.log('cleanCookies', options);\n return;\n }\n async getCookies(options) {\n // Web implementation to get cookies\n return options;\n }\n async openWebView(options) {\n console.log('openWebView', options);\n return options;\n }\n async executeScript({ code }) {\n console.log('code', code);\n return code;\n }\n async close(options) {\n console.log('close', options);\n return;\n }\n async hide(options) {\n console.log('hide', options);\n return;\n }\n async show(options) {\n console.log('show', options);\n return;\n }\n async setUrl(options) {\n console.log('setUrl', options.url);\n return;\n }\n async reload(options) {\n console.log('reload', options);\n return;\n }\n async postMessage(options) {\n console.log('postMessage', options);\n return options;\n }\n async takeScreenshot(options) {\n console.log('takeScreenshot not supported on web', options);\n throw this.unimplemented('Screenshots are not supported on web.');\n }\n async goBack() {\n console.log('goBack');\n return;\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n async updateDimensions(options) {\n console.log('updateDimensions', options);\n // Web platform doesn't support dimension control\n return;\n }\n async handleProxyRequest(options) {\n console.log('handleProxyRequest not supported on web', options);\n return;\n }\n async setEnabledSafeTopMargin(options) {\n console.log('setEnabledSafeTopMargin not supported on web', options);\n return;\n }\n async setEnabledSafeBottomMargin(options) {\n console.log('setEnabledSafeBottomMargin not supported on web', options);\n return;\n }\n async openSecureWindow(options) {\n const w = 600;\n const h = 550;\n const settings = [\n ['width', w],\n ['height', h],\n ['left', screen.width / 2 - w / 2],\n ['top', screen.height / 2 - h / 2],\n ]\n .map((x) => x.join('='))\n .join(',');\n const popup = window.open(options.authEndpoint, 'Authorization', settings);\n if (!popup) {\n throw new Error('Failed to open secure window');\n }\n if (typeof popup.focus === 'function') {\n popup.focus();\n }\n return new Promise((resolve, reject) => {\n const bc = new BroadcastChannel(options.broadcastChannelName || 'oauth-channel');\n bc.addEventListener('message', (event) => {\n if (event.data.startsWith(options.redirectUri)) {\n bc.close();\n resolve({ redirectedUri: event.data });\n }\n else {\n bc.close();\n reject(new Error('Redirect URI does not match, expected ' + options.redirectUri + ' but got ' + event.data));\n }\n });\n setTimeout(() => {\n bc.close();\n reject(new Error('The sign-in flow timed out'));\n }, 5 * 60000);\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","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IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU,EAAE;IAC/C,YAAY,KAAK,CAAC,KAAK,EAAE;IACzB,QAAQ;IACR,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;IAChD,YAAY,MAAM,EAAE,GAAG,IAAI,gBAAgB,CAAC,OAAO,CAAC,oBAAoB,IAAI,eAAe,CAAC;IAC5F,YAAY,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,KAAK;IACtD,gBAAgB,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;IAChE,oBAAoB,EAAE,CAAC,KAAK,EAAE;IAC9B,oBAAoB,OAAO,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1D,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB,EAAE,CAAC,KAAK,EAAE;IAC9B,oBAAoB,MAAM,CAAC,IAAI,KAAK,CAAC,wCAAwC,GAAG,OAAO,CAAC,WAAW,GAAG,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAChI,gBAAgB;IAChB,YAAY,CAAC,CAAC;IACd,YAAY,UAAU,CAAC,MAAM;IAC7B,gBAAgB,EAAE,CAAC,KAAK,EAAE;IAC1B,gBAAgB,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC/D,YAAY,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;IACzB,QAAQ,CAAC,CAAC;IACV,IAAI;IACJ;;;;;;;;;;;;;;;;"}
|
|
@@ -71,15 +71,15 @@ extension UIColor {
|
|
|
71
71
|
* Please read the Capacitor iOS Plugin Development Guide
|
|
72
72
|
* here: https://capacitorjs.com/docs/plugins/ios
|
|
73
73
|
*/
|
|
74
|
-
@objc(
|
|
75
|
-
public class
|
|
74
|
+
@objc(CapgoInAppBrowserPlugin)
|
|
75
|
+
public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
76
76
|
enum InvisibilityMode: String {
|
|
77
77
|
case aware = "AWARE"
|
|
78
78
|
case fakeVisible = "FAKE_VISIBLE"
|
|
79
79
|
}
|
|
80
|
-
private let pluginVersion: String = "8.6.
|
|
81
|
-
public let identifier = "
|
|
82
|
-
public let jsName = "
|
|
80
|
+
private let pluginVersion: String = "8.6.18"
|
|
81
|
+
public let identifier = "CapgoInAppBrowserPlugin"
|
|
82
|
+
public let jsName = "CapgoInAppBrowser"
|
|
83
83
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
84
84
|
CAPPluginMethod(name: "goBack", returnType: CAPPluginReturnPromise),
|
|
85
85
|
CAPPluginMethod(name: "open", returnType: CAPPluginReturnPromise),
|
|
@@ -325,7 +325,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
325
325
|
try rawRules.enumerated().map { index, item in
|
|
326
326
|
guard let dictionary = item as? [String: Any] else {
|
|
327
327
|
throw NSError(
|
|
328
|
-
domain: "
|
|
328
|
+
domain: "CapgoInAppBrowserPlugin",
|
|
329
329
|
code: -1,
|
|
330
330
|
userInfo: [NSLocalizedDescriptionKey: "Proxy rule at index \(index) must be an object"]
|
|
331
331
|
)
|
|
@@ -342,12 +342,18 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
342
342
|
return
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
+
dismissActiveKeyboard()
|
|
345
346
|
let presenter = self.bridge?.viewController?.presentedViewController ?? self.bridge?.viewController
|
|
346
347
|
presenter?.present(navigationController, animated: isAnimated, completion: {
|
|
347
348
|
self.currentPluginCall?.resolve()
|
|
348
349
|
})
|
|
349
350
|
}
|
|
350
351
|
|
|
352
|
+
private func dismissActiveKeyboard() {
|
|
353
|
+
self.bridge?.webView?.endEditing(true)
|
|
354
|
+
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
|
|
355
|
+
}
|
|
356
|
+
|
|
351
357
|
private func activeWindow() -> UIWindow? {
|
|
352
358
|
return UIApplication.shared.connectedScenes
|
|
353
359
|
.compactMap { $0 as? UIWindowScene }
|
|
@@ -1925,7 +1931,10 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
1925
1931
|
}
|
|
1926
1932
|
}
|
|
1927
1933
|
|
|
1928
|
-
|
|
1934
|
+
@available(*, deprecated, renamed: "CapgoInAppBrowserPlugin")
|
|
1935
|
+
public typealias InAppBrowserPlugin = CapgoInAppBrowserPlugin
|
|
1936
|
+
|
|
1937
|
+
extension CapgoInAppBrowserPlugin: ASWebAuthenticationPresentationContextProviding {
|
|
1929
1938
|
public func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
|
|
1930
1939
|
return self.bridge?.viewController?.view.window ?? ASPresentationAnchor()
|
|
1931
1940
|
}
|
|
@@ -449,7 +449,7 @@ public class ProxySchemeHandler: NSObject, WKURLSchemeHandler, URLSessionTaskDel
|
|
|
449
449
|
/// still reach finish() or the scheme task strands.
|
|
450
450
|
static let redirectStatusCodes: Set<Int> = [301, 302, 303, 307, 308]
|
|
451
451
|
|
|
452
|
-
weak var plugin:
|
|
452
|
+
weak var plugin: CapgoInAppBrowserPlugin?
|
|
453
453
|
private var pendingTasks: [String: PendingProxyTask] = [:]
|
|
454
454
|
private var stoppedRequests: [String: UUID] = [:]
|
|
455
455
|
private var timedOutRequests: [String: String] = [:]
|
|
@@ -464,7 +464,7 @@ public class ProxySchemeHandler: NSObject, WKURLSchemeHandler, URLSessionTaskDel
|
|
|
464
464
|
private lazy var session = URLSession(configuration: .default, delegate: self, delegateQueue: nil)
|
|
465
465
|
|
|
466
466
|
init(
|
|
467
|
-
plugin:
|
|
467
|
+
plugin: CapgoInAppBrowserPlugin,
|
|
468
468
|
webviewId: String,
|
|
469
469
|
legacyProxyRequests: Bool,
|
|
470
470
|
legacyProxyRequestURLRegex: NSRegularExpression?,
|
|
@@ -226,6 +226,16 @@ enum ConsoleMessageSupport {
|
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
enum WebViewViewportLayoutSupport {
|
|
230
|
+
static func shouldRefreshViewport(previousSize: CGSize?, currentSize: CGSize, force: Bool = false) -> Bool {
|
|
231
|
+
guard currentSize.width > 0, currentSize.height > 0 else {
|
|
232
|
+
return false
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return force || previousSize != currentSize
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
229
239
|
open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
230
240
|
|
|
231
241
|
public init() {
|
|
@@ -338,14 +348,11 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
338
348
|
open var headers: [String: String]?
|
|
339
349
|
open var httpMethod: String?
|
|
340
350
|
open var httpBody: String?
|
|
341
|
-
open var capBrowserPlugin:
|
|
351
|
+
open var capBrowserPlugin: CapgoInAppBrowserPlugin?
|
|
342
352
|
var instanceId: String = ""
|
|
343
353
|
var shareDisclaimer: [String: Any]?
|
|
344
354
|
var shareSubject: String?
|
|
345
355
|
var didpageInit = false
|
|
346
|
-
var viewHeightLandscape: CGFloat?
|
|
347
|
-
var viewHeightPortrait: CGFloat?
|
|
348
|
-
var currentViewHeight: CGFloat?
|
|
349
356
|
open var closeModal = false
|
|
350
357
|
open var closeModalTitle = ""
|
|
351
358
|
open var closeModalDescription = ""
|
|
@@ -386,6 +393,8 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
386
393
|
internal var preShowSemaphore: DispatchSemaphore?
|
|
387
394
|
internal var preShowError: String?
|
|
388
395
|
private var isWebViewInitialized = false
|
|
396
|
+
private var isObservingKeyboardViewportChanges = false
|
|
397
|
+
private var lastViewportRefreshSize: CGSize?
|
|
389
398
|
private var downloadStates: [ObjectIdentifier: WKDownloadState] = [:]
|
|
390
399
|
private var previewItemURL: URL?
|
|
391
400
|
|
|
@@ -432,10 +441,10 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
432
441
|
|
|
433
442
|
private func attachmentDispositionType(_ response: URLResponse) -> String? {
|
|
434
443
|
guard let disposition = attachmentDisposition(response)?
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
444
|
+
.split(separator: ";", maxSplits: 1)
|
|
445
|
+
.first?
|
|
446
|
+
.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
447
|
+
.lowercased(),
|
|
439
448
|
!disposition.isEmpty else {
|
|
440
449
|
return nil
|
|
441
450
|
}
|
|
@@ -527,7 +536,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
527
536
|
"application/download",
|
|
528
537
|
"application/x-download",
|
|
529
538
|
"application/binary",
|
|
530
|
-
"application/x-binary"
|
|
539
|
+
"application/x-binary"
|
|
531
540
|
]
|
|
532
541
|
|
|
533
542
|
if let candidate, !candidate.isEmpty, !genericMimeTypes.contains(candidate) {
|
|
@@ -590,7 +599,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
590
599
|
"fileName": fileURL.lastPathComponent,
|
|
591
600
|
"path": fileURL.path,
|
|
592
601
|
"localUrl": fileURL.absoluteString,
|
|
593
|
-
"handledBy": handledBy
|
|
602
|
+
"handledBy": handledBy
|
|
594
603
|
]
|
|
595
604
|
if let sourceURL {
|
|
596
605
|
data["sourceUrl"] = sourceURL
|
|
@@ -842,6 +851,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
842
851
|
}
|
|
843
852
|
|
|
844
853
|
deinit {
|
|
854
|
+
NotificationCenter.default.removeObserver(self)
|
|
845
855
|
webView?.removeObserver(self, forKeyPath: estimatedProgressKeyPath)
|
|
846
856
|
if websiteTitleInNavigationBar {
|
|
847
857
|
webView?.removeObserver(self, forKeyPath: titleKeyPath)
|
|
@@ -886,6 +896,11 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
886
896
|
}
|
|
887
897
|
}
|
|
888
898
|
|
|
899
|
+
override open func viewDidLayoutSubviews() {
|
|
900
|
+
super.viewDidLayoutSubviews()
|
|
901
|
+
refreshWebViewViewportIfNeeded()
|
|
902
|
+
}
|
|
903
|
+
|
|
889
904
|
func updateButtonTintColors() {
|
|
890
905
|
// Ensure all button items use the navigation bar's tint color
|
|
891
906
|
if let tintColor = navigationController?.navigationBar.tintColor {
|
|
@@ -986,6 +1001,63 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
986
1001
|
capBrowserPlugin?.notifyListeners(eventName, data: payload(with: data))
|
|
987
1002
|
}
|
|
988
1003
|
|
|
1004
|
+
private func startObservingKeyboardViewportChanges() {
|
|
1005
|
+
guard !isObservingKeyboardViewportChanges else {
|
|
1006
|
+
return
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
isObservingKeyboardViewportChanges = true
|
|
1010
|
+
let center = NotificationCenter.default
|
|
1011
|
+
center.addObserver(self, selector: #selector(keyboardViewportDidChange(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
|
|
1012
|
+
center.addObserver(self, selector: #selector(keyboardViewportDidChange(_:)), name: UIResponder.keyboardDidHideNotification, object: nil)
|
|
1013
|
+
center.addObserver(self, selector: #selector(keyboardViewportDidChange(_:)), name: UIResponder.keyboardDidChangeFrameNotification, object: nil)
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
@objc private func keyboardViewportDidChange(_ notification: Notification) {
|
|
1017
|
+
scheduleWebViewViewportRefresh(force: true, delay: viewportRefreshDelay(from: notification))
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
private func viewportRefreshDelay(from notification: Notification) -> TimeInterval {
|
|
1021
|
+
guard let duration = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber else {
|
|
1022
|
+
return 0.05
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
return max(0.05, duration.doubleValue)
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
private func scheduleWebViewViewportRefresh(force: Bool = false, delay: TimeInterval = 0.05) {
|
|
1029
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in
|
|
1030
|
+
self?.refreshWebViewViewportIfNeeded(force: force)
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
private func refreshWebViewViewportIfNeeded(force: Bool = false) {
|
|
1035
|
+
guard let webView = self.webView, webView.superview != nil else {
|
|
1036
|
+
return
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
if force {
|
|
1040
|
+
self.view.setNeedsLayout()
|
|
1041
|
+
self.view.layoutIfNeeded()
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
let currentSize = webView.bounds.size
|
|
1045
|
+
guard WebViewViewportLayoutSupport.shouldRefreshViewport(
|
|
1046
|
+
previousSize: lastViewportRefreshSize,
|
|
1047
|
+
currentSize: currentSize,
|
|
1048
|
+
force: force
|
|
1049
|
+
) else {
|
|
1050
|
+
return
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
lastViewportRefreshSize = currentSize
|
|
1054
|
+
webView.setNeedsLayout()
|
|
1055
|
+
webView.layoutIfNeeded()
|
|
1056
|
+
webView.scrollView.setNeedsLayout()
|
|
1057
|
+
webView.scrollView.layoutIfNeeded()
|
|
1058
|
+
webView.evaluateJavaScript("window.dispatchEvent(new Event('resize'));", completionHandler: nil)
|
|
1059
|
+
}
|
|
1060
|
+
|
|
989
1061
|
private func jsonString(from object: Any) -> String? {
|
|
990
1062
|
guard JSONSerialization.isValidJSONObject(object),
|
|
991
1063
|
let data = try? JSONSerialization.data(withJSONObject: object),
|
|
@@ -1251,6 +1323,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
1251
1323
|
return
|
|
1252
1324
|
}
|
|
1253
1325
|
self.isWebViewInitialized = true
|
|
1326
|
+
self.startObservingKeyboardViewportChanges()
|
|
1254
1327
|
self.view.backgroundColor = UIColor.white
|
|
1255
1328
|
|
|
1256
1329
|
self.extendedLayoutIncludesOpaqueBars = true
|
|
@@ -1540,47 +1613,6 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
1540
1613
|
return self.capableWebView
|
|
1541
1614
|
}
|
|
1542
1615
|
|
|
1543
|
-
@objc func restateViewHeight() {
|
|
1544
|
-
var bottomPadding = CGFloat(0.0)
|
|
1545
|
-
var topPadding = CGFloat(0.0)
|
|
1546
|
-
let window = UIApplication.shared.windows.first(where: { $0.isKeyWindow })
|
|
1547
|
-
bottomPadding = window?.safeAreaInsets.bottom ?? 0.0
|
|
1548
|
-
topPadding = window?.safeAreaInsets.top ?? 0.0
|
|
1549
|
-
if UIDevice.current.orientation.isPortrait {
|
|
1550
|
-
// Don't force toolbar visibility
|
|
1551
|
-
if self.viewHeightPortrait == nil {
|
|
1552
|
-
self.viewHeightPortrait = self.view.safeAreaLayoutGuide.layoutFrame.size.height
|
|
1553
|
-
self.viewHeightPortrait! += bottomPadding
|
|
1554
|
-
if self.navigationController?.navigationBar.isHidden == true {
|
|
1555
|
-
self.viewHeightPortrait! += topPadding
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
self.currentViewHeight = self.viewHeightPortrait
|
|
1559
|
-
} else if UIDevice.current.orientation.isLandscape {
|
|
1560
|
-
// Don't force toolbar visibility
|
|
1561
|
-
if self.viewHeightLandscape == nil {
|
|
1562
|
-
self.viewHeightLandscape = self.view.safeAreaLayoutGuide.layoutFrame.size.height
|
|
1563
|
-
self.viewHeightLandscape! += bottomPadding
|
|
1564
|
-
if self.navigationController?.navigationBar.isHidden == true {
|
|
1565
|
-
self.viewHeightLandscape! += topPadding
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
self.currentViewHeight = self.viewHeightLandscape
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
override open func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
|
|
1573
|
-
// self.view.frame.size.height = self.currentViewHeight!
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
override open func viewWillLayoutSubviews() {
|
|
1577
|
-
restateViewHeight()
|
|
1578
|
-
// Don't override frame height when enabledSafeBottomMargin is true, as it would override our constraints
|
|
1579
|
-
if self.currentViewHeight != nil && !self.enabledSafeBottomMargin {
|
|
1580
|
-
self.view.frame.size.height = self.currentViewHeight!
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
|
|
1584
1616
|
override open func viewWillAppear(_ animated: Bool) {
|
|
1585
1617
|
super.viewWillAppear(animated)
|
|
1586
1618
|
if !self.viewWasPresented {
|
|
@@ -1620,6 +1652,8 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
1620
1652
|
|
|
1621
1653
|
override open func viewDidAppear(_ animated: Bool) {
|
|
1622
1654
|
super.viewDidAppear(animated)
|
|
1655
|
+
refreshWebViewViewportIfNeeded(force: true)
|
|
1656
|
+
scheduleWebViewViewportRefresh(force: true, delay: 0.25)
|
|
1623
1657
|
|
|
1624
1658
|
// Force add buttonNearDone if it's not visible yet
|
|
1625
1659
|
if buttonNearDoneIcon != nil {
|
|
@@ -2907,6 +2941,7 @@ extension WKWebViewController: WKNavigationDelegate {
|
|
|
2907
2941
|
webView.topAnchor.constraint(equalTo: topAnchor)
|
|
2908
2942
|
])
|
|
2909
2943
|
self.view.layoutIfNeeded()
|
|
2944
|
+
refreshWebViewViewportIfNeeded(force: true)
|
|
2910
2945
|
}
|
|
2911
2946
|
|
|
2912
2947
|
open func updateSafeBottomMargin(_ enabled: Bool) {
|
|
@@ -2927,6 +2962,7 @@ extension WKWebViewController: WKNavigationDelegate {
|
|
|
2927
2962
|
webView.bottomAnchor.constraint(equalTo: bottomAnchor)
|
|
2928
2963
|
])
|
|
2929
2964
|
self.view.layoutIfNeeded()
|
|
2965
|
+
refreshWebViewViewportIfNeeded(force: true)
|
|
2930
2966
|
}
|
|
2931
2967
|
}
|
|
2932
2968
|
|