Show attachment approval for GIFs.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 957c2e3963
commit 1f35a1d29c

@ -3226,15 +3226,13 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
#pragma mark GifPickerViewControllerDelegate #pragma mark GifPickerViewControllerDelegate
- (void)gifPickerWillSend - (void)gifPickerDidSelectWithAttachment:(SignalAttachment *)attachment
{ {
[ThreadUtil addThreadToProfileWhitelistIfEmptyContactThread:self.thread]; OWSAssert(attachment);
}
- (void)gifPickerDidSendWithOutgoingMessage:(TSOutgoingMessage *)message [self tryToSendAttachmentIfApproved:attachment];
{
[self messageWasSent:message];
[ThreadUtil addThreadToProfileWhitelistIfEmptyContactThread:self.thread];
[self ensureDynamicInteractions]; [self ensureDynamicInteractions];
} }

@ -6,8 +6,7 @@ import Foundation
@objc @objc
protocol GifPickerViewControllerDelegate: class { protocol GifPickerViewControllerDelegate: class {
func gifPickerWillSend() func gifPickerDidSelect(attachment: SignalAttachment)
func gifPickerDidSend(outgoingMessage: TSOutgoingMessage)
} }
class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollectionViewDataSource, UICollectionViewDelegate, GifPickerLayoutDelegate { class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollectionViewDataSource, UICollectionViewDelegate, GifPickerLayoutDelegate {
@ -363,13 +362,9 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
} }
let attachment = SignalAttachment(dataSource: dataSource, dataUTI: asset.rendition.utiType) let attachment = SignalAttachment(dataSource: dataSource, dataUTI: asset.rendition.utiType)
strongSelf.delegate?.gifPickerWillSend() strongSelf.dismiss(animated: true, completion: {
strongSelf.delegate?.gifPickerDidSelect(attachment: attachment)
let outgoingMessage = ThreadUtil.sendMessage(with: attachment, in: strongSelf.thread, messageSender: strongSelf.messageSender) })
strongSelf.delegate?.gifPickerDidSend(outgoingMessage: outgoingMessage)
strongSelf.dismiss(animated: true, completion: nil)
}.catch { [weak self] error in }.catch { [weak self] error in
guard let strongSelf = self else { guard let strongSelf = self else {
Logger.info("\(GifPickerViewController.TAG) ignoring failure, since VC was dismissed before fetching finished.") Logger.info("\(GifPickerViewController.TAG) ignoring failure, since VC was dismissed before fetching finished.")

Loading…
Cancel
Save