@capgo/inappbrowser 6.11.1 → 6.13.0

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.
Files changed (30) hide show
  1. package/README.md +50 -42
  2. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +161 -41
  3. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java +83 -22
  4. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewCallbacks.java +2 -0
  5. package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +749 -96
  6. package/android/src/main/res/drawable/ic_share.xml +10 -0
  7. package/android/src/main/res/layout/activity_browser.xml +8 -0
  8. package/android/src/main/res/layout/content_browser.xml +10 -1
  9. package/android/src/main/res/layout/tool_bar.xml +19 -7
  10. package/android/src/main/res/values/strings.xml +2 -0
  11. package/android/src/main/res/values/themes.xml +27 -0
  12. package/dist/docs.json +211 -37
  13. package/dist/esm/definitions.d.ts +244 -31
  14. package/dist/esm/definitions.js +12 -1
  15. package/dist/esm/definitions.js.map +1 -1
  16. package/dist/plugin.cjs.js +12 -1
  17. package/dist/plugin.cjs.js.map +1 -1
  18. package/dist/plugin.js +12 -1
  19. package/dist/plugin.js.map +1 -1
  20. package/ios/Plugin/InAppBrowserPlugin.swift +344 -44
  21. package/ios/Plugin/WKWebViewController.swift +499 -45
  22. package/package.json +7 -8
  23. package/ios/Plugin/Assets.xcassets/Back.imageset/Back.png +0 -0
  24. package/ios/Plugin/Assets.xcassets/Back.imageset/Back@2x.png +0 -0
  25. package/ios/Plugin/Assets.xcassets/Back.imageset/Back@3x.png +0 -0
  26. package/ios/Plugin/Assets.xcassets/Back.imageset/Contents.json +0 -26
  27. package/ios/Plugin/Assets.xcassets/Forward.imageset/Contents.json +0 -26
  28. package/ios/Plugin/Assets.xcassets/Forward.imageset/Forward.png +0 -0
  29. package/ios/Plugin/Assets.xcassets/Forward.imageset/Forward@2x.png +0 -0
  30. package/ios/Plugin/Assets.xcassets/Forward.imageset/Forward@3x.png +0 -0
