@capgo/inappbrowser 1.2.7 → 1.2.12
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 +36 -22
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +13 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +17 -2
- package/dist/docs.json +52 -37
- package/dist/esm/definitions.d.ts +6 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +1 -0
- package/dist/esm/web.js +4 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +4 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +4 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/InAppBrowserPlugin.m +1 -0
- package/ios/Plugin/InAppBrowserPlugin.swift +10 -1
- package/ios/Plugin/WKWebViewController.swift +3 -5
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ InAppBrowser.open("YOUR_URL");
|
|
|
32
32
|
* [`addListener('closeEvent', ...)`](#addlistenercloseevent)
|
|
33
33
|
* [`addListener('confirmBtnClicked', ...)`](#addlistenerconfirmbtnclicked)
|
|
34
34
|
* [`removeAllListeners()`](#removealllisteners)
|
|
35
|
+
* [`reload()`](#reload)
|
|
35
36
|
* [Interfaces](#interfaces)
|
|
36
37
|
* [Type Aliases](#type-aliases)
|
|
37
38
|
* [Enums](#enums)
|
|
@@ -44,7 +45,7 @@ InAppBrowser.open("YOUR_URL");
|
|
|
44
45
|
### open(...)
|
|
45
46
|
|
|
46
47
|
```typescript
|
|
47
|
-
open(options: OpenOptions) => any
|
|
48
|
+
open(options: OpenOptions) => Promise<any>
|
|
48
49
|
```
|
|
49
50
|
|
|
50
51
|
Open url in a new window fullscreen
|
|
@@ -53,7 +54,7 @@ Open url in a new window fullscreen
|
|
|
53
54
|
| ------------- | --------------------------------------------------- |
|
|
54
55
|
| **`options`** | <code><a href="#openoptions">OpenOptions</a></code> |
|
|
55
56
|
|
|
56
|
-
**Returns:** <code>any
|
|
57
|
+
**Returns:** <code>Promise<any></code>
|
|
57
58
|
|
|
58
59
|
**Since:** 0.1.0
|
|
59
60
|
|
|
@@ -63,12 +64,12 @@ Open url in a new window fullscreen
|
|
|
63
64
|
### clearCookies()
|
|
64
65
|
|
|
65
66
|
```typescript
|
|
66
|
-
clearCookies() => any
|
|
67
|
+
clearCookies() => Promise<any>
|
|
67
68
|
```
|
|
68
69
|
|
|
69
70
|
Clear all cookies
|
|
70
71
|
|
|
71
|
-
**Returns:** <code>any
|
|
72
|
+
**Returns:** <code>Promise<any></code>
|
|
72
73
|
|
|
73
74
|
**Since:** 0.5.0
|
|
74
75
|
|
|
@@ -78,10 +79,10 @@ Clear all cookies
|
|
|
78
79
|
### close()
|
|
79
80
|
|
|
80
81
|
```typescript
|
|
81
|
-
close() => any
|
|
82
|
+
close() => Promise<any>
|
|
82
83
|
```
|
|
83
84
|
|
|
84
|
-
**Returns:** <code>any
|
|
85
|
+
**Returns:** <code>Promise<any></code>
|
|
85
86
|
|
|
86
87
|
--------------------
|
|
87
88
|
|
|
@@ -89,7 +90,7 @@ close() => any
|
|
|
89
90
|
### openWebView(...)
|
|
90
91
|
|
|
91
92
|
```typescript
|
|
92
|
-
openWebView(options: OpenWebViewOptions) => any
|
|
93
|
+
openWebView(options: OpenWebViewOptions) => Promise<any>
|
|
93
94
|
```
|
|
94
95
|
|
|
95
96
|
Open url in a new webview with toolbars
|
|
@@ -98,7 +99,7 @@ Open url in a new webview with toolbars
|
|
|
98
99
|
| ------------- | ----------------------------------------------------------------- |
|
|
99
100
|
| **`options`** | <code><a href="#openwebviewoptions">OpenWebViewOptions</a></code> |
|
|
100
101
|
|
|
101
|
-
**Returns:** <code>any
|
|
102
|
+
**Returns:** <code>Promise<any></code>
|
|
102
103
|
|
|
103
104
|
**Since:** 0.1.0
|
|
104
105
|
|
|
@@ -108,14 +109,14 @@ Open url in a new webview with toolbars
|
|
|
108
109
|
### setUrl(...)
|
|
109
110
|
|
|
110
111
|
```typescript
|
|
111
|
-
setUrl(options: { url: string; }) => any
|
|
112
|
+
setUrl(options: { url: string; }) => Promise<any>
|
|
112
113
|
```
|
|
113
114
|
|
|
114
115
|
| Param | Type |
|
|
115
116
|
| ------------- | ----------------------------- |
|
|
116
117
|
| **`options`** | <code>{ url: string; }</code> |
|
|
117
118
|
|
|
118
|
-
**Returns:** <code>any
|
|
119
|
+
**Returns:** <code>Promise<any></code>
|
|
119
120
|
|
|
120
121
|
--------------------
|
|
121
122
|
|
|
@@ -133,7 +134,7 @@ Listen for url change, only for openWebView
|
|
|
133
134
|
| **`eventName`** | <code>'urlChangeEvent'</code> |
|
|
134
135
|
| **`listenerFunc`** | <code><a href="#urlchangelistener">UrlChangeListener</a></code> |
|
|
135
136
|
|
|
136
|
-
**Returns:** <code>
|
|
137
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
|
|
137
138
|
|
|
138
139
|
**Since:** 0.0.1
|
|
139
140
|
|
|
@@ -153,7 +154,7 @@ Listen for close click only for openWebView
|
|
|
153
154
|
| **`eventName`** | <code>'closeEvent'</code> |
|
|
154
155
|
| **`listenerFunc`** | <code><a href="#urlchangelistener">UrlChangeListener</a></code> |
|
|
155
156
|
|
|
156
|
-
**Returns:** <code>
|
|
157
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
|
|
157
158
|
|
|
158
159
|
**Since:** 0.4.0
|
|
159
160
|
|
|
@@ -173,7 +174,7 @@ Will be triggered when user clicks on confirm button when disclaimer is required
|
|
|
173
174
|
| **`eventName`** | <code>'confirmBtnClicked'</code> |
|
|
174
175
|
| **`listenerFunc`** | <code><a href="#confirmbtnlistener">ConfirmBtnListener</a></code> |
|
|
175
176
|
|
|
176
|
-
**Returns:** <code>
|
|
177
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
|
|
177
178
|
|
|
178
179
|
**Since:** 0.0.1
|
|
179
180
|
|
|
@@ -183,12 +184,25 @@ Will be triggered when user clicks on confirm button when disclaimer is required
|
|
|
183
184
|
### removeAllListeners()
|
|
184
185
|
|
|
185
186
|
```typescript
|
|
186
|
-
removeAllListeners() =>
|
|
187
|
+
removeAllListeners() => Promise<void>
|
|
187
188
|
```
|
|
188
189
|
|
|
189
190
|
Remove all listeners for this plugin.
|
|
190
191
|
|
|
191
|
-
**
|
|
192
|
+
**Since:** 1.0.0
|
|
193
|
+
|
|
194
|
+
--------------------
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
### reload()
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
reload() => Promise<any>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Reload the current web page.
|
|
204
|
+
|
|
205
|
+
**Returns:** <code>Promise<any></code>
|
|
192
206
|
|
|
193
207
|
**Since:** 1.0.0
|
|
194
208
|
|
|
@@ -244,6 +258,13 @@ Remove all listeners for this plugin.
|
|
|
244
258
|
| **`cancelBtn`** | <code>string</code> |
|
|
245
259
|
|
|
246
260
|
|
|
261
|
+
#### PluginListenerHandle
|
|
262
|
+
|
|
263
|
+
| Prop | Type |
|
|
264
|
+
| ------------ | ----------------------------------------- |
|
|
265
|
+
| **`remove`** | <code>() => Promise<void></code> |
|
|
266
|
+
|
|
267
|
+
|
|
247
268
|
#### UrlEvent
|
|
248
269
|
|
|
249
270
|
| Prop | Type | Description | Since |
|
|
@@ -251,13 +272,6 @@ Remove all listeners for this plugin.
|
|
|
251
272
|
| **`url`** | <code>string</code> | Emit when the url changes | 0.0.1 |
|
|
252
273
|
|
|
253
274
|
|
|
254
|
-
#### PluginListenerHandle
|
|
255
|
-
|
|
256
|
-
| Prop | Type |
|
|
257
|
-
| ------------ | ------------------------- |
|
|
258
|
-
| **`remove`** | <code>() => any</code> |
|
|
259
|
-
|
|
260
|
-
|
|
261
275
|
#### BtnEvent
|
|
262
276
|
|
|
263
277
|
| Prop | Type | Description | Since |
|
|
@@ -178,6 +178,7 @@ public class InAppBrowserPlugin extends Plugin {
|
|
|
178
178
|
options.setCloseModal(false);
|
|
179
179
|
}
|
|
180
180
|
options.setPluginCall(call);
|
|
181
|
+
// options.getToolbarItemTypes().add(ToolbarItemType.RELOAD); TODO: fix this
|
|
181
182
|
options.setCallbacks(
|
|
182
183
|
new WebViewCallbacks() {
|
|
183
184
|
@Override
|
|
@@ -218,10 +219,22 @@ public class InAppBrowserPlugin extends Plugin {
|
|
|
218
219
|
);
|
|
219
220
|
}
|
|
220
221
|
|
|
222
|
+
@PluginMethod
|
|
223
|
+
public void reload(PluginCall call) {
|
|
224
|
+
if (webViewDialog != null) {
|
|
225
|
+
webViewDialog.reload();
|
|
226
|
+
}
|
|
227
|
+
call.resolve();
|
|
228
|
+
}
|
|
229
|
+
|
|
221
230
|
@PluginMethod
|
|
222
231
|
public void close(PluginCall call) {
|
|
223
232
|
if (webViewDialog != null) {
|
|
224
233
|
webViewDialog.dismiss();
|
|
234
|
+
notifyListeners(
|
|
235
|
+
"closeEvent",
|
|
236
|
+
new JSObject().put("url", webViewDialog.getUrl())
|
|
237
|
+
);
|
|
225
238
|
webViewDialog = null;
|
|
226
239
|
} else {
|
|
227
240
|
Intent intent = new Intent(
|
|
@@ -93,6 +93,14 @@ public class WebViewDialog extends Dialog {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
public void reload() {
|
|
97
|
+
_webView.reload();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public String getUrl() {
|
|
101
|
+
return _webView.getUrl();
|
|
102
|
+
}
|
|
103
|
+
|
|
96
104
|
public void setUrl(String url) {
|
|
97
105
|
Map<String, String> requestHeaders = new HashMap<>();
|
|
98
106
|
if (_options.getHeaders() != null) {
|
|
@@ -122,11 +130,18 @@ public class WebViewDialog extends Dialog {
|
|
|
122
130
|
|
|
123
131
|
private void setupToolbar() {
|
|
124
132
|
_toolbar = this.findViewById(R.id.tool_bar);
|
|
133
|
+
int color = Color.parseColor("#ffffff");
|
|
125
134
|
try {
|
|
126
|
-
|
|
135
|
+
color = Color.parseColor(_options.getToolbarColor());
|
|
127
136
|
} catch (IllegalArgumentException e) {
|
|
128
|
-
|
|
137
|
+
// Do nothing
|
|
129
138
|
}
|
|
139
|
+
_toolbar.setBackgroundColor(color);
|
|
140
|
+
_toolbar.findViewById(R.id.backButton).setBackgroundColor(color);
|
|
141
|
+
_toolbar.findViewById(R.id.forwardButton).setBackgroundColor(color);
|
|
142
|
+
_toolbar.findViewById(R.id.closeButton).setBackgroundColor(color);
|
|
143
|
+
_toolbar.findViewById(R.id.reloadButton).setBackgroundColor(color);
|
|
144
|
+
|
|
130
145
|
if (!TextUtils.isEmpty(_options.getTitle())) {
|
|
131
146
|
this.setTitle(_options.getTitle());
|
|
132
147
|
} else {
|
package/dist/docs.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"methods": [
|
|
8
8
|
{
|
|
9
9
|
"name": "open",
|
|
10
|
-
"signature": "(options: OpenOptions) => any",
|
|
10
|
+
"signature": "(options: OpenOptions) => Promise<any>",
|
|
11
11
|
"parameters": [
|
|
12
12
|
{
|
|
13
13
|
"name": "options",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"type": "OpenOptions"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
|
-
"returns": "any",
|
|
18
|
+
"returns": "Promise<any>",
|
|
19
19
|
"tags": [
|
|
20
20
|
{
|
|
21
21
|
"name": "since",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"name": "clearCookies",
|
|
33
|
-
"signature": "() => any",
|
|
33
|
+
"signature": "() => Promise<any>",
|
|
34
34
|
"parameters": [],
|
|
35
|
-
"returns": "any",
|
|
35
|
+
"returns": "Promise<any>",
|
|
36
36
|
"tags": [
|
|
37
37
|
{
|
|
38
38
|
"name": "since",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"name": "close",
|
|
48
|
-
"signature": "() => any",
|
|
48
|
+
"signature": "() => Promise<any>",
|
|
49
49
|
"parameters": [],
|
|
50
|
-
"returns": "any",
|
|
50
|
+
"returns": "Promise<any>",
|
|
51
51
|
"tags": [],
|
|
52
52
|
"docs": "",
|
|
53
53
|
"complexTypes": [],
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"name": "openWebView",
|
|
58
|
-
"signature": "(options: OpenWebViewOptions) => any",
|
|
58
|
+
"signature": "(options: OpenWebViewOptions) => Promise<any>",
|
|
59
59
|
"parameters": [
|
|
60
60
|
{
|
|
61
61
|
"name": "options",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"type": "OpenWebViewOptions"
|
|
64
64
|
}
|
|
65
65
|
],
|
|
66
|
-
"returns": "any",
|
|
66
|
+
"returns": "Promise<any>",
|
|
67
67
|
"tags": [
|
|
68
68
|
{
|
|
69
69
|
"name": "since",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
"name": "setUrl",
|
|
81
|
-
"signature": "(options: { url: string; }) => any",
|
|
81
|
+
"signature": "(options: { url: string; }) => Promise<any>",
|
|
82
82
|
"parameters": [
|
|
83
83
|
{
|
|
84
84
|
"name": "options",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"type": "{ url: string; }"
|
|
87
87
|
}
|
|
88
88
|
],
|
|
89
|
-
"returns": "any",
|
|
89
|
+
"returns": "Promise<any>",
|
|
90
90
|
"tags": [],
|
|
91
91
|
"docs": "",
|
|
92
92
|
"complexTypes": [],
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"type": "UrlChangeListener"
|
|
108
108
|
}
|
|
109
109
|
],
|
|
110
|
-
"returns": "
|
|
110
|
+
"returns": "Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
111
111
|
"tags": [
|
|
112
112
|
{
|
|
113
113
|
"name": "since",
|
|
@@ -116,8 +116,8 @@
|
|
|
116
116
|
],
|
|
117
117
|
"docs": "Listen for url change, only for openWebView",
|
|
118
118
|
"complexTypes": [
|
|
119
|
-
"
|
|
120
|
-
"
|
|
119
|
+
"PluginListenerHandle",
|
|
120
|
+
"UrlChangeListener"
|
|
121
121
|
],
|
|
122
122
|
"slug": "addlistenerurlchangeevent"
|
|
123
123
|
},
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"type": "UrlChangeListener"
|
|
137
137
|
}
|
|
138
138
|
],
|
|
139
|
-
"returns": "
|
|
139
|
+
"returns": "Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
140
140
|
"tags": [
|
|
141
141
|
{
|
|
142
142
|
"name": "since",
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
],
|
|
146
146
|
"docs": "Listen for close click only for openWebView",
|
|
147
147
|
"complexTypes": [
|
|
148
|
-
"
|
|
149
|
-
"
|
|
148
|
+
"PluginListenerHandle",
|
|
149
|
+
"UrlChangeListener"
|
|
150
150
|
],
|
|
151
151
|
"slug": "addlistenercloseevent"
|
|
152
152
|
},
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"type": "ConfirmBtnListener"
|
|
166
166
|
}
|
|
167
167
|
],
|
|
168
|
-
"returns": "
|
|
168
|
+
"returns": "Promise<PluginListenerHandle> & PluginListenerHandle",
|
|
169
169
|
"tags": [
|
|
170
170
|
{
|
|
171
171
|
"name": "since",
|
|
@@ -174,16 +174,16 @@
|
|
|
174
174
|
],
|
|
175
175
|
"docs": "Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS",
|
|
176
176
|
"complexTypes": [
|
|
177
|
-
"
|
|
178
|
-
"
|
|
177
|
+
"PluginListenerHandle",
|
|
178
|
+
"ConfirmBtnListener"
|
|
179
179
|
],
|
|
180
180
|
"slug": "addlistenerconfirmbtnclicked"
|
|
181
181
|
},
|
|
182
182
|
{
|
|
183
183
|
"name": "removeAllListeners",
|
|
184
|
-
"signature": "() =>
|
|
184
|
+
"signature": "() => Promise<void>",
|
|
185
185
|
"parameters": [],
|
|
186
|
-
"returns": "
|
|
186
|
+
"returns": "Promise<void>",
|
|
187
187
|
"tags": [
|
|
188
188
|
{
|
|
189
189
|
"name": "since",
|
|
@@ -193,6 +193,21 @@
|
|
|
193
193
|
"docs": "Remove all listeners for this plugin.",
|
|
194
194
|
"complexTypes": [],
|
|
195
195
|
"slug": "removealllisteners"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "reload",
|
|
199
|
+
"signature": "() => Promise<any>",
|
|
200
|
+
"parameters": [],
|
|
201
|
+
"returns": "Promise<any>",
|
|
202
|
+
"tags": [
|
|
203
|
+
{
|
|
204
|
+
"name": "since",
|
|
205
|
+
"text": "1.0.0"
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"docs": "Reload the current web page.",
|
|
209
|
+
"complexTypes": [],
|
|
210
|
+
"slug": "reload"
|
|
196
211
|
}
|
|
197
212
|
],
|
|
198
213
|
"properties": []
|
|
@@ -570,6 +585,22 @@
|
|
|
570
585
|
}
|
|
571
586
|
]
|
|
572
587
|
},
|
|
588
|
+
{
|
|
589
|
+
"name": "PluginListenerHandle",
|
|
590
|
+
"slug": "pluginlistenerhandle",
|
|
591
|
+
"docs": "",
|
|
592
|
+
"tags": [],
|
|
593
|
+
"methods": [],
|
|
594
|
+
"properties": [
|
|
595
|
+
{
|
|
596
|
+
"name": "remove",
|
|
597
|
+
"tags": [],
|
|
598
|
+
"docs": "",
|
|
599
|
+
"complexTypes": [],
|
|
600
|
+
"type": "() => Promise<void>"
|
|
601
|
+
}
|
|
602
|
+
]
|
|
603
|
+
},
|
|
573
604
|
{
|
|
574
605
|
"name": "UrlEvent",
|
|
575
606
|
"slug": "urlevent",
|
|
@@ -591,22 +622,6 @@
|
|
|
591
622
|
}
|
|
592
623
|
]
|
|
593
624
|
},
|
|
594
|
-
{
|
|
595
|
-
"name": "PluginListenerHandle",
|
|
596
|
-
"slug": "pluginlistenerhandle",
|
|
597
|
-
"docs": "",
|
|
598
|
-
"tags": [],
|
|
599
|
-
"methods": [],
|
|
600
|
-
"properties": [
|
|
601
|
-
{
|
|
602
|
-
"name": "remove",
|
|
603
|
-
"tags": [],
|
|
604
|
-
"docs": "",
|
|
605
|
-
"complexTypes": [],
|
|
606
|
-
"type": "() => any"
|
|
607
|
-
}
|
|
608
|
-
]
|
|
609
|
-
},
|
|
610
625
|
{
|
|
611
626
|
"name": "BtnEvent",
|
|
612
627
|
"slug": "btnevent",
|
|
@@ -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: 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 * 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 * 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\
|
|
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: 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 * 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 * 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 all cookies\n *\n * @since 0.5.0\n */\n clearCookies(): Promise<any>;\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 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> & 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> & 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 /**\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
package/dist/esm/web.js
CHANGED
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;AAQ5C,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;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,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;QAChB,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAC5B,OAAO;IACT,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,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} 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(): Promise<any> {\n console.log(\"cleanCookies\");\n return;\n }\n\n async openWebView(options: OpenWebViewOptions): Promise<any> {\n console.log(\"openWebView\", options);\n return options;\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
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,GAAG;AACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AACpC,QAAQ,OAAO;AACf,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,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;;;;;;;;;"}
|
|
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 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,GAAG;AACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AACpC,QAAQ,OAAO;AACf,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,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
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,GAAG;IACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACpC,QAAQ,OAAO;IACf,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,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;;;;;;;;;;;;;;;"}
|
|
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 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,GAAG;IACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACpC,QAAQ,OAAO;IACf,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,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,7 @@
|
|
|
6
6
|
CAP_PLUGIN(InAppBrowserPlugin, "InAppBrowser",
|
|
7
7
|
CAP_PLUGIN_METHOD(openWebView, CAPPluginReturnPromise);
|
|
8
8
|
CAP_PLUGIN_METHOD(clearCookies, CAPPluginReturnPromise);
|
|
9
|
+
CAP_PLUGIN_METHOD(reload, CAPPluginReturnPromise);
|
|
9
10
|
CAP_PLUGIN_METHOD(open, CAPPluginReturnPromise);
|
|
10
11
|
CAP_PLUGIN_METHOD(setUrl, CAPPluginReturnPromise);
|
|
11
12
|
CAP_PLUGIN_METHOD(show, CAPPluginReturnPromise);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import Capacitor
|
|
3
|
+
import WebKit
|
|
3
4
|
|
|
4
5
|
extension UIColor {
|
|
5
6
|
|
|
@@ -16,6 +17,7 @@ extension UIColor {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
}
|
|
20
|
+
|
|
19
21
|
/**
|
|
20
22
|
* Please read the Capacitor iOS Plugin Development Guide
|
|
21
23
|
* here: https://capacitorjs.com/docs/plugins/ios
|
|
@@ -96,6 +98,7 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
self.webViewController?.source = .remote(url!)
|
|
101
|
+
self.webViewController?.leftNavigaionBarItemTypes = self.getToolbarItems(toolbarType: toolbarType) + [.reload]
|
|
99
102
|
self.webViewController?.leftNavigaionBarItemTypes = self.getToolbarItems(toolbarType: toolbarType)
|
|
100
103
|
self.webViewController?.toolbarItemTypes = []
|
|
101
104
|
self.webViewController?.doneBarButtonItemPosition = .right
|
|
@@ -145,6 +148,11 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
145
148
|
return result
|
|
146
149
|
}
|
|
147
150
|
|
|
151
|
+
@objc func reload(_ call: CAPPluginCall) {
|
|
152
|
+
self.webViewController?.reload()
|
|
153
|
+
call.resolve()
|
|
154
|
+
}
|
|
155
|
+
|
|
148
156
|
@objc func setUrl(_ call: CAPPluginCall) {
|
|
149
157
|
guard let url = call.getString("url") else {
|
|
150
158
|
call.reject("Cannot get new url to set")
|
|
@@ -210,7 +218,7 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
210
218
|
self.navigationWebViewController?.navigationBar.isTranslucent = false
|
|
211
219
|
self.navigationWebViewController?.toolbar.isTranslucent = false
|
|
212
220
|
self.navigationWebViewController?.navigationBar.backgroundColor = .white
|
|
213
|
-
|
|
221
|
+
let inputString: String = call.getString("toolbarColor", "#ffffff")
|
|
214
222
|
var color: UIColor = UIColor(hexString: "#ffffff")
|
|
215
223
|
if self.isHexColorCode(inputString) {
|
|
216
224
|
color = UIColor(hexString: inputString)
|
|
@@ -228,6 +236,7 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
228
236
|
@objc func close(_ call: CAPPluginCall) {
|
|
229
237
|
DispatchQueue.main.async {
|
|
230
238
|
self.navigationWebViewController?.dismiss(animated: true, completion: nil)
|
|
239
|
+
self.notifyListeners("closeEvent", data: ["url": self.webViewController?.url?.absoluteString ?? ""])
|
|
231
240
|
call.resolve()
|
|
232
241
|
}
|
|
233
242
|
}
|
|
@@ -313,11 +313,6 @@ open class WKWebViewController: UIViewController {
|
|
|
313
313
|
rollbackState()
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
override open func didReceiveMemoryWarning() {
|
|
317
|
-
super.didReceiveMemoryWarning()
|
|
318
|
-
// Dispose of any resources that can be recreated.
|
|
319
|
-
}
|
|
320
|
-
|
|
321
316
|
override open func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
|
|
322
317
|
switch keyPath {
|
|
323
318
|
case estimatedProgressKeyPath?:
|
|
@@ -378,6 +373,9 @@ public extension WKWebViewController {
|
|
|
378
373
|
webView?.go(to: firstPageItem)
|
|
379
374
|
}
|
|
380
375
|
}
|
|
376
|
+
func reload() {
|
|
377
|
+
webView?.reload()
|
|
378
|
+
}
|
|
381
379
|
}
|
|
382
380
|
|
|
383
381
|
// MARK: - Fileprivate Methods
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/inappbrowser",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.12",
|
|
4
4
|
"description": "Capacitor plugin in app browser",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@ionic/eslint-config": "^0.3.0",
|
|
54
54
|
"@ionic/prettier-config": "^3.0.0",
|
|
55
55
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
56
|
+
"@types/node": "20",
|
|
56
57
|
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
|
57
58
|
"@typescript-eslint/parser": "^5.59.7",
|
|
58
59
|
"eslint": "^8.41.0",
|