Skip to content

Commit

Permalink
Merge pull request #701 from TICESoftware/modifyAccessLevels
Browse files Browse the repository at this point in the history
Make presenter public to fire send
  • Loading branch information
wiruzx authored Mar 18, 2021
2 parents b4be879 + b9991c9 commit 491d886
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions ChattoAdditions/Source/Input/ChatInputBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ open class ChatInputBar: ReusableXibView {
}

public weak var delegate: ChatInputBarDelegate?
weak var presenter: ChatInputBarPresenter?
public weak var presenter: ChatInputBarPresenter?

public var shouldEnableSendButton = { (inputBar: ChatInputBar) -> Bool in
return !inputBar.textView.text.isEmpty
Expand Down Expand Up @@ -289,7 +289,7 @@ extension ChatInputBar: UITextViewDelegate {
self.delegate?.inputBarDidChangeText(self)
}

public func textView(_ textView: UITextView, shouldChangeTextIn nsRange: NSRange, replacementText text: String) -> Bool {
open func textView(_ textView: UITextView, shouldChangeTextIn nsRange: NSRange, replacementText text: String) -> Bool {
guard let maxCharactersCount = self.maxCharactersCount else { return true }
let currentText: NSString = textView.text as NSString
let currentCount = currentText.length
Expand Down
8 changes: 4 additions & 4 deletions ChattoAdditions/Source/Input/ChatInputBarPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import UIKit

protocol ChatInputBarPresenter: class {
public protocol ChatInputBarPresenter: class {
var focusedItem: ChatInputItemProtocol? { get }
var chatInputBar: ChatInputBar { get }
func onDidBeginEditing()
Expand Down Expand Up @@ -61,7 +61,7 @@ public class BasicChatInputBarPresenter: NSObject, ChatInputBarPresenter {
self.notificationCenter.removeObserver(self)
}

fileprivate(set) var focusedItem: ChatInputItemProtocol? {
fileprivate(set) public var focusedItem: ChatInputItemProtocol? {
willSet {
self.focusedItem?.selected = false
}
Expand Down Expand Up @@ -172,7 +172,7 @@ extension BasicChatInputBarPresenter {
}
}

func onSendButtonPressed() {
public func onSendButtonPressed() {
if let focusedItem = self.focusedItem {
focusedItem.handleInput(self.chatInputBar.inputText as AnyObject)
} else if let keyboardItem = self.firstKeyboardInputItem() {
Expand All @@ -181,7 +181,7 @@ extension BasicChatInputBarPresenter {
self.chatInputBar.inputText = ""
}

func onDidReceiveFocusOnItem(_ item: ChatInputItemProtocol) {
public func onDidReceiveFocusOnItem(_ item: ChatInputItemProtocol) {
guard item.presentationMode != .none else { return }
guard item !== self.focusedItem else { return }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class ExpandableChatInputBarPresenter: NSObject, ChatInputBarPresenter {
self.notificationCenter.removeObserver(self)
}

fileprivate(set) var focusedItem: ChatInputItemProtocol? {
fileprivate(set) public var focusedItem: ChatInputItemProtocol? {
willSet {
self.focusedItem?.selected = false
}
Expand Down Expand Up @@ -267,7 +267,7 @@ extension ExpandableChatInputBarPresenter {
}
}

func onSendButtonPressed() {
public func onSendButtonPressed() {
if let focusedItem = self.focusedItem {
focusedItem.handleInput(self.chatInputBar.inputText as AnyObject)
} else if let keyboardItem = self.firstKeyboardInputItem() {
Expand All @@ -276,7 +276,7 @@ extension ExpandableChatInputBarPresenter {
self.chatInputBar.inputText = ""
}

func onDidReceiveFocusOnItem(_ item: ChatInputItemProtocol) {
public func onDidReceiveFocusOnItem(_ item: ChatInputItemProtocol) {
guard item.presentationMode != .none else { return }
guard item !== self.focusedItem else { return }

Expand Down

0 comments on commit 491d886

Please sign in to comment.