You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/10/14 08:57:22 UTC

[GitHub] [cordova-plugin-camera] PieterVanPoyer commented on a change in pull request #669: Bugfix issue 341 save to photo gallery - Fixes #341, fixes #577

PieterVanPoyer commented on a change in pull request #669:
URL: https://github.com/apache/cordova-plugin-camera/pull/669#discussion_r504514583



##########
File path: src/android/CameraLauncher.java
##########
@@ -494,16 +494,18 @@ private void processResultFromCamera(int destType, Intent intent) throws IOExcep
         // in the gallery and the modified image is saved in the temporary
         // directory
         if (this.saveToPhotoAlbum) {
-            galleryUri = Uri.fromFile(new File(getPicturesPath()));
+            GalleryPathVO galleryPathVO = getPicturesPath();
+            galleryUri = Uri.fromFile(new File(galleryPathVO.getGalleryPath()));
 
             if (this.allowEdit && this.croppedUri != null) {
                 writeUncompressedImage(croppedUri, galleryUri);
             } else {
-                Uri imageUri = this.imageUri;
-                writeUncompressedImage(imageUri, galleryUri);
+                if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) { // Between LOLLIPOP_MR1 and P

Review comment:
       Yes, this works.
   - I dit test with target API 29, and 5.1 emulator. It works.
   
   The Build.VERSION_CODES are compile-time constants that gets inlined in the generated bytecode. Because of that, the symbol does not need to be resolved at runtime.
   
   Some additional context:
   - I did also make the decision to use smaller or equal to Build.VERSION_CODES.P instead of smaller than Build.VERSION_CODES.Q . Because When you downscale the compile version to 28, it keeps compiling and working. 
   - But you cannot compile with version 27. Becuase VERSION_CODES.P is not available in that sdk.
   
   ![image](https://user-images.githubusercontent.com/33040889/95965581-6280c480-0e0a-11eb-8582-ff70d190dd56.png)
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org