parent
1780973e68
commit
5320536736
|
@ -1096,44 +1096,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
//- (void)handleLongPressGesture:(UILongPressGestureRecognizer *)sender
|
||||
//{
|
||||
// OWSAssert(self.delegate);
|
||||
//
|
||||
// if (sender.state != UIGestureRecognizerStateBegan) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (self.viewItem.interaction.interactionType == OWSInteractionType_OutgoingMessage) {
|
||||
// TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)self.viewItem.interaction;
|
||||
// if (outgoingMessage.messageState == TSOutgoingMessageStateUnsent) {
|
||||
// // Ignore long press on unsent messages.
|
||||
// return;
|
||||
// } else if (outgoingMessage.messageState == TSOutgoingMessageStateAttemptingOut) {
|
||||
// // Ignore long press on outgoing messages being sent.
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// CGPoint locationInMessageBubble = [sender locationInView:self];
|
||||
// switch ([self gestureLocationForLocation:locationInMessageBubble]) {
|
||||
// case OWSMessageGestureLocation_Default:
|
||||
// case OWSMessageGestureLocation_OversizeText: {
|
||||
// CGPoint location = [sender locationInView:self];
|
||||
// [self showTextMenuController:location];
|
||||
// break;
|
||||
// }
|
||||
// case OWSMessageGestureLocation_Media: {
|
||||
// CGPoint location = [sender locationInView:self];
|
||||
// [self showMediaMenuController:location];
|
||||
// break;
|
||||
// }
|
||||
// case OWSMessageGestureLocation_QuotedReply:
|
||||
// // TODO:
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
|
||||
- (void)handleMediaTapGesture
|
||||
{
|
||||
|
|
|
@ -83,10 +83,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
self.contentView.userInteractionEnabled = YES;
|
||||
|
||||
// UITapGestureRecognizer *tap =
|
||||
// [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
|
||||
// [self.contentView addGestureRecognizer:tap];
|
||||
|
||||
UILongPressGestureRecognizer *longPress =
|
||||
[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressGesture:)];
|
||||
[self.contentView addGestureRecognizer:longPress];
|
||||
|
@ -483,47 +479,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
#pragma mark - Gesture recognizers
|
||||
|
||||
//- (void)handleTapGesture:(UITapGestureRecognizer *)sender
|
||||
//{
|
||||
// OWSAssert(self.delegate);
|
||||
//
|
||||
// if (sender.state != UIGestureRecognizerStateRecognized) {
|
||||
// DDLogVerbose(@"%@ Ignoring tap on message: %@", self.logTag, self.viewItem.interaction.debugDescription);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (self.viewItem.interaction.interactionType == OWSInteractionType_OutgoingMessage) {
|
||||
// TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)self.viewItem.interaction;
|
||||
// if (outgoingMessage.messageState == TSOutgoingMessageStateUnsent) {
|
||||
// [self.delegate didTapFailedOutgoingMessage:outgoingMessage];
|
||||
// return;
|
||||
// } else if (outgoingMessage.messageState == TSOutgoingMessageStateAttemptingOut) {
|
||||
// // Ignore taps on outgoing messages being sent.
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// CGPoint locationInMessageBubble = [sender locationInView:self.messageBubbleView];
|
||||
// switch ([self.messageBubbleView gestureLocationForLocation:locationInMessageBubble]) {
|
||||
// case OWSMessageGestureLocation_Default:
|
||||
// // Do nothing.
|
||||
// return;
|
||||
// case OWSMessageGestureLocation_OversizeText:
|
||||
// [self.delegate didTapTruncatedTextMessage:self.viewItem];
|
||||
// return;
|
||||
// case OWSMessageGestureLocation_Media:
|
||||
// [self handleMediaTapGesture];
|
||||
// break;
|
||||
// case OWSMessageGestureLocation_QuotedReply:
|
||||
// if (self.message.quotedMessage) {
|
||||
// [self.delegate didTapQuotedMessage:self.viewItem quotedMessage:self.message.quotedMessage];
|
||||
// } else {
|
||||
// OWSFail(@"%@ Missing quoted message.", self.logTag)
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
- (void)handleLongPressGesture:(UILongPressGestureRecognizer *)sender
|
||||
{
|
||||
OWSAssert(self.delegate);
|
||||
|
|
|
@ -560,9 +560,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
|||
[[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"REPLY_ITEM_ACTION",
|
||||
@"Short name for edit menu item to reply to a message.")
|
||||
action:self.replyActionSelector],
|
||||
// FIXME: when deleting a caption, users will be surprised that it also deletes the attachment.
|
||||
// We either need to implement a way to remove the caption separate from the attachment
|
||||
// or make a design change which clarifies that the whole message is getting deleted.
|
||||
[[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_DELETE_ACTION",
|
||||
@"Short name for edit menu item to delete contents of media message.")
|
||||
action:self.deleteActionSelector]
|
||||
|
|
|
@ -12,7 +12,6 @@ enum MessageMetadataViewMode: UInt {
|
|||
case focusOnMetadata
|
||||
}
|
||||
|
||||
//class MessageDetailViewController: OWSViewController, MediaDetailPresenter, MediaGalleryDataSourceDelegate {
|
||||
class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDelegate, OWSMessageBubbleViewDelegate {
|
||||
|
||||
// MARK: Properties
|
||||
|
@ -330,7 +329,6 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
|
|||
messageBubbleView.loadContent()
|
||||
|
||||
assert(messageBubbleView.isUserInteractionEnabled)
|
||||
// messageBubbleView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(messageBubbleTapped)))
|
||||
|
||||
let row = UIView()
|
||||
row.addSubview(messageBubbleView)
|
||||
|
@ -587,42 +585,6 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
|
|||
messageBubbleViewHeightLayoutConstraint.constant = messageBubbleSize.height
|
||||
}
|
||||
|
||||
// // MARK: - Event Handlers
|
||||
//
|
||||
// func messageBubbleTapped(sender: UIGestureRecognizer) {
|
||||
// guard let messageBubbleView = messageBubbleView else {
|
||||
// return
|
||||
// }
|
||||
// guard sender.state == .recognized else {
|
||||
// return
|
||||
// }
|
||||
// if let outgoingMessage = viewItem.interaction as? TSOutgoingMessage {
|
||||
// switch outgoingMessage.messageState {
|
||||
// case .attemptingOut,
|
||||
// .unsent:
|
||||
// // Ignore taps on "unsent" and "sending" messages.
|
||||
// return
|
||||
// default:
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// let locationInMessageBubble = sender.location(in: messageBubbleView)
|
||||
// switch messageBubbleView.gestureLocation(forLocation: locationInMessageBubble) {
|
||||
// case .default:
|
||||
// break
|
||||
// case .oversizeText:
|
||||
// let viewController = LongTextViewController(viewItem: viewItem)
|
||||
// self.navigationController?.pushViewController(viewController, animated: true)
|
||||
// break
|
||||
// case .media:
|
||||
// // TODO: We could show MediaGalleryViewController?
|
||||
// break
|
||||
// case .quotedReply:
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
|
||||
// MARK: OWSMessageBubbleViewDelegate
|
||||
|
||||
func didTapImageViewItem(_ viewItem: ConversationViewItem, attachmentStream: TSAttachmentStream, imageView: UIView) {
|
||||
|
@ -714,17 +676,4 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
|
|||
self.navigationController?.popViewController(animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
// // MARK: MediaDetailPresenter
|
||||
//
|
||||
// public func presentDetails(mediaMessageView: MediaMessageView, fromView: UIView) {
|
||||
// guard self.attachmentStream != nil else {
|
||||
// owsFail("attachment stream unexpectedly nil")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// let mediaGalleryViewController = MediaGalleryViewController(thread: self.thread, uiDatabaseConnection: self.uiDatabaseConnection)
|
||||
// mediaGalleryViewController.addDataSourceDelegate(self)
|
||||
// mediaGalleryViewController.presentDetailView(fromViewController: self, mediaMessage: self.message, replacingView: fromView)
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -14,11 +14,6 @@ public enum MediaMessageViewMode: UInt {
|
|||
case attachmentApproval
|
||||
}
|
||||
|
||||
//@objc
|
||||
//public protocol MediaDetailPresenter: class {
|
||||
// func presentDetails(mediaMessageView: MediaMessageView, fromView: UIView)
|
||||
//}
|
||||
|
||||
@objc
|
||||
public class MediaMessageView: UIView, OWSAudioPlayerDelegate {
|
||||
|
||||
|
@ -59,8 +54,6 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate {
|
|||
@objc
|
||||
public var contentView: UIView?
|
||||
|
||||
// private weak var mediaDetailPresenter: MediaDetailPresenter?
|
||||
|
||||
// MARK: Initializers
|
||||
|
||||
@available(*, unavailable, message:"use other constructor instead.")
|
||||
|
@ -68,18 +61,13 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate {
|
|||
fatalError("\(#function) is unimplemented.")
|
||||
}
|
||||
|
||||
// @objc
|
||||
// public convenience init(attachment: SignalAttachment, mode: MediaMessageViewMode) {
|
||||
// self.init(attachment: attachment, mode: mode, mediaDetailPresenter: nil)
|
||||
// }
|
||||
|
||||
// TODO there's only one mode now, used by the AttachmentApprovalView
|
||||
// Currently we only use one mode (AttachmentApproval), so we could simplify this class, but it's kind
|
||||
// of nice that it's written in a flexible way in case we'd want to use it elsewhere again in the future.
|
||||
@objc
|
||||
public required init(attachment: SignalAttachment, mode: MediaMessageViewMode) { //}, mediaDetailPresenter: MediaDetailPresenter?) {
|
||||
public required init(attachment: SignalAttachment, mode: MediaMessageViewMode) {
|
||||
assert(!attachment.hasError)
|
||||
self.attachment = attachment
|
||||
self.mode = mode
|
||||
// self.mediaDetailPresenter = mediaDetailPresenter
|
||||
super.init(frame: CGRect.zero)
|
||||
|
||||
createViews()
|
||||
|
@ -205,9 +193,6 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate {
|
|||
let aspectRatio = image.size.width / image.size.height
|
||||
addSubviewWithScaleAspectFitLayout(view: animatedImageView, aspectRatio: aspectRatio)
|
||||
contentView = animatedImageView
|
||||
//
|
||||
// animatedImageView.isUserInteractionEnabled = true
|
||||
// animatedImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(imageTapped)))
|
||||
}
|
||||
|
||||
private func addSubviewWithScaleAspectFitLayout(view: UIView, aspectRatio: CGFloat) {
|
||||
|
@ -239,9 +224,6 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate {
|
|||
let aspectRatio = image.size.width / image.size.height
|
||||
addSubviewWithScaleAspectFitLayout(view: imageView, aspectRatio: aspectRatio)
|
||||
contentView = imageView
|
||||
//
|
||||
// imageView.isUserInteractionEnabled = true
|
||||
// imageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(imageTapped)))
|
||||
}
|
||||
|
||||
private func createVideoPreview() {
|
||||
|
@ -270,9 +252,6 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate {
|
|||
videoPlayButton.contentMode = .scaleAspectFit
|
||||
self.addSubview(videoPlayButton)
|
||||
videoPlayButton.autoCenterInSuperview()
|
||||
|
||||
// imageView.isUserInteractionEnabled = true
|
||||
// imageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(videoTapped)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,43 +426,4 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate {
|
|||
audioPlayButton?.setImage(image, for: .normal)
|
||||
audioPlayButton?.imageView?.tintColor = controlTintColor
|
||||
}
|
||||
//
|
||||
// // MARK: - Full Screen Image
|
||||
//
|
||||
// @objc
|
||||
// func imageTapped(sender: UIGestureRecognizer) {
|
||||
// // Approval view handles it's own zooming gesture
|
||||
// guard mode != .attachmentApproval else {
|
||||
// return
|
||||
// }
|
||||
// guard sender.state == .recognized else {
|
||||
// return
|
||||
// }
|
||||
// guard let fromView = sender.view else {
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// showMediaDetailViewController(fromView: fromView)
|
||||
// }
|
||||
//
|
||||
// // MARK: - Video Playback
|
||||
//
|
||||
// @objc
|
||||
// func videoTapped(sender: UIGestureRecognizer) {
|
||||
// // Approval view handles it's own play gesture
|
||||
// guard mode != .attachmentApproval else {
|
||||
// return
|
||||
// }
|
||||
// guard sender.state == .recognized else {
|
||||
// return
|
||||
// }
|
||||
// guard let fromView = sender.view else {
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// showMediaDetailViewController(fromView: fromView)
|
||||
// }
|
||||
// func showMediaDetailViewController(fromView: UIView) {
|
||||
// self.mediaDetailPresenter?.presentDetails(mediaMessageView: self, fromView: fromView)
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue