|
@@ -6,6 +6,7 @@ public protocol ChatEditingDelegate: class {
|
|
|
func onForwardPressed()
|
|
|
func onCancelPressed()
|
|
|
func onCopyPressed()
|
|
|
+ func onMorePressed()
|
|
|
}
|
|
|
|
|
|
public class ChatEditingBar: UIView, InputItem {
|
|
@@ -19,6 +20,9 @@ public class ChatEditingBar: UIView, InputItem {
|
|
|
|
|
|
public var isEnabled: Bool {
|
|
|
willSet(newValue) {
|
|
|
+ if !newValue {
|
|
|
+ moreButton.isEnabled = newValue
|
|
|
+ }
|
|
|
deleteButton.isEnabled = newValue
|
|
|
forwardButton.isEnabled = newValue
|
|
|
copyButton.isEnabled = newValue
|
|
@@ -27,6 +31,21 @@ public class ChatEditingBar: UIView, InputItem {
|
|
|
|
|
|
weak var delegate: ChatEditingDelegate?
|
|
|
|
|
|
+ public lazy var moreButton: UIButton = {
|
|
|
+ let view = UIButton()
|
|
|
+ if #available(iOS 13.0, *) {
|
|
|
+ view.setImage(UIImage(systemName: "ellipsis.circle"), for: .normal)
|
|
|
+ } else {
|
|
|
+ view.setImage(UIImage(named: "ic_more"), for: .normal)
|
|
|
+ }
|
|
|
+ view.tintColor = .systemBlue
|
|
|
+ view.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ view.isUserInteractionEnabled = true
|
|
|
+ view.imageView?.contentMode = .scaleAspectFit
|
|
|
+ view.accessibilityLabel = String.localized("resend")
|
|
|
+ return view
|
|
|
+ }()
|
|
|
+
|
|
|
private lazy var copyButton: UIButton = {
|
|
|
let view = UIButton()
|
|
|
if #available(iOS 13.0, *) {
|
|
@@ -72,7 +91,7 @@ public class ChatEditingBar: UIView, InputItem {
|
|
|
}()
|
|
|
|
|
|
private lazy var mainContentView: UIStackView = {
|
|
|
- let view = UIStackView(arrangedSubviews: [copyButton, forwardButton, deleteButton])
|
|
|
+ let view = UIStackView(arrangedSubviews: [copyButton, forwardButton, deleteButton, moreButton])
|
|
|
view.axis = .horizontal
|
|
|
view.distribution = .fillEqually
|
|
|
view.alignment = .center
|
|
@@ -105,12 +124,16 @@ public class ChatEditingBar: UIView, InputItem {
|
|
|
mainContentView.constraintAlignTrailingTo(self),
|
|
|
deleteButton.constraintHeightTo(36),
|
|
|
forwardButton.constraintHeightTo(26),
|
|
|
- copyButton.constraintHeightTo(36)
|
|
|
+ copyButton.constraintHeightTo(36),
|
|
|
+ moreButton.constraintHeightTo(36)
|
|
|
])
|
|
|
|
|
|
let copyButtonGestureListener = UITapGestureRecognizer(target: self, action: #selector(onCopyPressed))
|
|
|
copyButton.addGestureRecognizer(copyButtonGestureListener)
|
|
|
|
|
|
+ let moreBtnGestureListener = UITapGestureRecognizer(target: self, action: #selector(onMorePressed))
|
|
|
+ moreButton.addGestureRecognizer(moreBtnGestureListener)
|
|
|
+
|
|
|
let forwardGestureListener = UITapGestureRecognizer(target: self, action: #selector(onForwardPressed))
|
|
|
forwardButton.addGestureRecognizer(forwardGestureListener)
|
|
|
|
|
@@ -122,6 +145,10 @@ public class ChatEditingBar: UIView, InputItem {
|
|
|
delegate?.onCopyPressed()
|
|
|
}
|
|
|
|
|
|
+ @objc func onMorePressed() {
|
|
|
+ delegate?.onMorePressed()
|
|
|
+ }
|
|
|
+
|
|
|
@objc func onForwardPressed() {
|
|
|
delegate?.onForwardPressed()
|
|
|
}
|