@capgo/capacitor-contacts 8.0.8 → 8.0.10
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.
|
@@ -39,7 +39,7 @@ import java.util.Set;
|
|
|
39
39
|
)
|
|
40
40
|
public class CapacitorContactsPlugin extends Plugin {
|
|
41
41
|
|
|
42
|
-
private final String pluginVersion = "8.0.
|
|
42
|
+
private final String pluginVersion = "8.0.10";
|
|
43
43
|
private static final int BATCH_SIZE = 50;
|
|
44
44
|
|
|
45
45
|
// MARK: - Implemented API surface
|
|
@@ -186,9 +186,34 @@ public class CapacitorContactsPlugin extends Plugin {
|
|
|
186
186
|
|
|
187
187
|
@PluginMethod
|
|
188
188
|
public void requestPermissions(PluginCall call) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
JSArray permissions = call.getArray("permissions");
|
|
190
|
+
String[] aliases;
|
|
191
|
+
|
|
192
|
+
if (permissions == null || permissions.length() == 0) {
|
|
193
|
+
aliases = new String[] { "readContacts", "writeContacts" };
|
|
194
|
+
} else {
|
|
195
|
+
List<String> requestedAliases = new ArrayList<>();
|
|
196
|
+
|
|
197
|
+
for (int i = 0; i < permissions.length(); i++) {
|
|
198
|
+
String alias = permissions.optString(i, null);
|
|
199
|
+
if (alias == null) {
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if ("readContacts".equals(alias) || "writeContacts".equals(alias)) {
|
|
204
|
+
requestedAliases.add(alias);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (requestedAliases.isEmpty()) {
|
|
209
|
+
call.reject("No valid permissions requested.");
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
aliases = requestedAliases.toArray(new String[0]);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
requestPermissionForAliases(aliases, call, "handleRequestPermissions");
|
|
192
217
|
}
|
|
193
218
|
|
|
194
219
|
@PermissionCallback
|
|
@@ -5,7 +5,7 @@ import UIKit
|
|
|
5
5
|
|
|
6
6
|
@objc(CapacitorContactsPlugin)
|
|
7
7
|
public class CapacitorContactsPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
8
|
-
private let pluginVersion: String = "8.0.
|
|
8
|
+
private let pluginVersion: String = "8.0.10"
|
|
9
9
|
public let identifier = "CapacitorContactsPlugin"
|
|
10
10
|
public let jsName = "CapacitorContacts"
|
|
11
11
|
public let pluginMethods: [CAPPluginMethod] = [
|