mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
Conform cells to RoomCellReadMarkerDisplayable.
This commit is contained in:
parent
5bf67bbddd
commit
5d9040db4b
6 changed files with 44 additions and 38 deletions
|
@ -16,7 +16,7 @@
|
|||
|
||||
import UIKit
|
||||
|
||||
class FileWithoutThumbnailBaseBubbleCell: SizableBaseRoomCell, RoomCellReactionsDisplayable {
|
||||
class FileWithoutThumbnailBaseBubbleCell: SizableBaseRoomCell, RoomCellReactionsDisplayable, RoomCellReadMarkerDisplayable {
|
||||
|
||||
weak var fileAttachementView: FileWithoutThumbnailCellContentView?
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
import UIKit
|
||||
|
||||
class TextMessageBaseBubbleCell: SizableBaseRoomCell, RoomCellURLPreviewDisplayable, RoomCellReactionsDisplayable, RoomCellThreadSummaryDisplayable, RoomCellReadReceiptsDisplayable {
|
||||
class TextMessageBaseBubbleCell: SizableBaseRoomCell, RoomCellURLPreviewDisplayable, RoomCellReactionsDisplayable, RoomCellThreadSummaryDisplayable, RoomCellReadReceiptsDisplayable, RoomCellReadMarkerDisplayable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
class LocationBubbleCell: SizableBaseRoomCell, RoomCellReactionsDisplayable {
|
||||
class LocationBubbleCell: SizableBaseRoomCell, RoomCellReactionsDisplayable, RoomCellReadMarkerDisplayable {
|
||||
|
||||
private var locationView: RoomTimelineLocationView!
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
class PollBubbleCell: SizableBaseRoomCell, RoomCellReactionsDisplayable {
|
||||
class PollBubbleCell: SizableBaseRoomCell, RoomCellReactionsDisplayable, RoomCellReadMarkerDisplayable {
|
||||
|
||||
private var pollView: UIView?
|
||||
private var event: MXEvent?
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
class VoiceMessageBubbleCell: SizableBaseRoomCell, RoomCellReactionsDisplayable {
|
||||
class VoiceMessageBubbleCell: SizableBaseRoomCell, RoomCellReactionsDisplayable, RoomCellReadMarkerDisplayable {
|
||||
|
||||
private(set) var playbackController: VoiceMessagePlaybackController!
|
||||
|
||||
|
|
|
@ -210,40 +210,46 @@ class PlainRoomTimelineCellDecorator: RoomTimelineCellDecorator {
|
|||
cellData: MXKRoomBubbleCellData,
|
||||
contentViewPositionY: CGFloat) {
|
||||
|
||||
guard let overlayContainer = cell.bubbleOverlayContainer else {
|
||||
return
|
||||
if let readMarkerDisplayable = cell as? RoomCellReadMarkerDisplayable {
|
||||
|
||||
readMarkerDisplayable.addReadMarkerView(readMarkerView)
|
||||
|
||||
} else {
|
||||
guard let overlayContainer = cell.bubbleOverlayContainer else {
|
||||
return
|
||||
}
|
||||
|
||||
// The read marker is added into the overlay container.
|
||||
// CAUTION: Keep disabled the user interaction on this container to not disturb tap gesture handling.
|
||||
overlayContainer.backgroundColor = UIColor.clear
|
||||
overlayContainer.alpha = 1
|
||||
overlayContainer.isUserInteractionEnabled = false
|
||||
overlayContainer.isHidden = false
|
||||
|
||||
// Add read marker to overlayContainer
|
||||
readMarkerView.translatesAutoresizingMaskIntoConstraints = false
|
||||
overlayContainer.addSubview(readMarkerView)
|
||||
cell.readMarkerView = readMarkerView
|
||||
|
||||
// Force read marker constraints
|
||||
let topConstraint = readMarkerView.topAnchor.constraint(equalTo: overlayContainer.topAnchor, constant: contentViewPositionY - PlainRoomCellLayoutConstants.readMarkerViewHeight)
|
||||
|
||||
let leadingConstraint = readMarkerView.leadingAnchor.constraint(equalTo: overlayContainer.leadingAnchor)
|
||||
|
||||
let trailingConstraint = readMarkerView.trailingAnchor.constraint(equalTo: overlayContainer.trailingAnchor)
|
||||
|
||||
let heightConstraint = readMarkerView.heightAnchor.constraint(equalToConstant: PlainRoomCellLayoutConstants.readMarkerViewHeight)
|
||||
|
||||
NSLayoutConstraint.activate([topConstraint,
|
||||
leadingConstraint,
|
||||
trailingConstraint,
|
||||
heightConstraint])
|
||||
|
||||
cell.readMarkerViewTopConstraint = topConstraint
|
||||
cell.readMarkerViewLeadingConstraint = leadingConstraint
|
||||
cell.readMarkerViewTrailingConstraint = trailingConstraint
|
||||
cell.readMarkerViewHeightConstraint = heightConstraint
|
||||
}
|
||||
|
||||
// The read marker is added into the overlay container.
|
||||
// CAUTION: Keep disabled the user interaction on this container to not disturb tap gesture handling.
|
||||
overlayContainer.backgroundColor = UIColor.clear
|
||||
overlayContainer.alpha = 1
|
||||
overlayContainer.isUserInteractionEnabled = false
|
||||
overlayContainer.isHidden = false
|
||||
|
||||
// Add read marker to overlayContainer
|
||||
readMarkerView.translatesAutoresizingMaskIntoConstraints = false
|
||||
overlayContainer.addSubview(readMarkerView)
|
||||
cell.readMarkerView = readMarkerView
|
||||
|
||||
// Force read marker constraints
|
||||
let topConstraint = readMarkerView.topAnchor.constraint(equalTo: overlayContainer.topAnchor, constant: contentViewPositionY - PlainRoomCellLayoutConstants.readMarkerViewHeight)
|
||||
|
||||
let leadingConstraint = readMarkerView.leadingAnchor.constraint(equalTo: overlayContainer.leadingAnchor)
|
||||
|
||||
let trailingConstraint = readMarkerView.trailingAnchor.constraint(equalTo: overlayContainer.trailingAnchor)
|
||||
|
||||
let heightConstraint = readMarkerView.heightAnchor.constraint(equalToConstant: PlainRoomCellLayoutConstants.readMarkerViewHeight)
|
||||
|
||||
NSLayoutConstraint.activate([topConstraint,
|
||||
leadingConstraint,
|
||||
trailingConstraint,
|
||||
heightConstraint])
|
||||
|
||||
cell.readMarkerViewTopConstraint = topConstraint
|
||||
cell.readMarkerViewLeadingConstraint = leadingConstraint
|
||||
cell.readMarkerViewTrailingConstraint = trailingConstraint
|
||||
cell.readMarkerViewHeightConstraint = heightConstraint
|
||||
}
|
||||
|
||||
func dissmissReadMarkerView(forCell cell: MXKRoomBubbleTableViewCell,
|
||||
|
|
Loading…
Reference in a new issue