fix missing video thumbnails in approval view
This commit is contained in:
parent
d77d968bfd
commit
858ba6ef37
|
@ -70,7 +70,7 @@ class SignalAttachmentItem: Hashable {
|
|||
|
||||
func getThumbnailImage() -> Promise<UIImage> {
|
||||
return DispatchQueue.global().async(.promise) { () -> UIImage in
|
||||
guard let image = self.attachment.image() else {
|
||||
guard let image = self.attachment.staticThumbnail() else {
|
||||
throw SignalAttachmentItemError.noThumbnail
|
||||
}
|
||||
return image
|
||||
|
@ -78,9 +78,9 @@ class SignalAttachmentItem: Hashable {
|
|||
switch result {
|
||||
case .fulfilled(let image):
|
||||
self.imageSize = image.size
|
||||
default: break
|
||||
case .rejected(let error):
|
||||
owsFailDebug("failed with error: \(error)")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,6 +263,21 @@ public class SignalAttachment: NSObject {
|
|||
albumMessageId: message.uniqueId)
|
||||
}
|
||||
|
||||
@objc
|
||||
public func staticThumbnail() -> UIImage? {
|
||||
if isAnimatedImage {
|
||||
return image()
|
||||
} else if isImage {
|
||||
return image()
|
||||
} else if isVideo {
|
||||
return videoPreview()
|
||||
} else if isAudio {
|
||||
return nil
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@objc
|
||||
public func image() -> UIImage? {
|
||||
if let cachedImage = cachedImage {
|
||||
|
|
Loading…
Reference in New Issue