erisu commented on code in PR #970:
URL:
https://github.com/apache/cordova-plugin-camera/pull/970#discussion_r4022532674
##########
src/android/CameraLauncher.java:
##########
@@ -1214,6 +1219,37 @@ private void cleanup(Uri oldImage, Uri newImage, Bitmap
bitmap) {
System.gc();
}
+ /**
+ * Best-effort cleanup for temporary files when capture/selection is
cancelled or stopped.
+ */
+ private void cleanupPendingResultFiles() {
+ deleteIfExists(this.imageUri);
Review Comment:
I think the `imageUri` contains a `content://` URI, and the `deleteIfExists`
method which uses `new File(filePath).delete()` would not work as it expects a
filesystem path.
I believe we would need to use the `ContentResolver` to delete the file by
passing in the `imageUri`.
##########
src/android/CameraLauncher.java:
##########
@@ -1214,6 +1219,37 @@ private void cleanup(Uri oldImage, Uri newImage, Bitmap
bitmap) {
System.gc();
}
+ /**
+ * Best-effort cleanup for temporary files when capture/selection is
cancelled or stopped.
+ */
+ private void cleanupPendingResultFiles() {
+ deleteIfExists(this.imageUri);
+ deleteIfExists(this.croppedUri);
Review Comment:
In this case, I think `croppedUri` is not a content URI so it is correct.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]