Tweak how image editor overlays are presented.

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

@ -1156,12 +1156,13 @@ extension AttachmentPrepViewController: UIScrollViewDelegate {
// MARK: -
extension AttachmentPrepViewController: ImageEditorViewDelegate {
public func imageEditor(presentFullScreenOverlay viewController: UIViewController,
withNavigation: Bool) {
public func imageEditor(presentFullScreenView viewController: UIViewController,
isTransparent: Bool) {
if withNavigation {
let navigationController = OWSNavigationController(rootViewController: viewController)
navigationController.modalPresentationStyle = .overFullScreen
navigationController.modalPresentationStyle = (isTransparent
? .overFullScreen
: .fullScreen)
if let navigationBar = navigationController.navigationBar as? OWSNavigationBar {
navigationBar.overrideTheme(type: .clear)
@ -1172,16 +1173,11 @@ extension AttachmentPrepViewController: ImageEditorViewDelegate {
self.present(navigationController, animated: false) {
// Do nothing.
}
} else {
self.present(viewController, animated: false) {
// Do nothing.
}
}
}
public func imageEditorPresentCaptionView() {
let view = AttachmentCaptionViewController(delegate: self, attachmentItem: attachmentItem)
self.imageEditor(presentFullScreenOverlay: view, withNavigation: true)
self.imageEditor(presentFullScreenView: view, isTransparent: true)
isShowingCaptionView = true
}

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

Loading…
Cancel
Save