remove redunant method, consolidate naming, adding array getter

pull/1/head
Michael Kirk 7 years ago
parent 6fdd5d1001
commit 0ac8f13c0b

@ -314,7 +314,7 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
lastObservedKeyboardTop = keyboardEndFrame.size.height lastObservedKeyboardTop = keyboardEndFrame.size.height
let keyboardScenario: KeyboardScenario = bottomToolView.isEditingMediaMessage ? .editingMessage : .editingCaption let keyboardScenario: KeyboardScenario = bottomToolView.isEditingMediaMessage ? .editingMessage : .editingCaption
currentPageController.updateCaptionViewBottomInset(keyboardScenario: keyboardScenario) currentPageViewController.updateCaptionViewBottomInset(keyboardScenario: keyboardScenario)
} }
@objc @objc
@ -337,7 +337,7 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
Logger.debug("\(keyboardStartFrame) -> \(keyboardEndFrame)") Logger.debug("\(keyboardStartFrame) -> \(keyboardEndFrame)")
lastObservedKeyboardTop = UIScreen.main.bounds.height - keyboardEndFrame.size.height lastObservedKeyboardTop = UIScreen.main.bounds.height - keyboardEndFrame.size.height
currentPageController.updateCaptionViewBottomInset(keyboardScenario: .hidden) currentPageViewController.updateCaptionViewBottomInset(keyboardScenario: .hidden)
} }
// MARK: - View Helpers // MARK: - View Helpers
@ -483,13 +483,17 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
return nextPage return nextPage
} }
public var currentViewController: AttachmentPrepViewController { public var currentPageViewController: AttachmentPrepViewController {
return viewControllers!.first as! AttachmentPrepViewController return pageViewControllers.first!
}
public var pageViewControllers: [AttachmentPrepViewController] {
return super.viewControllers!.map { $0 as! AttachmentPrepViewController }
} }
var currentItem: SignalAttachmentItem! { var currentItem: SignalAttachmentItem! {
get { get {
return currentViewController.attachmentItem return currentPageViewController.attachmentItem
} }
set { set {
setCurrentItem(newValue, direction: .forward, animated: false) setCurrentItem(newValue, direction: .forward, animated: false)
@ -586,23 +590,19 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
} }
extension AttachmentApprovalViewController: MediaMessageTextToolbarDelegate { extension AttachmentApprovalViewController: MediaMessageTextToolbarDelegate {
var currentPageController: AttachmentPrepViewController {
return viewControllers!.first as! AttachmentPrepViewController
}
func mediaMessageTextToolbarDidBeginEditing(_ mediaMessageTextToolbar: MediaMessageTextToolbar) { func mediaMessageTextToolbarDidBeginEditing(_ mediaMessageTextToolbar: MediaMessageTextToolbar) {
currentPageController.setAttachmentViewScale(.compact, animated: true) currentPageViewController.setAttachmentViewScale(.compact, animated: true)
} }
func mediaMessageTextToolbarDidEndEditing(_ mediaMessageTextToolbar: MediaMessageTextToolbar) { func mediaMessageTextToolbarDidEndEditing(_ mediaMessageTextToolbar: MediaMessageTextToolbar) {
currentPageController.setAttachmentViewScale(.fullsize, animated: true) currentPageViewController.setAttachmentViewScale(.fullsize, animated: true)
} }
func mediaMessageTextToolbarDidTapSend(_ mediaMessageTextToolbar: MediaMessageTextToolbar) { func mediaMessageTextToolbarDidTapSend(_ mediaMessageTextToolbar: MediaMessageTextToolbar) {
// Toolbar flickers in and out if there are errors // Toolbar flickers in and out if there are errors
// and remains visible momentarily after share extension is dismissed. // and remains visible momentarily after share extension is dismissed.
// It's easiest to just hide it at this point since we're done with it. // It's easiest to just hide it at this point since we're done with it.
currentViewController.shouldAllowAttachmentViewResizing = false currentPageViewController.shouldAllowAttachmentViewResizing = false
mediaMessageTextToolbar.isUserInteractionEnabled = false mediaMessageTextToolbar.isUserInteractionEnabled = false
mediaMessageTextToolbar.isHidden = true mediaMessageTextToolbar.isHidden = true

Loading…
Cancel
Save