@capgo/inappbrowser 7.0.0 → 7.1.1

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.
@@ -1,19 +1,144 @@
1
1
  package ee.forgr.capacitor_inappbrowser;
2
2
 
3
+ import android.content.res.AssetManager;
4
+ import androidx.annotation.Nullable;
3
5
  import com.getcapacitor.JSObject;
4
6
  import com.getcapacitor.PluginCall;
7
+ import java.io.IOException;
8
+ import java.io.InputStream;
9
+ import java.util.Objects;
10
+ import java.util.regex.Pattern;
5
11
 
6
12
  public class Options {
7
13
 
14
+ public static class ButtonNearDone {
15
+
16
+ public enum AllIconTypes {
17
+ ASSET,
18
+ }
19
+
20
+ private AllIconTypes iconType;
21
+ private String icon;
22
+ private int height;
23
+ private int width;
24
+
25
+ private ButtonNearDone(
26
+ AllIconTypes iconType,
27
+ String icon,
28
+ int height,
29
+ int width
30
+ ) {
31
+ this.iconType = iconType;
32
+ this.icon = icon;
33
+ this.height = height;
34
+ this.width = width;
35
+ }
36
+
37
+ @Nullable
38
+ public static ButtonNearDone generateFromPluginCall(
39
+ PluginCall call,
40
+ AssetManager assetManager
41
+ ) throws IllegalArgumentException, RuntimeException {
42
+ JSObject buttonNearDone = call.getObject("buttonNearDone");
43
+ if (buttonNearDone == null) {
44
+ // Return null when "buttonNearDone" isn't configured, else throw an error
45
+ return null;
46
+ }
47
+
48
+ JSObject android = buttonNearDone.getJSObject("android");
49
+ if (android == null) {
50
+ throw new IllegalArgumentException("buttonNearDone.android is null");
51
+ }
52
+
53
+ String iconType = android.getString("iconType", "asset");
54
+ if (!Objects.equals(iconType, "asset")) {
55
+ throw new IllegalArgumentException(
56
+ "buttonNearDone.android.iconType is not equal to \"asset\""
57
+ );
58
+ }
59
+
60
+ String icon = android.getString("icon");
61
+ if (icon == null) {
62
+ throw new IllegalArgumentException(
63
+ "buttonNearDone.android.icon is null"
64
+ );
65
+ }
66
+
67
+ InputStream fileInputString = null;
68
+
69
+ try {
70
+ // Try to open the file
71
+ fileInputString = assetManager.open(icon);
72
+ // do nothing
73
+ } catch (IOException e) {
74
+ throw new IllegalArgumentException(
75
+ "buttonNearDone.android.icon cannot be found in the assetManager"
76
+ );
77
+ } finally {
78
+ // Close the input stream if it was opened
79
+ if (fileInputString != null) {
80
+ try {
81
+ fileInputString.close();
82
+ } catch (IOException e) {
83
+ throw new RuntimeException(e);
84
+ }
85
+ }
86
+ }
87
+ Integer width = android.getInteger("width", 48);
88
+
89
+ Integer height = android.getInteger("height", 48);
90
+ return new ButtonNearDone(AllIconTypes.ASSET, icon, height, width);
91
+ }
92
+
93
+ public AllIconTypes getIconType() {
94
+ return iconType;
95
+ }
96
+
97
+ public String getIcon() {
98
+ return icon;
99
+ }
100
+
101
+ public int getHeight() {
102
+ return height;
103
+ }
104
+
105
+ public int getWidth() {
106
+ return width;
107
+ }
108
+ }
109
+
8
110
  private String title;
111
+ private boolean CloseModal;
112
+ private String CloseModalTitle;
113
+ private String CloseModalDescription;
114
+ private String CloseModalCancel;
115
+ private ButtonNearDone buttonNearDone;
116
+ private String CloseModalOk;
9
117
  private String url;
10
118
  private JSObject headers;
119
+ private JSObject credentials;
11
120
  private String toolbarType;
12
121
  private JSObject shareDisclaimer;
13
122
  private String shareSubject;
123
+ private boolean disableGoBackOnNativeApplication;
124
+ private boolean activeNativeNavigationForWebview;
14
125
  private boolean isPresentAfterPageLoad;
15
126
  private WebViewCallbacks callbacks;
16
127
  private PluginCall pluginCall;
128
+ private boolean VisibleTitle;
129
+ private String ToolbarColor;
130
+ private boolean ShowArrow;
131
+ private boolean ignoreUntrustedSSLError;
132
+ private String preShowScript;
133
+ private Pattern proxyRequestsPattern = null;
134
+
135
+ public Pattern getProxyRequestsPattern() {
136
+ return proxyRequestsPattern;
137
+ }
138
+
139
+ public void setProxyRequestsPattern(Pattern proxyRequestsPattern) {
140
+ this.proxyRequestsPattern = proxyRequestsPattern;
141
+ }
17
142
 
18
143
  public PluginCall getPluginCall() {
19
144
  return pluginCall;
@@ -31,6 +156,54 @@ public class Options {
31
156
  this.title = title;
32
157
  }
33
158
 
159
+ public boolean getCloseModal() {
160
+ return CloseModal;
161
+ }
162
+
163
+ public void setCloseModal(boolean CloseModal) {
164
+ this.CloseModal = CloseModal;
165
+ }
166
+
167
+ public String getCloseModalTitle() {
168
+ return CloseModalTitle;
169
+ }
170
+
171
+ public void setCloseModalTitle(String CloseModalTitle) {
172
+ this.CloseModalTitle = CloseModalTitle;
173
+ }
174
+
175
+ public String getCloseModalDescription() {
176
+ return CloseModalDescription;
177
+ }
178
+
179
+ public void setCloseModalDescription(String CloseModalDescription) {
180
+ this.CloseModalDescription = CloseModalDescription;
181
+ }
182
+
183
+ public void setButtonNearDone(ButtonNearDone buttonNearDone) {
184
+ this.buttonNearDone = buttonNearDone;
185
+ }
186
+
187
+ public ButtonNearDone getButtonNearDone() {
188
+ return this.buttonNearDone;
189
+ }
190
+
191
+ public String getCloseModalCancel() {
192
+ return CloseModalCancel;
193
+ }
194
+
195
+ public void setCloseModalCancel(String CloseModalCancel) {
196
+ this.CloseModalCancel = CloseModalCancel;
197
+ }
198
+
199
+ public String getCloseModalOk() {
200
+ return CloseModalOk;
201
+ }
202
+
203
+ public void setCloseModalOk(String CloseModalOk) {
204
+ this.CloseModalOk = CloseModalOk;
205
+ }
206
+
34
207
  public String getUrl() {
35
208
  return url;
36
209
  }
@@ -47,6 +220,14 @@ public class Options {
47
220
  this.headers = headers;
48
221
  }
49
222
 
223
+ public JSObject getCredentials() {
224
+ return credentials;
225
+ }
226
+
227
+ public void setCredentials(JSObject credentials) {
228
+ this.credentials = credentials;
229
+ }
230
+
50
231
  public String getToolbarType() {
51
232
  return toolbarType;
52
233
  }
@@ -59,6 +240,16 @@ public class Options {
59
240
  return shareDisclaimer;
60
241
  }
61
242
 
243
+ public boolean showReloadButton;
244
+
245
+ public boolean getShowReloadButton() {
246
+ return showReloadButton;
247
+ }
248
+
249
+ public void setShowReloadButton(boolean showReloadButton) {
250
+ this.showReloadButton = showReloadButton;
251
+ }
252
+
62
253
  public void setShareDisclaimer(JSObject shareDisclaimer) {
63
254
  this.shareDisclaimer = shareDisclaimer;
64
255
  }
@@ -71,6 +262,26 @@ public class Options {
71
262
  this.shareSubject = shareSubject;
72
263
  }
73
264
 
265
+ public boolean getActiveNativeNavigationForWebview() {
266
+ return activeNativeNavigationForWebview;
267
+ }
268
+
269
+ public void setActiveNativeNavigationForWebview(
270
+ boolean activeNativeNavigationForWebview
271
+ ) {
272
+ this.activeNativeNavigationForWebview = activeNativeNavigationForWebview;
273
+ }
274
+
275
+ public boolean getDisableGoBackOnNativeApplication() {
276
+ return disableGoBackOnNativeApplication;
277
+ }
278
+
279
+ public void setDisableGoBackOnNativeApplication(
280
+ boolean disableGoBackOnNativeApplication
281
+ ) {
282
+ this.disableGoBackOnNativeApplication = disableGoBackOnNativeApplication;
283
+ }
284
+
74
285
  public boolean isPresentAfterPageLoad() {
75
286
  return isPresentAfterPageLoad;
76
287
  }
@@ -86,4 +297,44 @@ public class Options {
86
297
  public void setCallbacks(WebViewCallbacks callbacks) {
87
298
  this.callbacks = callbacks;
88
299
  }
300
+
301
+ public boolean getVisibleTitle() {
302
+ return VisibleTitle;
303
+ }
304
+
305
+ public void setVisibleTitle(boolean _visibleTitle) {
306
+ this.VisibleTitle = _visibleTitle;
307
+ }
308
+
309
+ public String getToolbarColor() {
310
+ return ToolbarColor;
311
+ }
312
+
313
+ public void setToolbarColor(String toolbarColor) {
314
+ this.ToolbarColor = toolbarColor;
315
+ }
316
+
317
+ public boolean showArrow() {
318
+ return ShowArrow;
319
+ }
320
+
321
+ public void setArrow(boolean _showArrow) {
322
+ this.ShowArrow = _showArrow;
323
+ }
324
+
325
+ public boolean ignoreUntrustedSSLError() {
326
+ return ignoreUntrustedSSLError;
327
+ }
328
+
329
+ public void setIgnoreUntrustedSSLError(boolean _ignoreUntrustedSSLError) {
330
+ this.ignoreUntrustedSSLError = _ignoreUntrustedSSLError;
331
+ }
332
+
333
+ public String getPreShowScript() {
334
+ return preShowScript;
335
+ }
336
+
337
+ public void setPreShowScript(String preLoadScript) {
338
+ this.preShowScript = preLoadScript;
339
+ }
89
340
  }
@@ -8,4 +8,8 @@ public interface WebViewCallbacks {
8
8
  public void pageLoaded();
9
9
 
10
10
  public void pageLoadError();
11
+
12
+ public void javascriptCallback(String message);
13
+
14
+ public void buttonNearDoneClicked();
11
15
  }