From 4ea608cd45d25a3d1719734bff2d606f1bb52243 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 21 Mar 2019 12:18:20 -0400 Subject: [PATCH 1/2] Ensure status bar is hidden in image editor subviews. --- .../Views/ImageEditor/ImageEditorBrushViewController.swift | 5 +++++ .../Views/ImageEditor/ImageEditorCropViewController.swift | 5 +++++ .../Views/ImageEditor/ImageEditorTextViewController.swift | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/SignalMessaging/Views/ImageEditor/ImageEditorBrushViewController.swift b/SignalMessaging/Views/ImageEditor/ImageEditorBrushViewController.swift index 4281208dc..6848b4a13 100644 --- a/SignalMessaging/Views/ImageEditor/ImageEditorBrushViewController.swift +++ b/SignalMessaging/Views/ImageEditor/ImageEditorBrushViewController.swift @@ -114,6 +114,11 @@ public class ImageEditorBrushViewController: OWSViewController { paletteView.isHidden = hasStroke } + @objc + public override var prefersStatusBarHidden: Bool { + return true + } + // MARK: - Actions @objc func didTapUndo(sender: UIButton) { diff --git a/SignalMessaging/Views/ImageEditor/ImageEditorCropViewController.swift b/SignalMessaging/Views/ImageEditor/ImageEditorCropViewController.swift index 3a78f54f6..9714a73c3 100644 --- a/SignalMessaging/Views/ImageEditor/ImageEditorCropViewController.swift +++ b/SignalMessaging/Views/ImageEditor/ImageEditorCropViewController.swift @@ -237,6 +237,11 @@ class ImageEditorCropViewController: OWSViewController { : "image_editor_crop_unlock")) } + @objc + public override var prefersStatusBarHidden: Bool { + return true + } + private static let desiredCornerSize: CGFloat = 24 private static let minCropSize: CGFloat = desiredCornerSize * 2 private var cornerSize = CGSize.zero diff --git a/SignalMessaging/Views/ImageEditor/ImageEditorTextViewController.swift b/SignalMessaging/Views/ImageEditor/ImageEditorTextViewController.swift index f4814c540..53f1f2cfc 100644 --- a/SignalMessaging/Views/ImageEditor/ImageEditorTextViewController.swift +++ b/SignalMessaging/Views/ImageEditor/ImageEditorTextViewController.swift @@ -234,6 +234,11 @@ public class ImageEditorTextViewController: OWSViewController, VAlignTextViewDel updateNavigationBar(navigationBarItems: navigationBarItems) } + @objc + public override var prefersStatusBarHidden: Bool { + return true + } + // MARK: - Pinch Gesture private var pinchFontStart: UIFont? From 558b5f5816afe85a101bbd7a6a793497e7e1eca1 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 21 Mar 2019 12:18:38 -0400 Subject: [PATCH 2/2] Tap to dismiss caption editor. --- .../AttachmentApprovalViewController.swift | 17 +++++++++++++++ .../AttachmentPrepViewController.swift | 21 ------------------- 2 files changed, 17 insertions(+), 21 deletions(-) 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)