ui: subtitle for session table view

pull/941/head
ryanzhao 2 years ago
parent a50de813ce
commit 6bd7476c29

@ -79,7 +79,7 @@ class ThreadDisappearingMessagesViewModel: SessionTableViewModel<ThreadDisappear
// MARK: - Content
override var title: String { "DISAPPEARING_MESSAGES".localized() }
var subtitle: String { threadVariant == .contact ? "DISAPPERING_MESSAGES_SUBTITLE_CONTACTS".localized() : "DISAPPERING_MESSAGES_SUBTITLE_GROUPS".localized() }
override var subtitle: String? { threadVariant == .contact ? "DISAPPERING_MESSAGES_SUBTITLE_CONTACTS".localized() : "DISAPPERING_MESSAGES_SUBTITLE_GROUPS".localized() }
private var _settingsData: [SectionModel] = []
public override var settingsData: [SectionModel] { _settingsData }

@ -132,7 +132,7 @@ final class ConversationTitleView: UIView {
self.titleLabel.text = name
self.titleLabel.font = .boldSystemFont(
ofSize: (shouldHaveSubtitle ?
Values.mediumFontSize :
Values.largeFontSize :
Values.veryLargeFontSize
)
)
@ -219,7 +219,7 @@ final class ConversationTitleView: UIView {
labelTypes: labelTypes,
labelSize: CGSize(
width: self?.labelCarouselViewWidth.constant ?? 0,
height: 20
height: 15
),
shouldAutoScroll: false
)

@ -159,7 +159,7 @@ final class SessionLabelCarouselView: UIView, UIScrollViewDelegate {
addSubview(pageControl)
pageControl.center(.horizontal, in: self)
pageControl.pin(.bottom, to: .bottom, of: self, withInset: -1)
pageControl.pin(.bottom, to: .bottom, of: self, withInset: 1)
scrollView.addSubview(stackView)
}

@ -95,7 +95,7 @@ class SessionTableViewController<NavItemId: Equatable, Section: SessionTableSect
super.viewDidLoad()
navigationItem.titleView = titleView
titleView.update(title: self.viewModel.title, subTitle: nil)
titleView.update(title: self.viewModel.title, subtitle: self.viewModel.subtitle)
view.themeBackgroundColor = .backgroundPrimary
view.addSubview(tableView)

@ -38,6 +38,7 @@ class SessionTableViewModel<NavItemId: Equatable, Section: SessionTableSection,
// MARK: - Content
open var title: String { preconditionFailure("abstract class - override in subclass") }
open var subtitle: String? { nil }
open var settingsData: [SectionModel] { preconditionFailure("abstract class - override in subclass") }
open var observableSettingsData: ObservableData {
preconditionFailure("abstract class - override in subclass")

@ -35,7 +35,7 @@ final class SessionTableViewTitleView: UIView {
private lazy var subtitleLabel: UILabel = {
let result: UILabel = UILabel()
result.font = .systemFont(ofSize: 13)
result.font = .systemFont(ofSize: Values.verySmallFontSize)
result.themeTextColor = .textPrimary
result.lineBreakMode = .byTruncatingTail
@ -71,37 +71,22 @@ final class SessionTableViewTitleView: UIView {
// MARK: - Content
override func layoutSubviews() {
super.layoutSubviews()
// There is an annoying issue where pushing seems to update the width of this
// view resulting in the content shifting to the right during
guard self.oldSize != .zero, self.oldSize != bounds.size else {
self.oldSize = bounds.size
return
}
let diff: CGFloat = (bounds.size.width - oldSize.width)
// self.stackViewTrailingConstraint.constant = -max(0, diff)
self.oldSize = bounds.size
}
public func update(title: String, subTitle: String?) {
public func update(title: String, subtitle: String?) {
guard Thread.isMainThread else {
DispatchQueue.main.async { [weak self] in
self?.update(title: title, subTitle: subTitle)
self?.update(title: title, subtitle: subtitle)
}
return
}
self.titleLabel.text = title
self.titleLabel.font = .boldSystemFont(
ofSize: (subTitle != nil ?
Values.mediumFontSize :
ofSize: (subtitle?.isEmpty == false ?
Values.largeFontSize :
Values.veryLargeFontSize
)
)
self.subtitleLabel.text = subTitle
self.subtitleLabel.text = subtitle
}
}

Loading…
Cancel
Save