@capacitor/camera 5.0.0-alpha.1 → 5.0.0-nightly-20230320T150751.0

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.
@@ -17,7 +17,7 @@ buildscript {
17
17
  }
18
18
  }
19
19
  dependencies {
20
- classpath 'com.android.tools.build:gradle:7.2.1'
20
+ classpath 'com.android.tools.build:gradle:7.4.1'
21
21
  if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
22
22
  classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
23
23
  }
@@ -372,7 +372,12 @@ public class CameraPlugin extends Plugin {
372
372
  } else if (data.getExtras() != null) {
373
373
  Bundle bundle = data.getExtras();
374
374
  if (bundle.keySet().contains("selectedItems")) {
375
- ArrayList<Parcelable> fileUris = bundle.getParcelableArrayList("selectedItems");
375
+ ArrayList<Parcelable> fileUris;
376
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
377
+ fileUris = bundle.getParcelableArrayList("selectedItems", Parcelable.class);
378
+ } else {
379
+ fileUris = getLegacyParcelableArrayList(bundle, "selectedItems");
380
+ }
376
381
  if (fileUris != null) {
377
382
  for (Parcelable fileUri : fileUris) {
378
383
  if (fileUri instanceof Uri) {
@@ -402,6 +407,11 @@ public class CameraPlugin extends Plugin {
402
407
  }
403
408
  }
404
409
 
410
+ @SuppressWarnings("deprecation")
411
+ private ArrayList<Parcelable> getLegacyParcelableArrayList(Bundle bundle, String key) {
412
+ return bundle.getParcelableArrayList(key);
413
+ }
414
+
405
415
  private void processPickedImage(Uri imageUri, PluginCall call) {
406
416
  InputStream imageStream = null;
407
417
 
@@ -798,9 +808,18 @@ public class CameraPlugin extends Plugin {
798
808
  int flags = Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
799
809
  editIntent.addFlags(flags);
800
810
  editIntent.putExtra(MediaStore.EXTRA_OUTPUT, editUri);
801
- List<ResolveInfo> resInfoList = getContext()
802
- .getPackageManager()
803
- .queryIntentActivities(editIntent, PackageManager.MATCH_DEFAULT_ONLY);
811
+
812
+ List<ResolveInfo> resInfoList;
813
+
814
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
815
+ resInfoList =
816
+ getContext()
817
+ .getPackageManager()
818
+ .queryIntentActivities(editIntent, PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY));
819
+ } else {
820
+ resInfoList = legacyQueryIntentActivities(editIntent);
821
+ }
822
+
804
823
  for (ResolveInfo resolveInfo : resInfoList) {
805
824
  String packageName = resolveInfo.activityInfo.packageName;
806
825
  getContext().grantUriPermission(packageName, editUri, flags);
@@ -811,6 +830,11 @@ public class CameraPlugin extends Plugin {
811
830
  }
812
831
  }
813
832
 
833
+ @SuppressWarnings("deprecation")
834
+ private List<ResolveInfo> legacyQueryIntentActivities(Intent intent) {
835
+ return getContext().getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
836
+ }
837
+
814
838
  @Override
815
839
  protected Bundle saveInstanceState() {
816
840
  Bundle bundle = super.saveInstanceState();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/camera",
3
- "version": "5.0.0-alpha.1",
3
+ "version": "5.0.0-nightly-20230320T150751.0",
4
4
  "description": "The Camera API provides the ability to take a photo with the camera or choose an existing one from the photo album.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "b980c4d862b72610560a6cedc69238021c5367cc"
82
+ "gitHead": "a8c50bd448824cf38caa9717717b6c02143f4a1f"
83
83
  }