capacitor-camera-module 0.0.22 → 0.0.23
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.
|
@@ -458,25 +458,24 @@ public class CameraModulePlugin extends Plugin {
|
|
|
458
458
|
@PluginMethod
|
|
459
459
|
public void getLastGalleryImage(PluginCall call) {
|
|
460
460
|
|
|
461
|
-
|
|
461
|
+
String alias = Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU ? "gallery_13" : "gallery_pre13";
|
|
462
|
+
|
|
463
|
+
if (getPermissionState(alias) != PermissionState.GRANTED) {
|
|
462
464
|
call.reject("Gallery permission not granted");
|
|
463
465
|
return;
|
|
464
466
|
}
|
|
465
467
|
|
|
466
468
|
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
|
467
469
|
|
|
468
|
-
String[] projection = {
|
|
469
|
-
MediaStore.Images.Media._ID
|
|
470
|
-
};
|
|
471
|
-
|
|
470
|
+
String[] projection = { MediaStore.Images.Media._ID };
|
|
472
471
|
String sortOrder = MediaStore.Images.Media.DATE_ADDED + " DESC";
|
|
473
472
|
|
|
474
473
|
try (Cursor cursor = getContext().getContentResolver().query(
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
474
|
+
uri,
|
|
475
|
+
projection,
|
|
476
|
+
null,
|
|
477
|
+
null,
|
|
478
|
+
sortOrder
|
|
480
479
|
)) {
|
|
481
480
|
if (cursor != null && cursor.moveToFirst()) {
|
|
482
481
|
long id = cursor.getLong(0);
|
|
@@ -500,4 +499,5 @@ public class CameraModulePlugin extends Plugin {
|
|
|
500
499
|
|
|
501
500
|
|
|
502
501
|
|
|
502
|
+
|
|
503
503
|
}
|