mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-25 19:10:49 +02:00
RoomMessageBubbleBackgroundView: Conforms to TimestampDisplayable.
This commit is contained in:
+31
@@ -15,6 +15,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
class RoomMessageBubbleBackgroundView: UIView {
|
||||
|
||||
@@ -27,6 +28,7 @@ class RoomMessageBubbleBackgroundView: UIView {
|
||||
// MARK: - Properties
|
||||
|
||||
private var heightConstraint: NSLayoutConstraint?
|
||||
fileprivate weak var timestampView: UIView?
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
@@ -72,3 +74,32 @@ class RoomMessageBubbleBackgroundView: UIView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - TimestampDisplayable
|
||||
extension RoomMessageBubbleBackgroundView: TimestampDisplayable {
|
||||
func addTimestampView(_ timestampView: UIView) {
|
||||
self.addTimestampView(timestampView, rightMargin: 8.0, bottomMargin: 4.0)
|
||||
self.timestampView = timestampView
|
||||
}
|
||||
|
||||
func removeTimestampView() {
|
||||
self.timestampView?.removeFromSuperview()
|
||||
}
|
||||
|
||||
func addTimestampView(_ timestampView: UIView,
|
||||
rightMargin: CGFloat,
|
||||
bottomMargin: CGFloat) {
|
||||
timestampView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
self.addSubview(timestampView)
|
||||
|
||||
let trailingConstraint = timestampView.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -rightMargin)
|
||||
|
||||
let bottomConstraint = timestampView.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -bottomMargin)
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
trailingConstraint,
|
||||
bottomConstraint
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user