@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 CHANGED
@@ -16,22 +16,37 @@ npx cap sync
16
16
  ```js
17
17
  import { InAppBrowser } from '@capgo/inappbrowser'
18
18
 
19
- InAppBrowser.open("YOUR_URL");
19
+ InAppBrowser.open({ url: "YOUR_URL" });
20
20
  ```
21
21
 
22
+ Web platform is not supported. Use `window.open` instead.
23
+
24
+ ### Camera usage
25
+
26
+ if you need the Camera to work in Android, you need to add the following to your `AndroidManifest.xml` file:
27
+
28
+ ```xml
29
+ <uses-permission android:name="android.permission.CAMERA" />
30
+ ```
31
+
32
+ Then the permission will be asked when the camera is used.
33
+
22
34
  ## API
23
35
 
24
36
  <docgen-index>
25
37
 
26
38
  * [`open(...)`](#open)
27
- * [`clearCookies()`](#clearcookies)
39
+ * [`clearCookies(...)`](#clearcookies)
40
+ * [`getCookies(...)`](#getcookies)
28
41
  * [`close()`](#close)
29
42
  * [`openWebView(...)`](#openwebview)
43
+ * [`executeScript(...)`](#executescript)
30
44
  * [`setUrl(...)`](#seturl)
31
- * [`addListener('urlChangeEvent', ...)`](#addlistenerurlchangeevent)
32
- * [`addListener('closeEvent', ...)`](#addlistenercloseevent)
33
- * [`addListener('confirmBtnClicked', ...)`](#addlistenerconfirmbtnclicked)
45
+ * [`addListener('urlChangeEvent', ...)`](#addlistenerurlchangeevent-)
46
+ * [`addListener('closeEvent', ...)`](#addlistenercloseevent-)
47
+ * [`addListener('confirmBtnClicked', ...)`](#addlistenerconfirmbtnclicked-)
34
48
  * [`removeAllListeners()`](#removealllisteners)
49
+ * [`reload()`](#reload)
35
50
  * [Interfaces](#interfaces)
36
51
  * [Type Aliases](#type-aliases)
37
52
  * [Enums](#enums)
@@ -44,7 +59,7 @@ InAppBrowser.open("YOUR_URL");
44
59
  ### open(...)
45
60
 
46
61
  ```typescript
47
- open(options: OpenOptions) => any
62
+ open(options: OpenOptions) => Promise<any>
48
63
  ```
49
64
 
50
65
  Open url in a new window fullscreen
@@ -53,35 +68,56 @@ Open url in a new window fullscreen
53
68
  | ------------- | --------------------------------------------------- |
54
69
  | **`options`** | <code><a href="#openoptions">OpenOptions</a></code> |
55
70
 
56
- **Returns:** <code>any</code>
71
+ **Returns:** <code>Promise&lt;any&gt;</code>
57
72
 
58
73
  **Since:** 0.1.0
59
74
 
60
75
  --------------------
61
76
 
62
77
 
63
- ### clearCookies()
78
+ ### clearCookies(...)
64
79
 
65
80
  ```typescript
66
- clearCookies() => any
81
+ clearCookies(options: ClearCookieOptions) => Promise<any>
67
82
  ```
68
83
 
69
- Clear all cookies
84
+ Clear cookies of url
70
85
 
71
- **Returns:** <code>any</code>
86
+ | Param | Type |
87
+ | ------------- | ----------------------------------------------------------------- |
88
+ | **`options`** | <code><a href="#clearcookieoptions">ClearCookieOptions</a></code> |
89
+
90
+ **Returns:** <code>Promise&lt;any&gt;</code>
72
91
 
73
92
  **Since:** 0.5.0
74
93
 
75
94
  --------------------
76
95
 
77
96
 
97
+ ### getCookies(...)
98
+
99
+ ```typescript
100
+ getCookies(options: GetCookieOptions) => Promise<Record<string, string>>
101
+ ```
102
+
103
+ Get cookies for a specific URL.
104
+
105
+ | Param | Type | Description |
106
+ | ------------- | ------------------------------------------------------------- | -------------------------------------------------- |
107
+ | **`options`** | <code><a href="#getcookieoptions">GetCookieOptions</a></code> | The options, including the URL to get cookies for. |
108
+
109
+ **Returns:** <code>Promise&lt;<a href="#record">Record</a>&lt;string, string&gt;&gt;</code>
110
+
111
+ --------------------
112
+
113
+
78
114
  ### close()
79
115
 
80
116
  ```typescript
81
- close() => any
117
+ close() => Promise<any>
82
118
  ```
83
119
 
84
- **Returns:** <code>any</code>
120
+ **Returns:** <code>Promise&lt;any&gt;</code>
85
121
 
86
122
  --------------------
87
123
 
@@ -89,7 +125,7 @@ close() => any
89
125
  ### openWebView(...)
90
126
 
91
127
  ```typescript
92
- openWebView(options: OpenWebViewOptions) => any
128
+ openWebView(options: OpenWebViewOptions) => Promise<any>
93
129
  ```
94
130
 
95
131
  Open url in a new webview with toolbars
@@ -98,24 +134,39 @@ Open url in a new webview with toolbars
98
134
  | ------------- | ----------------------------------------------------------------- |
99
135
  | **`options`** | <code><a href="#openwebviewoptions">OpenWebViewOptions</a></code> |
100
136
 
101
- **Returns:** <code>any</code>
137
+ **Returns:** <code>Promise&lt;any&gt;</code>
102
138
 
103
139
  **Since:** 0.1.0
104
140
 
105
141
  --------------------
106
142
 
107
143
 
144
+ ### executeScript(...)
145
+
146
+ ```typescript
147
+ executeScript({ code }: { code: string; }) => Promise<void>
148
+ ```
149
+
150
+ Injects JavaScript code into the InAppBrowser window.
151
+
152
+ | Param | Type |
153
+ | --------- | ------------------------------ |
154
+ | **`__0`** | <code>{ code: string; }</code> |
155
+
156
+ --------------------
157
+
158
+
108
159
  ### setUrl(...)
109
160
 
110
161
  ```typescript
111
- setUrl(options: { url: string; }) => any
162
+ setUrl(options: { url: string; }) => Promise<any>
112
163
  ```
113
164
 
114
165
  | Param | Type |
115
166
  | ------------- | ----------------------------- |
116
167
  | **`options`** | <code>{ url: string; }</code> |
117
168
 
118
- **Returns:** <code>any</code>
169
+ **Returns:** <code>Promise&lt;any&gt;</code>
119
170
 
120
171
  --------------------
121
172
 
@@ -123,17 +174,17 @@ setUrl(options: { url: string; }) => any
123
174
  ### addListener('urlChangeEvent', ...)
124
175
 
125
176
  ```typescript
126
- addListener(eventName: "urlChangeEvent", listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
177
+ addListener(eventName: "urlChangeEvent", listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle>
127
178
  ```
128
179
 
129
- Listen for url change
180
+ Listen for url change, only for openWebView
130
181
 
131
182
  | Param | Type |
132
183
  | ------------------ | --------------------------------------------------------------- |
133
184
  | **`eventName`** | <code>'urlChangeEvent'</code> |
134
185
  | **`listenerFunc`** | <code><a href="#urlchangelistener">UrlChangeListener</a></code> |
135
186
 
136
- **Returns:** <code>any</code>
187
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
137
188
 
138
189
  **Since:** 0.0.1
139
190
 
@@ -143,17 +194,17 @@ Listen for url change
143
194
  ### addListener('closeEvent', ...)
144
195
 
145
196
  ```typescript
146
- addListener(eventName: "closeEvent", listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
197
+ addListener(eventName: "closeEvent", listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle>
147
198
  ```
148
199
 
149
- Listen for close click
200
+ Listen for close click only for openWebView
150
201
 
151
202
  | Param | Type |
152
203
  | ------------------ | --------------------------------------------------------------- |
153
204
  | **`eventName`** | <code>'closeEvent'</code> |
154
205
  | **`listenerFunc`** | <code><a href="#urlchangelistener">UrlChangeListener</a></code> |
155
206
 
156
- **Returns:** <code>any</code>
207
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
157
208
 
158
209
  **Since:** 0.4.0
159
210
 
@@ -163,7 +214,7 @@ Listen for close click
163
214
  ### addListener('confirmBtnClicked', ...)
164
215
 
165
216
  ```typescript
166
- addListener(eventName: "confirmBtnClicked", listenerFunc: ConfirmBtnListener) => Promise<PluginListenerHandle> & PluginListenerHandle
217
+ addListener(eventName: "confirmBtnClicked", listenerFunc: ConfirmBtnListener) => Promise<PluginListenerHandle>
167
218
  ```
168
219
 
169
220
  Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS
@@ -173,7 +224,7 @@ Will be triggered when user clicks on confirm button when disclaimer is required
173
224
  | **`eventName`** | <code>'confirmBtnClicked'</code> |
174
225
  | **`listenerFunc`** | <code><a href="#confirmbtnlistener">ConfirmBtnListener</a></code> |
175
226
 
176
- **Returns:** <code>any</code>
227
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
177
228
 
178
229
  **Since:** 0.0.1
179
230
 
@@ -183,12 +234,25 @@ Will be triggered when user clicks on confirm button when disclaimer is required
183
234
  ### removeAllListeners()
184
235
 
185
236
  ```typescript
186
- removeAllListeners() => any
237
+ removeAllListeners() => Promise<void>
187
238
  ```
188
239
 
189
240
  Remove all listeners for this plugin.
190
241
 
191
- **Returns:** <code>any</code>
242
+ **Since:** 1.0.0
243
+
244
+ --------------------
245
+
246
+
247
+ ### reload()
248
+
249
+ ```typescript
250
+ reload() => Promise<any>
251
+ ```
252
+
253
+ Reload the current web page.
254
+
255
+ **Returns:** <code>Promise&lt;any&gt;</code>
192
256
 
193
257
  **Since:** 1.0.0
194
258
 
@@ -211,18 +275,56 @@ Remove all listeners for this plugin.
211
275
  #### Headers
212
276
 
213
277
 
278
+ #### ClearCookieOptions
279
+
280
+ | Prop | Type |
281
+ | ----------- | -------------------- |
282
+ | **`url`** | <code>string</code> |
283
+ | **`cache`** | <code>boolean</code> |
284
+
285
+
286
+ #### HttpCookie
287
+
288
+ | Prop | Type | Description |
289
+ | ----------- | ------------------- | ------------------------ |
290
+ | **`url`** | <code>string</code> | The URL of the cookie. |
291
+ | **`key`** | <code>string</code> | The key of the cookie. |
292
+ | **`value`** | <code>string</code> | The value of the cookie. |
293
+
294
+
295
+ #### GetCookieOptions
296
+
297
+ | Prop | Type |
298
+ | --------------------- | -------------------- |
299
+ | **`url`** | <code>string</code> |
300
+ | **`includeHttpOnly`** | <code>boolean</code> |
301
+
302
+
214
303
  #### OpenWebViewOptions
215
304
 
216
- | Prop | Type | Description | Default | Since |
217
- | ---------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | ----- |
218
- | **`url`** | <code>string</code> | Target URL to load. | | 0.1.0 |
219
- | **`headers`** | <code><a href="#headers">Headers</a></code> | <a href="#headers">Headers</a> to send with the request. | | 0.1.0 |
220
- | **`shareDisclaimer`** | <code><a href="#disclaimeroptions">DisclaimerOptions</a></code> | share options | | 0.1.0 |
221
- | **`toolbarType`** | <code><a href="#toolbartype">ToolBarType</a></code> | Toolbar type | <code>ToolBarType.DEFAULT</code> | 0.1.0 |
222
- | **`shareSubject`** | <code>string</code> | Share subject | | 0.1.0 |
223
- | **`title`** | <code>string</code> | Title of the browser | <code>'New Window'</code> | 0.1.0 |
224
- | **`backgroundColor`** | <code><a href="#backgroundcolor">BackgroundColor</a></code> | Background color of the browser, only on IOS | <code>BackgroundColor.BLACK</code> | 0.1.0 |
225
- | **`isPresentAfterPageLoad`** | <code>boolean</code> | Open url in a new window fullscreen isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately. | <code>false</code> | 0.1.0 |
305
+ | Prop | Type | Description | Default | Since |
306
+ | -------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | ------ |
307
+ | **`url`** | <code>string</code> | Target URL to load. | | 0.1.0 |
308
+ | **`headers`** | <code><a href="#headers">Headers</a></code> | <a href="#headers">Headers</a> to send with the request. | | 0.1.0 |
309
+ | **`shareDisclaimer`** | <code><a href="#disclaimeroptions">DisclaimerOptions</a></code> | share options | | 0.1.0 |
310
+ | **`toolbarType`** | <code><a href="#toolbartype">ToolBarType</a></code> | Toolbar type | <code>ToolBarType.DEFAULT</code> | 0.1.0 |
311
+ | **`shareSubject`** | <code>string</code> | Share subject | | 0.1.0 |
312
+ | **`title`** | <code>string</code> | Title of the browser | <code>'New Window'</code> | 0.1.0 |
313
+ | **`backgroundColor`** | <code><a href="#backgroundcolor">BackgroundColor</a></code> | Background color of the browser, only on IOS | <code>BackgroundColor.BLACK</code> | 0.1.0 |
314
+ | **`activeNativeNavigationForWebview`** | <code>boolean</code> | If true, active the native navigation within the webview, Android only | <code>false</code> | |
315
+ | **`disableGoBackOnNativeApplication`** | <code>boolean</code> | Disable the possibility to go back on native application, usefull to force user to stay on the webview, Android only | <code>false</code> | |
316
+ | **`isPresentAfterPageLoad`** | <code>boolean</code> | Open url in a new window fullscreen isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately. | <code>false</code> | 0.1.0 |
317
+ | **`isInspectable`** | <code>boolean</code> | Whether the website in the webview is inspectable or not, ios only | <code>false</code> | |
318
+ | **`isAnimated`** | <code>boolean</code> | Whether the webview opening is animated or not, ios only | <code>true</code> | |
319
+ | **`showReloadButton`** | <code>boolean</code> | Shows a reload button that reloads the web page | <code>false</code> | 1.0.15 |
320
+ | **`closeModal`** | <code>boolean</code> | CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately. | <code>false</code> | 1.1.0 |
321
+ | **`closeModalTitle`** | <code>string</code> | CloseModalTitle: title of the confirm when user clicks on close button, only on IOS | <code>'Close'</code> | 1.1.0 |
322
+ | **`closeModalDescription`** | <code>string</code> | CloseModalDescription: description of the confirm when user clicks on close button, only on IOS | <code>'Are you sure you want to close this window?'</code> | 1.1.0 |
323
+ | **`closeModalOk`** | <code>string</code> | CloseModalOk: text of the confirm button when user clicks on close button, only on IOS | <code>'Close'</code> | 1.1.0 |
324
+ | **`closeModalCancel`** | <code>string</code> | CloseModalCancel: text of the cancel button when user clicks on close button, only on IOS | <code>'Cancel'</code> | 1.1.0 |
325
+ | **`visibleTitle`** | <code>boolean</code> | visibleTitle: if true the website title would be shown else shown empty | <code>true</code> | 1.2.5 |
326
+ | **`toolbarColor`** | <code>string</code> | toolbarColor: color of the toolbar in hex format | <code>'#ffffff''</code> | 1.2.5 |
327
+ | **`showArrow`** | <code>boolean</code> | showArrow: if true an arrow would be shown instead of cross for closing the window | <code>false</code> | 1.2.5 |
226
328
 
227
329
 
228
330
  #### DisclaimerOptions
@@ -235,6 +337,13 @@ Remove all listeners for this plugin.
235
337
  | **`cancelBtn`** | <code>string</code> |
236
338
 
237
339
 
340
+ #### PluginListenerHandle
341
+
342
+ | Prop | Type |
343
+ | ------------ | ----------------------------------------- |
344
+ | **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
345
+
346
+
238
347
  #### UrlEvent
239
348
 
240
349
  | Prop | Type | Description | Since |
@@ -242,13 +351,6 @@ Remove all listeners for this plugin.
242
351
  | **`url`** | <code>string</code> | Emit when the url changes | 0.0.1 |
243
352
 
244
353
 
245
- #### PluginListenerHandle
246
-
247
- | Prop | Type |
248
- | ------------ | ------------------------- |
249
- | **`remove`** | <code>() =&gt; any</code> |
250
-
251
-
252
354
  #### BtnEvent
253
355
 
254
356
  | Prop | Type | Description | Since |
@@ -259,6 +361,44 @@ Remove all listeners for this plugin.
259
361
  ### Type Aliases
260
362
 
261
363
 
364
+ #### ClearCookieOptions
365
+
366
+ <code><a href="#omit">Omit</a>&lt;<a href="#httpcookie">HttpCookie</a>, 'key' | 'value'&gt;</code>
367
+
368
+
369
+ #### Omit
370
+
371
+ Construct a type with the properties of T except for those in type K.
372
+
373
+ <code><a href="#pick">Pick</a>&lt;T, <a href="#exclude">Exclude</a>&lt;keyof T, K&gt;&gt;</code>
374
+
375
+
376
+ #### Pick
377
+
378
+ From T, pick a set of properties whose keys are in the union K
379
+
380
+ <code>{
262
381
  [P in K]: T[P];
263
382
  }</code>
383
+
384
+
385
+ #### Exclude
386
+
387
+ <a href="#exclude">Exclude</a> from T those types that are assignable to U
388
+
389
+ <code>T extends U ? never : T</code>
390
+
391
+
392
+ #### Record
393
+
394
+ Construct a type with a set of properties K of type T
395
+
396
+ <code>{
264
397
  [P in K]: T;
265
398
  }</code>
399
+
400
+
401
+ #### GetCookieOptions
402
+
403
+ <code><a href="#omit">Omit</a>&lt;<a href="#httpcookie">HttpCookie</a>, 'key' | 'value'&gt;</code>
404
+
405
+
266
406
  #### UrlChangeListener
267
407
 
268
408
  <code>(state: <a href="#urlevent">UrlEvent</a>): void</code>
@@ -3,6 +3,7 @@ ext {
3
3
  androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4
4
  androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
5
5
  androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
6
+ androidxBrowserVersion = project.hasProperty('androidxBrowserVersion') ? rootProject.ext.androidxBrowserVersion : '1.7.0'
6
7
  }
7
8
 
8
9
  buildscript {
@@ -11,7 +12,7 @@ buildscript {
11
12
  mavenCentral()
12
13
  }
13
14
  dependencies {
14
- classpath 'com.android.tools.build:gradle:8.0.1'
15
+ classpath 'com.android.tools.build:gradle:8.2.1'
15
16
  }
16
17
  }
17
18
 
@@ -19,10 +20,10 @@ apply plugin: 'com.android.library'
19
20
 
20
21
  android {
21
22
  namespace "ee.forgr.capacitor_inappbrowser"
22
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
23
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
23
24
  defaultConfig {
24
25
  minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
25
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
26
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
26
27
  versionCode 1
27
28
  versionName "1.0"
28
29
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -55,9 +56,8 @@ dependencies {
55
56
  testImplementation "junit:junit:$junitVersion"
56
57
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
57
58
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
58
- implementation 'androidx.browser:browser:1.0.0'
59
+ implementation "androidx.browser:browser:$androidxBrowserVersion"
59
60
  implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
60
- implementation 'com.google.android.material:material:1.0.0'
61
- implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
62
61
  implementation 'com.google.android.material:material:1.9.0'
62
+ implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
63
63
  }