@capgo/inappbrowser 1.2.18 → 1.2.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 +98 -4
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +113 -22
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +70 -1
- package/dist/docs.json +196 -4
- package/dist/esm/definitions.d.ts +15 -2
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -2
- package/dist/esm/web.js +6 -2
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +6 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +6 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/InAppBrowserPlugin.m +1 -0
- package/ios/Plugin/InAppBrowserPlugin.swift +40 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,12 +19,23 @@ import { InAppBrowser } from '@capgo/inappbrowser'
|
|
|
19
19
|
InAppBrowser.open({ url: "YOUR_URL" });
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
### Camera usage
|
|
23
|
+
|
|
24
|
+
if you need the Camera to work in Android, you need to add the following to your `AndroidManifest.xml` file:
|
|
25
|
+
|
|
26
|
+
```xml
|
|
27
|
+
<uses-permission android:name="android.permission.CAMERA" />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Then the permission will be asked when the camera is used.
|
|
31
|
+
|
|
22
32
|
## API
|
|
23
33
|
|
|
24
34
|
<docgen-index>
|
|
25
35
|
|
|
26
36
|
* [`open(...)`](#open)
|
|
27
|
-
* [`clearCookies()`](#clearcookies)
|
|
37
|
+
* [`clearCookies(...)`](#clearcookies)
|
|
38
|
+
* [`getCookies(...)`](#getcookies)
|
|
28
39
|
* [`close()`](#close)
|
|
29
40
|
* [`openWebView(...)`](#openwebview)
|
|
30
41
|
* [`setUrl(...)`](#seturl)
|
|
@@ -61,13 +72,17 @@ Open url in a new window fullscreen
|
|
|
61
72
|
--------------------
|
|
62
73
|
|
|
63
74
|
|
|
64
|
-
### clearCookies()
|
|
75
|
+
### clearCookies(...)
|
|
65
76
|
|
|
66
77
|
```typescript
|
|
67
|
-
clearCookies() => Promise<any>
|
|
78
|
+
clearCookies(options: ClearCookieOptions) => Promise<any>
|
|
68
79
|
```
|
|
69
80
|
|
|
70
|
-
Clear
|
|
81
|
+
Clear cookies of url
|
|
82
|
+
|
|
83
|
+
| Param | Type |
|
|
84
|
+
| ------------- | ----------------------------------------------------------------- |
|
|
85
|
+
| **`options`** | <code><a href="#clearcookieoptions">ClearCookieOptions</a></code> |
|
|
71
86
|
|
|
72
87
|
**Returns:** <code>Promise<any></code>
|
|
73
88
|
|
|
@@ -76,6 +91,23 @@ Clear all cookies
|
|
|
76
91
|
--------------------
|
|
77
92
|
|
|
78
93
|
|
|
94
|
+
### getCookies(...)
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
getCookies(options: GetCookieOptions) => Promise<Record<string, string>>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Get cookies for a specific URL.
|
|
101
|
+
|
|
102
|
+
| Param | Type | Description |
|
|
103
|
+
| ------------- | ------------------------------------------------------------- | -------------------------------------------------- |
|
|
104
|
+
| **`options`** | <code><a href="#getcookieoptions">GetCookieOptions</a></code> | The options, including the URL to get cookies for. |
|
|
105
|
+
|
|
106
|
+
**Returns:** <code>Promise<<a href="#record">Record</a><string, string>></code>
|
|
107
|
+
|
|
108
|
+
--------------------
|
|
109
|
+
|
|
110
|
+
|
|
79
111
|
### close()
|
|
80
112
|
|
|
81
113
|
```typescript
|
|
@@ -225,6 +257,30 @@ Reload the current web page.
|
|
|
225
257
|
#### Headers
|
|
226
258
|
|
|
227
259
|
|
|
260
|
+
#### ClearCookieOptions
|
|
261
|
+
|
|
262
|
+
| Prop | Type |
|
|
263
|
+
| --------- | ------------------- |
|
|
264
|
+
| **`url`** | <code>string</code> |
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
#### HttpCookie
|
|
268
|
+
|
|
269
|
+
| Prop | Type |
|
|
270
|
+
| ----------- | ------------------- |
|
|
271
|
+
| **`url`** | <code>string</code> |
|
|
272
|
+
| **`key`** | <code>string</code> |
|
|
273
|
+
| **`value`** | <code>string</code> |
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
#### GetCookieOptions
|
|
277
|
+
|
|
278
|
+
| Prop | Type |
|
|
279
|
+
| --------------------- | -------------------- |
|
|
280
|
+
| **`url`** | <code>string</code> |
|
|
281
|
+
| **`includeHttpOnly`** | <code>boolean</code> |
|
|
282
|
+
|
|
283
|
+
|
|
228
284
|
#### OpenWebViewOptions
|
|
229
285
|
|
|
230
286
|
| Prop | Type | Description | Default | Since |
|
|
@@ -282,6 +338,44 @@ Reload the current web page.
|
|
|
282
338
|
### Type Aliases
|
|
283
339
|
|
|
284
340
|
|
|
341
|
+
#### ClearCookieOptions
|
|
342
|
+
|
|
343
|
+
<code><a href="#omit">Omit</a><<a href="#httpcookie">HttpCookie</a>, 'key' | 'value'></code>
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
#### Omit
|
|
347
|
+
|
|
348
|
+
Construct a type with the properties of T except for those in type K.
|
|
349
|
+
|
|
350
|
+
<code><a href="#pick">Pick</a><T, <a href="#exclude">Exclude</a><keyof T, K>></code>
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
#### Pick
|
|
354
|
+
|
|
355
|
+
From T, pick a set of properties whose keys are in the union K
|
|
356
|
+
|
|
357
|
+
<code>{
|
|
285
358
|
[P in K]: T[P];
|
|
286
359
|
}</code>
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
#### Exclude
|
|
363
|
+
|
|
364
|
+
<a href="#exclude">Exclude</a> from T those types that are assignable to U
|
|
365
|
+
|
|
366
|
+
<code>T extends U ? never : T</code>
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
#### Record
|
|
370
|
+
|
|
371
|
+
Construct a type with a set of properties K of type T
|
|
372
|
+
|
|
373
|
+
<code>{
|
|
287
374
|
[P in K]: T;
|
|
288
375
|
}</code>
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
#### GetCookieOptions
|
|
379
|
+
|
|
380
|
+
<code><a href="#omit">Omit</a><<a href="#httpcookie">HttpCookie</a>, 'key' | 'value'></code>
|
|
381
|
+
|
|
382
|
+
|
|
289
383
|
#### UrlChangeListener
|
|
290
384
|
|
|
291
385
|
<code>(state: <a href="#urlevent">UrlEvent</a>): void</code>
|
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
package ee.forgr.capacitor_inappbrowser;
|
|
2
2
|
|
|
3
|
+
import android.Manifest;
|
|
3
4
|
import android.content.ComponentName;
|
|
4
5
|
import android.content.Intent;
|
|
5
6
|
import android.content.pm.PackageManager;
|
|
6
7
|
import android.content.pm.ResolveInfo;
|
|
7
|
-
import android.graphics.Color;
|
|
8
8
|
import android.net.Uri;
|
|
9
9
|
import android.os.Bundle;
|
|
10
10
|
import android.text.TextUtils;
|
|
11
11
|
import android.util.Log;
|
|
12
12
|
import android.webkit.CookieManager;
|
|
13
|
-
import android.webkit.
|
|
13
|
+
import android.webkit.PermissionRequest;
|
|
14
14
|
import androidx.browser.customtabs.CustomTabsCallback;
|
|
15
15
|
import androidx.browser.customtabs.CustomTabsClient;
|
|
16
16
|
import androidx.browser.customtabs.CustomTabsIntent;
|
|
17
17
|
import androidx.browser.customtabs.CustomTabsServiceConnection;
|
|
18
18
|
import androidx.browser.customtabs.CustomTabsSession;
|
|
19
19
|
import com.getcapacitor.JSObject;
|
|
20
|
+
import com.getcapacitor.PermissionState;
|
|
20
21
|
import com.getcapacitor.Plugin;
|
|
21
22
|
import com.getcapacitor.PluginCall;
|
|
22
23
|
import com.getcapacitor.PluginMethod;
|
|
23
24
|
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
25
|
+
import com.getcapacitor.annotation.Permission;
|
|
26
|
+
import com.getcapacitor.annotation.PermissionCallback;
|
|
24
27
|
import java.util.Iterator;
|
|
25
28
|
|
|
26
|
-
@CapacitorPlugin(
|
|
27
|
-
|
|
29
|
+
@CapacitorPlugin(
|
|
30
|
+
name = "InAppBrowser",
|
|
31
|
+
permissions = {
|
|
32
|
+
@Permission(alias = "camera", strings = { Manifest.permission.CAMERA }),
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
public class InAppBrowserPlugin
|
|
36
|
+
extends Plugin
|
|
37
|
+
implements WebViewDialog.PermissionHandler {
|
|
28
38
|
|
|
29
39
|
public static final String CUSTOM_TAB_PACKAGE_NAME = "com.android.chrome"; // Change when in stable
|
|
30
40
|
private CustomTabsClient customTabsClient;
|
|
@@ -32,6 +42,39 @@ public class InAppBrowserPlugin extends Plugin {
|
|
|
32
42
|
private WebViewDialog webViewDialog = null;
|
|
33
43
|
private String currentUrl = "";
|
|
34
44
|
|
|
45
|
+
private PermissionRequest currentPermissionRequest;
|
|
46
|
+
|
|
47
|
+
public void handleCameraPermissionRequest(PermissionRequest request) {
|
|
48
|
+
this.currentPermissionRequest = request;
|
|
49
|
+
if (getPermissionState("camera") != PermissionState.GRANTED) {
|
|
50
|
+
requestPermissionForAlias("camera", null, "cameraPermissionCallback");
|
|
51
|
+
} else {
|
|
52
|
+
grantCameraPermission();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@PermissionCallback
|
|
57
|
+
private void cameraPermissionCallback() {
|
|
58
|
+
if (getPermissionState("camera") == PermissionState.GRANTED) {
|
|
59
|
+
grantCameraPermission();
|
|
60
|
+
} else {
|
|
61
|
+
if (currentPermissionRequest != null) {
|
|
62
|
+
currentPermissionRequest.deny();
|
|
63
|
+
currentPermissionRequest = null;
|
|
64
|
+
}
|
|
65
|
+
// Handle the case where permission was not granted
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private void grantCameraPermission() {
|
|
70
|
+
if (currentPermissionRequest != null) {
|
|
71
|
+
currentPermissionRequest.grant(
|
|
72
|
+
new String[] { PermissionRequest.RESOURCE_VIDEO_CAPTURE }
|
|
73
|
+
);
|
|
74
|
+
currentPermissionRequest = null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
35
78
|
CustomTabsServiceConnection connection = new CustomTabsServiceConnection() {
|
|
36
79
|
@Override
|
|
37
80
|
public void onCustomTabsServiceConnected(
|
|
@@ -46,6 +89,33 @@ public class InAppBrowserPlugin extends Plugin {
|
|
|
46
89
|
public void onServiceDisconnected(ComponentName name) {}
|
|
47
90
|
};
|
|
48
91
|
|
|
92
|
+
@PluginMethod
|
|
93
|
+
public void requestCameraPermission(PluginCall call) {
|
|
94
|
+
if (getPermissionState("camera") != PermissionState.GRANTED) {
|
|
95
|
+
requestPermissionForAlias("camera", call, "cameraPermissionCallback");
|
|
96
|
+
} else {
|
|
97
|
+
call.resolve();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@PermissionCallback
|
|
102
|
+
private void cameraPermissionCallback(PluginCall call) {
|
|
103
|
+
if (getPermissionState("camera") == PermissionState.GRANTED) {
|
|
104
|
+
// Permission granted, notify the WebView to proceed
|
|
105
|
+
if (
|
|
106
|
+
webViewDialog != null && webViewDialog.currentPermissionRequest != null
|
|
107
|
+
) {
|
|
108
|
+
webViewDialog.currentPermissionRequest.grant(
|
|
109
|
+
new String[] { PermissionRequest.RESOURCE_VIDEO_CAPTURE }
|
|
110
|
+
);
|
|
111
|
+
webViewDialog.currentPermissionRequest = null;
|
|
112
|
+
}
|
|
113
|
+
call.resolve();
|
|
114
|
+
} else {
|
|
115
|
+
call.reject("Camera permission is required");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
49
119
|
@PluginMethod
|
|
50
120
|
public void setUrl(PluginCall call) {
|
|
51
121
|
String url = call.getString("url");
|
|
@@ -117,27 +187,46 @@ public class InAppBrowserPlugin extends Plugin {
|
|
|
117
187
|
|
|
118
188
|
@PluginMethod
|
|
119
189
|
public void clearCookies(PluginCall call) {
|
|
120
|
-
|
|
121
|
-
|
|
190
|
+
String url = call.getString("url");
|
|
191
|
+
if (url == null || TextUtils.isEmpty(url)) {
|
|
192
|
+
call.reject("Invalid URL");
|
|
193
|
+
} else {
|
|
194
|
+
CookieManager cookieManager = CookieManager.getInstance();
|
|
195
|
+
String cookie = cookieManager.getCookie(url);
|
|
196
|
+
if (cookie != null) {
|
|
197
|
+
String[] cookies = cookie.split(";");
|
|
198
|
+
for (String c : cookies) {
|
|
199
|
+
String cookieName = c.substring(0, c.indexOf("="));
|
|
200
|
+
cookieManager.setCookie(
|
|
201
|
+
url,
|
|
202
|
+
cookieName + "=; Expires=Thu, 01 Jan 1970 00:00:01 GMT"
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
call.resolve();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@PluginMethod
|
|
211
|
+
public void getCookies(PluginCall call) {
|
|
212
|
+
String url = call.getString("url");
|
|
213
|
+
if (url == null || TextUtils.isEmpty(url)) {
|
|
214
|
+
call.reject("Invalid URL");
|
|
122
215
|
} else {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
String cookie
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
String cookieName = c.substring(0, c.indexOf("="));
|
|
133
|
-
cookieManager.setCookie(
|
|
134
|
-
url,
|
|
135
|
-
cookieName + "=; Expires=Thu, 01 Jan 1970 00:00:01 GMT"
|
|
136
|
-
);
|
|
216
|
+
CookieManager cookieManager = CookieManager.getInstance();
|
|
217
|
+
String cookieString = cookieManager.getCookie(url);
|
|
218
|
+
if (cookieString != null) {
|
|
219
|
+
String[] cookiePairs = cookieString.split("; ");
|
|
220
|
+
JSObject result = new JSObject();
|
|
221
|
+
for (String cookie : cookiePairs) {
|
|
222
|
+
String[] parts = cookie.split("=", 2);
|
|
223
|
+
if (parts.length == 2) {
|
|
224
|
+
result.put(parts[0], parts[1]);
|
|
137
225
|
}
|
|
138
226
|
}
|
|
139
|
-
call.resolve();
|
|
227
|
+
call.resolve(result);
|
|
140
228
|
}
|
|
229
|
+
call.resolve(new JSObject());
|
|
141
230
|
}
|
|
142
231
|
}
|
|
143
232
|
|
|
@@ -211,9 +300,11 @@ public class InAppBrowserPlugin extends Plugin {
|
|
|
211
300
|
new WebViewDialog(
|
|
212
301
|
getContext(),
|
|
213
302
|
android.R.style.Theme_NoTitleBar,
|
|
214
|
-
options
|
|
303
|
+
options,
|
|
304
|
+
InAppBrowserPlugin.this
|
|
215
305
|
);
|
|
216
306
|
webViewDialog.presentWebView();
|
|
307
|
+
webViewDialog.activity = InAppBrowserPlugin.this.getActivity();
|
|
217
308
|
}
|
|
218
309
|
}
|
|
219
310
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package ee.forgr.capacitor_inappbrowser;
|
|
2
2
|
|
|
3
|
+
import android.app.Activity;
|
|
3
4
|
import android.app.AlertDialog;
|
|
4
5
|
import android.app.Dialog;
|
|
5
6
|
import android.content.Context;
|
|
@@ -7,15 +8,19 @@ import android.content.DialogInterface;
|
|
|
7
8
|
import android.graphics.Bitmap;
|
|
8
9
|
import android.graphics.Color;
|
|
9
10
|
import android.text.TextUtils;
|
|
11
|
+
import android.util.Log;
|
|
10
12
|
import android.view.View;
|
|
11
13
|
import android.view.Window;
|
|
12
14
|
import android.view.WindowManager;
|
|
15
|
+
import android.webkit.PermissionRequest;
|
|
16
|
+
import android.webkit.WebChromeClient;
|
|
13
17
|
import android.webkit.WebResourceError;
|
|
14
18
|
import android.webkit.WebResourceRequest;
|
|
15
19
|
import android.webkit.WebView;
|
|
16
20
|
import android.webkit.WebViewClient;
|
|
17
21
|
import android.widget.ImageButton;
|
|
18
22
|
import android.widget.TextView;
|
|
23
|
+
import android.widget.Toast;
|
|
19
24
|
import android.widget.Toolbar;
|
|
20
25
|
import java.net.URI;
|
|
21
26
|
import java.net.URISyntaxException;
|
|
@@ -29,12 +34,27 @@ public class WebViewDialog extends Dialog {
|
|
|
29
34
|
private Toolbar _toolbar;
|
|
30
35
|
private Options _options;
|
|
31
36
|
private Context _context;
|
|
37
|
+
public Activity activity;
|
|
32
38
|
private boolean isInitialized = false;
|
|
33
39
|
|
|
34
|
-
public
|
|
40
|
+
public PermissionRequest currentPermissionRequest;
|
|
41
|
+
|
|
42
|
+
public interface PermissionHandler {
|
|
43
|
+
void handleCameraPermissionRequest(PermissionRequest request);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private PermissionHandler permissionHandler;
|
|
47
|
+
|
|
48
|
+
public WebViewDialog(
|
|
49
|
+
Context context,
|
|
50
|
+
int theme,
|
|
51
|
+
Options options,
|
|
52
|
+
PermissionHandler permissionHandler
|
|
53
|
+
) {
|
|
35
54
|
super(context, theme);
|
|
36
55
|
this._options = options;
|
|
37
56
|
this._context = context;
|
|
57
|
+
this.permissionHandler = permissionHandler;
|
|
38
58
|
this.isInitialized = false;
|
|
39
59
|
}
|
|
40
60
|
|
|
@@ -65,6 +85,55 @@ public class WebViewDialog extends Dialog {
|
|
|
65
85
|
.setPluginState(android.webkit.WebSettings.PluginState.ON);
|
|
66
86
|
_webView.getSettings().setLoadWithOverviewMode(true);
|
|
67
87
|
_webView.getSettings().setUseWideViewPort(true);
|
|
88
|
+
_webView.getSettings().setAllowFileAccessFromFileURLs(true);
|
|
89
|
+
_webView.getSettings().setAllowUniversalAccessFromFileURLs(true);
|
|
90
|
+
|
|
91
|
+
_webView.setWebViewClient(new WebViewClient());
|
|
92
|
+
|
|
93
|
+
_webView.setWebChromeClient(
|
|
94
|
+
new WebChromeClient() {
|
|
95
|
+
// Grant permissions for cam
|
|
96
|
+
|
|
97
|
+
@Override
|
|
98
|
+
public void onPermissionRequest(final PermissionRequest request) {
|
|
99
|
+
Log.i(
|
|
100
|
+
"INAPPBROWSER",
|
|
101
|
+
"onPermissionRequest " + request.getResources().toString()
|
|
102
|
+
);
|
|
103
|
+
final String[] requestedResources = request.getResources();
|
|
104
|
+
for (String r : requestedResources) {
|
|
105
|
+
Log.i("INAPPBROWSER", "requestedResources " + r);
|
|
106
|
+
if (r.equals(PermissionRequest.RESOURCE_VIDEO_CAPTURE)) {
|
|
107
|
+
Log.i("INAPPBROWSER", "RESOURCE_VIDEO_CAPTURE req");
|
|
108
|
+
// Store the permission request
|
|
109
|
+
currentPermissionRequest = request;
|
|
110
|
+
// Initiate the permission request through the plugin
|
|
111
|
+
if (permissionHandler != null) {
|
|
112
|
+
permissionHandler.handleCameraPermissionRequest(request);
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@Override
|
|
120
|
+
public void onPermissionRequestCanceled(PermissionRequest request) {
|
|
121
|
+
super.onPermissionRequestCanceled(request);
|
|
122
|
+
Toast
|
|
123
|
+
.makeText(
|
|
124
|
+
WebViewDialog.this.activity,
|
|
125
|
+
"Permission Denied",
|
|
126
|
+
Toast.LENGTH_SHORT
|
|
127
|
+
)
|
|
128
|
+
.show();
|
|
129
|
+
// Handle the denied permission
|
|
130
|
+
if (currentPermissionRequest != null) {
|
|
131
|
+
currentPermissionRequest.deny();
|
|
132
|
+
currentPermissionRequest = null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
);
|
|
68
137
|
|
|
69
138
|
Map<String, String> requestHeaders = new HashMap<>();
|
|
70
139
|
if (_options.getHeaders() != null) {
|
package/dist/docs.json
CHANGED
|
@@ -30,8 +30,14 @@
|
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"name": "clearCookies",
|
|
33
|
-
"signature": "() => Promise<any>",
|
|
34
|
-
"parameters": [
|
|
33
|
+
"signature": "(options: ClearCookieOptions) => Promise<any>",
|
|
34
|
+
"parameters": [
|
|
35
|
+
{
|
|
36
|
+
"name": "options",
|
|
37
|
+
"docs": "",
|
|
38
|
+
"type": "ClearCookieOptions"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
35
41
|
"returns": "Promise<any>",
|
|
36
42
|
"tags": [
|
|
37
43
|
{
|
|
@@ -39,10 +45,40 @@
|
|
|
39
45
|
"text": "0.5.0"
|
|
40
46
|
}
|
|
41
47
|
],
|
|
42
|
-
"docs": "Clear
|
|
43
|
-
"complexTypes": [
|
|
48
|
+
"docs": "Clear cookies of url",
|
|
49
|
+
"complexTypes": [
|
|
50
|
+
"ClearCookieOptions"
|
|
51
|
+
],
|
|
44
52
|
"slug": "clearcookies"
|
|
45
53
|
},
|
|
54
|
+
{
|
|
55
|
+
"name": "getCookies",
|
|
56
|
+
"signature": "(options: GetCookieOptions) => Promise<Record<string, string>>",
|
|
57
|
+
"parameters": [
|
|
58
|
+
{
|
|
59
|
+
"name": "options",
|
|
60
|
+
"docs": "The options, including the URL to get cookies for.",
|
|
61
|
+
"type": "GetCookieOptions"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"returns": "Promise<Record<string, string>>",
|
|
65
|
+
"tags": [
|
|
66
|
+
{
|
|
67
|
+
"name": "param",
|
|
68
|
+
"text": "options The options, including the URL to get cookies for."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "returns",
|
|
72
|
+
"text": "A promise that resolves with the cookies."
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"docs": "Get cookies for a specific URL.",
|
|
76
|
+
"complexTypes": [
|
|
77
|
+
"Record",
|
|
78
|
+
"GetCookieOptions"
|
|
79
|
+
],
|
|
80
|
+
"slug": "getcookies"
|
|
81
|
+
},
|
|
46
82
|
{
|
|
47
83
|
"name": "close",
|
|
48
84
|
"signature": "() => Promise<any>",
|
|
@@ -275,6 +311,75 @@
|
|
|
275
311
|
"methods": [],
|
|
276
312
|
"properties": []
|
|
277
313
|
},
|
|
314
|
+
{
|
|
315
|
+
"name": "ClearCookieOptions",
|
|
316
|
+
"slug": "clearcookieoptions",
|
|
317
|
+
"docs": "",
|
|
318
|
+
"tags": [],
|
|
319
|
+
"methods": [],
|
|
320
|
+
"properties": [
|
|
321
|
+
{
|
|
322
|
+
"name": "url",
|
|
323
|
+
"tags": [],
|
|
324
|
+
"docs": "",
|
|
325
|
+
"complexTypes": [],
|
|
326
|
+
"type": "string"
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"name": "HttpCookie",
|
|
332
|
+
"slug": "httpcookie",
|
|
333
|
+
"docs": "",
|
|
334
|
+
"tags": [],
|
|
335
|
+
"methods": [],
|
|
336
|
+
"properties": [
|
|
337
|
+
{
|
|
338
|
+
"name": "url",
|
|
339
|
+
"tags": [],
|
|
340
|
+
"docs": "",
|
|
341
|
+
"complexTypes": [],
|
|
342
|
+
"type": "string | undefined"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"name": "key",
|
|
346
|
+
"tags": [],
|
|
347
|
+
"docs": "",
|
|
348
|
+
"complexTypes": [],
|
|
349
|
+
"type": "string"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"name": "value",
|
|
353
|
+
"tags": [],
|
|
354
|
+
"docs": "",
|
|
355
|
+
"complexTypes": [],
|
|
356
|
+
"type": "string"
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"name": "GetCookieOptions",
|
|
362
|
+
"slug": "getcookieoptions",
|
|
363
|
+
"docs": "",
|
|
364
|
+
"tags": [],
|
|
365
|
+
"methods": [],
|
|
366
|
+
"properties": [
|
|
367
|
+
{
|
|
368
|
+
"name": "url",
|
|
369
|
+
"tags": [],
|
|
370
|
+
"docs": "",
|
|
371
|
+
"complexTypes": [],
|
|
372
|
+
"type": "string"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"name": "includeHttpOnly",
|
|
376
|
+
"tags": [],
|
|
377
|
+
"docs": "",
|
|
378
|
+
"complexTypes": [],
|
|
379
|
+
"type": "boolean | undefined"
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
},
|
|
278
383
|
{
|
|
279
384
|
"name": "OpenWebViewOptions",
|
|
280
385
|
"slug": "openwebviewoptions",
|
|
@@ -695,6 +800,93 @@
|
|
|
695
800
|
}
|
|
696
801
|
],
|
|
697
802
|
"typeAliases": [
|
|
803
|
+
{
|
|
804
|
+
"name": "ClearCookieOptions",
|
|
805
|
+
"slug": "clearcookieoptions",
|
|
806
|
+
"docs": "",
|
|
807
|
+
"types": [
|
|
808
|
+
{
|
|
809
|
+
"text": "Omit<HttpCookie, 'key' | 'value'>",
|
|
810
|
+
"complexTypes": [
|
|
811
|
+
"Omit",
|
|
812
|
+
"HttpCookie"
|
|
813
|
+
]
|
|
814
|
+
}
|
|
815
|
+
]
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
"name": "Omit",
|
|
819
|
+
"slug": "omit",
|
|
820
|
+
"docs": "Construct a type with the properties of T except for those in type K.",
|
|
821
|
+
"types": [
|
|
822
|
+
{
|
|
823
|
+
"text": "Pick<T, Exclude<keyof T, K>>",
|
|
824
|
+
"complexTypes": [
|
|
825
|
+
"Pick",
|
|
826
|
+
"T",
|
|
827
|
+
"Exclude",
|
|
828
|
+
"K"
|
|
829
|
+
]
|
|
830
|
+
}
|
|
831
|
+
]
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
"name": "Pick",
|
|
835
|
+
"slug": "pick",
|
|
836
|
+
"docs": "From T, pick a set of properties whose keys are in the union K",
|
|
837
|
+
"types": [
|
|
838
|
+
{
|
|
839
|
+
"text": "{\r\n [P in K]: T[P];\r\n}",
|
|
840
|
+
"complexTypes": [
|
|
841
|
+
"K",
|
|
842
|
+
"T",
|
|
843
|
+
"P"
|
|
844
|
+
]
|
|
845
|
+
}
|
|
846
|
+
]
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
"name": "Exclude",
|
|
850
|
+
"slug": "exclude",
|
|
851
|
+
"docs": "Exclude from T those types that are assignable to U",
|
|
852
|
+
"types": [
|
|
853
|
+
{
|
|
854
|
+
"text": "T extends U ? never : T",
|
|
855
|
+
"complexTypes": [
|
|
856
|
+
"T",
|
|
857
|
+
"U"
|
|
858
|
+
]
|
|
859
|
+
}
|
|
860
|
+
]
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
"name": "Record",
|
|
864
|
+
"slug": "record",
|
|
865
|
+
"docs": "Construct a type with a set of properties K of type T",
|
|
866
|
+
"types": [
|
|
867
|
+
{
|
|
868
|
+
"text": "{\r\n [P in K]: T;\r\n}",
|
|
869
|
+
"complexTypes": [
|
|
870
|
+
"K",
|
|
871
|
+
"T"
|
|
872
|
+
]
|
|
873
|
+
}
|
|
874
|
+
]
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
"name": "GetCookieOptions",
|
|
878
|
+
"slug": "getcookieoptions",
|
|
879
|
+
"docs": "",
|
|
880
|
+
"types": [
|
|
881
|
+
{
|
|
882
|
+
"text": "Omit<HttpCookie, 'key' | 'value'>",
|
|
883
|
+
"complexTypes": [
|
|
884
|
+
"Omit",
|
|
885
|
+
"HttpCookie"
|
|
886
|
+
]
|
|
887
|
+
}
|
|
888
|
+
]
|
|
889
|
+
},
|
|
698
890
|
{
|
|
699
891
|
"name": "UrlChangeListener",
|
|
700
892
|
"slug": "urlchangelistener",
|
|
@@ -30,6 +30,13 @@ 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
|
+
}
|
|
33
40
|
export interface OpenOptions {
|
|
34
41
|
/**
|
|
35
42
|
* Target URL to load.
|
|
@@ -172,11 +179,17 @@ export interface InAppBrowserPlugin {
|
|
|
172
179
|
*/
|
|
173
180
|
open(options: OpenOptions): Promise<any>;
|
|
174
181
|
/**
|
|
175
|
-
* Clear
|
|
182
|
+
* Clear cookies of url
|
|
176
183
|
*
|
|
177
184
|
* @since 0.5.0
|
|
178
185
|
*/
|
|
179
|
-
clearCookies(): Promise<any>;
|
|
186
|
+
clearCookies(options: ClearCookieOptions): Promise<any>;
|
|
187
|
+
/**
|
|
188
|
+
* Get cookies for a specific URL.
|
|
189
|
+
* @param options The options, including the URL to get cookies for.
|
|
190
|
+
* @returns A promise that resolves with the cookies.
|
|
191
|
+
*/
|
|
192
|
+
getCookies(options: GetCookieOptions): Promise<Record<string, string>>;
|
|
180
193
|
close(): Promise<any>;
|
|
181
194
|
/**
|
|
182
195
|
* Open url in a new webview with toolbars
|
|
@@ -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\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
|
|
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}\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 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 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
|
@@ -1,8 +1,9 @@
|
|
|
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>;
|
|
7
8
|
close(): Promise<any>;
|
|
8
9
|
setUrl(options: {
|
package/dist/esm/web.js
CHANGED
|
@@ -4,10 +4,14 @@ 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;
|
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,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 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,10 +24,14 @@ 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;
|
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 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,
|
|
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 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,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,10 +23,14 @@ 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;
|
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 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,
|
|
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 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,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(getCookies, CAPPluginReturnPromise);
|
|
9
10
|
CAP_PLUGIN_METHOD(reload, CAPPluginReturnPromise);
|
|
10
11
|
CAP_PLUGIN_METHOD(open, CAPPluginReturnPromise);
|
|
11
12
|
CAP_PLUGIN_METHOD(setUrl, CAPPluginReturnPromise);
|
|
@@ -50,8 +50,45 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
@objc func clearCookies(_ call: CAPPluginCall) {
|
|
53
|
-
|
|
54
|
-
call.
|
|
53
|
+
let dataStore = WKWebsiteDataStore.default()
|
|
54
|
+
let urlString = call.getString("url") ?? ""
|
|
55
|
+
|
|
56
|
+
guard let url = URL(string: urlString), let hostName = url.host else {
|
|
57
|
+
call.reject("Invalid URL")
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
dataStore.httpCookieStore.getAllCookies { cookies in
|
|
61
|
+
let cookiesToDelete = cookies.filter { cookie in
|
|
62
|
+
cookie.domain == hostName || cookie.domain.hasSuffix(".\(hostName)") || hostName.hasSuffix(cookie.domain)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
for cookie in cookiesToDelete {
|
|
66
|
+
dataStore.httpCookieStore.delete(cookie)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
call.resolve()
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@objc func getCookies(_ call: CAPPluginCall) {
|
|
74
|
+
let urlString = call.getString("url") ?? ""
|
|
75
|
+
let includeHttpOnly = call.getBool("includeHttpOnly") ?? true
|
|
76
|
+
|
|
77
|
+
guard let url = URL(string: urlString), let host = url.host else {
|
|
78
|
+
call.reject("Invalid URL")
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
WKWebsiteDataStore.default().httpCookieStore.getAllCookies { cookies in
|
|
83
|
+
var cookieDict = [String: String]()
|
|
84
|
+
for cookie in cookies {
|
|
85
|
+
|
|
86
|
+
if (includeHttpOnly || !cookie.isHTTPOnly) && (cookie.domain == host || cookie.domain.hasSuffix(".\(host)") || host.hasSuffix(cookie.domain)) {
|
|
87
|
+
cookieDict[cookie.name] = cookie.value
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
call.resolve(cookieDict)
|
|
91
|
+
}
|
|
55
92
|
}
|
|
56
93
|
|
|
57
94
|
@objc func openWebView(_ call: CAPPluginCall) {
|
|
@@ -128,7 +165,7 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
128
165
|
self.navigationWebViewController?.navigationBar.isHidden = true
|
|
129
166
|
}
|
|
130
167
|
if showReloadButton {
|
|
131
|
-
|
|
168
|
+
let toolbarItems = self.getToolbarItems(toolbarType: toolbarType)
|
|
132
169
|
self.webViewController?.leftNavigaionBarItemTypes = toolbarItems + [.reload]
|
|
133
170
|
}
|
|
134
171
|
if !self.isPresentAfterPageLoad {
|