Handle gotosocial gif attachments

This commit is contained in:
Shadowfacts 2022-02-16 22:12:56 -05:00
parent de93d6e171
commit 930ec7ccff
1 changed files with 17 additions and 0 deletions

View File

@ -56,6 +56,23 @@ extension Attachment {
case gifv
case audio
case unknown
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
switch try container.decode(String.self) {
// gotosocial uses "gif" for gif images
case "image", "gif":
self = .image
case "video":
self = .video
case "gifv":
self = .gifv
case "audio":
self = .audio
default:
self = .unknown
}
}
}
}