mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
Fix cell layout when thread root is a poll
This commit is contained in:
@@ -168,6 +168,10 @@ class BaseBubbleCell: MXKRoomBubbleTableViewCell, BaseBubbleCellType {
|
||||
if let bubbleCellReactionsDisplayable = self as? BubbleCellReactionsDisplayable {
|
||||
bubbleCellReactionsDisplayable.removeReactionsView()
|
||||
}
|
||||
|
||||
if let bubbleCellThreadSummaryDisplayable = self as? BubbleCellThreadSummaryDisplayable {
|
||||
bubbleCellThreadSummaryDisplayable.removeThreadSummaryView()
|
||||
}
|
||||
}
|
||||
|
||||
override func render(_ cellData: MXKCellData!) {
|
||||
@@ -244,6 +248,16 @@ class BaseBubbleCell: MXKRoomBubbleTableViewCell, BaseBubbleCellType {
|
||||
func removeReactionsView() {
|
||||
self.bubbleCellContentView?.removeReactionsView()
|
||||
}
|
||||
|
||||
// MARK: - BubbleCellThreadSummaryDisplayable
|
||||
|
||||
func addThreadSummaryView(_ threadSummaryView: ThreadSummaryView) {
|
||||
self.bubbleCellContentView?.addThreadSummaryView(threadSummaryView)
|
||||
}
|
||||
|
||||
func removeThreadSummaryView() {
|
||||
self.bubbleCellContentView?.removeThreadSummaryView()
|
||||
}
|
||||
|
||||
// Encryption status
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ final class BubbleCellContentView: UIView, NibLoadable {
|
||||
|
||||
@IBOutlet weak var reactionsContainerView: UIView!
|
||||
@IBOutlet weak var reactionsContentView: UIView!
|
||||
|
||||
@IBOutlet weak var threadSummaryContainerView: UIView!
|
||||
|
||||
@IBOutlet weak var bubbleOverlayContainer: UIView!
|
||||
|
||||
@@ -69,6 +71,14 @@ final class BubbleCellContentView: UIView, NibLoadable {
|
||||
self.reactionsContainerView.isHidden = !newValue
|
||||
}
|
||||
}
|
||||
|
||||
private var showThreadSummary: Bool {
|
||||
get {
|
||||
return !self.threadSummaryContainerView.isHidden
|
||||
} set {
|
||||
self.threadSummaryContainerView.isHidden = !newValue
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Public
|
||||
|
||||
@@ -143,3 +153,27 @@ extension BubbleCellContentView: BubbleCellReactionsDisplayable {
|
||||
self.reactionsContentView.vc_removeAllSubviews()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - BubbleCellThreadSummaryDisplayable
|
||||
extension BubbleCellContentView: BubbleCellThreadSummaryDisplayable {
|
||||
|
||||
func addThreadSummaryView(_ threadSummaryView: ThreadSummaryView) {
|
||||
self.threadSummaryContainerView.vc_removeAllSubviews()
|
||||
self.threadSummaryContainerView.addSubview(threadSummaryView)
|
||||
NSLayoutConstraint.activate([
|
||||
threadSummaryView.leadingAnchor.constraint(equalTo: innerContentView.leadingAnchor),
|
||||
threadSummaryView.topAnchor.constraint(equalTo: threadSummaryContainerView.topAnchor),
|
||||
threadSummaryView.heightAnchor.constraint(equalToConstant: RoomBubbleCellLayout.threadSummaryViewHeight),
|
||||
threadSummaryView.bottomAnchor.constraint(equalTo: threadSummaryContainerView.bottomAnchor),
|
||||
threadSummaryView.trailingAnchor.constraint(lessThanOrEqualTo: threadSummaryContainerView.trailingAnchor,
|
||||
constant: -RoomBubbleCellLayout.reactionsViewRightMargin)
|
||||
])
|
||||
self.showThreadSummary = true
|
||||
}
|
||||
|
||||
func removeThreadSummaryView() {
|
||||
self.showThreadSummary = false
|
||||
self.threadSummaryContainerView.vc_removeAllSubviews()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -195,6 +195,10 @@
|
||||
<constraint firstAttribute="trailing" secondItem="SNw-aM-ILI" secondAttribute="trailing" constant="15" id="ynR-d4-6cf"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view hidden="YES" clipsSubviews="YES" contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="2eB-kB-m20">
|
||||
<rect key="frame" x="0.0" y="0.0" width="595" height="0.0"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Dj1-m6-1Jw" firstAttribute="width" secondItem="5GX-gn-bK1" secondAttribute="width" id="0Px-jL-CMJ"/>
|
||||
@@ -238,6 +242,7 @@
|
||||
<outlet property="readReceiptsContainerView" destination="4zo-V8-CNe" id="7ek-u4-CX8"/>
|
||||
<outlet property="readReceiptsContentView" destination="rQt-NH-Cb0" id="tqw-je-kp9"/>
|
||||
<outlet property="senderInfoContainerView" destination="w0C-6a-f5M" id="fZE-vY-0nR"/>
|
||||
<outlet property="threadSummaryContainerView" destination="2eB-kB-m20" id="0Y4-4E-I9K"/>
|
||||
<outlet property="userNameLabel" destination="meG-P8-61b" id="ETK-ag-WYR"/>
|
||||
<outlet property="userNameTouchMaskView" destination="ohU-Sc-mgb" id="FwW-aL-kc5"/>
|
||||
</connections>
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// `BubbleCellThreadSummaryDisplayable` is a protocol indicating that a cell support displaying a thread summary.
|
||||
@objc protocol BubbleCellThreadSummaryDisplayable {
|
||||
func addThreadSummaryView(_ threadSummaryView: ThreadSummaryView)
|
||||
func removeThreadSummaryView()
|
||||
}
|
||||
Reference in New Issue
Block a user