capacitor-camera-module 0.0.22 → 0.0.24
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.
|
@@ -303,10 +303,16 @@ public class CameraModulePlugin extends Plugin {
|
|
|
303
303
|
call.resolve(ret);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
+
|
|
306
307
|
@PluginMethod
|
|
307
308
|
public void pickImageBase64(PluginCall call) {
|
|
308
309
|
|
|
309
|
-
|
|
310
|
+
String alias =
|
|
311
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
|
|
312
|
+
? "gallery_13"
|
|
313
|
+
: "gallery_pre13";
|
|
314
|
+
|
|
315
|
+
if (getPermissionState(alias) != PermissionState.GRANTED) {
|
|
310
316
|
call.reject("Gallery permission not granted");
|
|
311
317
|
return;
|
|
312
318
|
}
|
|
@@ -323,6 +329,7 @@ public class CameraModulePlugin extends Plugin {
|
|
|
323
329
|
}
|
|
324
330
|
|
|
325
331
|
|
|
332
|
+
|
|
326
333
|
private String uriToBase64(Uri uri) throws Exception {
|
|
327
334
|
InputStream inputStream =
|
|
328
335
|
getContext().getContentResolver().openInputStream(uri);
|
|
@@ -458,25 +465,24 @@ public class CameraModulePlugin extends Plugin {
|
|
|
458
465
|
@PluginMethod
|
|
459
466
|
public void getLastGalleryImage(PluginCall call) {
|
|
460
467
|
|
|
461
|
-
|
|
468
|
+
String alias = Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU ? "gallery_13" : "gallery_pre13";
|
|
469
|
+
|
|
470
|
+
if (getPermissionState(alias) != PermissionState.GRANTED) {
|
|
462
471
|
call.reject("Gallery permission not granted");
|
|
463
472
|
return;
|
|
464
473
|
}
|
|
465
474
|
|
|
466
475
|
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
|
467
476
|
|
|
468
|
-
String[] projection = {
|
|
469
|
-
MediaStore.Images.Media._ID
|
|
470
|
-
};
|
|
471
|
-
|
|
477
|
+
String[] projection = { MediaStore.Images.Media._ID };
|
|
472
478
|
String sortOrder = MediaStore.Images.Media.DATE_ADDED + " DESC";
|
|
473
479
|
|
|
474
480
|
try (Cursor cursor = getContext().getContentResolver().query(
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
481
|
+
uri,
|
|
482
|
+
projection,
|
|
483
|
+
null,
|
|
484
|
+
null,
|
|
485
|
+
sortOrder
|
|
480
486
|
)) {
|
|
481
487
|
if (cursor != null && cursor.moveToFirst()) {
|
|
482
488
|
long id = cursor.getLong(0);
|
|
@@ -500,4 +506,5 @@ public class CameraModulePlugin extends Plugin {
|
|
|
500
506
|
|
|
501
507
|
|
|
502
508
|
|
|
509
|
+
|
|
503
510
|
}
|