capacitor-camera-module 0.0.20 → 0.0.21
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.
|
@@ -418,7 +418,7 @@ public class CameraModulePlugin extends Plugin {
|
|
|
418
418
|
permissionsToRequest = new String[]{ Manifest.permission.READ_EXTERNAL_STORAGE };
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
//
|
|
421
|
+
// Verificar si ya están concedidos
|
|
422
422
|
boolean granted = true;
|
|
423
423
|
for (String perm : permissionsToRequest) {
|
|
424
424
|
if (ContextCompat.checkSelfPermission(getContext(), perm) != PackageManager.PERMISSION_GRANTED) {
|
|
@@ -428,9 +428,8 @@ public class CameraModulePlugin extends Plugin {
|
|
|
428
428
|
}
|
|
429
429
|
|
|
430
430
|
if (!granted) {
|
|
431
|
-
//
|
|
432
|
-
|
|
433
|
-
requestPermissions(permissionsToRequest, "galleryPermissionCallback");
|
|
431
|
+
// Pedir permisos dinámicamente
|
|
432
|
+
requestPermissions(permissionsToRequest, call, "galleryPermissionCallback");
|
|
434
433
|
} else {
|
|
435
434
|
JSObject ret = new JSObject();
|
|
436
435
|
ret.put("granted", true);
|
|
@@ -440,6 +439,7 @@ public class CameraModulePlugin extends Plugin {
|
|
|
440
439
|
}
|
|
441
440
|
}
|
|
442
441
|
|
|
442
|
+
|
|
443
443
|
@PermissionCallback
|
|
444
444
|
private void galleryPermissionCallback(PluginCall call) {
|
|
445
445
|
JSObject ret = new JSObject();
|
|
@@ -458,6 +458,7 @@ public class CameraModulePlugin extends Plugin {
|
|
|
458
458
|
call.resolve(ret);
|
|
459
459
|
}
|
|
460
460
|
|
|
461
|
+
|
|
461
462
|
@PluginMethod
|
|
462
463
|
public void checkAndRequestGalleryPermission(PluginCall call) {
|
|
463
464
|
if (getPermissionState("gallery") == PermissionState.GRANTED) {
|