avatar arbitrarily picks the first available entry in hdProfilePicVersions
mycroftcanner opened this issue · comments
Mycroft Canner commented
Mycroft Canner commented
This will select the profile picture url that has the highest quality:
public var avatar: URL? {
return rawResponse.hdProfilePicVersions
.array?.sorted(
by: {
guard case .number(let lhs) = $0["width"], case .number(let rhs) = $1["width"] else { return false }
return lhs.intValue > rhs.intValue
}
).first?["url"].url
Stefano Bertagno commented
It does, you're right 💪
I was under the impression avatars were sorted like generic Media
by size, but apparently they're not.
Definitely fixing it in #96.