@@ -15,19 +15,23 @@ public class Options {
15
15
 
16
16
  public enum AllIconTypes {
17
17
  ASSET,
18
+ VECTOR,
18
19
  }
19
20
 
20
- private final AllIconTypes iconType;
21
+ private final AllIconTypes iconTypeEnum;
22
+ private final String iconType;
21
23
  private final String icon;
22
24
  private final int height;
23
25
  private final int width;
24
26
 
25
27
  private ButtonNearDone(
26
- AllIconTypes iconType,
28
+ AllIconTypes iconTypeEnum,
29
+ String iconType,
27
30
  String icon,
28
31
  int height,
29
32
  int width
30
33
  ) {
34
+ this.iconTypeEnum = iconTypeEnum;
31
35
  this.iconType = iconType;
32
36
  this.icon = icon;
33
37
  this.height = height;
@@ -51,9 +55,16 @@ public class Options {
51
55
  }
52
56
 
53
57
  String iconType = android.getString("iconType", "asset");
54
- if (!Objects.equals(iconType, "asset")) {
58
+ AllIconTypes iconTypeEnum;
59
+
60
+ // Validate and process icon type
61
+ if ("asset".equals(iconType)) {
62
+ iconTypeEnum = AllIconTypes.ASSET;
63
+ } else if ("vector".equals(iconType)) {
64
+ iconTypeEnum = AllIconTypes.VECTOR;
65
+ } else {
55
66
  throw new IllegalArgumentException(
56
- "buttonNearDone.android.iconType is not equal to \"asset\""
67
+ "buttonNearDone.android.iconType must be 'asset' or 'vector'"
57
68
  );
58
69
  }
59
70
 
@@ -64,31 +75,50 @@ public class Options {
64
75
  );
65
76
  }
66
77
 
67
- InputStream fileInputString = null;
78
+ // For asset type, verify the file exists
79
+ if (iconTypeEnum == AllIconTypes.ASSET) {
80
+ InputStream fileInputString = null;
68
81
 
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) {
82
+ try {
83
+ // Try to find in public folder first
80
84
  try {
81
- fileInputString.close();
85
+ fileInputString = assetManager.open("public/" + icon);
82
86
  } catch (IOException e) {
83
- e.printStackTrace();
87
+ // If not in public, try in root assets
88
+ try {
89
+ fileInputString = assetManager.open(icon);
90
+ } catch (IOException e2) {
91
+ throw new IllegalArgumentException(
92
+ "buttonNearDone.android.icon cannot be found in the assetManager"
93
+ );
94
+ }
95
+ }
96
+ // File exists, do nothing
97
+ } finally {
98
+ // Close the input stream if it was opened
99
+ if (fileInputString != null) {
100
+ try {
101
+ fileInputString.close();
102
+ } catch (IOException e) {
103
+ e.printStackTrace();
104
+ }
84
105
  }
85
106
  }
86
107
  }
87
- Integer width = android.getInteger("width", 48);
108
+ // For vector type, we don't validate here since resources are checked at runtime
109
+ else if (iconTypeEnum == AllIconTypes.VECTOR) {
110
+ // Vector resources will be validated when used
111
+ System.out.println(
112
+ "Vector resource will be validated at runtime: " + icon
113
+ );
114
+ }
115
+
116
+ Integer width = android.getInteger("width", 24);
117
+ Integer height = android.getInteger("height", 24);
88
118
 
89
- Integer height = android.getInteger("height", 48);
90
119
  final ButtonNearDone buttonNearDone1 = new ButtonNearDone(
91
- AllIconTypes.ASSET,
120
+ iconTypeEnum,
121
+ iconType,
92
122
  icon,
93
123
  height,
94
124
  width
@@ -96,7 +126,11 @@ public class Options {
96
126
  return buttonNearDone1;
97
127
  }
98
128
 
99
- public AllIconTypes getIconType() {
129
+ public AllIconTypes getIconTypeEnum() {
130
+ return iconTypeEnum;
131
+ }
132
+
133
+ public String getIconType() {
100
134
  return iconType;
101
135
  }
102
136
 
@@ -136,7 +170,26 @@ public class Options {
136
170
  private boolean ShowArrow;
137
171
  private boolean ignoreUntrustedSSLError;
138
172
  private String preShowScript;
173
+ private String toolbarTextColor;
139
174
  private Pattern proxyRequestsPattern = null;
175
+ private boolean materialPicker = false;
176
+ private int textZoom = 100; // Default text zoom is 100%
177
+
178
+ public int getTextZoom() {
179
+ return textZoom;
180
+ }
181
+
182
+ public void setTextZoom(int textZoom) {
183
+ this.textZoom = textZoom;
184
+ }
185
+
186
+ public boolean getMaterialPicker() {
187
+ return materialPicker;
188
+ }
189
+
190
+ public void setMaterialPicker(boolean materialPicker) {
191
+ this.materialPicker = materialPicker;
192
+ }
140
193
 
141
194
  public Pattern getProxyRequestsPattern() {
142
195
  return proxyRequestsPattern;
@@ -320,6 +373,14 @@ public class Options {
320
373
  this.ToolbarColor = toolbarColor;
321
374
  }
322
375
 
376
+ public String getToolbarTextColor() {
377
+ return toolbarTextColor;
378
+ }
379
+
380
+ public void setToolbarTextColor(String toolbarTextColor) {
381
+ this.toolbarTextColor = toolbarTextColor;
382
+ }
383
+
323
384
  public boolean showArrow() {
324
385
  return ShowArrow;
325
386
  }
@@ -12,4 +12,6 @@ public interface WebViewCallbacks {
12
12
  public void javascriptCallback(String message);
13
13
 
14
14
  public void buttonNearDoneClicked();
15
+
16
+ public void confirmBtnClicked();
15
17
  }