|
|
@ -4,7 +4,7 @@ final class DocumentView : UIView {
|
|
|
|
private let textColor: UIColor
|
|
|
|
private let textColor: UIColor
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: Settings
|
|
|
|
// MARK: Settings
|
|
|
|
private static let iconImageViewSize: CGSize = CGSize(width: 26, height: 40)
|
|
|
|
private static let iconImageViewSize: CGSize = CGSize(width: 31, height: 40)
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: Lifecycle
|
|
|
|
// MARK: Lifecycle
|
|
|
|
init(viewItem: ConversationViewItem, textColor: UIColor) {
|
|
|
|
init(viewItem: ConversationViewItem, textColor: UIColor) {
|
|
|
@ -36,11 +36,21 @@ final class DocumentView : UIView {
|
|
|
|
titleLabel.lineBreakMode = .byTruncatingTail
|
|
|
|
titleLabel.lineBreakMode = .byTruncatingTail
|
|
|
|
titleLabel.text = attachment.sourceFilename ?? "File"
|
|
|
|
titleLabel.text = attachment.sourceFilename ?? "File"
|
|
|
|
titleLabel.textColor = textColor
|
|
|
|
titleLabel.textColor = textColor
|
|
|
|
titleLabel.font = .systemFont(ofSize: Values.mediumFontSize, weight: .light)
|
|
|
|
titleLabel.font = .systemFont(ofSize: Values.smallFontSize, weight: .light)
|
|
|
|
|
|
|
|
// Size label
|
|
|
|
|
|
|
|
let sizeLabel = UILabel()
|
|
|
|
|
|
|
|
sizeLabel.lineBreakMode = .byTruncatingTail
|
|
|
|
|
|
|
|
sizeLabel.text = OWSFormat.formatFileSize(UInt(attachment.byteCount))
|
|
|
|
|
|
|
|
sizeLabel.textColor = textColor
|
|
|
|
|
|
|
|
sizeLabel.font = .systemFont(ofSize: Values.verySmallFontSize)
|
|
|
|
|
|
|
|
// Label stack view
|
|
|
|
|
|
|
|
let labelStackView = UIStackView(arrangedSubviews: [ titleLabel, sizeLabel ])
|
|
|
|
|
|
|
|
labelStackView.axis = .vertical
|
|
|
|
// Stack view
|
|
|
|
// Stack view
|
|
|
|
let stackView = UIStackView(arrangedSubviews: [ imageView, titleLabel ])
|
|
|
|
let stackView = UIStackView(arrangedSubviews: [ imageView, labelStackView ])
|
|
|
|
stackView.axis = .horizontal
|
|
|
|
stackView.axis = .horizontal
|
|
|
|
stackView.spacing = Values.verySmallSpacing
|
|
|
|
stackView.spacing = Values.verySmallSpacing
|
|
|
|
|
|
|
|
stackView.alignment = .center
|
|
|
|
addSubview(stackView)
|
|
|
|
addSubview(stackView)
|
|
|
|
stackView.pin(to: self)
|
|
|
|
stackView.pin(to: self)
|
|
|
|
}
|
|
|
|
}
|
|
|
|