From 6deb6d34a30c79025b034a7e6533997c141aff1d Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Mon, 7 Feb 2022 16:07:27 +0100 Subject: [PATCH 01/62] BubbleCellContentView: Add support for URL preview, expose several constraints. --- .../BubbleCellContentView.swift | 30 ++++++++++++++++++- .../BaseBubbleCell/BubbleCellContentView.xib | 15 ++++++++-- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BubbleCellContentView.swift b/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BubbleCellContentView.swift index 7fc615f8b..b2ada1d99 100644 --- a/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BubbleCellContentView.swift +++ b/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BubbleCellContentView.swift @@ -38,6 +38,7 @@ final class BubbleCellContentView: UIView, NibLoadable { @IBOutlet weak var innerContentViewLeadingConstraint: NSLayoutConstraint! @IBOutlet weak var innerContentViewTrailingConstraint: NSLayoutConstraint! + @IBOutlet weak var innerContentViewBottomContraint: NSLayoutConstraint! @IBOutlet weak var encryptionStatusContainerView: UIView! @IBOutlet weak var encryptionImageView: UIImageView! @@ -45,11 +46,15 @@ final class BubbleCellContentView: UIView, NibLoadable { @IBOutlet weak var bubbleInfoContainer: UIView! @IBOutlet weak var bubbleInfoContainerTopConstraint: NSLayoutConstraint! + @IBOutlet weak var urlPreviewContainerView: UIView! + @IBOutlet weak var readReceiptsContainerView: UIView! @IBOutlet weak var readReceiptsContentView: UIView! @IBOutlet weak var reactionsContainerView: UIView! @IBOutlet weak var reactionsContentView: UIView! + @IBOutlet weak var reactionsContentViewLeadingConstraint: NSLayoutConstraint! + @IBOutlet weak var reactionsContentViewTrailingConstraint: NSLayoutConstraint! @IBOutlet weak var threadSummaryContainerView: UIView! @@ -57,6 +62,15 @@ final class BubbleCellContentView: UIView, NibLoadable { // MARK: Private + private var showURLPreview: Bool { + get { + return !self.urlPreviewContainerView.isHidden + } + set { + self.urlPreviewContainerView.isHidden = !newValue + } + } + private var showReadReceipts: Bool { get { return !self.readReceiptsContainerView.isHidden @@ -178,5 +192,19 @@ extension BubbleCellContentView: BubbleCellThreadSummaryDisplayable { self.showThreadSummary = false self.threadSummaryContainerView.vc_removeAllSubviews() } - +} + +// MARK: - RoomCellURLPreviewDisplayable +extension BubbleCellContentView: RoomCellURLPreviewDisplayable { + + func addURLPreviewView(_ urlPreviewView: UIView) { + self.urlPreviewContainerView.vc_removeAllSubviews() + self.urlPreviewContainerView.vc_addSubViewMatchingParent(urlPreviewView) + self.showURLPreview = true + } + + func removeURLPreviewView() { + self.showURLPreview = false + self.urlPreviewContainerView.vc_removeAllSubviews() + } } diff --git a/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BubbleCellContentView.xib b/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BubbleCellContentView.xib index 2472391fc..76c12d077 100644 --- a/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BubbleCellContentView.xib +++ b/Riot/Modules/Room/Views/BubbleCells/BaseBubbleCell/BubbleCellContentView.xib @@ -17,7 +17,7 @@ - + -