Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChatInputBar and ChatInputItem extensions #580

Merged
merged 6 commits into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChattoAdditions/Source/Input/ChatInputBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ open class ChatInputBar: ReusableXibView {
return !inputBar.textView.text.isEmpty
}

public var inputTextView: UITextView? {
return self.textView
}

@IBOutlet weak var scrollView: HorizontalStackScrollView!
@IBOutlet weak var textView: ExpandableTextView!
@IBOutlet weak var sendButton: UIButton!
Expand Down
1 change: 1 addition & 0 deletions ChattoAdditions/Source/Input/ChatInputItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public protocol ChatInputItemProtocol: AnyObject {

var supportsExpandableState: Bool { get }
var expandedStateTopMargin: CGFloat { get }
var shouldSaveDraftMessage: Bool { get }

func handleInput(_ input: AnyObject)
}
4 changes: 4 additions & 0 deletions ChattoAdditions/Source/Input/Photos/PhotosChatInputItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ open class PhotosChatInputItem: ChatInputItemProtocol {
}

open func handleInput(_ input: AnyObject) {}

open var shouldSaveDraftMessage: Bool {
return false
}
}

// MARK: - PhotosInputViewDelegate
Expand Down
4 changes: 4 additions & 0 deletions ChattoAdditions/Source/Input/Text/TextChatInputItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,8 @@ extension TextChatInputItem: ChatInputItemProtocol {
self.textInputHandler?(text)
}
}

public var shouldSaveDraftMessage: Bool {
return false
}
}
1 change: 1 addition & 0 deletions ChattoAdditions/Tests/Input/ChatInputItemTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ChatInputItemTests: XCTestCase {

@objc
class MockInputItem: NSObject, ChatInputItemProtocol {
var shouldSaveDraftMessage: Bool = false
var supportsExpandableState: Bool = false
var expandedStateTopMargin: CGFloat = 0.0
var selected = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ open class ContentAwareInputItem {

// MARK: - ChatInputItemProtocol
extension ContentAwareInputItem: ChatInputItemProtocol {
public var shouldSaveDraftMessage: Bool {
return false
}

public var supportsExpandableState: Bool {
return true
}
Expand Down