Skip to content

Conversation

@chrisbobbe
Copy link
Collaborator

Stacked atop #1928.

@chrisbobbe chrisbobbe requested a review from gnprice October 30, 2025 21:45
@chrisbobbe chrisbobbe added the integration review Added by maintainers when PR may be ready for integration label Oct 30, 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.

Sure, seems reasonable — small comments below.

The commit message says "centralize", but it looks like there's only one call site. Are you planning to add another call site?

Comment on lines 493 to 494
/// Always show the animated version, ignoring device settings.
animateAlways,
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a use case for this value? I'd think not, and I don't see it used in this version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm thinking of when the user asks to see the animation, which they haven't seen yet because "Auto-Play Animated Images" is off. Maybe by opening an image preview in the lightbox, or by doing that and then pressing a "play" button that we would add?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree "ignoring device settings" doesn't sound right for that use case though :)

Comment on lines 496 to 497
/// Always show the still version, ignoring device settings.
animateNever,
Copy link
Member

Choose a reason for hiding this comment

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

And then I wouldn't think of this as "ignoring" settings — it's more like "even if allowed by device settings". (After all, there isn't really a setting that means "please use animations whenever at all possible, even where inappropriate".)

@@ -1,3 +1,4 @@
import 'package:flutter/widgets.dart';
Copy link
Member

Choose a reason for hiding this comment

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

I don't love introducing a widgets import in model code. (Looks like we have two of those so far.)

I think widgets/emoji.dart would be a good home for this logic.

In fact: even apart from the need for resolve to import the widgets library, I think widgets/emoji.dart is a more natural home for the enum itself than model/settings.dart is. That's because the enum values don't represent possible values of a setting, but rather possible choices for how different parts of our UI might configure a shared widget. IOW it's more about the widgets than it is about a setting.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since this will also be useful for animated image content in Zulip messages, how about maybe lib/widgets/content.dart, or maybe a new file lib/widgets/image.dart? (And the latter might be a nicer home for RealmContentNetworkImage than the former, actually?)

Copy link
Member

Choose a reason for hiding this comment

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

Sure, a widgets/image.dart file sounds good. RealmContentNetworkImage has long been a bit of an awkward fit in the file where it is.

Comment on lines 483 to 488
/// Callers should try to check whether an image is animated,
/// i.e. whether it has separate still and animated versions.
/// This can't be done perfectly (in 2025-10)
/// because of animated emoji that were uploaded before Zulip Server 5
/// and don't have `still_url` filled in:
/// https://github.com/zulip/zulip/issues/36339 .
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what this is saying a caller needs to do.

Is the "can't be done perfectly" just a reference to the fact that ImageEmojiDisplay.resolvedStillUrl is nullable? In that case, the second sentence seems like it belongs more on that field. Or perhaps better yet, on RealmEmojiItem.stillUrl which drives it.

@chrisbobbe chrisbobbe force-pushed the pr-centralize-should-animate-checks branch from d3479af to 1699aa5 Compare November 1, 2025 00:57
@chrisbobbe
Copy link
Collaborator Author

Thanks for the review! Revision pushed.

@gnprice
Copy link
Member

gnprice commented Nov 1, 2025

Thanks! Looks good; merging.

@gnprice gnprice merged commit 1699aa5 into zulip:main Nov 1, 2025
1 check passed
@chrisbobbe chrisbobbe deleted the pr-centralize-should-animate-checks branch November 1, 2025 01:21
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.

2 participants