@capgo/inappbrowser 0.4.3 → 0.4.7
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 +48 -24
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +167 -139
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java +81 -81
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewCallbacks.java +4 -4
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +216 -192
- package/dist/docs.json +131 -35
- package/dist/esm/definitions.d.ts +70 -4
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +5 -5
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +5 -5
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +5 -5
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/InAppBrowserPlugin.swift +1 -1
- package/ios/Plugin/WKWebViewController.swift +3 -3
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ npx cap sync
|
|
|
23
23
|
* [`addListener('urlChangeEvent', ...)`](#addlistenerurlchangeevent)
|
|
24
24
|
* [`addListener('closeEvent', ...)`](#addlistenercloseevent)
|
|
25
25
|
* [`addListener('confirmBtnClicked', ...)`](#addlistenerconfirmbtnclicked)
|
|
26
|
+
* [`removeAllListeners()`](#removealllisteners)
|
|
26
27
|
* [Interfaces](#interfaces)
|
|
27
28
|
* [Type Aliases](#type-aliases)
|
|
28
29
|
* [Enums](#enums)
|
|
@@ -38,12 +39,16 @@ npx cap sync
|
|
|
38
39
|
open(options: OpenOptions) => any
|
|
39
40
|
```
|
|
40
41
|
|
|
42
|
+
Open url in a new window fullscreen
|
|
43
|
+
|
|
41
44
|
| Param | Type |
|
|
42
45
|
| ------------- | --------------------------------------------------- |
|
|
43
46
|
| **`options`** | <code><a href="#openoptions">OpenOptions</a></code> |
|
|
44
47
|
|
|
45
48
|
**Returns:** <code>any</code>
|
|
46
49
|
|
|
50
|
+
**Since:** 0.1.0
|
|
51
|
+
|
|
47
52
|
--------------------
|
|
48
53
|
|
|
49
54
|
|
|
@@ -64,12 +69,16 @@ close() => any
|
|
|
64
69
|
openWebView(options: OpenWebViewOptions) => any
|
|
65
70
|
```
|
|
66
71
|
|
|
72
|
+
Open url in a new webview with toolbars
|
|
73
|
+
|
|
67
74
|
| Param | Type |
|
|
68
75
|
| ------------- | ----------------------------------------------------------------- |
|
|
69
76
|
| **`options`** | <code><a href="#openwebviewoptions">OpenWebViewOptions</a></code> |
|
|
70
77
|
|
|
71
78
|
**Returns:** <code>any</code>
|
|
72
79
|
|
|
80
|
+
**Since:** 0.1.0
|
|
81
|
+
|
|
73
82
|
--------------------
|
|
74
83
|
|
|
75
84
|
|
|
@@ -91,7 +100,7 @@ setUrl(options: { url: string; }) => any
|
|
|
91
100
|
### addListener('urlChangeEvent', ...)
|
|
92
101
|
|
|
93
102
|
```typescript
|
|
94
|
-
addListener(eventName:
|
|
103
|
+
addListener(eventName: "urlChangeEvent", listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
|
|
95
104
|
```
|
|
96
105
|
|
|
97
106
|
Listen for url change
|
|
@@ -111,7 +120,7 @@ Listen for url change
|
|
|
111
120
|
### addListener('closeEvent', ...)
|
|
112
121
|
|
|
113
122
|
```typescript
|
|
114
|
-
addListener(eventName:
|
|
123
|
+
addListener(eventName: "closeEvent", listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
|
|
115
124
|
```
|
|
116
125
|
|
|
117
126
|
Listen for close click
|
|
@@ -131,7 +140,7 @@ Listen for close click
|
|
|
131
140
|
### addListener('confirmBtnClicked', ...)
|
|
132
141
|
|
|
133
142
|
```typescript
|
|
134
|
-
addListener(eventName:
|
|
143
|
+
addListener(eventName: "confirmBtnClicked", listenerFunc: ConfirmBtnListener) => Promise<PluginListenerHandle> & PluginListenerHandle
|
|
135
144
|
```
|
|
136
145
|
|
|
137
146
|
Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS
|
|
@@ -148,16 +157,31 @@ Will be triggered when user clicks on confirm button when disclaimer is required
|
|
|
148
157
|
--------------------
|
|
149
158
|
|
|
150
159
|
|
|
160
|
+
### removeAllListeners()
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
removeAllListeners() => any
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Remove all listeners for this plugin.
|
|
167
|
+
|
|
168
|
+
**Returns:** <code>any</code>
|
|
169
|
+
|
|
170
|
+
**Since:** 1.0.0
|
|
171
|
+
|
|
172
|
+
--------------------
|
|
173
|
+
|
|
174
|
+
|
|
151
175
|
### Interfaces
|
|
152
176
|
|
|
153
177
|
|
|
154
178
|
#### OpenOptions
|
|
155
179
|
|
|
156
|
-
| Prop | Type |
|
|
157
|
-
| ---------------------------- | ------------------------------------------- |
|
|
158
|
-
| **`url`** | <code>string</code> |
|
|
159
|
-
| **`headers`** | <code><a href="#headers">Headers</a></code> |
|
|
160
|
-
| **`isPresentAfterPageLoad`** | <code>boolean</code> |
|
|
180
|
+
| Prop | Type | Description | Since |
|
|
181
|
+
| ---------------------------- | ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
182
|
+
| **`url`** | <code>string</code> | Target URL to load. | 0.1.0 |
|
|
183
|
+
| **`headers`** | <code><a href="#headers">Headers</a></code> | <a href="#headers">Headers</a> to send with the request. | 0.1.0 |
|
|
184
|
+
| **`isPresentAfterPageLoad`** | <code>boolean</code> | if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately. | 0.1.0 |
|
|
161
185
|
|
|
162
186
|
|
|
163
187
|
#### Headers
|
|
@@ -165,16 +189,16 @@ Will be triggered when user clicks on confirm button when disclaimer is required
|
|
|
165
189
|
|
|
166
190
|
#### OpenWebViewOptions
|
|
167
191
|
|
|
168
|
-
| Prop | Type |
|
|
169
|
-
| ---------------------------- | --------------------------------------------------------------- |
|
|
170
|
-
| **`url`** | <code>string</code> |
|
|
171
|
-
| **`headers`** | <code><a href="#headers">Headers</a></code> |
|
|
172
|
-
| **`shareDisclaimer`** | <code><a href="#disclaimeroptions">DisclaimerOptions</a></code> |
|
|
173
|
-
| **`toolbarType`** | <code><a href="#toolbartype">ToolBarType</a></code> |
|
|
174
|
-
| **`shareSubject`** | <code>string</code> |
|
|
175
|
-
| **`title`** | <code>string</code> |
|
|
176
|
-
| **`backgroundColor`** | <code><a href="#backgroundcolor">BackgroundColor</a></code> |
|
|
177
|
-
| **`isPresentAfterPageLoad`** | <code>boolean</code> |
|
|
192
|
+
| Prop | Type | Description | Default | Since |
|
|
193
|
+
| ---------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | ----- |
|
|
194
|
+
| **`url`** | <code>string</code> | Target URL to load. | | 0.1.0 |
|
|
195
|
+
| **`headers`** | <code><a href="#headers">Headers</a></code> | <a href="#headers">Headers</a> to send with the request. | | 0.1.0 |
|
|
196
|
+
| **`shareDisclaimer`** | <code><a href="#disclaimeroptions">DisclaimerOptions</a></code> | share options | | 0.1.0 |
|
|
197
|
+
| **`toolbarType`** | <code><a href="#toolbartype">ToolBarType</a></code> | Toolbar type | <code>ToolBarType.DEFAULT</code> | 0.1.0 |
|
|
198
|
+
| **`shareSubject`** | <code>string</code> | Share subject | | 0.1.0 |
|
|
199
|
+
| **`title`** | <code>string</code> | Title of the browser | <code>'New Window'</code> | 0.1.0 |
|
|
200
|
+
| **`backgroundColor`** | <code><a href="#backgroundcolor">BackgroundColor</a></code> | Background color of the browser, only on IOS | <code>BackgroundColor.BLACK</code> | 0.1.0 |
|
|
201
|
+
| **`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 |
|
|
178
202
|
|
|
179
203
|
|
|
180
204
|
#### DisclaimerOptions
|
|
@@ -228,18 +252,18 @@ Will be triggered when user clicks on confirm button when disclaimer is required
|
|
|
228
252
|
|
|
229
253
|
| Members | Value |
|
|
230
254
|
| ---------------- | ------------------------- |
|
|
231
|
-
| **`ACTIVITY`** | <code>
|
|
232
|
-
| **`NAVIGATION`** | <code>
|
|
233
|
-
| **`BLANK`** | <code>
|
|
234
|
-
| **`DEFAULT`** | <code>
|
|
255
|
+
| **`ACTIVITY`** | <code>"activity"</code> |
|
|
256
|
+
| **`NAVIGATION`** | <code>"navigation"</code> |
|
|
257
|
+
| **`BLANK`** | <code>"blank"</code> |
|
|
258
|
+
| **`DEFAULT`** | <code>""</code> |
|
|
235
259
|
|
|
236
260
|
|
|
237
261
|
#### BackgroundColor
|
|
238
262
|
|
|
239
263
|
| Members | Value |
|
|
240
264
|
| ----------- | -------------------- |
|
|
241
|
-
| **`WHITE`** | <code>
|
|
242
|
-
| **`BLACK`** | <code>
|
|
265
|
+
| **`WHITE`** | <code>"white"</code> |
|
|
266
|
+
| **`BLACK`** | <code>"black"</code> |
|
|
243
267
|
|
|
244
268
|
</docgen-api>
|
|
245
269
|
|
|
@@ -21,161 +21,189 @@ import java.util.Iterator;
|
|
|
21
21
|
@CapacitorPlugin(name = "InAppBrowser")
|
|
22
22
|
public class InAppBrowserPlugin extends Plugin {
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
public static final String CUSTOM_TAB_PACKAGE_NAME = "com.android.chrome"; // Change when in stable
|
|
25
|
+
private CustomTabsClient customTabsClient;
|
|
26
|
+
private CustomTabsSession currentSession;
|
|
27
|
+
private WebViewDialog webViewDialog = null;
|
|
28
|
+
|
|
29
|
+
CustomTabsServiceConnection connection = new CustomTabsServiceConnection() {
|
|
30
|
+
@Override
|
|
31
|
+
public void onCustomTabsServiceConnected(
|
|
32
|
+
ComponentName name,
|
|
33
|
+
CustomTabsClient client
|
|
34
|
+
) {
|
|
35
|
+
customTabsClient = client;
|
|
36
|
+
client.warmup(0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Override
|
|
40
|
+
public void onServiceDisconnected(ComponentName name) {}
|
|
41
|
+
};
|
|
28
42
|
|
|
29
|
-
|
|
43
|
+
@PluginMethod
|
|
44
|
+
public void setUrl(PluginCall call) {
|
|
45
|
+
String url = call.getString("url");
|
|
46
|
+
if (url == null || TextUtils.isEmpty(url)) {
|
|
47
|
+
call.reject("Invalid URL");
|
|
48
|
+
}
|
|
49
|
+
getActivity()
|
|
50
|
+
.runOnUiThread(
|
|
51
|
+
new Runnable() {
|
|
52
|
+
@Override
|
|
53
|
+
public void run() {
|
|
54
|
+
webViewDialog.setUrl(url);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
call.resolve();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@PluginMethod
|
|
62
|
+
public void open(PluginCall call) {
|
|
63
|
+
String url = call.getString("url");
|
|
64
|
+
if (url == null || TextUtils.isEmpty(url)) {
|
|
65
|
+
call.reject("Invalid URL");
|
|
66
|
+
}
|
|
67
|
+
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(
|
|
68
|
+
getCustomTabsSession()
|
|
69
|
+
);
|
|
70
|
+
CustomTabsIntent tabsIntent = builder.build();
|
|
71
|
+
tabsIntent.intent.putExtra(
|
|
72
|
+
Intent.EXTRA_REFERRER,
|
|
73
|
+
Uri.parse(
|
|
74
|
+
Intent.URI_ANDROID_APP_SCHEME + "//" + getContext().getPackageName()
|
|
75
|
+
)
|
|
76
|
+
);
|
|
77
|
+
tabsIntent.intent.putExtra(
|
|
78
|
+
android.provider.Browser.EXTRA_HEADERS,
|
|
79
|
+
this.getHeaders(call)
|
|
80
|
+
);
|
|
81
|
+
tabsIntent.launchUrl(getContext(), Uri.parse(url));
|
|
82
|
+
|
|
83
|
+
call.resolve();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@PluginMethod
|
|
87
|
+
public void openWebView(PluginCall call) {
|
|
88
|
+
String url = call.getString("url");
|
|
89
|
+
if (url == null || TextUtils.isEmpty(url)) {
|
|
90
|
+
call.reject("Invalid URL");
|
|
91
|
+
}
|
|
92
|
+
final Options options = new Options();
|
|
93
|
+
options.setUrl(url);
|
|
94
|
+
options.setHeaders(call.getObject("headers"));
|
|
95
|
+
options.setTitle(call.getString("title", "New Window"));
|
|
96
|
+
options.setShareDisclaimer(call.getObject("shareDisclaimer", null));
|
|
97
|
+
options.setShareSubject(call.getString("shareSubject", null));
|
|
98
|
+
options.setToolbarType(call.getString("toolbarType", ""));
|
|
99
|
+
options.setPresentAfterPageLoad(
|
|
100
|
+
call.getBoolean("isPresentAfterPageLoad", false)
|
|
101
|
+
);
|
|
102
|
+
options.setPluginCall(call);
|
|
103
|
+
options.setCallbacks(
|
|
104
|
+
new WebViewCallbacks() {
|
|
30
105
|
@Override
|
|
31
|
-
public void
|
|
32
|
-
|
|
33
|
-
client.warmup(0);
|
|
106
|
+
public void urlChangeEvent(String url) {
|
|
107
|
+
notifyListeners("urlChangeEvent", new JSObject().put("url", url));
|
|
34
108
|
}
|
|
35
109
|
|
|
36
110
|
@Override
|
|
37
|
-
public void
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
@PluginMethod
|
|
41
|
-
public void setUrl(PluginCall call) {
|
|
42
|
-
String url = call.getString("url");
|
|
43
|
-
if (url == null || TextUtils.isEmpty(url)) {
|
|
44
|
-
call.reject("Invalid URL");
|
|
111
|
+
public void closeEvent(String url) {
|
|
112
|
+
notifyListeners("closeEvent", new JSObject().put("url", url));
|
|
45
113
|
}
|
|
46
|
-
getActivity()
|
|
47
|
-
.runOnUiThread(
|
|
48
|
-
new Runnable() {
|
|
49
|
-
@Override
|
|
50
|
-
public void run() {
|
|
51
|
-
webViewDialog.setUrl(url);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
call.resolve();
|
|
56
|
-
}
|
|
57
114
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (url == null || TextUtils.isEmpty(url)) {
|
|
62
|
-
call.reject("Invalid URL");
|
|
115
|
+
@Override
|
|
116
|
+
public void pageLoaded() {
|
|
117
|
+
notifyListeners("browserPageLoaded", new JSObject());
|
|
63
118
|
}
|
|
64
|
-
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(getCustomTabsSession());
|
|
65
|
-
CustomTabsIntent tabsIntent = builder.build();
|
|
66
|
-
tabsIntent.intent.putExtra(Intent.EXTRA_REFERRER, Uri.parse(Intent.URI_ANDROID_APP_SCHEME + "//" + getContext().getPackageName()));
|
|
67
|
-
tabsIntent.intent.putExtra(android.provider.Browser.EXTRA_HEADERS, this.getHeaders(call));
|
|
68
|
-
tabsIntent.launchUrl(getContext(), Uri.parse(url));
|
|
69
|
-
|
|
70
|
-
call.resolve();
|
|
71
|
-
}
|
|
72
119
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (url == null || TextUtils.isEmpty(url)) {
|
|
77
|
-
call.reject("Invalid URL");
|
|
120
|
+
@Override
|
|
121
|
+
public void pageLoadError() {
|
|
122
|
+
notifyListeners("pageLoadError", new JSObject());
|
|
78
123
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
@Override
|
|
95
|
-
public void closeEvent(String url) {
|
|
96
|
-
notifyListeners("closeEvent", new JSObject().put("url", url));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@Override
|
|
100
|
-
public void pageLoaded() {
|
|
101
|
-
notifyListeners("browserPageLoaded", new JSObject());
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@Override
|
|
105
|
-
public void pageLoadError() {
|
|
106
|
-
notifyListeners("pageLoadError", new JSObject());
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
getActivity()
|
|
111
|
-
.runOnUiThread(
|
|
112
|
-
new Runnable() {
|
|
113
|
-
@Override
|
|
114
|
-
public void run() {
|
|
115
|
-
webViewDialog = new WebViewDialog(getContext(), android.R.style.Theme_NoTitleBar, options);
|
|
116
|
-
webViewDialog.presentWebView();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@PluginMethod
|
|
123
|
-
public void close(PluginCall call) {
|
|
124
|
-
if (webViewDialog != null) {
|
|
125
|
-
webViewDialog.dismiss();
|
|
126
|
-
webViewDialog = null;
|
|
127
|
-
} else {
|
|
128
|
-
Intent intent = new Intent(getContext(), getBridge().getActivity().getClass());
|
|
129
|
-
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
130
|
-
getContext().startActivity(intent);
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
getActivity()
|
|
127
|
+
.runOnUiThread(
|
|
128
|
+
new Runnable() {
|
|
129
|
+
@Override
|
|
130
|
+
public void run() {
|
|
131
|
+
webViewDialog =
|
|
132
|
+
new WebViewDialog(
|
|
133
|
+
getContext(),
|
|
134
|
+
android.R.style.Theme_NoTitleBar,
|
|
135
|
+
options
|
|
136
|
+
);
|
|
137
|
+
webViewDialog.presentWebView();
|
|
138
|
+
}
|
|
131
139
|
}
|
|
132
|
-
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@PluginMethod
|
|
144
|
+
public void close(PluginCall call) {
|
|
145
|
+
if (webViewDialog != null) {
|
|
146
|
+
webViewDialog.dismiss();
|
|
147
|
+
webViewDialog = null;
|
|
148
|
+
} else {
|
|
149
|
+
Intent intent = new Intent(
|
|
150
|
+
getContext(),
|
|
151
|
+
getBridge().getActivity().getClass()
|
|
152
|
+
);
|
|
153
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
154
|
+
getContext().startActivity(intent);
|
|
133
155
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
156
|
+
call.resolve();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private Bundle getHeaders(PluginCall pluginCall) {
|
|
160
|
+
JSObject headersProvided = pluginCall.getObject("headers");
|
|
161
|
+
Bundle headers = new Bundle();
|
|
162
|
+
if (headersProvided != null) {
|
|
163
|
+
Iterator<String> keys = headersProvided.keys();
|
|
164
|
+
while (keys.hasNext()) {
|
|
165
|
+
String key = keys.next();
|
|
166
|
+
headers.putString(key, headersProvided.getString(key));
|
|
167
|
+
}
|
|
146
168
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
169
|
+
return headers;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
protected void handleOnResume() {
|
|
173
|
+
boolean ok = CustomTabsClient.bindCustomTabsService(
|
|
174
|
+
getContext(),
|
|
175
|
+
CUSTOM_TAB_PACKAGE_NAME,
|
|
176
|
+
connection
|
|
177
|
+
);
|
|
178
|
+
if (!ok) {
|
|
179
|
+
Log.e(getLogTag(), "Error binding to custom tabs service");
|
|
153
180
|
}
|
|
181
|
+
}
|
|
154
182
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
183
|
+
protected void handleOnPause() {
|
|
184
|
+
getContext().unbindService(connection);
|
|
185
|
+
}
|
|
158
186
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
187
|
+
public CustomTabsSession getCustomTabsSession() {
|
|
188
|
+
if (customTabsClient == null) {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
163
191
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
return currentSession;
|
|
192
|
+
if (currentSession == null) {
|
|
193
|
+
currentSession =
|
|
194
|
+
customTabsClient.newSession(
|
|
195
|
+
new CustomTabsCallback() {
|
|
196
|
+
@Override
|
|
197
|
+
public void onNavigationEvent(int navigationEvent, Bundle extras) {
|
|
198
|
+
switch (navigationEvent) {
|
|
199
|
+
case NAVIGATION_FINISHED:
|
|
200
|
+
notifyListeners("browserPageLoaded", new JSObject());
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
);
|
|
180
206
|
}
|
|
207
|
+
return currentSession;
|
|
208
|
+
}
|
|
181
209
|
}
|
|
@@ -5,85 +5,85 @@ import com.getcapacitor.PluginCall;
|
|
|
5
5
|
|
|
6
6
|
public class Options {
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
8
|
+
private String title;
|
|
9
|
+
private String url;
|
|
10
|
+
private JSObject headers;
|
|
11
|
+
private String toolbarType;
|
|
12
|
+
private JSObject shareDisclaimer;
|
|
13
|
+
private String shareSubject;
|
|
14
|
+
private boolean isPresentAfterPageLoad;
|
|
15
|
+
private WebViewCallbacks callbacks;
|
|
16
|
+
private PluginCall pluginCall;
|
|
17
|
+
|
|
18
|
+
public PluginCall getPluginCall() {
|
|
19
|
+
return pluginCall;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public void setPluginCall(PluginCall pluginCall) {
|
|
23
|
+
this.pluginCall = pluginCall;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public String getTitle() {
|
|
27
|
+
return title;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public void setTitle(String title) {
|
|
31
|
+
this.title = title;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public String getUrl() {
|
|
35
|
+
return url;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public void setUrl(String url) {
|
|
39
|
+
this.url = url;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public JSObject getHeaders() {
|
|
43
|
+
return headers;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public void setHeaders(JSObject headers) {
|
|
47
|
+
this.headers = headers;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public String getToolbarType() {
|
|
51
|
+
return toolbarType;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public void setToolbarType(String toolbarType) {
|
|
55
|
+
this.toolbarType = toolbarType;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public JSObject getShareDisclaimer() {
|
|
59
|
+
return shareDisclaimer;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public void setShareDisclaimer(JSObject shareDisclaimer) {
|
|
63
|
+
this.shareDisclaimer = shareDisclaimer;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public String getShareSubject() {
|
|
67
|
+
return shareSubject;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public void setShareSubject(String shareSubject) {
|
|
71
|
+
this.shareSubject = shareSubject;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public boolean isPresentAfterPageLoad() {
|
|
75
|
+
return isPresentAfterPageLoad;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public void setPresentAfterPageLoad(boolean presentAfterPageLoad) {
|
|
79
|
+
isPresentAfterPageLoad = presentAfterPageLoad;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public WebViewCallbacks getCallbacks() {
|
|
83
|
+
return callbacks;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public void setCallbacks(WebViewCallbacks callbacks) {
|
|
87
|
+
this.callbacks = callbacks;
|
|
88
|
+
}
|
|
89
89
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
package ee.forgr.capacitor_inappbrowser;
|
|
2
2
|
|
|
3
3
|
public interface WebViewCallbacks {
|
|
4
|
-
|
|
4
|
+
public void urlChangeEvent(String url);
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
public void closeEvent(String url);
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
public void pageLoaded();
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
public void pageLoadError();
|
|
11
11
|
}
|