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/06/26 13:05:50 UTC

[GitHub] [cordova-plugin-camera] jcesarmobile opened a new pull request #617: breaking(android): stop using CordovaUri helper class

jcesarmobile opened a new pull request #617:
URL: https://github.com/apache/cordova-plugin-camera/pull/617


   <!--
   Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines:
   
   http://cordova.apache.org/contribute/contribute_guidelines.html
   
   Thanks!
   -->
   
   ### Platforms affected
   android
   
   
   ### Motivation and Context
   At the moment the plugin tries to guess (in a dirty way) the image path from the content url, but that's not really necessary since we know the path beforehand, and doesn't work at the moment since the path was changed in a previous PR causing #597 
   
   ### Description
   <!-- Describe your changes in detail -->
   probably breaking change since CordovaUri class says it's for Android 4.4.4 and lower support, but since cordova-android 9 won't support versions older than 5.1, I think we can remove the class and we also need to update the plugin to use Android X, which will require cordova-android 9.
   
   What the PR does is to store the file path in a variable and use that variable to send the camera result instead of trying to guess the image path from the returned result from the camera intent, which was a dirty way of getting it (according to the method description) and which doesn't work since [this](https://github.com/apache/cordova-plugin-camera/commit/df1441420376696994d77f0856ab3dfbed5f0bbe) was merged.
   
   For that, it removes CordovaUri.java class and it's usages.
   Saves image paths in a variable to return.
   Changes the file_provider to use `cache_files` as the mentioned commit stores the images there.
   Removes code used for Android 4.4 and older.
   
   fixes https://github.com/apache/cordova-plugin-camera/issues/597
   
   ### Testing
   Tested on Android 5 and Android 9 devices with this code
   
   ```
   navigator.camera.getPicture(onSuccess, onFail, { quality: 50, destinationType: Camera.DestinationType.FILE_URI });
       function onSuccess(imageURI) {
           alert(imageURI);
           document.getElementById("photoResult").src = imageURI;
       }
       function onFail(message) {
           alert('Failed because: ' + message);
       }
   ```
   
   
   ### Checklist
   
   - [ ] I've run the tests to see all new and existing tests pass
   - [ ] I added automated test coverage as appropriate for this change
   - [x] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`)
   - [x] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
   - [ ] I've updated the documentation if necessary
   


----------------------------------------------------------------
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


[GitHub] [cordova-plugin-camera] erisu commented on a change in pull request #617: breaking(android): stop using CordovaUri helper class

Posted by GitBox <gi...@apache.org>.
erisu commented on a change in pull request #617:
URL: https://github.com/apache/cordova-plugin-camera/pull/617#discussion_r454091657



##########
File path: src/android/CameraLauncher.java
##########
@@ -290,10 +292,13 @@ public void takePicture(int returnType, int encodingType)
 
         // Specify file so that large image is captured and returned
         File photo = createCaptureFile(encodingType);
-        this.imageUri = new CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
+        System.out.println("photo "+photo.getAbsolutePath());

Review comment:
       Is this needed?

##########
File path: src/android/CameraLauncher.java
##########
@@ -290,10 +292,13 @@ public void takePicture(int returnType, int encodingType)
 
         // Specify file so that large image is captured and returned
         File photo = createCaptureFile(encodingType);
-        this.imageUri = new CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
+        System.out.println("photo "+photo.getAbsolutePath());
+        this.imageFilePath = photo.getAbsolutePath();
+        this.imageUri = FileProvider.getUriForFile(cordova.getActivity(),
                 applicationId + ".provider",
-                photo));
-        intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri.getCorrectUri());
+                photo);
+        System.out.println("image uri "+this.imageUri);

Review comment:
       Same




----------------------------------------------------------------
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


[GitHub] [cordova-plugin-camera] jcesarmobile merged pull request #617: breaking(android): stop using CordovaUri helper class

Posted by GitBox <gi...@apache.org>.
jcesarmobile merged pull request #617:
URL: https://github.com/apache/cordova-plugin-camera/pull/617


   


----------------------------------------------------------------
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


[GitHub] [cordova-plugin-camera] erisu commented on pull request #617: breaking(android): stop using CordovaUri helper class

Posted by GitBox <gi...@apache.org>.
erisu commented on pull request #617:
URL: https://github.com/apache/cordova-plugin-camera/pull/617#issuecomment-658102938


   You might also be able to rebase with master to get the additional tests to pass.


----------------------------------------------------------------
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


[GitHub] [cordova-plugin-camera] erisu commented on pull request #617: breaking(android): stop using CordovaUri helper class

Posted by GitBox <gi...@apache.org>.
erisu commented on pull request #617:
URL: https://github.com/apache/cordova-plugin-camera/pull/617#issuecomment-657962775


   Other then the comments, I think the rest is OK 👌 


----------------------------------------------------------------
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