diff --git a/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BaseBubbleCell.swift b/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BaseBubbleCell.swift index d97c68ab5..78e646ece 100644 --- a/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BaseBubbleCell.swift +++ b/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BaseBubbleCell.swift @@ -144,25 +144,7 @@ class BaseBubbleCell: MXKRoomBubbleTableViewCell, BaseBubbleCellType { // MARK: - Public - // MARK: - Overrides - - override func setupViews() { - super.setupViews() - - let showEncryptionStatus = bubbleCellContentView?.showEncryptionStatus ?? false - - if showEncryptionStatus { - self.setupEncryptionStatusViewTapGestureRecognizer() - } - } - - override class func defaultReuseIdentifier() -> String! { - return String(describing: self) - } - - override func didEndDisplay() { - super.didEndDisplay() - + func removeDecorationViews() { if let bubbleCellReadReceiptsDisplayable = self as? BubbleCellReadReceiptsDisplayable { bubbleCellReadReceiptsDisplayable.removeReadReceiptsView() } @@ -184,6 +166,28 @@ class BaseBubbleCell: MXKRoomBubbleTableViewCell, BaseBubbleCellType { } } + // MARK: - Overrides + + override func setupViews() { + super.setupViews() + + let showEncryptionStatus = bubbleCellContentView?.showEncryptionStatus ?? false + + if showEncryptionStatus { + self.setupEncryptionStatusViewTapGestureRecognizer() + } + } + + override class func defaultReuseIdentifier() -> String! { + return String(describing: self) + } + + override func prepareForReuse() { + super.prepareForReuse() + + self.removeDecorationViews() + } + override func render(_ cellData: MXKCellData!) { // In `MXKRoomBubbleTableViewCell` setupViews() is called in awakeFromNib() that is not called here, so call it only on first render() call self.setupViewsIfNeeded()