Skip to content

Conversation

@chrisbobbe
Copy link
Collaborator

Stacked on #1926.

This resolves a few TODOs, and will be useful toward

@chrisbobbe chrisbobbe added the maintainer review PR ready for review by Zulip maintainers label Oct 18, 2025
@chrisbobbe
Copy link
Collaborator Author

Revision pushed, fixing a bug where I forgot to use neverAnimate in EmojiWidget, and adding a new commit:

ef29c09 settings [nfc]: Centralize logic for checking device animation settings

Copy link
Member

@rajveermalviya rajveermalviya left a comment

Choose a reason for hiding this comment

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

Thanks @chrisbobbe. Overall LGTM, just one comment.

emojiDisplay: emojiDisplay,
squareDimension: size,
neverAnimateImage: neverAnimate,
imageAnimationMode: ImageAnimationMode.animateNever,
Copy link
Member

Choose a reason for hiding this comment

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

Should this respect the value of neverAnimate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ooh, yes, thanks for the catch!

@chrisbobbe
Copy link
Collaborator Author

Thanks for the review! Revision pushed.

Copy link
Member

@rajveermalviya rajveermalviya left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM, moving over to Greg's review.

@rajveermalviya rajveermalviya added integration review Added by maintainers when PR may be ready for integration and removed maintainer review PR ready for review by Zulip maintainers labels Oct 24, 2025
Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks for this cleanup! Here's a review of the first 6 commits:
dc5d5dd emoji [nfc]: Dartdoc EmojiStore.emojiDisplayFor
0813931 emoji [nfc]: Pull out textEmojiForEmojiName helper
23985d3 emoji_reaction [nfc]: Inline _UnicodeEmoji
ea3299a emoji_reaction [nfc]: Inline _ImageEmoji
59f4a86 emoji_reaction [nfc]: Give _TextEmoji the emoji name more straightforwardly
6311f4f emoji [nfc]: Add reusable EmojiWidget; use it in ReactionChip

Going AFK for the moment, so I'll leave for a later review the remaining 6 commits:
329c335 emoji [nfc]: Use EmojiWidget in emoji picker and autocomplete
26ac403 emoji_reaction [nfc]: Use EmojiWidget in view-reactions header
29aeecb user status: When we can't load image emoji, lay out a padded empty square
3fece59 user status [nfc]: Pull Padding outside the emojiDisplay switch
30110ba user status [nfc]: Use EmojiWidget
3d7da28 settings [nfc]: Centralize logic for checking device animation settings

(Also on an early skim the last commit looks like it'd be best as a separate PR — seems nontrivial, and thematically rather separate from the rest.)

Comment on lines 124 to 127
/// May be a [TextEmojiDisplay] even if the emojiset is not [Emojiset.text];
/// this happens for image emojis whose URLs don't parse.
EmojiDisplay emojiDisplayFor({
Copy link
Member

Choose a reason for hiding this comment

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

Looking at the implementation, there are a few other cases where this happens, right? Seems like more generally it's when we can't understand the data that describes the emoji.

Comment on lines 77 to 79
UnicodeEmojiDisplay() => UnicodeEmojiWidget(
size: squareDimension,
emojiDisplay: emojiDisplay),
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this drops textScaler.

Comment on lines 57 to 58
ImageErrorWidgetBuilder _getImageErrorBuilder(double effectiveSize) {
return (_, _, _) => switch (imagePlaceholderStyle) {
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this indirection of a function returning a function can be simplified: we can wait to compute effectiveSize until the point where it turns out we need it.

This makes the caller a bit more verbose, but we're about to make it
simpler than it was before.
This makes the caller a bit more verbose, but we're about to make it
simpler than it was before.
There are several places where we switch on EmojiDisplay, mostly
with TODOs to factor the switch out to something central. Here's a
widget to accomplish that factoring, used first in ReactionChip.
…quare

Instead of laying out
- just padding, in the case where the network request failed, and
- nothing, in the case where the URL didn't parse.
@chrisbobbe
Copy link
Collaborator Author

chrisbobbe commented Oct 30, 2025

Thanks! Revision pushed, and I'll send that last commit in a separate PR. -> #1957

Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks! Just nits below.

Comment on lines +379 to +384
buildCustomTextEmoji: () {
// emojiDisplay is not TextEmojiDisplay,
// and imagePlaceholderStyle is not EmojiImagePlaceholderStyle.text.
assert(false);
return SizedBox.shrink();
},
Copy link
Member

Choose a reason for hiding this comment

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

Since this case can't happen, seems simpler to pass over it in silence 🙂 — I think the reader here won't naturally feel a need to think about it if the code doesn't bring it up

Copy link
Member

Choose a reason for hiding this comment

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

Particularly as if this case does happen, and the reader works out what this SizedBox.shrink produces in the layout, it seems like it'd be glitchy — we'd still have the 6px padding below but now around a zero-sized box.

Comment on lines +363 to +364
child: EmojiWidget(
emojiDisplay: emojiDisplay,
Copy link
Member

Choose a reason for hiding this comment

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

nit: over-indented as of the penultimate commit:

+      child: switch (emojiDisplay) {
+          UnicodeEmojiDisplay() => UnicodeEmojiWidget(size: size, emojiDisplay:
 emojiDisplay),
+          ImageEmojiDisplay() => ImageEmojiWidget(

neverAnimate: neverAnimate,
// If image emoji fails to load, show nothing.
errorBuilder: (_, _, _) => placeholder)),
// The user-status feature doesn't support a :text_emoji:-style display.
Copy link
Member

Choose a reason for hiding this comment

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

I think this line would be good as a replacement for the "Web doesn't seem to respect …" comment above. This one is stating a product/design choice we've made, which is what I think has effectively happened here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration review Added by maintainers when PR may be ready for integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants