@capgo/capacitor-inappbrowser 8.7.9 → 8.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 { 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 clearAllBrowsingData() {\n console.log('clearAllBrowsingData');\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 sendToBack(options) {\n console.log('sendToBack not supported on web', options);\n return;\n }\n async bringToFront(options) {\n console.log('bringToFront not supported on web', options);\n return;\n }\n async dispatchInputEvent(options) {\n console.log('dispatchInputEvent not supported on web', 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,SAA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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 = {}));\nexport var CloseAction;\n(function (CloseAction) {\n /**\n * The toolbar close button closes and destroys the webview.\n */\n CloseAction[\"CLOSE\"] = \"close\";\n /**\n * The toolbar close button hides the webview so it can be shown again.\n */\n CloseAction[\"HIDE\"] = \"hide\";\n})(CloseAction || (CloseAction = {}));\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 clearAllBrowsingData() {\n console.log('clearAllBrowsingData');\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 sendToBack(options) {\n console.log('sendToBack not supported on web', options);\n return;\n }\n async bringToFront(options) {\n console.log('bringToFront not supported on web', options);\n return;\n }\n async dispatchInputEvent(options) {\n console.log('dispatchInputEvent not supported on web', 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","CloseAction","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,W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AAK,CAAC;AACzB,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ;;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -40,6 +40,17 @@ var capacitorInAppBrowser = (function (exports, core) {
40
40
  */
41
41
  InvisibilityMode["FAKE_VISIBLE"] = "FAKE_VISIBLE";
42
42
  })(exports.InvisibilityMode || (exports.InvisibilityMode = {}));
43
+ exports.CloseAction = void 0;
44
+ (function (CloseAction) {
45
+ /**
46
+ * The toolbar close button closes and destroys the webview.
47
+ */
48
+ CloseAction["CLOSE"] = "close";
49
+ /**
50
+ * The toolbar close button hides the webview so it can be shown again.
51
+ */
52
+ CloseAction["HIDE"] = "hide";
53
+ })(exports.CloseAction || (exports.CloseAction = {}));
43
54
 
44
55
  const CAPGO_PLUGIN_NAME = 'CapgoInAppBrowser';
45
56
  const PREVIOUS_PLUGIN_NAME = 'InAppBrowser';
@@ -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 { 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 clearAllBrowsingData() {\n console.log('clearAllBrowsingData');\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 sendToBack(options) {\n console.log('sendToBack not supported on web', options);\n return;\n }\n async bringToFront(options) {\n console.log('bringToFront not supported on web', options);\n return;\n }\n async dispatchInputEvent(options) {\n console.log('dispatchInputEvent not supported on web', 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.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AW,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 = {}));\nexport var CloseAction;\n(function (CloseAction) {\n /**\n * The toolbar close button closes and destroys the webview.\n */\n CloseAction[\"CLOSE\"] = \"close\";\n /**\n * The toolbar close button hides the webview so it can be shown again.\n */\n CloseAction[\"HIDE\"] = \"hide\";\n})(CloseAction || (CloseAction = {}));\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 clearAllBrowsingData() {\n console.log('clearAllBrowsingData');\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 sendToBack(options) {\n console.log('sendToBack not supported on web', options);\n return;\n }\n async bringToFront(options) {\n console.log('bringToFront not supported on web', options);\n return;\n }\n async dispatchInputEvent(options) {\n console.log('dispatchInputEvent not supported on web', 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","CloseAction","Capacitor","registerPl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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;;;;;;;;;;;;;;;;"}
@@ -55,8 +55,8 @@ enum CustomWebViewFrameSupport {
55
55
  static func resolvedFrame(
56
56
  width: CGFloat?,
57
57
  height: CGFloat?,
58
- x: CGFloat?,
59
- y: CGFloat?,
58
+ x positionX: CGFloat?,
59
+ y positionY: CGFloat?,
60
60
  fallbackSize: CGSize
61
61
  ) -> CGRect? {
62
62
  guard let height else {
@@ -64,8 +64,8 @@ enum CustomWebViewFrameSupport {
64
64
  }
65
65
 
66
66
  return CGRect(
67
- x: x ?? 0,
68
- y: y ?? 0,
67
+ x: positionX ?? 0,
68
+ y: positionY ?? 0,
69
69
  width: width ?? fallbackSize.width,
70
70
  height: height
71
71
  )
@@ -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.9"
101
+ private let pluginVersion: String = "8.8.0"
102
102
  public let identifier = "CapgoInAppBrowserPlugin"
103
103
  public let jsName = "CapgoInAppBrowser"
104
104
  public let pluginMethods: [CAPPluginMethod] = [
@@ -687,6 +687,17 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
687
687
  self.navigationWebViewController = nil
688
688
  }
689
689
 
690
+ func handleWebViewDidHide(id: String, url: String) {
691
+ if !id.isEmpty {
692
+ self.notifyListeners("hideEvent", data: ["id": id, "url": url])
693
+ self.setHiddenState(true, targetId: id, call: nil)
694
+ return
695
+ }
696
+
697
+ self.notifyListeners("hideEvent", data: ["url": url])
698
+ self.setHiddenState(true, targetId: activeWebViewId, call: nil)
699
+ }
700
+
690
701
  @objc func clearAllCookies(_ call: CAPPluginCall) {
691
702
  DispatchQueue.main.async {
692
703
  let targetId = call.getString("id")
@@ -832,6 +843,61 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
832
843
 
833
844
  }
834
845
 
846
+ private func optionError(_ message: String) -> NSError {
847
+ NSError(domain: "CapgoInAppBrowser", code: 0, userInfo: [NSLocalizedDescriptionKey: message])
848
+ }
849
+
850
+ private func loadToolbarIcon(from iosSettings: JSObject, optionName: String) throws -> UIImage {
851
+ guard let iconType = iosSettings["iconType"] as? String, !iconType.isEmpty else {
852
+ throw optionError("\(optionName).ios.iconType is empty")
853
+ }
854
+ guard iconType == "sf-symbol" || iconType == "asset" else {
855
+ throw optionError("\(optionName).ios.iconType must be 'sf-symbol' or 'asset'")
856
+ }
857
+ guard let icon = iosSettings["icon"] as? String, !icon.isEmpty else {
858
+ throw optionError("\(optionName).ios.icon is empty")
859
+ }
860
+
861
+ if iconType == "sf-symbol" {
862
+ guard let image = UIImage(systemName: icon)?.withRenderingMode(.alwaysTemplate) else {
863
+ throw optionError("Failed to load \(optionName) SF Symbol: \(icon)")
864
+ }
865
+ return image
866
+ }
867
+
868
+ let paths = [
869
+ icon,
870
+ "public/\(icon)",
871
+ icon.replacingOccurrences(of: "public/", with: "")
872
+ ]
873
+
874
+ for path in paths {
875
+ let assetPath = path.replacingOccurrences(of: "public/", with: "")
876
+ if let webDir = Bundle.main.resourceURL?.appendingPathComponent("public") {
877
+ let fileURL = webDir.appendingPathComponent(assetPath)
878
+ if FileManager.default.fileExists(atPath: fileURL.path),
879
+ let data = try? Data(contentsOf: fileURL),
880
+ let image = UIImage(data: data) {
881
+ return image.withRenderingMode(.alwaysTemplate)
882
+ }
883
+ }
884
+
885
+ if let wwwDir = Bundle.main.resourceURL?.appendingPathComponent("www") {
886
+ let wwwFileURL = wwwDir.appendingPathComponent(assetPath)
887
+ if FileManager.default.fileExists(atPath: wwwFileURL.path),
888
+ let data = try? Data(contentsOf: wwwFileURL),
889
+ let image = UIImage(data: data) {
890
+ return image.withRenderingMode(.alwaysTemplate)
891
+ }
892
+ }
893
+
894
+ if let image = UIImage(named: path) {
895
+ return image.withRenderingMode(.alwaysTemplate)
896
+ }
897
+ }
898
+ throw optionError("Failed to load \(optionName) icon: \(icon)")
899
+ }
900
+
835
901
  private func webSource(for urlString: String) -> WKWebSource? {
836
902
  if let html = HtmlDataUrlSupport.parseHtml(from: urlString) {
837
903
  return .string(html, base: nil)
@@ -873,85 +939,26 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
873
939
  call.reject("IOS settings are not an object")
874
940
  return
875
941
  }
876
-
877
- guard let iconType = iosSettings["iconType"] as? String else {
878
- call.reject("buttonNearDone.iconType is empty")
942
+ do {
943
+ buttonNearDoneIcon = try self.loadToolbarIcon(from: iosSettings, optionName: "buttonNearDone")
944
+ } catch {
945
+ call.reject(error.localizedDescription)
879
946
  return
880
947
  }
881
- if iconType != "sf-symbol" && iconType != "asset" {
882
- call.reject("IconType is neither 'sf-symbol' nor 'asset'")
948
+ }
949
+
950
+ var titleIcon: UIImage?
951
+ if let titleIconSettings = call.getObject("titleIcon"), let iosSettingsRaw = titleIconSettings["ios"] {
952
+ guard let iosSettings = iosSettingsRaw as? JSObject else {
953
+ call.reject("titleIcon.ios settings are not an object")
883
954
  return
884
955
  }
885
- guard let icon = iosSettings["icon"] as? String else {
886
- call.reject("buttonNearDone.icon is empty")
956
+ do {
957
+ titleIcon = try self.loadToolbarIcon(from: iosSettings, optionName: "titleIcon")
958
+ } catch {
959
+ call.reject(error.localizedDescription)
887
960
  return
888
961
  }
889
-
890
- if iconType == "sf-symbol" {
891
- buttonNearDoneIcon = UIImage(systemName: icon)?.withRenderingMode(.alwaysTemplate)
892
- print("[DEBUG] Set buttonNearDone SF Symbol icon: \(icon)")
893
- } else {
894
- // Look in app's web assets/public directory
895
- guard let webDir = Bundle.main.resourceURL?.appendingPathComponent("public") else {
896
- call.reject("Failed to locate bundled web assets")
897
- return
898
- }
899
-
900
- // Try several path combinations to find the asset
901
- let paths = [
902
- icon, // Just the icon name
903
- "public/\(icon)", // With public/ prefix
904
- icon.replacingOccurrences(of: "public/", with: "") // Without public/ prefix
905
- ]
906
-
907
- var foundImage = false
908
-
909
- for path in paths {
910
- // Try as a direct path from web assets dir
911
- let assetPath = path.replacingOccurrences(of: "public/", with: "")
912
- let fileURL = webDir.appendingPathComponent(assetPath)
913
-
914
- print("[DEBUG] Trying to load from: \(fileURL.path)")
915
-
916
- if FileManager.default.fileExists(atPath: fileURL.path),
917
- let data = try? Data(contentsOf: fileURL),
918
- let img = UIImage(data: data) {
919
- buttonNearDoneIcon = img.withRenderingMode(.alwaysTemplate)
920
- print("[DEBUG] Successfully loaded buttonNearDone from web assets: \(fileURL.path)")
921
- foundImage = true
922
- break
923
- }
924
-
925
- // Try with www directory as an alternative
926
- if let wwwDir = Bundle.main.resourceURL?.appendingPathComponent("www") {
927
- let wwwFileURL = wwwDir.appendingPathComponent(assetPath)
928
-
929
- print("[DEBUG] Trying to load from www dir: \(wwwFileURL.path)")
930
-
931
- if FileManager.default.fileExists(atPath: wwwFileURL.path),
932
- let data = try? Data(contentsOf: wwwFileURL),
933
- let img = UIImage(data: data) {
934
- buttonNearDoneIcon = img.withRenderingMode(.alwaysTemplate)
935
- print("[DEBUG] Successfully loaded buttonNearDone from www dir: \(wwwFileURL.path)")
936
- foundImage = true
937
- break
938
- }
939
- }
940
-
941
- // Try looking in app bundle assets
942
- if let iconImage = UIImage(named: path) {
943
- buttonNearDoneIcon = iconImage.withRenderingMode(.alwaysTemplate)
944
- print("[DEBUG] Successfully loaded buttonNearDone from app bundle: \(path)")
945
- foundImage = true
946
- break
947
- }
948
- }
949
-
950
- if !foundImage {
951
- call.reject("Failed to load buttonNearDone icon: \(icon)")
952
- return
953
- }
954
- }
955
962
  }
956
963
 
957
964
  if showScreenshotButton, buttonNearDoneSettings != nil {
@@ -966,6 +973,12 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
966
973
  let closeModalOk = call.getString("closeModalOk", "OK")
967
974
  let closeModalCancel = call.getString("closeModalCancel", "Cancel")
968
975
  let closeModalURLPattern = call.getString("closeModalURLPattern")
976
+ let closeAction = call.getString("closeAction", "close").lowercased()
977
+ guard closeAction == "close" || closeAction == "hide" else {
978
+ call.reject("closeAction must be 'close' or 'hide'")
979
+ return
980
+ }
981
+ let titleFontFamily = call.getString("titleFontFamily")
969
982
  let isInspectable = call.getBool("isInspectable", false)
970
983
  let preventDeeplink = call.getBool("preventDeeplink", false)
971
984
  let openBlankTargetInWebView = call.getBool("openBlankTargetInWebView", false)
@@ -1274,6 +1287,9 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
1274
1287
 
1275
1288
  webViewController.capBrowserPlugin = self
1276
1289
  webViewController.title = call.getString("title", "New Window")
1290
+ webViewController.closeAction = closeAction
1291
+ webViewController.titleFontFamily = titleFontFamily
1292
+ webViewController.titleIcon = titleIcon
1277
1293
  // Only set shareSubject if not already set for activity mode
1278
1294
  if webViewController.shareSubject == nil {
1279
1295
  webViewController.shareSubject = call.getString("shareSubject")
@@ -1383,6 +1399,7 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
1383
1399
  webViewController.updateStatusBarStyle()
1384
1400
 
1385
1401
  }
1402
+ webViewController.updateTitleAppearance()
1386
1403
 
1387
1404
  // Configure modal presentation for touch passthrough if custom dimensions are set
1388
1405
  if (width != nil || height != nil) && !toBack {
@@ -1674,14 +1691,14 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
1674
1691
  return String(Double(value))
1675
1692
  }
1676
1693
 
1677
- private func dispatchInputScript(type: String, x: Float?, y: Float?, deltaX: Float?, deltaY: Float?) -> String? {
1694
+ private func dispatchInputScript(type: String, x positionX: Float?, y positionY: Float?, deltaX: Float?, deltaY: Float?) -> String? {
1678
1695
  if type == "scroll" {
1679
- guard let x, let y, let deltaX, let deltaY,
1680
- x.isFinite, y.isFinite, deltaX.isFinite, deltaY.isFinite else {
1696
+ guard let positionX, let positionY, let deltaX, let deltaY,
1697
+ positionX.isFinite, positionY.isFinite, deltaX.isFinite, deltaY.isFinite else {
1681
1698
  return nil
1682
1699
  }
1683
- let xLiteral = jsNumber(x)
1684
- let yLiteral = jsNumber(y)
1700
+ let xLiteral = jsNumber(positionX)
1701
+ let yLiteral = jsNumber(positionY)
1685
1702
  let deltaXLiteral = jsNumber(deltaX)
1686
1703
  let deltaYLiteral = jsNumber(deltaY)
1687
1704
  return """
@@ -1735,7 +1752,7 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
1735
1752
  return nil
1736
1753
  }
1737
1754
 
1738
- guard let x, let y, x.isFinite, y.isFinite else {
1755
+ guard let positionX, let positionY, positionX.isFinite, positionY.isFinite else {
1739
1756
  return nil
1740
1757
  }
1741
1758
 
@@ -1748,8 +1765,8 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
1748
1765
 
1749
1766
  return """
1750
1767
  (function() {
1751
- const x = \(jsNumber(x));
1752
- const y = \(jsNumber(y));
1768
+ const x = \(jsNumber(positionX));
1769
+ const y = \(jsNumber(positionY));
1753
1770
  const target = document.elementFromPoint(x, y);
1754
1771
  if (!target) return false;
1755
1772
  const base = { bubbles: true, cancelable: true, composed: true, clientX: x, clientY: y, screenX: x, screenY: y };
@@ -415,6 +415,9 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
415
415
  var shareSubject: String?
416
416
  var didpageInit = false
417
417
  open var closeModal = false
418
+ open var closeAction = "close"
419
+ open var titleFontFamily: String?
420
+ open var titleIcon: UIImage?
418
421
  open var closeModalTitle = ""
419
422
  open var closeModalDescription = ""
420
423
  open var closeModalOk = ""
@@ -733,7 +736,6 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
733
736
  }
734
737
  }
735
738
 
736
-
737
739
  private func parseBlobBridgePayload(_ payload: Any) -> [String: Any]? {
738
740
  if let dictionary = payload as? [String: Any] {
739
741
  return dictionary
@@ -764,6 +766,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
764
766
  }
765
767
  }
766
768
 
769
+ @discardableResult
767
770
  private func abortBlobDownloadSession(sessionId: String, deleteFile: Bool) -> BlobDownloadSession? {
768
771
  guard let session = blobDownloadSessions.removeValue(forKey: sessionId) else {
769
772
  return nil
@@ -1333,10 +1336,54 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
1333
1336
 
1334
1337
  // Force update UI if needed
1335
1338
  self?.navigationController?.navigationBar.setNeedsLayout()
1339
+
1336
1340
  }
1337
1341
  }
1338
1342
  }
1339
1343
 
1344
+ func updateTitleAppearance() {
1345
+ guard titleIcon != nil || titleFontFamily != nil else {
1346
+ navigationItem.titleView = nil
1347
+ return
1348
+ }
1349
+
1350
+ let currentTitle = navigationItem.title ?? title ?? webView?.url?.host ?? ""
1351
+ let titleColor = navigationController?.navigationBar.titleTextAttributes?[.foregroundColor] as? UIColor
1352
+ ?? tintColor
1353
+ ?? navigationController?.navigationBar.tintColor
1354
+ ?? .label
1355
+ let fontSize = UIFont.preferredFont(forTextStyle: .headline).pointSize
1356
+ let titleFont = titleFontFamily.flatMap { UIFont(name: $0, size: fontSize) }
1357
+ ?? UIFont.systemFont(ofSize: fontSize, weight: .semibold)
1358
+
1359
+ let label = UILabel()
1360
+ label.text = currentTitle
1361
+ label.textColor = titleColor
1362
+ label.font = titleFont
1363
+ label.lineBreakMode = .byTruncatingTail
1364
+ label.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
1365
+
1366
+ let stackView = UIStackView()
1367
+ stackView.axis = .horizontal
1368
+ stackView.alignment = .center
1369
+ stackView.spacing = 6
1370
+
1371
+ if let titleIcon {
1372
+ let imageView = UIImageView(image: titleIcon.withRenderingMode(.alwaysTemplate))
1373
+ imageView.tintColor = titleColor
1374
+ imageView.contentMode = .scaleAspectFit
1375
+ imageView.translatesAutoresizingMaskIntoConstraints = false
1376
+ NSLayoutConstraint.activate([
1377
+ imageView.widthAnchor.constraint(equalToConstant: 18),
1378
+ imageView.heightAnchor.constraint(equalToConstant: 18)
1379
+ ])
1380
+ stackView.addArrangedSubview(imageView)
1381
+ }
1382
+
1383
+ stackView.addArrangedSubview(label)
1384
+ navigationItem.titleView = stackView
1385
+ }
1386
+
1340
1387
  override open func viewDidLayoutSubviews() {
1341
1388
  super.viewDidLayoutSubviews()
1342
1389
  syncWebViewSafeAreaLayout()
@@ -1387,6 +1434,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
1387
1434
  navigationItem.rightBarButtonItems?.append(buttonItem)
1388
1435
  }
1389
1436
  }
1437
+ updateTitleAppearance()
1390
1438
  }
1391
1439
 
1392
1440
  override open func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
@@ -2167,6 +2215,9 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
2167
2215
  self.ignoreUntrustedSSLError = parent.ignoreUntrustedSSLError
2168
2216
  self.enableGooglePaySupport = parent.enableGooglePaySupport
2169
2217
  self.preventDeeplink = parent.preventDeeplink
2218
+ self.closeAction = parent.closeAction
2219
+ self.titleFontFamily = parent.titleFontFamily
2220
+ self.titleIcon = parent.titleIcon
2170
2221
  self.openBlankTargetInWebView = parent.openBlankTargetInWebView
2171
2222
  self.blankNavigationTab = false
2172
2223
  self.enabledSafeBottomMargin = parent.enabledSafeBottomMargin
@@ -2218,6 +2269,12 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
2218
2269
  return self.capableWebView
2219
2270
  }
2220
2271
 
2272
+ private func applyNavigationVisibility() {
2273
+ navigationController?.setNavigationBarHidden(blankNavigationTab, animated: false)
2274
+ // Always hide toolbar since we never want it.
2275
+ navigationController?.setToolbarHidden(true, animated: false)
2276
+ }
2277
+
2221
2278
  override open func viewWillAppear(_ animated: Bool) {
2222
2279
  super.viewWillAppear(animated)
2223
2280
  if !self.viewWasPresented {
@@ -2229,6 +2286,9 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
2229
2286
  applyCustomDimensions()
2230
2287
  }
2231
2288
 
2289
+ // Reapply presentation state after hide/show re-presents the same controller.
2290
+ applyNavigationVisibility()
2291
+
2232
2292
  // Force update button appearances
2233
2293
  updateButtonTintColors()
2234
2294
 
@@ -2322,6 +2382,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
2322
2382
  case titleKeyPath?:
2323
2383
  if self.hasDynamicTitle {
2324
2384
  self.navigationItem.title = webView?.url?.host
2385
+ self.updateTitleAppearance()
2325
2386
  }
2326
2387
  case "URL":
2327
2388
  // Guard against notifications during cleanup when webView is being torn down
@@ -2676,11 +2737,7 @@ fileprivate extension WKWebViewController {
2676
2737
  }
2677
2738
 
2678
2739
  func setUpState() {
2679
- navigationController?.setNavigationBarHidden(blankNavigationTab, animated: false)
2680
-
2681
- // Always hide toolbar since we never want it
2682
- navigationController?.setToolbarHidden(true, animated: false)
2683
-
2740
+ applyNavigationVisibility()
2684
2741
  // Set tint colors but don't override specific colors
2685
2742
  if tintColor == nil {
2686
2743
  // Use system appearance if no specific tint color is set
@@ -2700,7 +2757,10 @@ fileprivate extension WKWebViewController {
2700
2757
 
2701
2758
  navigationController?.navigationBar.tintColor = previousNavigationBarState.tintColor
2702
2759
 
2703
- navigationController?.setNavigationBarHidden(previousNavigationBarState.hidden, animated: true)
2760
+ navigationController?.setNavigationBarHidden(
2761
+ blankNavigationTab || previousNavigationBarState.hidden,
2762
+ animated: true
2763
+ )
2704
2764
  }
2705
2765
 
2706
2766
  func checkRequestCookies(_ request: URLRequest, cookies: [HTTPCookie]) -> Bool {
@@ -2982,6 +3042,10 @@ fileprivate extension WKWebViewController {
2982
3042
  }
2983
3043
  if canDismiss {
2984
3044
  let currentUrl = webView?.url?.absoluteString ?? ""
3045
+ if closeAction == "hide" {
3046
+ self.capBrowserPlugin?.handleWebViewDidHide(id: instanceId, url: currentUrl)
3047
+ return
3048
+ }
2985
3049
  cleanupWebView()
2986
3050
  self.capBrowserPlugin?.handleWebViewDidClose(id: instanceId, url: currentUrl)
2987
3051
  dismiss(animated: true, completion: nil)