Skip to content

Commit

Permalink
Fix scroll issues with VoiceBroadcastPlayback cells (by fixing Sizabl…
Browse files Browse the repository at this point in the history
…eBaseRoomCell)
  • Loading branch information
Philippe Loriaux committed Nov 23, 2022
1 parent 61073ed commit c5ac0ce
Showing 1 changed file with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ class SizableBaseRoomCell: BaseRoomCell, SizableBaseRoomCellType {

return self.height(for: roomBubbleCellData, fitting: maxWidth)
}

override func prepareForReuse() {
cleanContentVC()

super.prepareForReuse()
}

// MARK - SizableBaseRoomCellType

Expand Down Expand Up @@ -173,10 +179,21 @@ class SizableBaseRoomCell: BaseRoomCell, SizableBaseRoomCellType {
}

return height
}

}

private func cleanContentVC() {
contentVC?.removeFromParent()
contentVC?.view.removeFromSuperview()
contentVC?.didMove(toParent: nil)
contentVC = nil
}

// MARK: - Public

func addContentViewController(_ controller: UIViewController, on contentView: UIView) {
controller.view.invalidateIntrinsicContentSize()

cleanContentVC()

let parent = vc_parentViewController
parent?.addChild(controller)
Expand All @@ -185,13 +202,4 @@ class SizableBaseRoomCell: BaseRoomCell, SizableBaseRoomCellType {

contentVC = controller
}

override func prepareForReuse() {
contentVC?.removeFromParent()
contentVC?.view.removeFromSuperview()
contentVC?.didMove(toParent: nil)
contentVC = nil

super.prepareForReuse()
}
}

0 comments on commit c5ac0ce

Please sign in to comment.