Skip to content

Conversation

vicajilau
Copy link
Collaborator

@vicajilau vicajilau commented Mar 27, 2025

Fixes #1742
Fixes #1743

@vicajilau vicajilau linked an issue Mar 27, 2025 that may be closed by this pull request
@vicajilau vicajilau requested a review from navaronbracke March 27, 2025 16:31
Copy link
Collaborator

@navaronbracke navaronbracke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vicajilau Does this fix the compression quality bug?

Maybe we should just have allowCompression be deprecated (and removed in the Java class).

I think we can look at the value of compressionQuality to determine if we should compress the image? Like, if compressionQuality is 0 (which would be the new default), we do not compress.

@vicajilau vicajilau changed the title Removed compressionQuality by default Changed compressionQuality by default to 0 Mar 28, 2025
@daniJimen
Copy link
Contributor

daniJimen commented Mar 28, 2025

@vicajilau @navaronbracke many thanks for your fast resolution, i appreciate that, for me the resolution its perfect! i would add only one think about that and its instead create the compressed image into pictures folder (when the user set any compression level), create the image into app folder to not create a lot of images into a shared folder

@vicajilau
Copy link
Collaborator Author

vicajilau commented Mar 28, 2025

@navaronbracke and @daniJimen, We have to keep in mind that only Android and iOS uses these two properties (allowCompression and compressionQuality). Compression capability is ignored on all other platforms (Linux, macOS, Windows and Web).

Copy link
Collaborator

@navaronbracke navaronbracke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small remarks, but otherwise LGTM.

Sadly changing the default compression quality could be seen as a breaking change? (Even though it is used to fix a bug)

if (onFileLoading != null) {
_eventSubscription = _eventChannel.receiveBroadcastStream().listen(
(data) => onFileLoading((data as bool)
(data) => onFileLoading((data is bool)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its still broken

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File storageDir = context.getCacheDir();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is to fix #1743 ?

Copy link
Collaborator Author

@vicajilau vicajilau Mar 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES!! And not only because this will fix #1742 too, also aligning android and iOS flows

private static File createImageFile() throws IOException {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
private static File createImageFile(Context context) throws IOException {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch for the locale!

@vicajilau vicajilau requested a review from navaronbracke March 28, 2025 10:37
@vicajilau
Copy link
Collaborator Author

Everything ready @navaronbracke 🚀

@vicajilau
Copy link
Collaborator Author

Conflicts resolved @navaronbracke

Copy link
Collaborator

@navaronbracke navaronbracke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update the major version, since this changes the default value of the compressionQuality, so people might be surprised if the compression breaks when updating. (going from a default of 30 to 0)

@vicajilau vicajilau requested a review from navaronbracke March 31, 2025 06:43
CHANGELOG.md Outdated
@@ -1,10 +1,18 @@
## 10.0.0
### General
- The `compressionQuality` property in the `pickFiles` method now defaults to `0`, and `allowCompression` is set to `false`. [@vicajilau](https://github.com/vicajilau).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you removed the wrong duplicated section here? Now the breaking change label is gone.

@vicajilau
Copy link
Collaborator Author

Everything ready as you suggested @navaronbracke 🚀

@navaronbracke
Copy link
Collaborator

Updated the OP so that the mentioned issues will be closed when this is merged.

@navaronbracke navaronbracke merged commit 2012577 into master Mar 31, 2025
3 checks passed
@vicajilau vicajilau deleted the feature/image-duplication-in-pictures-folder-on-android branch March 31, 2025 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Image duplication in "Pictures" folder on Android Android 11 or less - permission denied exception when compressionQuality not 0

4 participants