Skip to content
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

Disable animation for goal thumbnails #625

Merged
merged 1 commit into from
Jan 26, 2025
Merged

Conversation

theospears
Copy link
Collaborator

@theospears theospears commented Jan 26, 2025

Summary

Animation of goal thumbnails in the gallery often had some unfortunate affects:

  • Because gallery cells are re-used, on returning to the gallery from a goal the gallery entry for a goal would show the graph for a different goal before fading to the right one
  • Refreshing the gallery would cause images to flicker to slightly darker and back

It may be possible to more carefully choose when to animate to address these, but for now avoid the issue by not animating thumbnails.

Validation

Loaded the app and navigated to a goal and back. Observed the gallery immediately showed the correct graphs.

@theospears theospears changed the title disable thumbnail animation Disable animation for goal thumbnails Jan 26, 2025
Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@theospears theospears marked this pull request as ready for review January 26, 2025 06:07
@theospears theospears requested a review from a team as a code owner January 26, 2025 06:07
@theospears theospears merged commit 638b04a into master Jan 26, 2025
6 checks passed
@theospears theospears deleted the no-animate-thumbnails branch January 26, 2025 06:14
@@ -77,8 +77,13 @@ class GoalImageView : UIView {

@MainActor
private func showGraphImage(image: UIImage) {
// Animating the thumbnail view interacts badly with cell re-use in the gallery
Copy link
Contributor

@krugerk krugerk Jan 26, 2025

Choose a reason for hiding this comment

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

I would guess there is something wrong with the cell or the GoalImageView itself.

GoalCollectionViewCell has its prepareForReuse method which is called when the system is about to reuse a cell. The method should finish with the cell being in the state that it can be reused again. As is, it sets the thumbnailImageView's goal to nil.

The expectation is probably that doing so would set the thumbnailImageView to set the graph placeholder as the image or at the very least remove the previously associated graph-thumbnail.

So what is going on in the lifecycle of GoalImageView? When is clearGoalGraph being called?

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.

2 participants