Tweak how image editor overlays are presented.

pull/2/head
Matthew Chen 7 years ago
parent 7ee38f808d
commit d15f5b581f

@ -1156,32 +1156,28 @@ extension AttachmentPrepViewController: UIScrollViewDelegate {
// MARK: - // MARK: -
extension AttachmentPrepViewController: ImageEditorViewDelegate { extension AttachmentPrepViewController: ImageEditorViewDelegate {
public func imageEditor(presentFullScreenOverlay viewController: UIViewController, public func imageEditor(presentFullScreenView viewController: UIViewController,
withNavigation: Bool) { isTransparent: Bool) {
if withNavigation { let navigationController = OWSNavigationController(rootViewController: viewController)
let navigationController = OWSNavigationController(rootViewController: viewController) navigationController.modalPresentationStyle = (isTransparent
navigationController.modalPresentationStyle = .overFullScreen ? .overFullScreen
: .fullScreen)
if let navigationBar = navigationController.navigationBar as? OWSNavigationBar { if let navigationBar = navigationController.navigationBar as? OWSNavigationBar {
navigationBar.overrideTheme(type: .clear) navigationBar.overrideTheme(type: .clear)
} else {
owsFailDebug("navigationBar was nil or unexpected class")
}
self.present(navigationController, animated: false) {
// Do nothing.
}
} else { } else {
self.present(viewController, animated: false) { owsFailDebug("navigationBar was nil or unexpected class")
// Do nothing. }
}
self.present(navigationController, animated: false) {
// Do nothing.
} }
} }
public func imageEditorPresentCaptionView() { public func imageEditorPresentCaptionView() {
let view = AttachmentCaptionViewController(delegate: self, attachmentItem: attachmentItem) let view = AttachmentCaptionViewController(delegate: self, attachmentItem: attachmentItem)
self.imageEditor(presentFullScreenOverlay: view, withNavigation: true) self.imageEditor(presentFullScreenView: view, isTransparent: true)
isShowingCaptionView = true isShowingCaptionView = true
} }

@ -6,8 +6,8 @@ import UIKit
@objc @objc
public protocol ImageEditorViewDelegate: class { public protocol ImageEditorViewDelegate: class {
func imageEditor(presentFullScreenOverlay viewController: UIViewController, func imageEditor(presentFullScreenView viewController: UIViewController,
withNavigation: Bool) isTransparent: Bool)
func imageEditorPresentCaptionView() func imageEditorPresentCaptionView()
func imageEditorUpdateNavigationBar() func imageEditorUpdateNavigationBar()
func imageEditorAttachmentCount() -> Int func imageEditorAttachmentCount() -> Int
@ -134,8 +134,8 @@ public class ImageEditorView: UIView {
Logger.verbose("") Logger.verbose("")
let brushView = ImageEditorBrushViewController(delegate: self, model: model, currentColor: currentColor) let brushView = ImageEditorBrushViewController(delegate: self, model: model, currentColor: currentColor)
self.delegate?.imageEditor(presentFullScreenOverlay: brushView, self.delegate?.imageEditor(presentFullScreenView: brushView,
withNavigation: true) isTransparent: false)
} }
@objc func didTapCrop(sender: UIButton) { @objc func didTapCrop(sender: UIButton) {
@ -434,8 +434,8 @@ public class ImageEditorView: UIView {
model: model, model: model,
textItem: textItem, textItem: textItem,
maxTextWidthPoints: maxTextWidthPoints) maxTextWidthPoints: maxTextWidthPoints)
self.delegate?.imageEditor(presentFullScreenOverlay: textEditor, self.delegate?.imageEditor(presentFullScreenView: textEditor,
withNavigation: true) isTransparent: false)
} }
// MARK: - Crop Tool // MARK: - Crop Tool
@ -458,8 +458,8 @@ public class ImageEditorView: UIView {
} }
let cropTool = ImageEditorCropViewController(delegate: self, model: model, srcImage: srcImage, previewImage: previewImage) let cropTool = ImageEditorCropViewController(delegate: self, model: model, srcImage: srcImage, previewImage: previewImage)
self.delegate?.imageEditor(presentFullScreenOverlay: cropTool, self.delegate?.imageEditor(presentFullScreenView: cropTool,
withNavigation: true) isTransparent: false)
}} }}
// MARK: - // MARK: -

Loading…
Cancel
Save