@capgo/capacitor-inappbrowser 8.6.15

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.
Files changed (59) hide show
  1. package/CapgoCapacitorInappbrowser.podspec +17 -0
  2. package/LICENSE +373 -0
  3. package/Package.swift +28 -0
  4. package/README.md +1610 -0
  5. package/android/build.gradle +64 -0
  6. package/android/src/main/AndroidManifest.xml +22 -0
  7. package/android/src/main/assets/proxy-bridge.js +586 -0
  8. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/ActiveWebViewSupport.java +10 -0
  9. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/CustomSchemeInterceptSupport.java +51 -0
  10. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +1820 -0
  11. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/MobileAppBridgeScript.java +122 -0
  12. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/NativeProxyRule.java +128 -0
  13. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java +725 -0
  14. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/ProxyBridge.java +93 -0
  15. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/ProxyRequestSupport.java +869 -0
  16. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/ProxyResponseRouting.java +35 -0
  17. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/SafeAreaInsetsSupport.java +28 -0
  18. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewCallbacks.java +42 -0
  19. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +6022 -0
  20. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewPermissionSupport.java +58 -0
  21. package/android/src/main/res/.gitkeep +0 -0
  22. package/android/src/main/res/drawable/arrow_back_disabled.xml +9 -0
  23. package/android/src/main/res/drawable/arrow_back_enabled.xml +9 -0
  24. package/android/src/main/res/drawable/arrow_forward_disabled.xml +9 -0
  25. package/android/src/main/res/drawable/arrow_forward_enabled.xml +9 -0
  26. package/android/src/main/res/drawable/ic_clear_24px.xml +9 -0
  27. package/android/src/main/res/drawable/ic_refresh.xml +9 -0
  28. package/android/src/main/res/drawable/ic_share.xml +10 -0
  29. package/android/src/main/res/layout/activity_browser.xml +32 -0
  30. package/android/src/main/res/layout/bridge_layout_main.xml +15 -0
  31. package/android/src/main/res/layout/content_browser.xml +17 -0
  32. package/android/src/main/res/layout/tool_bar.xml +87 -0
  33. package/android/src/main/res/values/browser_theme.xml +3 -0
  34. package/android/src/main/res/values/colors.xml +5 -0
  35. package/android/src/main/res/values/dimens.xml +3 -0
  36. package/android/src/main/res/values/strings.xml +13 -0
  37. package/android/src/main/res/values/styles.xml +4 -0
  38. package/android/src/main/res/values/themes.xml +27 -0
  39. package/android/src/main/res/xml/file_paths.xml +14 -0
  40. package/dist/docs.json +3200 -0
  41. package/dist/esm/definitions.d.ts +1507 -0
  42. package/dist/esm/definitions.js +40 -0
  43. package/dist/esm/definitions.js.map +1 -0
  44. package/dist/esm/index.d.ts +6 -0
  45. package/dist/esm/index.js +102 -0
  46. package/dist/esm/index.js.map +1 -0
  47. package/dist/esm/web.d.ts +47 -0
  48. package/dist/esm/web.js +120 -0
  49. package/dist/esm/web.js.map +1 -0
  50. package/dist/plugin.cjs.js +270 -0
  51. package/dist/plugin.cjs.js.map +1 -0
  52. package/dist/plugin.js +273 -0
  53. package/dist/plugin.js.map +1 -0
  54. package/ios/Sources/InAppBrowserPlugin/Enums.swift +65 -0
  55. package/ios/Sources/InAppBrowserPlugin/InAppBrowserPlugin.swift +1932 -0
  56. package/ios/Sources/InAppBrowserPlugin/ProxySchemeHandler.swift +1185 -0
  57. package/ios/Sources/InAppBrowserPlugin/WKWebView+SchemeHandling.swift +43 -0
  58. package/ios/Sources/InAppBrowserPlugin/WKWebViewController.swift +3032 -0
  59. package/package.json +139 -0
@@ -0,0 +1,270 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ exports.BackgroundColor = void 0;
6
+ (function (BackgroundColor) {
7
+ BackgroundColor["WHITE"] = "white";
8
+ BackgroundColor["BLACK"] = "black";
9
+ })(exports.BackgroundColor || (exports.BackgroundColor = {}));
10
+ exports.ToolBarType = void 0;
11
+ (function (ToolBarType) {
12
+ /**
13
+ * Shows a simple toolbar with just a close button and share button
14
+ * @since 0.1.0
15
+ */
16
+ ToolBarType["ACTIVITY"] = "activity";
17
+ /**
18
+ * Shows a simple toolbar with just a close button
19
+ * @since 7.6.8
20
+ */
21
+ ToolBarType["COMPACT"] = "compact";
22
+ /**
23
+ * Shows a full navigation toolbar with back/forward buttons
24
+ * @since 0.1.0
25
+ */
26
+ ToolBarType["NAVIGATION"] = "navigation";
27
+ /**
28
+ * Shows no toolbar
29
+ * @since 0.1.0
30
+ */
31
+ ToolBarType["BLANK"] = "blank";
32
+ })(exports.ToolBarType || (exports.ToolBarType = {}));
33
+ exports.InvisibilityMode = void 0;
34
+ (function (InvisibilityMode) {
35
+ /**
36
+ * WebView is aware it is hidden (dimensions may be zero).
37
+ */
38
+ InvisibilityMode["AWARE"] = "AWARE";
39
+ /**
40
+ * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).
41
+ */
42
+ InvisibilityMode["FAKE_VISIBLE"] = "FAKE_VISIBLE";
43
+ })(exports.InvisibilityMode || (exports.InvisibilityMode = {}));
44
+
45
+ const InAppBrowser = core.registerPlugin('InAppBrowser', {
46
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.InAppBrowserWeb()),
47
+ });
48
+ function arrayBufferToBase64(buffer) {
49
+ const bytes = new Uint8Array(buffer);
50
+ let binary = '';
51
+ for (let i = 0; i < bytes.byteLength; i++) {
52
+ binary += String.fromCharCode(bytes[i]);
53
+ }
54
+ return btoa(binary);
55
+ }
56
+ function headersToRecord(headers) {
57
+ const result = {};
58
+ headers.forEach((value, key) => {
59
+ result[key] = value;
60
+ });
61
+ return result;
62
+ }
63
+ function errorMessage(error) {
64
+ if (error instanceof Error) {
65
+ return error.message;
66
+ }
67
+ if (typeof error === 'string') {
68
+ return error;
69
+ }
70
+ if (error && typeof error === 'object' && 'message' in error && typeof error.message === 'string') {
71
+ return error.message;
72
+ }
73
+ return String(error);
74
+ }
75
+ function isStaleProxyResponseError(error) {
76
+ const message = errorMessage(error);
77
+ return message.includes('No proxy handler found') || message.includes('Target WebView not found for proxy request');
78
+ }
79
+ function isProxyResponse(value) {
80
+ return (value !== null &&
81
+ typeof value === 'object' &&
82
+ 'status' in value &&
83
+ 'headers' in value &&
84
+ !(value instanceof Response));
85
+ }
86
+ function isProxyRequestOverride(value) {
87
+ return value !== null && typeof value === 'object' && 'url' in value && !(value instanceof Response);
88
+ }
89
+ function isProxyDecision(value) {
90
+ return (value !== null && typeof value === 'object' && ('request' in value || 'response' in value || 'cancel' in value));
91
+ }
92
+ async function sendProxyDecision(requestId, webviewId, decision, phase) {
93
+ try {
94
+ await InAppBrowser.handleProxyRequest({
95
+ requestId,
96
+ webviewId,
97
+ decision,
98
+ phase,
99
+ });
100
+ }
101
+ catch (error) {
102
+ if (isStaleProxyResponseError(error)) {
103
+ return;
104
+ }
105
+ throw error;
106
+ }
107
+ }
108
+ const addProxyHandler = (callback) => {
109
+ return InAppBrowser.addListener('proxyRequest', async (event) => {
110
+ let decision = null;
111
+ try {
112
+ const result = await callback(event);
113
+ if (result === null) {
114
+ decision = null;
115
+ }
116
+ else if (isProxyDecision(result)) {
117
+ decision = result;
118
+ }
119
+ else if (isProxyRequestOverride(result)) {
120
+ decision = { request: result };
121
+ }
122
+ else if (isProxyResponse(result)) {
123
+ decision = { response: result };
124
+ }
125
+ else {
126
+ const cloned = result.clone();
127
+ const buffer = await cloned.arrayBuffer();
128
+ decision = {
129
+ response: {
130
+ body: arrayBufferToBase64(buffer),
131
+ status: result.status,
132
+ headers: headersToRecord(result.headers),
133
+ },
134
+ };
135
+ }
136
+ }
137
+ catch (_error) {
138
+ decision = null;
139
+ }
140
+ await sendProxyDecision(event.requestId, event.webviewId, decision, event.phase);
141
+ });
142
+ };
143
+
144
+ class InAppBrowserWeb extends core.WebPlugin {
145
+ clearAllCookies() {
146
+ console.log('clearAllCookies');
147
+ return Promise.resolve();
148
+ }
149
+ clearCache() {
150
+ console.log('clearCache');
151
+ return Promise.resolve();
152
+ }
153
+ async open(options) {
154
+ console.log('open', options);
155
+ return options;
156
+ }
157
+ async clearCookies(options) {
158
+ console.log('cleanCookies', options);
159
+ return;
160
+ }
161
+ async getCookies(options) {
162
+ // Web implementation to get cookies
163
+ return options;
164
+ }
165
+ async openWebView(options) {
166
+ console.log('openWebView', options);
167
+ return options;
168
+ }
169
+ async executeScript({ code }) {
170
+ console.log('code', code);
171
+ return code;
172
+ }
173
+ async close(options) {
174
+ console.log('close', options);
175
+ return;
176
+ }
177
+ async hide(options) {
178
+ console.log('hide', options);
179
+ return;
180
+ }
181
+ async show(options) {
182
+ console.log('show', options);
183
+ return;
184
+ }
185
+ async setUrl(options) {
186
+ console.log('setUrl', options.url);
187
+ return;
188
+ }
189
+ async reload(options) {
190
+ console.log('reload', options);
191
+ return;
192
+ }
193
+ async postMessage(options) {
194
+ console.log('postMessage', options);
195
+ return options;
196
+ }
197
+ async takeScreenshot(options) {
198
+ console.log('takeScreenshot not supported on web', options);
199
+ throw this.unimplemented('Screenshots are not supported on web.');
200
+ }
201
+ async goBack() {
202
+ console.log('goBack');
203
+ return;
204
+ }
205
+ async getPluginVersion() {
206
+ return { version: 'web' };
207
+ }
208
+ async updateDimensions(options) {
209
+ console.log('updateDimensions', options);
210
+ // Web platform doesn't support dimension control
211
+ return;
212
+ }
213
+ async handleProxyRequest(options) {
214
+ console.log('handleProxyRequest not supported on web', options);
215
+ return;
216
+ }
217
+ async setEnabledSafeTopMargin(options) {
218
+ console.log('setEnabledSafeTopMargin not supported on web', options);
219
+ return;
220
+ }
221
+ async setEnabledSafeBottomMargin(options) {
222
+ console.log('setEnabledSafeBottomMargin not supported on web', options);
223
+ return;
224
+ }
225
+ async openSecureWindow(options) {
226
+ const w = 600;
227
+ const h = 550;
228
+ const settings = [
229
+ ['width', w],
230
+ ['height', h],
231
+ ['left', screen.width / 2 - w / 2],
232
+ ['top', screen.height / 2 - h / 2],
233
+ ]
234
+ .map((x) => x.join('='))
235
+ .join(',');
236
+ const popup = window.open(options.authEndpoint, 'Authorization', settings);
237
+ if (!popup) {
238
+ throw new Error('Failed to open secure window');
239
+ }
240
+ if (typeof popup.focus === 'function') {
241
+ popup.focus();
242
+ }
243
+ return new Promise((resolve, reject) => {
244
+ const bc = new BroadcastChannel(options.broadcastChannelName || 'oauth-channel');
245
+ bc.addEventListener('message', (event) => {
246
+ if (event.data.startsWith(options.redirectUri)) {
247
+ bc.close();
248
+ resolve({ redirectedUri: event.data });
249
+ }
250
+ else {
251
+ bc.close();
252
+ reject(new Error('Redirect URI does not match, expected ' + options.redirectUri + ' but got ' + event.data));
253
+ }
254
+ });
255
+ setTimeout(() => {
256
+ bc.close();
257
+ reject(new Error('The sign-in flow timed out'));
258
+ }, 5 * 60000);
259
+ });
260
+ }
261
+ }
262
+
263
+ var web = /*#__PURE__*/Object.freeze({
264
+ __proto__: null,
265
+ InAppBrowserWeb: InAppBrowserWeb
266
+ });
267
+
268
+ exports.InAppBrowser = InAppBrowser;
269
+ exports.addProxyHandler = addProxyHandler;
270
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +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,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;AAC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AACJ;;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,273 @@
1
+ var capacitorInAppBrowser = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ exports.BackgroundColor = void 0;
5
+ (function (BackgroundColor) {
6
+ BackgroundColor["WHITE"] = "white";
7
+ BackgroundColor["BLACK"] = "black";
8
+ })(exports.BackgroundColor || (exports.BackgroundColor = {}));
9
+ exports.ToolBarType = void 0;
10
+ (function (ToolBarType) {
11
+ /**
12
+ * Shows a simple toolbar with just a close button and share button
13
+ * @since 0.1.0
14
+ */
15
+ ToolBarType["ACTIVITY"] = "activity";
16
+ /**
17
+ * Shows a simple toolbar with just a close button
18
+ * @since 7.6.8
19
+ */
20
+ ToolBarType["COMPACT"] = "compact";
21
+ /**
22
+ * Shows a full navigation toolbar with back/forward buttons
23
+ * @since 0.1.0
24
+ */
25
+ ToolBarType["NAVIGATION"] = "navigation";
26
+ /**
27
+ * Shows no toolbar
28
+ * @since 0.1.0
29
+ */
30
+ ToolBarType["BLANK"] = "blank";
31
+ })(exports.ToolBarType || (exports.ToolBarType = {}));
32
+ exports.InvisibilityMode = void 0;
33
+ (function (InvisibilityMode) {
34
+ /**
35
+ * WebView is aware it is hidden (dimensions may be zero).
36
+ */
37
+ InvisibilityMode["AWARE"] = "AWARE";
38
+ /**
39
+ * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).
40
+ */
41
+ InvisibilityMode["FAKE_VISIBLE"] = "FAKE_VISIBLE";
42
+ })(exports.InvisibilityMode || (exports.InvisibilityMode = {}));
43
+
44
+ const InAppBrowser = core.registerPlugin('InAppBrowser', {
45
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.InAppBrowserWeb()),
46
+ });
47
+ function arrayBufferToBase64(buffer) {
48
+ const bytes = new Uint8Array(buffer);
49
+ let binary = '';
50
+ for (let i = 0; i < bytes.byteLength; i++) {
51
+ binary += String.fromCharCode(bytes[i]);
52
+ }
53
+ return btoa(binary);
54
+ }
55
+ function headersToRecord(headers) {
56
+ const result = {};
57
+ headers.forEach((value, key) => {
58
+ result[key] = value;
59
+ });
60
+ return result;
61
+ }
62
+ function errorMessage(error) {
63
+ if (error instanceof Error) {
64
+ return error.message;
65
+ }
66
+ if (typeof error === 'string') {
67
+ return error;
68
+ }
69
+ if (error && typeof error === 'object' && 'message' in error && typeof error.message === 'string') {
70
+ return error.message;
71
+ }
72
+ return String(error);
73
+ }
74
+ function isStaleProxyResponseError(error) {
75
+ const message = errorMessage(error);
76
+ return message.includes('No proxy handler found') || message.includes('Target WebView not found for proxy request');
77
+ }
78
+ function isProxyResponse(value) {
79
+ return (value !== null &&
80
+ typeof value === 'object' &&
81
+ 'status' in value &&
82
+ 'headers' in value &&
83
+ !(value instanceof Response));
84
+ }
85
+ function isProxyRequestOverride(value) {
86
+ return value !== null && typeof value === 'object' && 'url' in value && !(value instanceof Response);
87
+ }
88
+ function isProxyDecision(value) {
89
+ return (value !== null && typeof value === 'object' && ('request' in value || 'response' in value || 'cancel' in value));
90
+ }
91
+ async function sendProxyDecision(requestId, webviewId, decision, phase) {
92
+ try {
93
+ await InAppBrowser.handleProxyRequest({
94
+ requestId,
95
+ webviewId,
96
+ decision,
97
+ phase,
98
+ });
99
+ }
100
+ catch (error) {
101
+ if (isStaleProxyResponseError(error)) {
102
+ return;
103
+ }
104
+ throw error;
105
+ }
106
+ }
107
+ const addProxyHandler = (callback) => {
108
+ return InAppBrowser.addListener('proxyRequest', async (event) => {
109
+ let decision = null;
110
+ try {
111
+ const result = await callback(event);
112
+ if (result === null) {
113
+ decision = null;
114
+ }
115
+ else if (isProxyDecision(result)) {
116
+ decision = result;
117
+ }
118
+ else if (isProxyRequestOverride(result)) {
119
+ decision = { request: result };
120
+ }
121
+ else if (isProxyResponse(result)) {
122
+ decision = { response: result };
123
+ }
124
+ else {
125
+ const cloned = result.clone();
126
+ const buffer = await cloned.arrayBuffer();
127
+ decision = {
128
+ response: {
129
+ body: arrayBufferToBase64(buffer),
130
+ status: result.status,
131
+ headers: headersToRecord(result.headers),
132
+ },
133
+ };
134
+ }
135
+ }
136
+ catch (_error) {
137
+ decision = null;
138
+ }
139
+ await sendProxyDecision(event.requestId, event.webviewId, decision, event.phase);
140
+ });
141
+ };
142
+
143
+ class InAppBrowserWeb extends core.WebPlugin {
144
+ clearAllCookies() {
145
+ console.log('clearAllCookies');
146
+ return Promise.resolve();
147
+ }
148
+ clearCache() {
149
+ console.log('clearCache');
150
+ return Promise.resolve();
151
+ }
152
+ async open(options) {
153
+ console.log('open', options);
154
+ return options;
155
+ }
156
+ async clearCookies(options) {
157
+ console.log('cleanCookies', options);
158
+ return;
159
+ }
160
+ async getCookies(options) {
161
+ // Web implementation to get cookies
162
+ return options;
163
+ }
164
+ async openWebView(options) {
165
+ console.log('openWebView', options);
166
+ return options;
167
+ }
168
+ async executeScript({ code }) {
169
+ console.log('code', code);
170
+ return code;
171
+ }
172
+ async close(options) {
173
+ console.log('close', options);
174
+ return;
175
+ }
176
+ async hide(options) {
177
+ console.log('hide', options);
178
+ return;
179
+ }
180
+ async show(options) {
181
+ console.log('show', options);
182
+ return;
183
+ }
184
+ async setUrl(options) {
185
+ console.log('setUrl', options.url);
186
+ return;
187
+ }
188
+ async reload(options) {
189
+ console.log('reload', options);
190
+ return;
191
+ }
192
+ async postMessage(options) {
193
+ console.log('postMessage', options);
194
+ return options;
195
+ }
196
+ async takeScreenshot(options) {
197
+ console.log('takeScreenshot not supported on web', options);
198
+ throw this.unimplemented('Screenshots are not supported on web.');
199
+ }
200
+ async goBack() {
201
+ console.log('goBack');
202
+ return;
203
+ }
204
+ async getPluginVersion() {
205
+ return { version: 'web' };
206
+ }
207
+ async updateDimensions(options) {
208
+ console.log('updateDimensions', options);
209
+ // Web platform doesn't support dimension control
210
+ return;
211
+ }
212
+ async handleProxyRequest(options) {
213
+ console.log('handleProxyRequest not supported on web', options);
214
+ return;
215
+ }
216
+ async setEnabledSafeTopMargin(options) {
217
+ console.log('setEnabledSafeTopMargin not supported on web', options);
218
+ return;
219
+ }
220
+ async setEnabledSafeBottomMargin(options) {
221
+ console.log('setEnabledSafeBottomMargin not supported on web', options);
222
+ return;
223
+ }
224
+ async openSecureWindow(options) {
225
+ const w = 600;
226
+ const h = 550;
227
+ const settings = [
228
+ ['width', w],
229
+ ['height', h],
230
+ ['left', screen.width / 2 - w / 2],
231
+ ['top', screen.height / 2 - h / 2],
232
+ ]
233
+ .map((x) => x.join('='))
234
+ .join(',');
235
+ const popup = window.open(options.authEndpoint, 'Authorization', settings);
236
+ if (!popup) {
237
+ throw new Error('Failed to open secure window');
238
+ }
239
+ if (typeof popup.focus === 'function') {
240
+ popup.focus();
241
+ }
242
+ return new Promise((resolve, reject) => {
243
+ const bc = new BroadcastChannel(options.broadcastChannelName || 'oauth-channel');
244
+ bc.addEventListener('message', (event) => {
245
+ if (event.data.startsWith(options.redirectUri)) {
246
+ bc.close();
247
+ resolve({ redirectedUri: event.data });
248
+ }
249
+ else {
250
+ bc.close();
251
+ reject(new Error('Redirect URI does not match, expected ' + options.redirectUri + ' but got ' + event.data));
252
+ }
253
+ });
254
+ setTimeout(() => {
255
+ bc.close();
256
+ reject(new Error('The sign-in flow timed out'));
257
+ }, 5 * 60000);
258
+ });
259
+ }
260
+ }
261
+
262
+ var web = /*#__PURE__*/Object.freeze({
263
+ __proto__: null,
264
+ InAppBrowserWeb: InAppBrowserWeb
265
+ });
266
+
267
+ exports.InAppBrowser = InAppBrowser;
268
+ exports.addProxyHandler = addProxyHandler;
269
+
270
+ return exports;
271
+
272
+ })({}, capacitorExports);
273
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +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,EAA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I,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC/D,YAAY,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;IACzB,QAAQ,CAAC,CAAC;IACV,IAAI;IACJ;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,65 @@
1
+ //
2
+ // Enums.swift
3
+ // Sample
4
+ //
5
+ // Created by Meniny on 2018-01-20.
6
+ // Copyright © 2018年 Meniny. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+ import UIKit
11
+
12
+ public enum WKWebSource: Equatable {
13
+ case remote(URL)
14
+ case file(URL, access: URL)
15
+ case string(String, base: URL?)
16
+
17
+ public var url: URL? {
18
+ switch self {
19
+ case .remote(let urlValue): return urlValue
20
+ case .file(let urlValue, access: _): return urlValue
21
+ default: return nil
22
+ }
23
+ }
24
+
25
+ public var remoteURL: URL? {
26
+ switch self {
27
+ case .remote(let urlValue): return urlValue
28
+ default: return nil
29
+ }
30
+ }
31
+
32
+ public var absoluteString: String? {
33
+ switch self {
34
+ case .remote(let urlValue): return urlValue.absoluteString
35
+ case .file(let urlValue, access: _): return urlValue.absoluteString
36
+ default: return nil
37
+ }
38
+ }
39
+ }
40
+
41
+ public enum BarButtonItemType {
42
+ case back
43
+ case forward
44
+ case reload
45
+ case stop
46
+ case activity
47
+ case done
48
+ case flexibleSpace
49
+ case custom(icon: UIImage?, title: String?, action: (WKWebViewController) -> Void)
50
+ }
51
+
52
+ public enum NavigationBarPosition: String, Equatable, Codable {
53
+ case none
54
+ case left
55
+ case right
56
+ }
57
+
58
+ @objc public enum NavigationType: Int, Equatable, Codable {
59
+ case linkActivated
60
+ case formSubmitted
61
+ case backForward
62
+ case reload
63
+ case formResubmitted
64
+ case other
65
+ }