-
Notifications
You must be signed in to change notification settings - Fork 309
Fix avatar blurriness in profile screen #534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@gnprice could you review this PR and let me know if any changes are required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
Before we can review this in detail, it will need tests, and both the new and existing tests will need to be passing.
On running the tests and writing tests, see the project README.
For this code, because it's based on existing code in zulip-mobile, it would be good to also transcribe that code's tests and make sure that this new code passes all the same tests. If there are any tests of the zulip-mobile code that for some reason don't make sense in this version, then note that with a comment.
@gnprice There are a few sections of this PR currently that might need to be discussed before implementation. I've listed them below: Handling Avatar URL set to nullIn the AvatarImage widget the resolvedUrl variable could possibly be null, this has been marked as a TODO(#255). I've handled this edge case inside the AvatarURL class. But this doesn't pass a few UI tests as when url is null the widget returned is expected to be SizedBox.shrink(), I propose we should make those changes in the UI tests. The current temporary patch is as below. Setting default size for imagesIn the AvatarImage widget, I added a size param that allows me to recompute the image URL for better resolution. But the AvatarImage widget is used in several places without being provided with a size param hence I have to use a default value of 30 as implemented above. I would like to hear your thoughts as to how I should proceed with them. |
Sure, thanks for the clear questions. When There's another case where For the size, the AvatarImage widget hasn't previously called for a size because it hasn't previously had anything it would do with that information — it's been always fetchinig the same image regardless of what size it'll be shown at. Now that it does need to know the size, though, it should take the size as a parameter. I don't think there's a good default that AvatarImage can use for the size — sometimes it'll be used in a place where it's going to be shown large, and sometimes where it's going to be shown small, and there's no reasonable way it can guess. So the parameter should just be required. |
Ah, no, I've now gone and reread #255 and I see that's not the correct behavior here. Currently there should not be any null values in If we were to turn on both of the features described in #254 and #255 (and not do anything else), then we'd have two different cases both show up as null there: the case where we should compute a gravatar, and the case where we should compute a fallback avatar URL. That's because one of those would be represented by When we do go to take care of those two issues, then, we'll need to add a wrinkle in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @saisumith770 for the contribution! Comments below, and see also high-level comments above.
@gnprice You mentioned that size should be a required parameter for AvatarImage, but in the recent_dm_conversations.dart file AvatarImage is used without providing the size param. This is in the previous version of the app. How should this be handled ! |
At those call sites, the caller should pass the actual size the AvatarImage will have. If you look around at the surrounding code, the caller does know the size. It just hasn't been passing it to AvatarImage because there hasn't previously been anything that AvatarImage would do with that information. |
Refer commit 533c6ca also changed the avatar function naming in 5be3f1a |
@gnprice could you review the changes! Thank you for your efforts 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the revision! Here's a fresh round of review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started doing another round of review, but then I realized you hadn't actually said the PR was ready for another round. And indeed there are a number of comments you haven't yet gotten to — which is fine, please take as much time as you need for addressing the review feedback.
Just reply here to say when it's ready for another round. I'm also happy to answer specific questions in between, like at #534 (comment) above.
Anyway, here are the couple of items I spotted as I was just beginning a review.
@gnprice I've made the suggested changes, do let me know if any revisions are required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the revision! This is getting a lot closer.
There's a variety of comments below. One other important thing we'll need before we can merge this is that the commits in the branch need to be squashed and reorganized into clear and coherent commits, following the Zulip project's Git style: https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html
For this PR, I think that will mean two commits:
- One commit adding
size
toAvatarImage
, and making the necessary changes where that widget is used. This commit should be an NFC commit. - Then one commit with the rest of the changes: adding
AvatarUrl
and subclasses, using that fromAvatarImage
, adding the tests.
To get there from your current structure, my suggestion would be:
- First,
git rebase
to get on top of current main and eliminate the merge commit. (If this hits any merge conflicts, the easiest solution might be to abort the rebase and usegit merge origin/main
instead. You'll still have conflicts but all at once, which in this case is probably easiest.) - Then
git reset origin/main
, so that your current commit isorigin/main
but you have all your changes to files. - Then
git add -p
followed bygit commit
, to make the first commit. - Then
git add
andgit commit
to make the second commit.
But if you have another procedure you're comfortable with that gets the right result, that's good too. If you have any questions with the Git manipulations or want any help, just ask in #git help
on chat.zulip.org.
@gnprice I've made the changes, if it's alright then I will start squashing the commits as requested |
Sure — please go ahead. |
7ba0055
to
6a17b75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @saisumith770 for the revision! This is close to merging now.
A few comments below on the code. The commit structure all looks good.
The commit messages are close but need a few changes. I can make a final pass on those before merging, but please also try to give them another round of editing yourself. Take a look again in particular at this section of the Zulip commit style guide:
https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html#commit-summary-part-2
For the main commit (the second one, the one making most of the changes), see also the paragraph about GitHub issues in this section:
https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html#commit-description
and see this section about what information goes in the description:
https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html#the-purpose-of-the-commit-description
Finally, looking back at the screenshots in the description: please include "before" versions as well as "after". That helps make it easy to see from the screenshots what's changed in the UI.
4d3f6b5
to
3072030
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the revision! This is very close now to merge.
Just one comment on the revised code, below.
The commit messages also look good, except that the main commit's message should say it's closing the issue. (Hmm — and the PR description, at the top of this thread, should do so too.) It could also benefit from just a few more words saying what it's doing. So here's a revised version:
avatar: Fix blurriness on profile screen by adjusting physical image size
Fixes: #301
Please also add "before" as well as "after" screenshots as mentioned above. (Rereading, I see you didn't actually say this was ready for re-review, so perhaps you were already planning to do that.)
@gnprice I've made the suggested changes! |
Looks good — merging. Thanks @saisumith770 for all your work on this! |
Description
Updated the avatar URL used in the profile screen to request a higher-resolution image to reduce blurriness.
Fixes #301
Outcome