Skip to content

Commit

Permalink
Add placeholder usage to AvatarImageView in hopes of avoiding showing…
Browse files Browse the repository at this point in the history
… incorrect avatar image
  • Loading branch information
whattherestimefor committed Dec 10, 2024
1 parent ca6ecd1 commit dbd0537
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ public class AvatarImageView: FLAnimatedImageView {
extension AvatarImageView {

public func prepareForReuse() {
cancelTask()
af.cancelImageRequest()
cancelTask() // should cancel any gif loading task
af.cancelImageRequest() // should cancel any normal image loading task
self.image = Self.placeholder // because loading a gif doesn't offer a placeholder option and we want to make sure we don't continue showing an avatar from another account while a gif avatar loads
}

override public func layoutSubviews() {
Expand Down Expand Up @@ -81,6 +82,7 @@ extension AvatarImageView {

af.setImage(
withURL: url,
placeholderImage: Self.placeholder,
filter: filter
)
}
Expand Down

0 comments on commit dbd0537

Please sign in to comment.