From dbd05377b8cc6f89c341424db27ba0e55cd2f132 Mon Sep 17 00:00:00 2001 From: shannon Date: Tue, 10 Dec 2024 14:12:47 -0500 Subject: [PATCH] Add placeholder usage to AvatarImageView in hopes of avoiding showing incorrect avatar image --- .../Sources/MastodonUI/View/ImageView/AvatarImageView.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MastodonSDK/Sources/MastodonUI/View/ImageView/AvatarImageView.swift b/MastodonSDK/Sources/MastodonUI/View/ImageView/AvatarImageView.swift index 92f800443f..5dd346ff59 100644 --- a/MastodonSDK/Sources/MastodonUI/View/ImageView/AvatarImageView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/ImageView/AvatarImageView.swift @@ -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() { @@ -81,6 +82,7 @@ extension AvatarImageView { af.setImage( withURL: url, + placeholderImage: Self.placeholder, filter: filter ) }