@capgo/inappbrowser 6.0.53 → 6.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.
package/README.md
CHANGED
|
@@ -23,7 +23,9 @@ Web platform is not supported. Use `window.open` instead.
|
|
|
23
23
|
|
|
24
24
|
### Camera usage
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
#### Android
|
|
27
|
+
|
|
28
|
+
Add the following to your `AndroidManifest.xml` file:
|
|
27
29
|
|
|
28
30
|
```xml
|
|
29
31
|
<uses-permission android:name="android.permission.CAMERA" />
|
|
@@ -31,6 +33,37 @@ if you need the Camera to work in Android, you need to add the following to your
|
|
|
31
33
|
|
|
32
34
|
Then the permission will be asked when the camera is used.
|
|
33
35
|
|
|
36
|
+
#### iOS
|
|
37
|
+
|
|
38
|
+
Add the following to your `Info.plist` file:
|
|
39
|
+
|
|
40
|
+
```xml
|
|
41
|
+
<key>NSCameraUsageDescription</key>
|
|
42
|
+
<string>We need access to the camera to record audio.</string>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Microphone usage
|
|
46
|
+
|
|
47
|
+
#### Android
|
|
48
|
+
|
|
49
|
+
Add the following to your `AndroidManifest.xml` file:
|
|
50
|
+
|
|
51
|
+
```xml
|
|
52
|
+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
|
53
|
+
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then the permission will be asked when the microphone is used.
|
|
57
|
+
|
|
58
|
+
#### iOS
|
|
59
|
+
|
|
60
|
+
Add the following to your `Info.plist` file:
|
|
61
|
+
|
|
62
|
+
```xml
|
|
63
|
+
<key>NSMicrophoneUsageDescription</key>
|
|
64
|
+
<string>We need access to the microphone to record audio.</string>
|
|
65
|
+
```
|
|
66
|
+
|
|
34
67
|
## API
|
|
35
68
|
|
|
36
69
|
<docgen-index>
|
|
@@ -32,6 +32,10 @@ import java.util.Iterator;
|
|
|
32
32
|
name = "InAppBrowser",
|
|
33
33
|
permissions = {
|
|
34
34
|
@Permission(alias = "camera", strings = { Manifest.permission.CAMERA }),
|
|
35
|
+
@Permission(
|
|
36
|
+
alias = "microphone",
|
|
37
|
+
strings = { Manifest.permission.RECORD_AUDIO }
|
|
38
|
+
),
|
|
35
39
|
@Permission(
|
|
36
40
|
alias = "storage",
|
|
37
41
|
strings = { Manifest.permission.READ_EXTERNAL_STORAGE }
|
|
@@ -55,6 +59,59 @@ public class InAppBrowserPlugin
|
|
|
55
59
|
|
|
56
60
|
private PermissionRequest currentPermissionRequest;
|
|
57
61
|
|
|
62
|
+
public void handleMicrophonePermissionRequest(PermissionRequest request) {
|
|
63
|
+
this.currentPermissionRequest = request;
|
|
64
|
+
if (getPermissionState("microphone") != PermissionState.GRANTED) {
|
|
65
|
+
requestPermissionForAlias(
|
|
66
|
+
"microphone",
|
|
67
|
+
null,
|
|
68
|
+
"microphonePermissionCallback"
|
|
69
|
+
);
|
|
70
|
+
} else {
|
|
71
|
+
grantMicrophonePermission();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private void grantMicrophonePermission() {
|
|
76
|
+
if (currentPermissionRequest != null) {
|
|
77
|
+
currentPermissionRequest.grant(
|
|
78
|
+
new String[] { PermissionRequest.RESOURCE_AUDIO_CAPTURE }
|
|
79
|
+
);
|
|
80
|
+
currentPermissionRequest = null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@PermissionCallback
|
|
85
|
+
private void microphonePermissionCallback() {
|
|
86
|
+
if (getPermissionState("microphone") == PermissionState.GRANTED) {
|
|
87
|
+
grantCameraPermission();
|
|
88
|
+
} else {
|
|
89
|
+
if (currentPermissionRequest != null) {
|
|
90
|
+
currentPermissionRequest.deny();
|
|
91
|
+
currentPermissionRequest = null;
|
|
92
|
+
}
|
|
93
|
+
// Handle the case where permission was not granted
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@PermissionCallback
|
|
98
|
+
private void microphonePermissionCallback(PluginCall call) {
|
|
99
|
+
if (getPermissionState("microphone") == PermissionState.GRANTED) {
|
|
100
|
+
// Permission granted, notify the WebView to proceed
|
|
101
|
+
if (
|
|
102
|
+
webViewDialog != null && webViewDialog.currentPermissionRequest != null
|
|
103
|
+
) {
|
|
104
|
+
webViewDialog.currentPermissionRequest.grant(
|
|
105
|
+
new String[] { PermissionRequest.RESOURCE_AUDIO_CAPTURE }
|
|
106
|
+
);
|
|
107
|
+
webViewDialog.currentPermissionRequest = null;
|
|
108
|
+
}
|
|
109
|
+
call.resolve();
|
|
110
|
+
} else {
|
|
111
|
+
call.reject("Camera permission is required");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
58
115
|
public void handleCameraPermissionRequest(PermissionRequest request) {
|
|
59
116
|
this.currentPermissionRequest = request;
|
|
60
117
|
if (getPermissionState("camera") != PermissionState.GRANTED) {
|
|
@@ -107,6 +164,24 @@ public class InAppBrowserPlugin
|
|
|
107
164
|
}
|
|
108
165
|
}
|
|
109
166
|
|
|
167
|
+
@PermissionCallback
|
|
168
|
+
private void cameraPermissionCallback(PluginCall call) {
|
|
169
|
+
if (getPermissionState("camera") == PermissionState.GRANTED) {
|
|
170
|
+
// Permission granted, notify the WebView to proceed
|
|
171
|
+
if (
|
|
172
|
+
webViewDialog != null && webViewDialog.currentPermissionRequest != null
|
|
173
|
+
) {
|
|
174
|
+
webViewDialog.currentPermissionRequest.grant(
|
|
175
|
+
new String[] { PermissionRequest.RESOURCE_VIDEO_CAPTURE }
|
|
176
|
+
);
|
|
177
|
+
webViewDialog.currentPermissionRequest = null;
|
|
178
|
+
}
|
|
179
|
+
call.resolve();
|
|
180
|
+
} else {
|
|
181
|
+
call.reject("Camera permission is required");
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
110
185
|
private void grantCameraPermission() {
|
|
111
186
|
if (currentPermissionRequest != null) {
|
|
112
187
|
currentPermissionRequest.grant(
|
|
@@ -139,24 +214,6 @@ public class InAppBrowserPlugin
|
|
|
139
214
|
}
|
|
140
215
|
}
|
|
141
216
|
|
|
142
|
-
@PermissionCallback
|
|
143
|
-
private void cameraPermissionCallback(PluginCall call) {
|
|
144
|
-
if (getPermissionState("camera") == PermissionState.GRANTED) {
|
|
145
|
-
// Permission granted, notify the WebView to proceed
|
|
146
|
-
if (
|
|
147
|
-
webViewDialog != null && webViewDialog.currentPermissionRequest != null
|
|
148
|
-
) {
|
|
149
|
-
webViewDialog.currentPermissionRequest.grant(
|
|
150
|
-
new String[] { PermissionRequest.RESOURCE_VIDEO_CAPTURE }
|
|
151
|
-
);
|
|
152
|
-
webViewDialog.currentPermissionRequest = null;
|
|
153
|
-
}
|
|
154
|
-
call.resolve();
|
|
155
|
-
} else {
|
|
156
|
-
call.reject("Camera permission is required");
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
217
|
@PluginMethod
|
|
161
218
|
public void setUrl(PluginCall call) {
|
|
162
219
|
String url = call.getString("url");
|
|
@@ -51,6 +51,8 @@ public class WebViewDialog extends Dialog {
|
|
|
51
51
|
|
|
52
52
|
public interface PermissionHandler {
|
|
53
53
|
void handleCameraPermissionRequest(PermissionRequest request);
|
|
54
|
+
|
|
55
|
+
void handleMicrophonePermissionRequest(PermissionRequest request);
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
private PermissionHandler permissionHandler;
|
|
@@ -135,6 +137,15 @@ public class WebViewDialog extends Dialog {
|
|
|
135
137
|
permissionHandler.handleCameraPermissionRequest(request);
|
|
136
138
|
}
|
|
137
139
|
break;
|
|
140
|
+
} else if (r.equals(PermissionRequest.RESOURCE_AUDIO_CAPTURE)) {
|
|
141
|
+
Log.i("INAPPBROWSER", "RESOURCE_AUDIO_CAPTURE req");
|
|
142
|
+
// Store the permission request
|
|
143
|
+
currentPermissionRequest = request;
|
|
144
|
+
// Initiate the permission request through the plugin
|
|
145
|
+
if (permissionHandler != null) {
|
|
146
|
+
permissionHandler.handleMicrophonePermissionRequest(request);
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
138
149
|
}
|
|
139
150
|
}
|
|
140
151
|
}
|
|
@@ -57,7 +57,7 @@ public class InAppBrowserPlugin: CAPPlugin {
|
|
|
57
57
|
if clearCache {
|
|
58
58
|
URLCache.shared.removeAllCachedResponses()
|
|
59
59
|
}
|
|
60
|
-
if
|
|
60
|
+
if urlString.isEmpty {
|
|
61
61
|
HTTPCookieStorage.shared.cookies?.forEach(HTTPCookieStorage.shared.deleteCookie)
|
|
62
62
|
call.resolve()
|
|
63
63
|
return
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/inappbrowser",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "Capacitor plugin in app browser",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -78,5 +78,6 @@
|
|
|
78
78
|
"android": {
|
|
79
79
|
"src": "android"
|
|
80
80
|
}
|
|
81
|
-
}
|
|
81
|
+
},
|
|
82
|
+
"packageManager": "pnpm@9.7.0+sha512.dc09430156b427f5ecfc79888899e1c39d2d690f004be70e05230b72cb173d96839587545d09429b55ac3c429c801b4dc3c0e002f653830a420fa2dd4e3cf9cf"
|
|
82
83
|
}
|