@capgo/inappbrowser 0.3.7 → 0.3.20
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 +38 -17
- package/android/build.gradle +1 -1
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +4 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewCallbacks.java +2 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +3 -2
- package/dist/docs.json +59 -30
- package/dist/esm/definitions.d.ts +8 -2
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Plugin/InAppBrowserPlugin.m +1 -0
- package/ios/Plugin/WKWebViewController.swift +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ npx cap sync
|
|
|
21
21
|
* [`openWebView(...)`](#openwebview)
|
|
22
22
|
* [`setUrl(...)`](#seturl)
|
|
23
23
|
* [`addListener('urlChangeEvent', ...)`](#addlistenerurlchangeevent)
|
|
24
|
+
* [`addListener('closeEvent', ...)`](#addlistenercloseevent)
|
|
24
25
|
* [`addListener('confirmBtnClicked', ...)`](#addlistenerconfirmbtnclicked)
|
|
25
26
|
* [Interfaces](#interfaces)
|
|
26
27
|
* [Type Aliases](#type-aliases)
|
|
@@ -34,14 +35,14 @@ npx cap sync
|
|
|
34
35
|
### open(...)
|
|
35
36
|
|
|
36
37
|
```typescript
|
|
37
|
-
open(options: OpenOptions) =>
|
|
38
|
+
open(options: OpenOptions) => any
|
|
38
39
|
```
|
|
39
40
|
|
|
40
41
|
| Param | Type |
|
|
41
42
|
| ------------- | --------------------------------------------------- |
|
|
42
43
|
| **`options`** | <code><a href="#openoptions">OpenOptions</a></code> |
|
|
43
44
|
|
|
44
|
-
**Returns:** <code>
|
|
45
|
+
**Returns:** <code>any</code>
|
|
45
46
|
|
|
46
47
|
--------------------
|
|
47
48
|
|
|
@@ -49,10 +50,10 @@ open(options: OpenOptions) => Promise<any>
|
|
|
49
50
|
### close()
|
|
50
51
|
|
|
51
52
|
```typescript
|
|
52
|
-
close() =>
|
|
53
|
+
close() => any
|
|
53
54
|
```
|
|
54
55
|
|
|
55
|
-
**Returns:** <code>
|
|
56
|
+
**Returns:** <code>any</code>
|
|
56
57
|
|
|
57
58
|
--------------------
|
|
58
59
|
|
|
@@ -60,14 +61,14 @@ close() => Promise<any>
|
|
|
60
61
|
### openWebView(...)
|
|
61
62
|
|
|
62
63
|
```typescript
|
|
63
|
-
openWebView(options: OpenWebViewOptions) =>
|
|
64
|
+
openWebView(options: OpenWebViewOptions) => any
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
| Param | Type |
|
|
67
68
|
| ------------- | ----------------------------------------------------------------- |
|
|
68
69
|
| **`options`** | <code><a href="#openwebviewoptions">OpenWebViewOptions</a></code> |
|
|
69
70
|
|
|
70
|
-
**Returns:** <code>
|
|
71
|
+
**Returns:** <code>any</code>
|
|
71
72
|
|
|
72
73
|
--------------------
|
|
73
74
|
|
|
@@ -75,14 +76,14 @@ openWebView(options: OpenWebViewOptions) => Promise<any>
|
|
|
75
76
|
### setUrl(...)
|
|
76
77
|
|
|
77
78
|
```typescript
|
|
78
|
-
setUrl(options: { url: string; }) =>
|
|
79
|
+
setUrl(options: { url: string; }) => any
|
|
79
80
|
```
|
|
80
81
|
|
|
81
82
|
| Param | Type |
|
|
82
83
|
| ------------- | ----------------------------- |
|
|
83
84
|
| **`options`** | <code>{ url: string; }</code> |
|
|
84
85
|
|
|
85
|
-
**Returns:** <code>
|
|
86
|
+
**Returns:** <code>any</code>
|
|
86
87
|
|
|
87
88
|
--------------------
|
|
88
89
|
|
|
@@ -100,13 +101,33 @@ Listen for url change
|
|
|
100
101
|
| **`eventName`** | <code>'urlChangeEvent'</code> |
|
|
101
102
|
| **`listenerFunc`** | <code><a href="#urlchangelistener">UrlChangeListener</a></code> |
|
|
102
103
|
|
|
103
|
-
**Returns:** <code>
|
|
104
|
+
**Returns:** <code>any</code>
|
|
104
105
|
|
|
105
106
|
**Since:** 0.0.1
|
|
106
107
|
|
|
107
108
|
--------------------
|
|
108
109
|
|
|
109
110
|
|
|
111
|
+
### addListener('closeEvent', ...)
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
addListener(eventName: 'closeEvent', listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Listen for close click
|
|
118
|
+
|
|
119
|
+
| Param | Type |
|
|
120
|
+
| ------------------ | --------------------------------------------------------------- |
|
|
121
|
+
| **`eventName`** | <code>'closeEvent'</code> |
|
|
122
|
+
| **`listenerFunc`** | <code><a href="#urlchangelistener">UrlChangeListener</a></code> |
|
|
123
|
+
|
|
124
|
+
**Returns:** <code>any</code>
|
|
125
|
+
|
|
126
|
+
**Since:** 0.4.0
|
|
127
|
+
|
|
128
|
+
--------------------
|
|
129
|
+
|
|
130
|
+
|
|
110
131
|
### addListener('confirmBtnClicked', ...)
|
|
111
132
|
|
|
112
133
|
```typescript
|
|
@@ -120,7 +141,7 @@ Will be triggered when user clicks on confirm button when disclaimer is required
|
|
|
120
141
|
| **`eventName`** | <code>'confirmBtnClicked'</code> |
|
|
121
142
|
| **`listenerFunc`** | <code><a href="#confirmbtnlistener">ConfirmBtnListener</a></code> |
|
|
122
143
|
|
|
123
|
-
**Returns:** <code>
|
|
144
|
+
**Returns:** <code>any</code>
|
|
124
145
|
|
|
125
146
|
**Since:** 0.0.1
|
|
126
147
|
|
|
@@ -166,13 +187,6 @@ Will be triggered when user clicks on confirm button when disclaimer is required
|
|
|
166
187
|
| **`cancelBtn`** | <code>string</code> |
|
|
167
188
|
|
|
168
189
|
|
|
169
|
-
#### PluginListenerHandle
|
|
170
|
-
|
|
171
|
-
| Prop | Type |
|
|
172
|
-
| ------------ | ----------------------------------------- |
|
|
173
|
-
| **`remove`** | <code>() => Promise<void></code> |
|
|
174
|
-
|
|
175
|
-
|
|
176
190
|
#### UrlEvent
|
|
177
191
|
|
|
178
192
|
| Prop | Type | Description | Since |
|
|
@@ -180,6 +194,13 @@ Will be triggered when user clicks on confirm button when disclaimer is required
|
|
|
180
194
|
| **`url`** | <code>string</code> | Emit when the url changes | 0.0.1 |
|
|
181
195
|
|
|
182
196
|
|
|
197
|
+
#### PluginListenerHandle
|
|
198
|
+
|
|
199
|
+
| Prop | Type |
|
|
200
|
+
| ------------ | ------------------------- |
|
|
201
|
+
| **`remove`** | <code>() => any</code> |
|
|
202
|
+
|
|
203
|
+
|
|
183
204
|
#### BtnEvent
|
|
184
205
|
|
|
185
206
|
| Prop | Type | Description | Since |
|
package/android/build.gradle
CHANGED
|
@@ -60,5 +60,5 @@ dependencies {
|
|
|
60
60
|
implementation 'com.android.support:design:28.0.0'
|
|
61
61
|
implementation 'com.android.support:appcompat-v7:28.0.0'
|
|
62
62
|
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
|
|
63
|
-
implementation 'com.google.android.material:material:1.
|
|
63
|
+
implementation 'com.google.android.material:material:1.8.0'
|
|
64
64
|
}
|
|
@@ -91,6 +91,10 @@ public class InAppBrowserPlugin extends Plugin {
|
|
|
91
91
|
public void urlChangeEvent(String url) {
|
|
92
92
|
notifyListeners("urlChangeEvent", new JSObject().put("url", url));
|
|
93
93
|
}
|
|
94
|
+
@Override
|
|
95
|
+
public void closeEvent(String url) {
|
|
96
|
+
notifyListeners("closeEvent", new JSObject().put("url", url));
|
|
97
|
+
}
|
|
94
98
|
|
|
95
99
|
@Override
|
|
96
100
|
public void pageLoaded() {
|
|
@@ -72,7 +72,7 @@ public class WebViewDialog extends Dialog {
|
|
|
72
72
|
|
|
73
73
|
if (!this._options.isPresentAfterPageLoad()) {
|
|
74
74
|
show();
|
|
75
|
-
_options.getPluginCall().
|
|
75
|
+
_options.getPluginCall().resolve();
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -140,6 +140,7 @@ public class WebViewDialog extends Dialog {
|
|
|
140
140
|
@Override
|
|
141
141
|
public void onClick(View view) {
|
|
142
142
|
dismiss();
|
|
143
|
+
_options.getCallbacks().closeEvent(_webView.getUrl());
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
);
|
|
@@ -192,7 +193,7 @@ public class WebViewDialog extends Dialog {
|
|
|
192
193
|
_webView.clearHistory();
|
|
193
194
|
if (_options.isPresentAfterPageLoad()) {
|
|
194
195
|
show();
|
|
195
|
-
_options.getPluginCall().
|
|
196
|
+
_options.getPluginCall().resolve();
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
199
|
|
package/dist/docs.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"methods": [
|
|
8
8
|
{
|
|
9
9
|
"name": "open",
|
|
10
|
-
"signature": "(options: OpenOptions) =>
|
|
10
|
+
"signature": "(options: OpenOptions) => any",
|
|
11
11
|
"parameters": [
|
|
12
12
|
{
|
|
13
13
|
"name": "options",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"type": "OpenOptions"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
|
-
"returns": "
|
|
18
|
+
"returns": "any",
|
|
19
19
|
"tags": [],
|
|
20
20
|
"docs": "",
|
|
21
21
|
"complexTypes": [
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"name": "close",
|
|
28
|
-
"signature": "() =>
|
|
28
|
+
"signature": "() => any",
|
|
29
29
|
"parameters": [],
|
|
30
|
-
"returns": "
|
|
30
|
+
"returns": "any",
|
|
31
31
|
"tags": [],
|
|
32
32
|
"docs": "",
|
|
33
33
|
"complexTypes": [],
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
"name": "openWebView",
|
|
38
|
-
"signature": "(options: OpenWebViewOptions) =>
|
|
38
|
+
"signature": "(options: OpenWebViewOptions) => any",
|
|
39
39
|
"parameters": [
|
|
40
40
|
{
|
|
41
41
|
"name": "options",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"type": "OpenWebViewOptions"
|
|
44
44
|
}
|
|
45
45
|
],
|
|
46
|
-
"returns": "
|
|
46
|
+
"returns": "any",
|
|
47
47
|
"tags": [],
|
|
48
48
|
"docs": "",
|
|
49
49
|
"complexTypes": [
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
"name": "setUrl",
|
|
56
|
-
"signature": "(options: { url: string; }) =>
|
|
56
|
+
"signature": "(options: { url: string; }) => any",
|
|
57
57
|
"parameters": [
|
|
58
58
|
{
|
|
59
59
|
"name": "options",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"type": "{ url: string; }"
|
|
62
62
|
}
|
|
63
63
|
],
|
|
64
|
-
"returns": "
|
|
64
|
+
"returns": "any",
|
|
65
65
|
"tags": [],
|
|
66
66
|
"docs": "",
|
|
67
67
|
"complexTypes": [],
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"type": "UrlChangeListener"
|
|
83
83
|
}
|
|
84
84
|
],
|
|
85
|
-
"returns": "
|
|
85
|
+
"returns": "any",
|
|
86
86
|
"tags": [
|
|
87
87
|
{
|
|
88
88
|
"name": "since",
|
|
@@ -91,11 +91,40 @@
|
|
|
91
91
|
],
|
|
92
92
|
"docs": "Listen for url change",
|
|
93
93
|
"complexTypes": [
|
|
94
|
-
"
|
|
95
|
-
"
|
|
94
|
+
"UrlChangeListener",
|
|
95
|
+
"PluginListenerHandle"
|
|
96
96
|
],
|
|
97
97
|
"slug": "addlistenerurlchangeevent"
|
|
98
98
|
},
|
|
99
|
+
{
|
|
100
|
+
"name": "addListener",
|
|
101
|
+
"signature": "(eventName: 'closeEvent', listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
102
|
+
"parameters": [
|
|
103
|
+
{
|
|
104
|
+
"name": "eventName",
|
|
105
|
+
"docs": "",
|
|
106
|
+
"type": "'closeEvent'"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "listenerFunc",
|
|
110
|
+
"docs": "",
|
|
111
|
+
"type": "UrlChangeListener"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"returns": "any",
|
|
115
|
+
"tags": [
|
|
116
|
+
{
|
|
117
|
+
"name": "since",
|
|
118
|
+
"text": "0.4.0"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"docs": "Listen for close click",
|
|
122
|
+
"complexTypes": [
|
|
123
|
+
"UrlChangeListener",
|
|
124
|
+
"PluginListenerHandle"
|
|
125
|
+
],
|
|
126
|
+
"slug": "addlistenercloseevent"
|
|
127
|
+
},
|
|
99
128
|
{
|
|
100
129
|
"name": "addListener",
|
|
101
130
|
"signature": "(eventName: 'confirmBtnClicked', listenerFunc: ConfirmBtnListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
@@ -111,7 +140,7 @@
|
|
|
111
140
|
"type": "ConfirmBtnListener"
|
|
112
141
|
}
|
|
113
142
|
],
|
|
114
|
-
"returns": "
|
|
143
|
+
"returns": "any",
|
|
115
144
|
"tags": [
|
|
116
145
|
{
|
|
117
146
|
"name": "since",
|
|
@@ -120,8 +149,8 @@
|
|
|
120
149
|
],
|
|
121
150
|
"docs": "Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS",
|
|
122
151
|
"complexTypes": [
|
|
123
|
-
"
|
|
124
|
-
"
|
|
152
|
+
"ConfirmBtnListener",
|
|
153
|
+
"PluginListenerHandle"
|
|
125
154
|
],
|
|
126
155
|
"slug": "addlistenerconfirmbtnclicked"
|
|
127
156
|
}
|
|
@@ -279,22 +308,6 @@
|
|
|
279
308
|
}
|
|
280
309
|
]
|
|
281
310
|
},
|
|
282
|
-
{
|
|
283
|
-
"name": "PluginListenerHandle",
|
|
284
|
-
"slug": "pluginlistenerhandle",
|
|
285
|
-
"docs": "",
|
|
286
|
-
"tags": [],
|
|
287
|
-
"methods": [],
|
|
288
|
-
"properties": [
|
|
289
|
-
{
|
|
290
|
-
"name": "remove",
|
|
291
|
-
"tags": [],
|
|
292
|
-
"docs": "",
|
|
293
|
-
"complexTypes": [],
|
|
294
|
-
"type": "() => Promise<void>"
|
|
295
|
-
}
|
|
296
|
-
]
|
|
297
|
-
},
|
|
298
311
|
{
|
|
299
312
|
"name": "UrlEvent",
|
|
300
313
|
"slug": "urlevent",
|
|
@@ -316,6 +329,22 @@
|
|
|
316
329
|
}
|
|
317
330
|
]
|
|
318
331
|
},
|
|
332
|
+
{
|
|
333
|
+
"name": "PluginListenerHandle",
|
|
334
|
+
"slug": "pluginlistenerhandle",
|
|
335
|
+
"docs": "",
|
|
336
|
+
"tags": [],
|
|
337
|
+
"methods": [],
|
|
338
|
+
"properties": [
|
|
339
|
+
{
|
|
340
|
+
"name": "remove",
|
|
341
|
+
"tags": [],
|
|
342
|
+
"docs": "",
|
|
343
|
+
"complexTypes": [],
|
|
344
|
+
"type": "() => any"
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
},
|
|
319
348
|
{
|
|
320
349
|
"name": "BtnEvent",
|
|
321
350
|
"slug": "btnevent",
|
|
@@ -15,8 +15,8 @@ export interface BtnEvent {
|
|
|
15
15
|
*/
|
|
16
16
|
url: string;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
19
|
-
export
|
|
18
|
+
export type UrlChangeListener = (state: UrlEvent) => void;
|
|
19
|
+
export type ConfirmBtnListener = (state: BtnEvent) => void;
|
|
20
20
|
export declare enum BackgroundColor {
|
|
21
21
|
WHITE = "white",
|
|
22
22
|
BLACK = "black"
|
|
@@ -64,6 +64,12 @@ export interface InAppBrowserPlugin {
|
|
|
64
64
|
* @since 0.0.1
|
|
65
65
|
*/
|
|
66
66
|
addListener(eventName: 'urlChangeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
67
|
+
/**
|
|
68
|
+
* Listen for close click
|
|
69
|
+
*
|
|
70
|
+
* @since 0.4.0
|
|
71
|
+
*/
|
|
72
|
+
addListener(eventName: 'closeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
67
73
|
/**
|
|
68
74
|
* Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS
|
|
69
75
|
*
|
|
@@ -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 url: string;\n headers?: Headers;\n isPresentAfterPageLoad?: boolean;\n}\n\nexport interface DisclaimerOptions {\n title: string;\n message: string;\n confirmBtn: string;\n cancelBtn: string;\n}\n\nexport interface OpenWebViewOptions {\n url: string;\n headers?: Headers;\n shareDisclaimer?: DisclaimerOptions;\n toolbarType?: ToolBarType;\n shareSubject?: string;\n title: string;\n backgroundColor?: BackgroundColor;\n isPresentAfterPageLoad?: boolean;\n}\n\n// CapBrowser.addListener(\"urlChangeEvent\", (info: any) => {\n// console.log(info.url)\n// })\n\n// CapBrowser.addListener(\"confirmBtnClicked\", (info: any) => {\n// // will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS\n// console.log(info.url)\n// })\nexport interface InAppBrowserPlugin {\n open(options: OpenOptions): Promise<any>;\n close(): Promise<any>;\n openWebView(options: OpenWebViewOptions): Promise<any>;\n setUrl(options: { url: string }): Promise<any>;\n /**\n * Listen for url change\n *\n * @since 0.0.1\n */\n addListener(\n eventName: 'urlChangeEvent',\n listenerFunc: UrlChangeListener\n ): Promise<PluginListenerHandle> & 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> & PluginListenerHandle;\n}\n"]}
|
|
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 url: string;\n headers?: Headers;\n isPresentAfterPageLoad?: boolean;\n}\n\nexport interface DisclaimerOptions {\n title: string;\n message: string;\n confirmBtn: string;\n cancelBtn: string;\n}\n\nexport interface OpenWebViewOptions {\n url: string;\n headers?: Headers;\n shareDisclaimer?: DisclaimerOptions;\n toolbarType?: ToolBarType;\n shareSubject?: string;\n title: string;\n backgroundColor?: BackgroundColor;\n isPresentAfterPageLoad?: boolean;\n}\n\n// CapBrowser.addListener(\"urlChangeEvent\", (info: any) => {\n// console.log(info.url)\n// })\n\n// CapBrowser.addListener(\"confirmBtnClicked\", (info: any) => {\n// // will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS\n// console.log(info.url)\n// })\nexport interface InAppBrowserPlugin {\n open(options: OpenOptions): Promise<any>;\n close(): Promise<any>;\n openWebView(options: OpenWebViewOptions): Promise<any>;\n setUrl(options: { url: string }): Promise<any>;\n /**\n * Listen for url change\n *\n * @since 0.0.1\n */\n addListener(\n eventName: 'urlChangeEvent',\n listenerFunc: UrlChangeListener\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Listen for close click\n *\n * @since 0.4.0\n */\n addListener(\n eventName: 'closeEvent',\n listenerFunc: UrlChangeListener\n ): Promise<PluginListenerHandle> & 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> & PluginListenerHandle;\n}\n"]}
|
|
@@ -12,4 +12,5 @@ CAP_PLUGIN(InAppBrowserPlugin, "InAppBrowser",
|
|
|
12
12
|
CAP_PLUGIN_METHOD(hide, CAPPluginReturnPromise);
|
|
13
13
|
CAP_PLUGIN_METHOD(executeScript, CAPPluginReturnPromise);
|
|
14
14
|
CAP_PLUGIN_METHOD(insertCSS, CAPPluginReturnPromise);
|
|
15
|
+
CAP_PLUGIN_METHOD(removeAllListeners, CAPPluginReturnPromise);
|
|
15
16
|
)
|
|
@@ -679,6 +679,7 @@ fileprivate extension WKWebViewController {
|
|
|
679
679
|
}
|
|
680
680
|
if canDismiss {
|
|
681
681
|
// UIDevice.current.setValue(Int(UIInterfaceOrientation.portrait.rawValue), forKey: "orientation")
|
|
682
|
+
self.capBrowserPlugin?.notifyListeners("closeEvent", data: ["url": webView?.url?.absoluteString ?? ""])
|
|
682
683
|
dismiss(animated: true, completion: nil)
|
|
683
684
|
}
|
|
684
685
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/inappbrowser",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.20",
|
|
4
4
|
"description": "Capacitor plugin in app browser",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"eslint-plugin-import": "^2.26.0",
|
|
60
60
|
"husky": "^8.0.2",
|
|
61
61
|
"prettier": "^2.7.1",
|
|
62
|
-
"prettier-plugin-java": "^
|
|
63
|
-
"rimraf": "^
|
|
62
|
+
"prettier-plugin-java": "^2.0.0",
|
|
63
|
+
"rimraf": "^4.0.0",
|
|
64
64
|
"rollup": "^3.2.5",
|
|
65
65
|
"swiftlint": "^1.0.1",
|
|
66
66
|
"typescript": "^4.8.4"
|