Handle gotosocial gif attachments
This commit is contained in:
parent
de93d6e171
commit
930ec7ccff
|
@ -56,6 +56,23 @@ extension Attachment {
|
||||||
case gifv
|
case gifv
|
||||||
case audio
|
case audio
|
||||||
case unknown
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue