feat(account): add support for PNG avatars#10506
Conversation
wmontwe
left a comment
There was a problem hiding this comment.
Thank your for adding support for PNG avatars!
You also need to patch the UpdateAvatarImage use case as it checks the mime type and rejects non JPEG files. Additionally I would change the imagePicker to use OpenDocument to allow you to define a list of allowed file types.
...ain/kotlin/net/thunderbird/feature/account/settings/impl/ui/general/GeneralSettingsScreen.kt
Outdated
Show resolved
Hide resolved
|
Thanks! Maybe I completely forgot about that. It should work now with |
Thanks, sadly all the fancy image selection supports either a single MIME type or applies no limit. I had a look at the There are some conflicts with a fix I had to do for our beta #10500. Could you also squash the two When all checks pass, this is ready to be merged. |
|
I'm working on this, however it's quite overwhelming as I am new to Kotlin, but it should work by noon (hopefully). |
|
@McBaumwolle no problem, we know that this is not a simple project and if something doesn't work, I could have a look. |
52121c0 to
d6f4e35
Compare
|
Soo I think I got it now, and it also seems to work with your changes (#10500) and updates as it should. On my phone it also once again only allowed for |
569cb44 to
fea5dcc
Compare
.../kotlin/net/thunderbird/feature/account/avatar/data/datasource/LocalAvatarImageDataSource.kt
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
.../kotlin/net/thunderbird/feature/account/avatar/data/datasource/LocalAvatarImageDataSource.kt
Show resolved
Hide resolved
.../kotlin/net/thunderbird/feature/account/avatar/data/datasource/LocalAvatarImageDataSource.kt
Show resolved
Hide resolved
|
I usally run |
|
Thank you for all your help, @wmontwe - it should all work now (and I completely forgot about the documentation)! |
|
Thanks for your contribution! Your pull request has been merged and will be part of Thunderbird 17. We appreciate the time and effort you put into improving Thunderbird. If you haven’t already, you’re welcome to join our Matrix chat for contributors. It’s where we discuss development and help each other out. https://matrix.to/#/#tb-android-dev:mozilla.org |
Description
This PR updates the account avatar logic to support both
.jpgand.pngfile extensions. Previously, all avatars were forced to use the.jpgextension, which caused issues when someone uploaded PNGs, especially those with transparency (I tried some for my main email and did not understand why it failed at first, or rather did not show the images in the picker).Changes
LocalAvatarImageDataSourcenow detects if the source image is a PNG and saves it with the correct.pngextension.delete()function now checks for and removes both.jpgand.pngfiles for the given account. This ensures that, when a user switches from a JPEG avatar to a PNG avatar (or vice versa), the old file is deleted and does not remain orphaned.LocalAvatarImageDataSourceTestto verify PNG support and ensure the clean-up logic works for multiple file types.Fixes:
#10501