Fix confirm reblog alert not adjusting to Dynamic Type

Closes #246
This commit is contained in:
Shadowfacts 2022-11-13 17:15:06 -05:00
parent 71f97d41c4
commit 06ad46e639
2 changed files with 9 additions and 5 deletions

View File

@ -76,6 +76,7 @@ class CustomAlertController: UIViewController {
let titleLabel = UILabel()
titleLabel.text = config.title
titleLabel.font = UIFont(descriptor: .preferredFontDescriptor(withTextStyle: .body).withSymbolicTraits(.traitBold)!, size: 0)
titleLabel.adjustsFontForContentSizeCategory = true
titleLabel.numberOfLines = 0
titleLabel.textAlignment = .center
stack.addArrangedSubview(titleLabel)
@ -361,13 +362,14 @@ class CustomAlertActionButton: UIControl {
let label = UILabel()
label.text = title
label.textColor = .tintColor
switch action.style {
case .cancel:
label.adjustsFontForContentSizeCategory = true
if case .cancel = action.style {
label.font = UIFont(descriptor: .preferredFontDescriptor(withTextStyle: .body).withSymbolicTraits(.traitBold)!, size: 0)
case .destructive:
} else {
label.font = .preferredFont(forTextStyle: .body)
}
if case .destructive = action.style {
label.textColor = .systemRed
default:
break
}
titleView.addArrangedSubview(label)
}

View File

@ -55,6 +55,7 @@ class ConfirmReblogStatusPreviewView: UIView {
let displayNameLabel = EmojiLabel()
displayNameLabel.font = UIFont(descriptor: .preferredFontDescriptor(withTextStyle: .caption1).addingAttributes([.traits: [UIFontDescriptor.TraitKey.weight: UIFont.Weight.semibold]]), size: 0)
displayNameLabel.adjustsFontSizeToFitWidth = true
displayNameLabel.adjustsFontForContentSizeCategory = true
displayNameLabel.updateForAccountDisplayName(account: status.account)
vStack.addArrangedSubview(displayNameLabel)
@ -64,6 +65,7 @@ class ConfirmReblogStatusPreviewView: UIView {
contentView.isScrollEnabled = false
contentView.backgroundColor = nil
contentView.textContainerInset = .zero
contentView.adjustsFontForContentSizeCategory = true
// remove the extra line spacing applied by StatusContentTextView because, since we're using a smaller font, the regular 2pt looks big
contentView.paragraphStyle = .default
// TODO: line limit