diff --git a/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentApprovalViewController.swift b/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentApprovalViewController.swift index 6d7451bcf..00dd02442 100644 --- a/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentApprovalViewController.swift +++ b/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentApprovalViewController.swift @@ -114,6 +114,8 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC return bottomToolView }() + lazy var touchInterceptorView = UIView() + // MARK: - View Lifecycle public override var prefersStatusBarHidden: Bool { @@ -145,6 +147,12 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC // layout immediately to avoid animating the layout process during the transition self.currentPageViewController.view.layoutIfNeeded() + + view.addSubview(touchInterceptorView) + touchInterceptorView.autoPinEdgesToSuperviewEdges() + touchInterceptorView.isHidden = true + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTapTouchInterceptorView(gesture:))) + touchInterceptorView.addGestureRecognizer(tapGesture) } override public func viewWillAppear(_ animated: Bool) { @@ -177,6 +185,8 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC updateNavigationBar() updateInputAccessory() updateControlVisibility() + + touchInterceptorView.isHidden = !isEditingCaptions } // MARK: - Input Accessory @@ -609,6 +619,13 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC // MARK: - Event Handlers + @objc + func didTapTouchInterceptorView(gesture: UITapGestureRecognizer) { + Logger.info("") + + isEditingCaptions = false + } + private func cancelPressed() { self.approvalDelegate?.attachmentApproval(self, didCancelAttachments: attachments) } diff --git a/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift b/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift index 887565cd4..80dab11b5 100644 --- a/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift +++ b/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift @@ -57,17 +57,6 @@ public class AttachmentPrepViewController: OWSViewController, PlayerProgressBarD fatalError("init(coder:) has not been implemented") } - // MARK: - Subviews - - // TODO: Do we still need this? - lazy var touchInterceptorView: UIView = { - let touchInterceptorView = UIView() - let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTapTouchInterceptorView(gesture:))) - touchInterceptorView.addGestureRecognizer(tapGesture) - - return touchInterceptorView - }() - // MARK: - View Lifecycle override public func loadView() { @@ -175,10 +164,6 @@ public class AttachmentPrepViewController: OWSViewController, PlayerProgressBarD playButton.addTarget(self, action: #selector(playButtonTapped), for: .touchUpInside) playButton.autoCenterInSuperview() } - - view.addSubview(touchInterceptorView) - touchInterceptorView.autoPinEdgesToSuperviewEdges() - touchInterceptorView.isHidden = true } override public func viewWillAppear(_ animated: Bool) { @@ -220,12 +205,6 @@ public class AttachmentPrepViewController: OWSViewController, PlayerProgressBarD // MARK: - Event Handlers - @objc - func didTapTouchInterceptorView(gesture: UITapGestureRecognizer) { - Logger.info("") - touchInterceptorView.isHidden = true - } - @objc public func didTapPlayerView(_ gestureRecognizer: UIGestureRecognizer) { assert(self.videoPlayer != nil)