|
|
@ -63,7 +63,9 @@ class AttachmentApprovalViewController: UIViewController {
|
|
|
|
|
|
|
|
|
|
|
|
createButtonRow(attachmentPreviewView:attachmentPreviewView)
|
|
|
|
createButtonRow(attachmentPreviewView:attachmentPreviewView)
|
|
|
|
|
|
|
|
|
|
|
|
if attachment.isImage {
|
|
|
|
if attachment.isAnimatedImage {
|
|
|
|
|
|
|
|
createAnimatedPreview(attachmentPreviewView:attachmentPreviewView)
|
|
|
|
|
|
|
|
} else if attachment.isImage {
|
|
|
|
createImagePreview(attachmentPreviewView:attachmentPreviewView)
|
|
|
|
createImagePreview(attachmentPreviewView:attachmentPreviewView)
|
|
|
|
} else if attachment.isVideo {
|
|
|
|
} else if attachment.isVideo {
|
|
|
|
createVideoPreview(attachmentPreviewView:attachmentPreviewView)
|
|
|
|
createVideoPreview(attachmentPreviewView:attachmentPreviewView)
|
|
|
@ -72,6 +74,20 @@ class AttachmentApprovalViewController: UIViewController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private func createAnimatedPreview(attachmentPreviewView: UIView) {
|
|
|
|
|
|
|
|
// Use Flipboard FLAnimatedImage library to display gifs
|
|
|
|
|
|
|
|
guard let animatedImage = FLAnimatedImage(gifData:attachment.data) else {
|
|
|
|
|
|
|
|
createGenericPreview(attachmentPreviewView:attachmentPreviewView)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let animatedImageView = FLAnimatedImageView()
|
|
|
|
|
|
|
|
animatedImageView.animatedImage = animatedImage
|
|
|
|
|
|
|
|
animatedImageView.contentMode = .scaleAspectFit
|
|
|
|
|
|
|
|
attachmentPreviewView.addSubview(animatedImageView)
|
|
|
|
|
|
|
|
animatedImageView.autoPinWidthToSuperview()
|
|
|
|
|
|
|
|
animatedImageView.autoPinHeightToSuperview()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private func createImagePreview(attachmentPreviewView: UIView) {
|
|
|
|
private func createImagePreview(attachmentPreviewView: UIView) {
|
|
|
|
var image = attachment.image
|
|
|
|
var image = attachment.image
|
|
|
|
if image == nil {
|
|
|
|
if image == nil {
|
|
|
|