mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
Implement opening thread modal when tapped
This commit is contained in:
@@ -19,7 +19,7 @@ import Reusable
|
||||
|
||||
@objc
|
||||
protocol ThreadSummaryViewDelegate: AnyObject {
|
||||
func tappedThreadSummaryView(_ summaryView: ThreadSummaryView, for thread: MXThread)
|
||||
func threadSummaryViewTapped(_ summaryView: ThreadSummaryView)
|
||||
}
|
||||
|
||||
/// A view to display a summary for an `MXThread` generated by the `MXThreadingService`.
|
||||
@@ -42,6 +42,10 @@ class ThreadSummaryView: UIView {
|
||||
}
|
||||
}
|
||||
|
||||
private lazy var tapGestureRecognizer: UITapGestureRecognizer = {
|
||||
return UITapGestureRecognizer(target: self, action: #selector(tapped(_:)))
|
||||
}()
|
||||
|
||||
weak var delegate: ThreadSummaryViewDelegate?
|
||||
|
||||
// MARK: - Setup
|
||||
@@ -61,6 +65,7 @@ class ThreadSummaryView: UIView {
|
||||
private func configure() {
|
||||
clipsToBounds = true
|
||||
layer.cornerRadius = Constants.cornerRadius
|
||||
addGestureRecognizer(tapGestureRecognizer)
|
||||
|
||||
guard let thread = thread else { return }
|
||||
numberOfRepliesLabel.text = String(thread.numberOfReplies)
|
||||
@@ -95,6 +100,11 @@ class ThreadSummaryView: UIView {
|
||||
|
||||
// MARK: - Action
|
||||
|
||||
@objc
|
||||
private func tapped(_ sender: UITapGestureRecognizer) {
|
||||
guard thread != nil else { return }
|
||||
delegate?.threadSummaryViewTapped(self)
|
||||
}
|
||||
}
|
||||
|
||||
extension ThreadSummaryView: NibLoadable {}
|
||||
|
||||
Reference in New Issue
Block a user