Move ChatInputItem selected and enabled properties to protocol extension
This commit is contained in:
parent
a8ba3531b7
commit
c17a99014b
|
|
@ -60,10 +60,10 @@ protocol ChatInputBarPresenter: class {
|
|||
|
||||
private(set) var focusedItem: ChatInputItemProtocol? {
|
||||
willSet {
|
||||
self.focusedItem?.selected = false
|
||||
self.focusedItem?.setSelected(false)
|
||||
}
|
||||
didSet {
|
||||
self.focusedItem?.selected = true
|
||||
self.focusedItem?.setSelected(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,24 @@ public protocol ChatInputItemProtocol: AnyObject {
|
|||
var inputView: UIView? { get }
|
||||
var presentationMode: ChatInputItemPresentationMode { get }
|
||||
var showsSendButton: Bool { get }
|
||||
var selected: Bool { get set }
|
||||
|
||||
func handleInput(input: AnyObject)
|
||||
}
|
||||
|
||||
extension ChatInputItemProtocol {
|
||||
func selected() -> Bool {
|
||||
return self.inputButton.selected
|
||||
}
|
||||
|
||||
func setSelected(selected: Bool) {
|
||||
self.inputButton.selected = selected
|
||||
}
|
||||
|
||||
func enabled() -> Bool {
|
||||
return self.inputButton.enabled
|
||||
}
|
||||
|
||||
func setEnabled(enabled: Bool) {
|
||||
self.inputButton.enabled = enabled
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,12 +57,6 @@ public class PhotosChatInputItem: ChatInputItemProtocol {
|
|||
return photosInputView
|
||||
}()
|
||||
|
||||
public var selected = false {
|
||||
didSet {
|
||||
self.internalInputButton.selected = self.selected
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - ChatInputItemProtocol
|
||||
|
||||
public var presentationMode: ChatInputItemPresentationMode {
|
||||
|
|
|
|||
|
|
@ -45,13 +45,6 @@ public class TextChatInputItem {
|
|||
lazy private var internalInputButton: ChatInputButton = {
|
||||
return ChatInputButton.makeInputButton(withAppearance: self.buttonAppearance)
|
||||
}()
|
||||
|
||||
// Move to protocol extension
|
||||
public var selected = false {
|
||||
didSet {
|
||||
self.internalInputButton.selected = self.selected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - ChatInputItemProtocol
|
||||
|
|
|
|||
Loading…
Reference in New Issue