mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-28 19:11:30 +00:00
Message timestamps
This commit is contained in:
parent
1f590ddf09
commit
48a7720737
1 changed files with 17 additions and 5 deletions
|
@ -7,6 +7,7 @@ import ViewModels
|
||||||
final class ConversationView: UIView {
|
final class ConversationView: UIView {
|
||||||
let avatarsView = ConversationAvatarsView()
|
let avatarsView = ConversationAvatarsView()
|
||||||
let displayNamesLabel = UILabel()
|
let displayNamesLabel = UILabel()
|
||||||
|
let timeLabel = UILabel()
|
||||||
let statusBodyView = StatusBodyView()
|
let statusBodyView = StatusBodyView()
|
||||||
|
|
||||||
private var conversationConfiguration: ConversationContentConfiguration
|
private var conversationConfiguration: ConversationContentConfiguration
|
||||||
|
@ -62,27 +63,37 @@ private extension ConversationView {
|
||||||
let containerStackView = UIStackView()
|
let containerStackView = UIStackView()
|
||||||
let sideStackView = UIStackView()
|
let sideStackView = UIStackView()
|
||||||
let mainStackView = UIStackView()
|
let mainStackView = UIStackView()
|
||||||
|
let namesTimeStackView = UIStackView()
|
||||||
|
|
||||||
addSubview(containerStackView)
|
addSubview(containerStackView)
|
||||||
containerStackView.translatesAutoresizingMaskIntoConstraints = false
|
containerStackView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
containerStackView.spacing = .defaultSpacing
|
containerStackView.spacing = .defaultSpacing
|
||||||
|
|
||||||
sideStackView.axis = .vertical
|
sideStackView.alignment = .top
|
||||||
sideStackView.alignment = .trailing
|
|
||||||
sideStackView.spacing = .compactSpacing
|
sideStackView.spacing = .compactSpacing
|
||||||
sideStackView.addArrangedSubview(avatarsView)
|
sideStackView.addArrangedSubview(avatarsView)
|
||||||
sideStackView.addArrangedSubview(UIView())
|
|
||||||
containerStackView.addArrangedSubview(sideStackView)
|
containerStackView.addArrangedSubview(sideStackView)
|
||||||
|
|
||||||
|
namesTimeStackView.spacing = .compactSpacing
|
||||||
|
namesTimeStackView.alignment = .top
|
||||||
|
namesTimeStackView.addArrangedSubview(displayNamesLabel)
|
||||||
|
namesTimeStackView.addArrangedSubview(timeLabel)
|
||||||
|
|
||||||
mainStackView.axis = .vertical
|
mainStackView.axis = .vertical
|
||||||
mainStackView.spacing = .compactSpacing
|
mainStackView.spacing = .compactSpacing
|
||||||
mainStackView.addArrangedSubview(displayNamesLabel)
|
mainStackView.addArrangedSubview(namesTimeStackView)
|
||||||
mainStackView.addSubview(UIView())
|
|
||||||
mainStackView.addArrangedSubview(statusBodyView)
|
mainStackView.addArrangedSubview(statusBodyView)
|
||||||
containerStackView.addArrangedSubview(mainStackView)
|
containerStackView.addArrangedSubview(mainStackView)
|
||||||
|
|
||||||
displayNamesLabel.font = .preferredFont(forTextStyle: .headline)
|
displayNamesLabel.font = .preferredFont(forTextStyle: .headline)
|
||||||
displayNamesLabel.adjustsFontForContentSizeCategory = true
|
displayNamesLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
displayNamesLabel.numberOfLines = 0
|
||||||
|
|
||||||
|
timeLabel.font = .preferredFont(forTextStyle: .subheadline)
|
||||||
|
timeLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
timeLabel.textColor = .secondaryLabel
|
||||||
|
timeLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
|
timeLabel.setContentHuggingPriority(.required, for: .horizontal)
|
||||||
|
|
||||||
statusBodyView.alpha = 0.5
|
statusBodyView.alpha = 0.5
|
||||||
statusBodyView.isUserInteractionEnabled = false
|
statusBodyView.isUserInteractionEnabled = false
|
||||||
|
@ -113,6 +124,7 @@ private extension ConversationView {
|
||||||
mutableDisplayNames.resizeAttachments(toLineHeight: displayNamesLabel.font.lineHeight)
|
mutableDisplayNames.resizeAttachments(toLineHeight: displayNamesLabel.font.lineHeight)
|
||||||
|
|
||||||
displayNamesLabel.attributedText = mutableDisplayNames
|
displayNamesLabel.attributedText = mutableDisplayNames
|
||||||
|
timeLabel.text = viewModel.statusViewModel?.time
|
||||||
statusBodyView.viewModel = viewModel.statusViewModel
|
statusBodyView.viewModel = viewModel.statusViewModel
|
||||||
avatarsView.viewModel = viewModel
|
avatarsView.viewModel = viewModel
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue