@capgo/inappbrowser 5.0.0 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -44
- package/android/build.gradle +6 -6
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +230 -34
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java +104 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +179 -9
- package/android/src/main/res/drawable/ic_refresh.xml +9 -0
- package/android/src/main/res/layout/tool_bar.xml +12 -3
- package/android/src/main/res/values/strings.xml +1 -0
- package/dist/docs.json +471 -49
- package/dist/esm/definitions.d.ts +121 -8
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +7 -2
- package/dist/esm/web.js +14 -2
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +14 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +14 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/InAppBrowserPlugin.m +2 -1
- package/ios/Plugin/InAppBrowserPlugin.swift +140 -10
- package/ios/Plugin/WKWebViewController.swift +58 -20
- package/package.json +21 -23
|
@@ -30,6 +30,14 @@ export declare enum ToolBarType {
|
|
|
30
30
|
export interface Headers {
|
|
31
31
|
[key: string]: string;
|
|
32
32
|
}
|
|
33
|
+
export interface GetCookieOptions {
|
|
34
|
+
url: string;
|
|
35
|
+
includeHttpOnly?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface ClearCookieOptions {
|
|
38
|
+
url: string;
|
|
39
|
+
cache?: boolean;
|
|
40
|
+
}
|
|
33
41
|
export interface OpenOptions {
|
|
34
42
|
/**
|
|
35
43
|
* Target URL to load.
|
|
@@ -86,13 +94,26 @@ export interface OpenWebViewOptions {
|
|
|
86
94
|
* @since 0.1.0
|
|
87
95
|
* @default 'New Window'
|
|
88
96
|
*/
|
|
89
|
-
title
|
|
97
|
+
title?: string;
|
|
90
98
|
/**
|
|
91
99
|
* Background color of the browser, only on IOS
|
|
92
100
|
* @since 0.1.0
|
|
93
101
|
* @default BackgroundColor.BLACK
|
|
94
102
|
*/
|
|
95
103
|
backgroundColor?: BackgroundColor;
|
|
104
|
+
/**
|
|
105
|
+
* If true, active the native navigation within the webview, Android only
|
|
106
|
+
*
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
activeNativeNavigationForWebview?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Disable the possibility to go back on native application,
|
|
112
|
+
* usefull to force user to stay on the webview, Android only
|
|
113
|
+
*
|
|
114
|
+
* @default false
|
|
115
|
+
*/
|
|
116
|
+
disableGoBackOnNativeApplication?: boolean;
|
|
96
117
|
/**
|
|
97
118
|
* Open url in a new window fullscreen
|
|
98
119
|
*
|
|
@@ -101,6 +122,80 @@ export interface OpenWebViewOptions {
|
|
|
101
122
|
* @default false
|
|
102
123
|
*/
|
|
103
124
|
isPresentAfterPageLoad?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Whether the website in the webview is inspectable or not, ios only
|
|
127
|
+
*
|
|
128
|
+
* @default false
|
|
129
|
+
*/
|
|
130
|
+
isInspectable?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Whether the webview opening is animated or not, ios only
|
|
133
|
+
*
|
|
134
|
+
* @default true
|
|
135
|
+
*/
|
|
136
|
+
isAnimated?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Shows a reload button that reloads the web page
|
|
139
|
+
* @since 1.0.15
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
showReloadButton?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.
|
|
145
|
+
*
|
|
146
|
+
* @since 1.1.0
|
|
147
|
+
* @default false
|
|
148
|
+
*/
|
|
149
|
+
closeModal?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* CloseModalTitle: title of the confirm when user clicks on close button, only on IOS
|
|
152
|
+
*
|
|
153
|
+
* @since 1.1.0
|
|
154
|
+
* @default 'Close'
|
|
155
|
+
*/
|
|
156
|
+
closeModalTitle?: string;
|
|
157
|
+
/**
|
|
158
|
+
* CloseModalDescription: description of the confirm when user clicks on close button, only on IOS
|
|
159
|
+
*
|
|
160
|
+
* @since 1.1.0
|
|
161
|
+
* @default 'Are you sure you want to close this window?'
|
|
162
|
+
*/
|
|
163
|
+
closeModalDescription?: string;
|
|
164
|
+
/**
|
|
165
|
+
* CloseModalOk: text of the confirm button when user clicks on close button, only on IOS
|
|
166
|
+
*
|
|
167
|
+
* @since 1.1.0
|
|
168
|
+
* @default 'Close'
|
|
169
|
+
*/
|
|
170
|
+
closeModalOk?: string;
|
|
171
|
+
/**
|
|
172
|
+
* CloseModalCancel: text of the cancel button when user clicks on close button, only on IOS
|
|
173
|
+
*
|
|
174
|
+
* @since 1.1.0
|
|
175
|
+
* @default 'Cancel'
|
|
176
|
+
*/
|
|
177
|
+
closeModalCancel?: string;
|
|
178
|
+
/**
|
|
179
|
+
* visibleTitle: if true the website title would be shown else shown empty
|
|
180
|
+
*
|
|
181
|
+
* @since 1.2.5
|
|
182
|
+
* @default true
|
|
183
|
+
*/
|
|
184
|
+
visibleTitle?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* toolbarColor: color of the toolbar in hex format
|
|
187
|
+
*
|
|
188
|
+
* @since 1.2.5
|
|
189
|
+
* @default '#ffffff''
|
|
190
|
+
*/
|
|
191
|
+
toolbarColor?: string;
|
|
192
|
+
/**
|
|
193
|
+
* showArrow: if true an arrow would be shown instead of cross for closing the window
|
|
194
|
+
*
|
|
195
|
+
* @since 1.2.5
|
|
196
|
+
* @default false
|
|
197
|
+
*/
|
|
198
|
+
showArrow?: boolean;
|
|
104
199
|
}
|
|
105
200
|
export interface InAppBrowserPlugin {
|
|
106
201
|
/**
|
|
@@ -110,11 +205,17 @@ export interface InAppBrowserPlugin {
|
|
|
110
205
|
*/
|
|
111
206
|
open(options: OpenOptions): Promise<any>;
|
|
112
207
|
/**
|
|
113
|
-
* Clear
|
|
208
|
+
* Clear cookies of url
|
|
114
209
|
*
|
|
115
210
|
* @since 0.5.0
|
|
116
211
|
*/
|
|
117
|
-
clearCookies(): Promise<any>;
|
|
212
|
+
clearCookies(options: ClearCookieOptions): Promise<any>;
|
|
213
|
+
/**
|
|
214
|
+
* Get cookies for a specific URL.
|
|
215
|
+
* @param options The options, including the URL to get cookies for.
|
|
216
|
+
* @returns A promise that resolves with the cookies.
|
|
217
|
+
*/
|
|
218
|
+
getCookies(options: GetCookieOptions): Promise<Record<string, string>>;
|
|
118
219
|
close(): Promise<any>;
|
|
119
220
|
/**
|
|
120
221
|
* Open url in a new webview with toolbars
|
|
@@ -122,31 +223,43 @@ export interface InAppBrowserPlugin {
|
|
|
122
223
|
* @since 0.1.0
|
|
123
224
|
*/
|
|
124
225
|
openWebView(options: OpenWebViewOptions): Promise<any>;
|
|
226
|
+
/**
|
|
227
|
+
* Injects JavaScript code into the InAppBrowser window.
|
|
228
|
+
*/
|
|
229
|
+
executeScript({ code }: {
|
|
230
|
+
code: string;
|
|
231
|
+
}): Promise<void>;
|
|
125
232
|
setUrl(options: {
|
|
126
233
|
url: string;
|
|
127
234
|
}): Promise<any>;
|
|
128
235
|
/**
|
|
129
|
-
* Listen for url change
|
|
236
|
+
* Listen for url change, only for openWebView
|
|
130
237
|
*
|
|
131
238
|
* @since 0.0.1
|
|
132
239
|
*/
|
|
133
|
-
addListener(eventName: "urlChangeEvent", listenerFunc: UrlChangeListener): Promise<PluginListenerHandle
|
|
240
|
+
addListener(eventName: "urlChangeEvent", listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;
|
|
134
241
|
/**
|
|
135
|
-
* Listen for close click
|
|
242
|
+
* Listen for close click only for openWebView
|
|
136
243
|
*
|
|
137
244
|
* @since 0.4.0
|
|
138
245
|
*/
|
|
139
|
-
addListener(eventName: "closeEvent", listenerFunc: UrlChangeListener): Promise<PluginListenerHandle
|
|
246
|
+
addListener(eventName: "closeEvent", listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;
|
|
140
247
|
/**
|
|
141
248
|
* Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS
|
|
142
249
|
*
|
|
143
250
|
* @since 0.0.1
|
|
144
251
|
*/
|
|
145
|
-
addListener(eventName: "confirmBtnClicked", listenerFunc: ConfirmBtnListener): Promise<PluginListenerHandle
|
|
252
|
+
addListener(eventName: "confirmBtnClicked", listenerFunc: ConfirmBtnListener): Promise<PluginListenerHandle>;
|
|
146
253
|
/**
|
|
147
254
|
* Remove all listeners for this plugin.
|
|
148
255
|
*
|
|
149
256
|
* @since 1.0.0
|
|
150
257
|
*/
|
|
151
258
|
removeAllListeners(): Promise<void>;
|
|
259
|
+
/**
|
|
260
|
+
* Reload the current web page.
|
|
261
|
+
*
|
|
262
|
+
* @since 1.0.0
|
|
263
|
+
*/
|
|
264
|
+
reload(): Promise<any>;
|
|
152
265
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,oCAAqB,CAAA;IACrB,wCAAyB,CAAA;IACzB,8BAAe,CAAA;IACf,2BAAY,CAAA;AACd,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface UrlEvent {\n /**\n * Emit when the url changes\n *\n * @since 0.0.1\n */\n url: string;\n}\nexport interface BtnEvent {\n /**\n * Emit when a button is clicked.\n *\n * @since 0.0.1\n */\n url: string;\n}\n\nexport type UrlChangeListener = (state: UrlEvent) => void;\nexport type ConfirmBtnListener = (state: BtnEvent) => void;\n\nexport enum BackgroundColor {\n WHITE = \"white\",\n BLACK = \"black\",\n}\nexport enum ToolBarType {\n ACTIVITY = \"activity\",\n NAVIGATION = \"navigation\",\n BLANK = \"blank\",\n DEFAULT = \"\",\n}\n\nexport interface Headers {\n [key: string]: string;\n}\n\nexport interface OpenOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n */\n headers?: Headers;\n /**\n * if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n */\n isPresentAfterPageLoad?: boolean;\n preventDeeplink?: boolean;\n}\n\nexport interface DisclaimerOptions {\n title: string;\n message: string;\n confirmBtn: string;\n cancelBtn: string;\n}\n\nexport interface OpenWebViewOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n */\n headers?: Headers;\n /**\n * share options\n * @since 0.1.0\n */\n shareDisclaimer?: DisclaimerOptions;\n /**\n * Toolbar type\n * @since 0.1.0\n * @default ToolBarType.DEFAULT\n */\n toolbarType?: ToolBarType;\n /**\n * Share subject\n * @since 0.1.0\n */\n shareSubject?: string;\n /**\n * Title of the browser\n * @since 0.1.0\n * @default 'New Window'\n */\n title
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,oCAAqB,CAAA;IACrB,wCAAyB,CAAA;IACzB,8BAAe,CAAA;IACf,2BAAY,CAAA;AACd,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface UrlEvent {\n /**\n * Emit when the url changes\n *\n * @since 0.0.1\n */\n url: string;\n}\nexport interface BtnEvent {\n /**\n * Emit when a button is clicked.\n *\n * @since 0.0.1\n */\n url: string;\n}\n\nexport type UrlChangeListener = (state: UrlEvent) => void;\nexport type ConfirmBtnListener = (state: BtnEvent) => void;\n\nexport enum BackgroundColor {\n WHITE = \"white\",\n BLACK = \"black\",\n}\nexport enum ToolBarType {\n ACTIVITY = \"activity\",\n NAVIGATION = \"navigation\",\n BLANK = \"blank\",\n DEFAULT = \"\",\n}\n\nexport interface Headers {\n [key: string]: string;\n}\n\nexport interface GetCookieOptions {\n url: string;\n includeHttpOnly?: boolean;\n}\n\nexport interface ClearCookieOptions {\n url: string;\n cache?: boolean;\n}\n\nexport interface OpenOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n */\n headers?: Headers;\n /**\n * if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n */\n isPresentAfterPageLoad?: boolean;\n preventDeeplink?: boolean;\n}\n\nexport interface DisclaimerOptions {\n title: string;\n message: string;\n confirmBtn: string;\n cancelBtn: string;\n}\n\nexport interface OpenWebViewOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n */\n headers?: Headers;\n /**\n * share options\n * @since 0.1.0\n */\n shareDisclaimer?: DisclaimerOptions;\n /**\n * Toolbar type\n * @since 0.1.0\n * @default ToolBarType.DEFAULT\n */\n toolbarType?: ToolBarType;\n /**\n * Share subject\n * @since 0.1.0\n */\n shareSubject?: string;\n /**\n * Title of the browser\n * @since 0.1.0\n * @default 'New Window'\n */\n title?: string;\n /**\n * Background color of the browser, only on IOS\n * @since 0.1.0\n * @default BackgroundColor.BLACK\n */\n backgroundColor?: BackgroundColor;\n /**\n * If true, active the native navigation within the webview, Android only\n *\n * @default false\n */\n activeNativeNavigationForWebview?: boolean;\n /**\n * Disable the possibility to go back on native application,\n * usefull to force user to stay on the webview, Android only\n *\n * @default false\n */\n disableGoBackOnNativeApplication?: boolean;\n /**\n * Open url in a new window fullscreen\n *\n * isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n * @default false\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * Whether the website in the webview is inspectable or not, ios only\n *\n * @default false\n */\n isInspectable?: boolean;\n /**\n * Whether the webview opening is animated or not, ios only\n *\n * @default true\n */\n isAnimated?: boolean;\n /**\n * Shows a reload button that reloads the web page\n * @since 1.0.15\n * @default false\n */\n showReloadButton?: boolean;\n /**\n * CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.\n *\n * @since 1.1.0\n * @default false\n */\n closeModal?: boolean;\n /**\n * CloseModalTitle: title of the confirm when user clicks on close button, only on IOS\n *\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalTitle?: string;\n /**\n * CloseModalDescription: description of the confirm when user clicks on close button, only on IOS\n *\n * @since 1.1.0\n * @default 'Are you sure you want to close this window?'\n */\n closeModalDescription?: string;\n /**\n * CloseModalOk: text of the confirm button when user clicks on close button, only on IOS\n *\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalOk?: string;\n /**\n * CloseModalCancel: text of the cancel button when user clicks on close button, only on IOS\n *\n * @since 1.1.0\n * @default 'Cancel'\n */\n closeModalCancel?: string;\n /**\n * visibleTitle: if true the website title would be shown else shown empty\n *\n * @since 1.2.5\n * @default true\n */\n visibleTitle?: boolean;\n /**\n * toolbarColor: color of the toolbar in hex format\n *\n * @since 1.2.5\n * @default '#ffffff''\n */\n toolbarColor?: string;\n /**\n * showArrow: if true an arrow would be shown instead of cross for closing the window\n *\n * @since 1.2.5\n * @default false\n */\n showArrow?: boolean;\n}\n\nexport interface InAppBrowserPlugin {\n /**\n * Open url in a new window fullscreen\n *\n * @since 0.1.0\n */\n open(options: OpenOptions): Promise<any>;\n\n /**\n * Clear cookies of url\n *\n * @since 0.5.0\n */\n clearCookies(options: ClearCookieOptions): Promise<any>;\n\n /**\n * Get cookies for a specific URL.\n * @param options The options, including the URL to get cookies for.\n * @returns A promise that resolves with the cookies.\n */\n getCookies(options: GetCookieOptions): Promise<Record<string, string>>;\n\n close(): Promise<any>;\n /**\n * Open url in a new webview with toolbars\n *\n * @since 0.1.0\n */\n openWebView(options: OpenWebViewOptions): Promise<any>;\n /**\n * Injects JavaScript code into the InAppBrowser window.\n */\n executeScript({ code }: { code: string }): Promise<void>;\n setUrl(options: { url: string }): Promise<any>;\n /**\n * Listen for url change, only for openWebView\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"urlChangeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(\n eventName: \"closeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"confirmBtnClicked\",\n listenerFunc: ConfirmBtnListener,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Reload the current web page.\n *\n * @since 1.0.0\n */\n reload(): Promise<any>; // Add this line\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { WebPlugin } from "@capacitor/core";
|
|
2
|
-
import type { InAppBrowserPlugin, OpenWebViewOptions, OpenOptions } from "./definitions";
|
|
2
|
+
import type { InAppBrowserPlugin, OpenWebViewOptions, OpenOptions, GetCookieOptions, ClearCookieOptions } from "./definitions";
|
|
3
3
|
export declare class InAppBrowserWeb extends WebPlugin implements InAppBrowserPlugin {
|
|
4
4
|
open(options: OpenOptions): Promise<any>;
|
|
5
|
-
clearCookies(): Promise<any>;
|
|
5
|
+
clearCookies(options: ClearCookieOptions): Promise<any>;
|
|
6
|
+
getCookies(options: GetCookieOptions): Promise<any>;
|
|
6
7
|
openWebView(options: OpenWebViewOptions): Promise<any>;
|
|
8
|
+
executeScript({ code }: {
|
|
9
|
+
code: string;
|
|
10
|
+
}): Promise<any>;
|
|
7
11
|
close(): Promise<any>;
|
|
8
12
|
setUrl(options: {
|
|
9
13
|
url: string;
|
|
10
14
|
}): Promise<any>;
|
|
15
|
+
reload(): Promise<any>;
|
|
11
16
|
}
|
package/dist/esm/web.js
CHANGED
|
@@ -4,14 +4,22 @@ export class InAppBrowserWeb extends WebPlugin {
|
|
|
4
4
|
console.log("open", options);
|
|
5
5
|
return options;
|
|
6
6
|
}
|
|
7
|
-
async clearCookies() {
|
|
8
|
-
console.log("cleanCookies");
|
|
7
|
+
async clearCookies(options) {
|
|
8
|
+
console.log("cleanCookies", options);
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
+
async getCookies(options) {
|
|
12
|
+
// Web implementation to get cookies
|
|
13
|
+
return options;
|
|
14
|
+
}
|
|
11
15
|
async openWebView(options) {
|
|
12
16
|
console.log("openWebView", options);
|
|
13
17
|
return options;
|
|
14
18
|
}
|
|
19
|
+
async executeScript({ code }) {
|
|
20
|
+
console.log("code", code);
|
|
21
|
+
return code;
|
|
22
|
+
}
|
|
15
23
|
async close() {
|
|
16
24
|
console.log("close");
|
|
17
25
|
return;
|
|
@@ -20,5 +28,9 @@ export class InAppBrowserWeb extends WebPlugin {
|
|
|
20
28
|
console.log("setUrl", options.url);
|
|
21
29
|
return;
|
|
22
30
|
}
|
|
31
|
+
async reload() {
|
|
32
|
+
console.log("reload");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
23
35
|
}
|
|
24
36
|
//# sourceMappingURL=web.js.map
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAA2B;QAC5C,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QACrC,OAAO;IACT,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAyB;QACxC,oCAAoC;QACpC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAA2B;QAC3C,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACpC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAE,IAAI,EAAoB;QAC5C,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,KAAK;QACT,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAwB;QACnC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,OAAO;IACT,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n InAppBrowserPlugin,\n OpenWebViewOptions,\n OpenOptions,\n GetCookieOptions,\n ClearCookieOptions,\n} from \"./definitions\";\n\nexport class InAppBrowserWeb extends WebPlugin implements InAppBrowserPlugin {\n async open(options: OpenOptions): Promise<any> {\n console.log(\"open\", options);\n return options;\n }\n\n async clearCookies(options: ClearCookieOptions): Promise<any> {\n console.log(\"cleanCookies\", options);\n return;\n }\n\n async getCookies(options: GetCookieOptions): Promise<any> {\n // Web implementation to get cookies\n return options;\n }\n\n async openWebView(options: OpenWebViewOptions): Promise<any> {\n console.log(\"openWebView\", options);\n return options;\n }\n\n async executeScript({ code }: { code: string }): Promise<any> {\n console.log(\"code\", code);\n return code;\n }\n\n async close(): Promise<any> {\n console.log(\"close\");\n return;\n }\n\n async setUrl(options: { url: string }): Promise<any> {\n console.log(\"setUrl\", options.url);\n return;\n }\n\n async reload(): Promise<any> {\n console.log(\"reload\");\n return;\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -24,14 +24,22 @@ class InAppBrowserWeb extends core.WebPlugin {
|
|
|
24
24
|
console.log("open", options);
|
|
25
25
|
return options;
|
|
26
26
|
}
|
|
27
|
-
async clearCookies() {
|
|
28
|
-
console.log("cleanCookies");
|
|
27
|
+
async clearCookies(options) {
|
|
28
|
+
console.log("cleanCookies", options);
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
+
async getCookies(options) {
|
|
32
|
+
// Web implementation to get cookies
|
|
33
|
+
return options;
|
|
34
|
+
}
|
|
31
35
|
async openWebView(options) {
|
|
32
36
|
console.log("openWebView", options);
|
|
33
37
|
return options;
|
|
34
38
|
}
|
|
39
|
+
async executeScript({ code }) {
|
|
40
|
+
console.log("code", code);
|
|
41
|
+
return code;
|
|
42
|
+
}
|
|
35
43
|
async close() {
|
|
36
44
|
console.log("close");
|
|
37
45
|
return;
|
|
@@ -40,6 +48,10 @@ class InAppBrowserWeb extends core.WebPlugin {
|
|
|
40
48
|
console.log("setUrl", options.url);
|
|
41
49
|
return;
|
|
42
50
|
}
|
|
51
|
+
async reload() {
|
|
52
|
+
console.log("reload");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n ToolBarType[\"BLANK\"] = \"blank\";\n ToolBarType[\"DEFAULT\"] = \"\";\n})(ToolBarType || (ToolBarType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst InAppBrowser = registerPlugin(\"InAppBrowser\", {\n web: () => import(\"./web\").then((m) => new m.InAppBrowserWeb()),\n});\nexport * from \"./definitions\";\nexport { InAppBrowser };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class InAppBrowserWeb extends WebPlugin {\n async open(options) {\n console.log(\"open\", options);\n return options;\n }\n async clearCookies() {\n console.log(\"cleanCookies\");\n return;\n }\n async openWebView(options) {\n console.log(\"openWebView\", options);\n return options;\n }\n async close() {\n console.log(\"close\");\n return;\n }\n async setUrl(options) {\n console.log(\"setUrl\", options.url);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA,iCAAgB;AAC3B,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACvC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACvC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC,CAAC;AACnCC,6BAAY;AACvB,CAAC,UAAU,WAAW,EAAE;AACxB,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACzC,IAAI,WAAW,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AAC7C,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACnC,IAAI,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;AAChC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;;ACVhC,MAAC,YAAY,GAAGC,mBAAc,CAAC,cAAc,EAAE;AACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACnE,CAAC;;ACFM,MAAM,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL,IAAI,MAAM,YAAY,
|
|
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 ToolBarType[\"ACTIVITY\"] = \"activity\";\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n ToolBarType[\"BLANK\"] = \"blank\";\n ToolBarType[\"DEFAULT\"] = \"\";\n})(ToolBarType || (ToolBarType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst InAppBrowser = registerPlugin(\"InAppBrowser\", {\n web: () => import(\"./web\").then((m) => new m.InAppBrowserWeb()),\n});\nexport * from \"./definitions\";\nexport { InAppBrowser };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class InAppBrowserWeb extends WebPlugin {\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() {\n console.log(\"close\");\n return;\n }\n async setUrl(options) {\n console.log(\"setUrl\", options.url);\n return;\n }\n async reload() {\n console.log(\"reload\");\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA,iCAAgB;AAC3B,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACvC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACvC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC,CAAC;AACnCC,6BAAY;AACvB,CAAC,UAAU,WAAW,EAAE;AACxB,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACzC,IAAI,WAAW,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AAC7C,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACnC,IAAI,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;AAChC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;;ACVhC,MAAC,YAAY,GAAGC,mBAAc,CAAC,cAAc,EAAE;AACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACnE,CAAC;;ACFM,MAAM,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;AAChC,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAC7C,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;AAC9B;AACA,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;AAC/B,QAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAC5C,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL,IAAI,MAAM,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE;AAClC,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAClC,QAAQ,OAAO,IAAI,CAAC;AACpB,KAAK;AACL,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC7B,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,MAAM,CAAC,OAAO,EAAE;AAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;AAC3C,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC9B,QAAQ,OAAO;AACf,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -23,14 +23,22 @@ var capacitorInAppBrowser = (function (exports, core) {
|
|
|
23
23
|
console.log("open", options);
|
|
24
24
|
return options;
|
|
25
25
|
}
|
|
26
|
-
async clearCookies() {
|
|
27
|
-
console.log("cleanCookies");
|
|
26
|
+
async clearCookies(options) {
|
|
27
|
+
console.log("cleanCookies", options);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
+
async getCookies(options) {
|
|
31
|
+
// Web implementation to get cookies
|
|
32
|
+
return options;
|
|
33
|
+
}
|
|
30
34
|
async openWebView(options) {
|
|
31
35
|
console.log("openWebView", options);
|
|
32
36
|
return options;
|
|
33
37
|
}
|
|
38
|
+
async executeScript({ code }) {
|
|
39
|
+
console.log("code", code);
|
|
40
|
+
return code;
|
|
41
|
+
}
|
|
34
42
|
async close() {
|
|
35
43
|
console.log("close");
|
|
36
44
|
return;
|
|
@@ -39,6 +47,10 @@ var capacitorInAppBrowser = (function (exports, core) {
|
|
|
39
47
|
console.log("setUrl", options.url);
|
|
40
48
|
return;
|
|
41
49
|
}
|
|
50
|
+
async reload() {
|
|
51
|
+
console.log("reload");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n ToolBarType[\"BLANK\"] = \"blank\";\n ToolBarType[\"DEFAULT\"] = \"\";\n})(ToolBarType || (ToolBarType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst InAppBrowser = registerPlugin(\"InAppBrowser\", {\n web: () => import(\"./web\").then((m) => new m.InAppBrowserWeb()),\n});\nexport * from \"./definitions\";\nexport { InAppBrowser };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class InAppBrowserWeb extends WebPlugin {\n async open(options) {\n console.log(\"open\", options);\n return options;\n }\n async clearCookies() {\n console.log(\"cleanCookies\");\n return;\n }\n async openWebView(options) {\n console.log(\"openWebView\", options);\n return options;\n }\n async close() {\n console.log(\"close\");\n return;\n }\n async setUrl(options) {\n console.log(\"setUrl\", options.url);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA,qCAAgB;IAC3B,CAAC,UAAU,eAAe,EAAE;IAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACvC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACvC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC,CAAC;AACnCC,iCAAY;IACvB,CAAC,UAAU,WAAW,EAAE;IACxB,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IACzC,IAAI,WAAW,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;IAC7C,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACnC,IAAI,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;IAChC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;;ACVhC,UAAC,YAAY,GAAGC,mBAAc,CAAC,cAAc,EAAE;IACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACnE,CAAC;;ICFM,MAAM,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL,IAAI,MAAM,YAAY,
|
|
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 ToolBarType[\"ACTIVITY\"] = \"activity\";\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n ToolBarType[\"BLANK\"] = \"blank\";\n ToolBarType[\"DEFAULT\"] = \"\";\n})(ToolBarType || (ToolBarType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst InAppBrowser = registerPlugin(\"InAppBrowser\", {\n web: () => import(\"./web\").then((m) => new m.InAppBrowserWeb()),\n});\nexport * from \"./definitions\";\nexport { InAppBrowser };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class InAppBrowserWeb extends WebPlugin {\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() {\n console.log(\"close\");\n return;\n }\n async setUrl(options) {\n console.log(\"setUrl\", options.url);\n return;\n }\n async reload() {\n console.log(\"reload\");\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA,qCAAgB;IAC3B,CAAC,UAAU,eAAe,EAAE;IAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACvC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACvC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC,CAAC;AACnCC,iCAAY;IACvB,CAAC,UAAU,WAAW,EAAE;IACxB,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IACzC,IAAI,WAAW,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;IAC7C,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACnC,IAAI,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;IAChC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;;ACVhC,UAAC,YAAY,GAAGC,mBAAc,CAAC,cAAc,EAAE;IACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACnE,CAAC;;ICFM,MAAM,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;IAChC,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7C,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B;IACA,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;IAC/B,QAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAC5C,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL,IAAI,MAAM,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE;IAClC,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClC,QAAQ,OAAO,IAAI,CAAC;IACpB,KAAK;IACL,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,MAAM,CAAC,OAAO,EAAE;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3C,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9B,QAAQ,OAAO;IACf,KAAK;IACL;;;;;;;;;;;;;;;"}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
CAP_PLUGIN(InAppBrowserPlugin, "InAppBrowser",
|
|
7
7
|
CAP_PLUGIN_METHOD(openWebView, CAPPluginReturnPromise);
|
|
8
8
|
CAP_PLUGIN_METHOD(clearCookies, CAPPluginReturnPromise);
|
|
9
|
+
CAP_PLUGIN_METHOD(getCookies, CAPPluginReturnPromise);
|
|
10
|
+
CAP_PLUGIN_METHOD(reload, CAPPluginReturnPromise);
|
|
9
11
|
CAP_PLUGIN_METHOD(open, CAPPluginReturnPromise);
|
|
10
12
|
CAP_PLUGIN_METHOD(setUrl, CAPPluginReturnPromise);
|
|
11
13
|
CAP_PLUGIN_METHOD(show, CAPPluginReturnPromise);
|
|
@@ -13,5 +15,4 @@ CAP_PLUGIN(InAppBrowserPlugin, "InAppBrowser",
|
|
|
13
15
|
CAP_PLUGIN_METHOD(hide, CAPPluginReturnPromise);
|
|
14
16
|
CAP_PLUGIN_METHOD(executeScript, CAPPluginReturnPromise);
|
|
15
17
|
CAP_PLUGIN_METHOD(insertCSS, CAPPluginReturnPromise);
|
|
16
|
-
CAP_PLUGIN_METHOD(removeAllListeners, CAPPluginReturnPromise);
|
|
17
18
|
)
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import Capacitor
|
|
3
|
+
import WebKit
|
|
4
|
+
|
|
5
|
+
extension UIColor {
|
|
6
|
+
|
|
7
|
+
convenience init(hexString: String) {
|
|
8
|
+
let hex = hexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
|
|
9
|
+
var int = UInt64()
|
|
10
|
+
Scanner(string: hex).scanHexInt64(&int)
|
|
11
|
+
let components = (
|
|
12
|
+
R: CGFloat((int >> 16) & 0xff) / 255,
|
|
13
|
+
G: CGFloat((int >> 08) & 0xff) / 255,
|
|
14
|
+
B: CGFloat((int >> 00) & 0xff) / 255
|
|
15
|
+
)
|
|
16
|
+
self.init(red: components.R, green: components.G, blue: components.B, alpha: 1)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
3
20
|
|
|
4
21
|
/**
|
|
5
22
|
* Please read the Capacitor iOS Plugin Development Guide
|
|
@@ -26,14 +43,57 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
26
43
|
#endif
|
|
27
44
|
}
|
|
28
45
|
|
|
29
|
-
func presentView() {
|
|
30
|
-
self.bridge?.viewController?.present(self.navigationWebViewController!, animated:
|
|
46
|
+
func presentView(isAnimated: Bool = true) {
|
|
47
|
+
self.bridge?.viewController?.present(self.navigationWebViewController!, animated: isAnimated, completion: {
|
|
31
48
|
self.currentPluginCall?.resolve()
|
|
32
49
|
})
|
|
33
50
|
}
|
|
34
51
|
|
|
35
|
-
func clearCookies() {
|
|
36
|
-
|
|
52
|
+
@objc func clearCookies(_ call: CAPPluginCall) {
|
|
53
|
+
let dataStore = WKWebsiteDataStore.default()
|
|
54
|
+
let urlString = call.getString("url") ?? ""
|
|
55
|
+
let clearCache = call.getBool("cache") ?? false
|
|
56
|
+
|
|
57
|
+
if clearCache {
|
|
58
|
+
URLCache.shared.removeAllCachedResponses()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
guard let url = URL(string: urlString), let hostName = url.host else {
|
|
62
|
+
call.reject("Invalid URL")
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
dataStore.httpCookieStore.getAllCookies { cookies in
|
|
66
|
+
let cookiesToDelete = cookies.filter { cookie in
|
|
67
|
+
cookie.domain == hostName || cookie.domain.hasSuffix(".\(hostName)") || hostName.hasSuffix(cookie.domain)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
for cookie in cookiesToDelete {
|
|
71
|
+
dataStore.httpCookieStore.delete(cookie)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
call.resolve()
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@objc func getCookies(_ call: CAPPluginCall) {
|
|
79
|
+
let urlString = call.getString("url") ?? ""
|
|
80
|
+
let includeHttpOnly = call.getBool("includeHttpOnly") ?? true
|
|
81
|
+
|
|
82
|
+
guard let url = URL(string: urlString), let host = url.host else {
|
|
83
|
+
call.reject("Invalid URL")
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
WKWebsiteDataStore.default().httpCookieStore.getAllCookies { cookies in
|
|
88
|
+
var cookieDict = [String: String]()
|
|
89
|
+
for cookie in cookies {
|
|
90
|
+
|
|
91
|
+
if (includeHttpOnly || !cookie.isHTTPOnly) && (cookie.domain == host || cookie.domain.hasSuffix(".\(host)") || host.hasSuffix(cookie.domain)) {
|
|
92
|
+
cookieDict[cookie.name] = cookie.value
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
call.resolve(cookieDict)
|
|
96
|
+
}
|
|
37
97
|
}
|
|
38
98
|
|
|
39
99
|
@objc func openWebView(_ call: CAPPluginCall) {
|
|
@@ -53,6 +113,13 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
53
113
|
}
|
|
54
114
|
|
|
55
115
|
let headers = call.getObject("headers", [:]).mapValues { String(describing: $0 as Any) }
|
|
116
|
+
let closeModal = call.getBool("closeModal", false)
|
|
117
|
+
let closeModalTitle = call.getString("closeModalTitle", "Close")
|
|
118
|
+
let closeModalDescription = call.getString("closeModalDescription", "Are you sure you want to close this window?")
|
|
119
|
+
let closeModalOk = call.getString("closeModalOk", "OK")
|
|
120
|
+
let closeModalCancel = call.getString("closeModalCancel", "Cancel")
|
|
121
|
+
let isInspectable = call.getBool("isInspectable", false)
|
|
122
|
+
let isAnimated = call.getBool("isAnimated", true)
|
|
56
123
|
|
|
57
124
|
var disclaimerContent = call.getObject("shareDisclaimer")
|
|
58
125
|
let toolbarType = call.getString("toolbarType", "")
|
|
@@ -62,25 +129,39 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
62
129
|
}
|
|
63
130
|
|
|
64
131
|
self.isPresentAfterPageLoad = call.getBool("isPresentAfterPageLoad", false)
|
|
132
|
+
let showReloadButton = call.getBool("showReloadButton", false)
|
|
65
133
|
|
|
66
134
|
DispatchQueue.main.async {
|
|
67
135
|
let url = URL(string: urlString)
|
|
68
136
|
|
|
69
137
|
if self.isPresentAfterPageLoad {
|
|
70
|
-
self.webViewController = WKWebViewController.init(url: url!, headers: headers)
|
|
138
|
+
self.webViewController = WKWebViewController.init(url: url!, headers: headers, isInspectable: isInspectable)
|
|
71
139
|
} else {
|
|
72
140
|
self.webViewController = WKWebViewController.init()
|
|
73
141
|
self.webViewController?.setHeaders(headers: headers)
|
|
74
142
|
}
|
|
75
143
|
|
|
76
144
|
self.webViewController?.source = .remote(url!)
|
|
145
|
+
self.webViewController?.leftNavigaionBarItemTypes = self.getToolbarItems(toolbarType: toolbarType) + [.reload]
|
|
77
146
|
self.webViewController?.leftNavigaionBarItemTypes = self.getToolbarItems(toolbarType: toolbarType)
|
|
78
147
|
self.webViewController?.toolbarItemTypes = []
|
|
79
148
|
self.webViewController?.doneBarButtonItemPosition = .right
|
|
149
|
+
if call.getBool("showArrow", false) {
|
|
150
|
+
self.webViewController?.stopBarButtonItemImage = UIImage(named: "Forward@3x", in: Bundle(for: InAppBrowserPlugin.self), compatibleWith: nil)
|
|
151
|
+
}
|
|
152
|
+
|
|
80
153
|
self.webViewController?.capBrowserPlugin = self
|
|
81
154
|
self.webViewController?.title = call.getString("title", "New Window")
|
|
82
155
|
self.webViewController?.shareSubject = call.getString("shareSubject")
|
|
83
156
|
self.webViewController?.shareDisclaimer = disclaimerContent
|
|
157
|
+
self.webViewController?.websiteTitleInNavigationBar = call.getBool("visibleTitle", true)
|
|
158
|
+
if closeModal {
|
|
159
|
+
self.webViewController?.closeModal = true
|
|
160
|
+
self.webViewController?.closeModalTitle = closeModalTitle
|
|
161
|
+
self.webViewController?.closeModalDescription = closeModalDescription
|
|
162
|
+
self.webViewController?.closeModalOk = closeModalOk
|
|
163
|
+
self.webViewController?.closeModalCancel = closeModalCancel
|
|
164
|
+
}
|
|
84
165
|
self.navigationWebViewController = UINavigationController.init(rootViewController: self.webViewController!)
|
|
85
166
|
self.navigationWebViewController?.navigationBar.isTranslucent = false
|
|
86
167
|
self.navigationWebViewController?.toolbar.isTranslucent = false
|
|
@@ -90,8 +171,12 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
90
171
|
if toolbarType == "blank" {
|
|
91
172
|
self.navigationWebViewController?.navigationBar.isHidden = true
|
|
92
173
|
}
|
|
174
|
+
if showReloadButton {
|
|
175
|
+
let toolbarItems = self.getToolbarItems(toolbarType: toolbarType)
|
|
176
|
+
self.webViewController?.leftNavigaionBarItemTypes = toolbarItems + [.reload]
|
|
177
|
+
}
|
|
93
178
|
if !self.isPresentAfterPageLoad {
|
|
94
|
-
self.presentView()
|
|
179
|
+
self.presentView(isAnimated: isAnimated)
|
|
95
180
|
}
|
|
96
181
|
}
|
|
97
182
|
}
|
|
@@ -107,20 +192,57 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
107
192
|
return result
|
|
108
193
|
}
|
|
109
194
|
|
|
195
|
+
@objc func reload(_ call: CAPPluginCall) {
|
|
196
|
+
self.webViewController?.reload()
|
|
197
|
+
call.resolve()
|
|
198
|
+
}
|
|
199
|
+
|
|
110
200
|
@objc func setUrl(_ call: CAPPluginCall) {
|
|
111
|
-
guard let
|
|
201
|
+
guard let urlString = call.getString("url") else {
|
|
112
202
|
call.reject("Cannot get new url to set")
|
|
113
203
|
return
|
|
114
204
|
}
|
|
115
|
-
|
|
205
|
+
|
|
206
|
+
guard let url = URL(string: urlString) else {
|
|
207
|
+
call.reject("Invalid URL")
|
|
208
|
+
return
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
self.webViewController?.load(remote: url)
|
|
116
212
|
call.resolve()
|
|
117
213
|
}
|
|
118
214
|
|
|
215
|
+
@objc func executeScript(_ call: CAPPluginCall) {
|
|
216
|
+
guard let script = call.getString("code") else {
|
|
217
|
+
call.reject("Cannot get script to execute")
|
|
218
|
+
return
|
|
219
|
+
}
|
|
220
|
+
self.webViewController?.executeScript(script: script)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
func isHexColorCode(_ input: String) -> Bool {
|
|
224
|
+
let hexColorRegex = "^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$"
|
|
225
|
+
|
|
226
|
+
do {
|
|
227
|
+
let regex = try NSRegularExpression(pattern: hexColorRegex)
|
|
228
|
+
let range = NSRange(location: 0, length: input.utf16.count)
|
|
229
|
+
if let _ = regex.firstMatch(in: input, options: [], range: range) {
|
|
230
|
+
return true
|
|
231
|
+
}
|
|
232
|
+
} catch {
|
|
233
|
+
print("Error creating regular expression: \(error)")
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return false
|
|
237
|
+
}
|
|
238
|
+
|
|
119
239
|
@objc func open(_ call: CAPPluginCall) {
|
|
120
240
|
if !self.isSetupDone {
|
|
121
241
|
self.setup()
|
|
122
242
|
}
|
|
123
243
|
|
|
244
|
+
let isInspectable = call.getBool("isInspectable", false)
|
|
245
|
+
|
|
124
246
|
self.currentPluginCall = call
|
|
125
247
|
|
|
126
248
|
guard let urlString = call.getString("url") else {
|
|
@@ -141,7 +263,7 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
141
263
|
let url = URL(string: urlString)
|
|
142
264
|
|
|
143
265
|
if self.isPresentAfterPageLoad {
|
|
144
|
-
self.webViewController = WKWebViewController.init(url: url!, headers: headers)
|
|
266
|
+
self.webViewController = WKWebViewController.init(url: url!, headers: headers, isInspectable: isInspectable)
|
|
145
267
|
} else {
|
|
146
268
|
self.webViewController = WKWebViewController.init()
|
|
147
269
|
self.webViewController?.setHeaders(headers: headers)
|
|
@@ -156,7 +278,14 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
156
278
|
self.navigationWebViewController?.navigationBar.isTranslucent = false
|
|
157
279
|
self.navigationWebViewController?.toolbar.isTranslucent = false
|
|
158
280
|
self.navigationWebViewController?.navigationBar.backgroundColor = .white
|
|
159
|
-
|
|
281
|
+
let inputString: String = call.getString("toolbarColor", "#ffffff")
|
|
282
|
+
var color: UIColor = UIColor(hexString: "#ffffff")
|
|
283
|
+
if self.isHexColorCode(inputString) {
|
|
284
|
+
color = UIColor(hexString: inputString)
|
|
285
|
+
} else {
|
|
286
|
+
print("\(inputString) is not a valid hex color code.")
|
|
287
|
+
}
|
|
288
|
+
self.navigationWebViewController?.toolbar.backgroundColor = color
|
|
160
289
|
self.navigationWebViewController?.modalPresentationStyle = .fullScreen
|
|
161
290
|
if !self.isPresentAfterPageLoad {
|
|
162
291
|
self.presentView()
|
|
@@ -167,6 +296,7 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
167
296
|
@objc func close(_ call: CAPPluginCall) {
|
|
168
297
|
DispatchQueue.main.async {
|
|
169
298
|
self.navigationWebViewController?.dismiss(animated: true, completion: nil)
|
|
299
|
+
self.notifyListeners("closeEvent", data: ["url": self.webViewController?.url?.absoluteString ?? ""])
|
|
170
300
|
call.resolve()
|
|
171
301
|
}
|
|
172
302
|
}
|