Ignore "GIF of death."

// FREEBIE
pull/1/head
Matthew Chen 7 years ago
parent 5fcf89dff1
commit 7f15228aba

@ -10,6 +10,7 @@
#import "Environment.h"
#import "FLAnimatedImage.h"
#import "FingerprintViewController.h"
#import "NSData+Image.h"
#import "NotificationsManager.h"
#import "OWSAnyTouchGestureRecognizer.h"
#import "OWSAudioAttachmentPlayer.h"

@ -171,8 +171,13 @@ class AttachmentApprovalViewController: OWSViewController, OWSAudioAttachmentPla
}
private func createAnimatedPreview(attachmentPreviewView: UIView) {
let data = attachment.data
guard (data as NSData).isValidImage() else {
return
}
// Use Flipboard FLAnimatedImage library to display gifs
guard let animatedImage = FLAnimatedImage(gifData:attachment.data) else {
guard let animatedImage = FLAnimatedImage(gifData:data) else {
createGenericPreview(attachmentPreviewView:attachmentPreviewView)
return
}

@ -2,15 +2,16 @@
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "FLAnimatedImage.h"
#import "FullImageViewController.h"
#import "UIUtil.h"
#import "UIView+OWS.h"
#import "TSPhotoAdapter.h"
#import "TSMessageAdapter.h"
#import "AttachmentSharing.h"
#import "FLAnimatedImage.h"
#import "NSData+Image.h"
#import "TSAnimatedAdapter.h"
#import "TSMessageAdapter.h"
#import "TSPhotoAdapter.h"
#import "UIColor+OWS.h"
#import "AttachmentSharing.h"
#import "UIUtil.h"
#import "UIView+OWS.h"
NS_ASSUME_NONNULL_BEGIN
@ -168,14 +169,18 @@ NS_ASSUME_NONNULL_BEGIN
- (void)initializeImageView {
if (self.isAnimated) {
// Present the animated image using Flipboard/FLAnimatedImage
FLAnimatedImage *animatedGif = [FLAnimatedImage animatedImageWithGIFData:self.fileData];
FLAnimatedImageView *imageView = [[FLAnimatedImageView alloc] init];
imageView.animatedImage = animatedGif;
imageView.frame = self.originRect;
imageView.contentMode = UIViewContentModeScaleAspectFill;
imageView.clipsToBounds = YES;
self.imageView = imageView;
if ([self.fileData isValidImage]) {
// Present the animated image using Flipboard/FLAnimatedImage
FLAnimatedImage *animatedGif = [FLAnimatedImage animatedImageWithGIFData:self.fileData];
FLAnimatedImageView *imageView = [[FLAnimatedImageView alloc] init];
imageView.animatedImage = animatedGif;
imageView.frame = self.originRect;
imageView.contentMode = UIViewContentModeScaleAspectFill;
imageView.clipsToBounds = YES;
self.imageView = imageView;
} else {
self.imageView = [[UIImageView alloc] initWithFrame:self.originRect];
}
} else {
// Present the static image using standard UIImageView
self.imageView = [[UIImageView alloc] initWithFrame:self.originRect];

Loading…
Cancel
Save