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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion BeeSwift/Components/GoalImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?

// e.g. it would cause us to show the image from a different goal before animating
// to the corrent one.
let duration = isThumbnail ? 0 : 0.4

UIView.transition(with: imageView,
duration: 0.8,
duration: duration,
options: .transitionCrossDissolve,
animations: { [weak self] in
self?.imageView.image = image
Expand Down