1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2025-01-23 06:02:35 +01:00

Set placeholder only if something goes wrong (IOS-238)

This commit is contained in:
Nathan Mattes 2024-05-21 17:14:32 +02:00
parent 7420563f37
commit 16d6c9e823

View File

@ -45,11 +45,14 @@ extension FLAnimatedImageView {
// cancel task
cancelTask()
// set placeholder
image = placeholder
// set image
guard let url = url else { return }
guard let url else {
DispatchQueue.main.async { [weak self] in
self?.image = placeholder
}
return
}
activeAvatarRequestURL = url
let avatarRequest = AF.request(url).publishData()
avatarRequestCancellable = avatarRequest
@ -78,7 +81,9 @@ extension FLAnimatedImageView {
}
}
case .failure:
break
DispatchQueue.main.async { [weak self] in
self?.image = placeholder
}
}
}
}