APP字体大小跟随系统设置

This commit is contained in:
Fin 2024-10-25 15:30:01 +08:00
parent efae83804a
commit 8a0b40cdb9
14 changed files with 78 additions and 35 deletions

View File

@ -99,6 +99,9 @@
067B2EB525693E38008B6BE1 /* MessageTableViewCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067B2EB425693E38008B6BE1 /* MessageTableViewCellViewModel.swift */; }; 067B2EB525693E38008B6BE1 /* MessageTableViewCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067B2EB425693E38008B6BE1 /* MessageTableViewCellViewModel.swift */; };
06802E5320ECC40C00767047 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0661A549204FDA4100965E4E /* Assets.xcassets */; }; 06802E5320ECC40C00767047 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0661A549204FDA4100965E4E /* Assets.xcassets */; };
06840DBB272298FB001B3193 /* BKColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06840DBA272298FB001B3193 /* BKColor.swift */; }; 06840DBB272298FB001B3193 /* BKColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06840DBA272298FB001B3193 /* BKColor.swift */; };
0687F2A82CCB791A00B2A52F /* UIFont+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0687F2A72CCB791A00B2A52F /* UIFont+Extension.swift */; };
0687F2A92CCB791A00B2A52F /* UIFont+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0687F2A72CCB791A00B2A52F /* UIFont+Extension.swift */; };
0687F2AA2CCB7FA500B2A52F /* UIFont+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0687F2A72CCB791A00B2A52F /* UIFont+Extension.swift */; };
06885EB6247FB9880004A303 /* MessageSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06885EB5247FB9880004A303 /* MessageSettingsViewController.swift */; }; 06885EB6247FB9880004A303 /* MessageSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06885EB5247FB9880004A303 /* MessageSettingsViewController.swift */; };
0689CF4C2C7484A7007203A6 /* BarkTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0689CF4B2C7484A7007203A6 /* BarkTabBarController.swift */; }; 0689CF4C2C7484A7007203A6 /* BarkTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0689CF4B2C7484A7007203A6 /* BarkTabBarController.swift */; };
068EC15827ED99C900D5D11E /* ServerListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068EC15727ED99C900D5D11E /* ServerListViewController.swift */; }; 068EC15827ED99C900D5D11E /* ServerListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068EC15727ED99C900D5D11E /* ServerListViewController.swift */; };
@ -326,6 +329,7 @@
0683487020510FB20024B6DA /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; }; 0683487020510FB20024B6DA /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
0683487220510FB20024B6DA /* UserNotificationsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotificationsUI.framework; path = System/Library/Frameworks/UserNotificationsUI.framework; sourceTree = SDKROOT; }; 0683487220510FB20024B6DA /* UserNotificationsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotificationsUI.framework; path = System/Library/Frameworks/UserNotificationsUI.framework; sourceTree = SDKROOT; };
06840DBA272298FB001B3193 /* BKColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BKColor.swift; sourceTree = "<group>"; }; 06840DBA272298FB001B3193 /* BKColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BKColor.swift; sourceTree = "<group>"; };
0687F2A72CCB791A00B2A52F /* UIFont+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+Extension.swift"; sourceTree = "<group>"; };
06885EB5247FB9880004A303 /* MessageSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageSettingsViewController.swift; sourceTree = "<group>"; }; 06885EB5247FB9880004A303 /* MessageSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageSettingsViewController.swift; sourceTree = "<group>"; };
0689CF4B2C7484A7007203A6 /* BarkTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarkTabBarController.swift; sourceTree = "<group>"; }; 0689CF4B2C7484A7007203A6 /* BarkTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarkTabBarController.swift; sourceTree = "<group>"; };
068EC15727ED99C900D5D11E /* ServerListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerListViewController.swift; sourceTree = "<group>"; }; 068EC15727ED99C900D5D11E /* ServerListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerListViewController.swift; sourceTree = "<group>"; };
@ -582,6 +586,7 @@
06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */, 06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */,
06F08EAB29B1DECD006AB9CA /* NSLocalizedString+Extension.swift */, 06F08EAB29B1DECD006AB9CA /* NSLocalizedString+Extension.swift */,
06E944742C07012E00AC86AB /* RealmConfiguration.swift */, 06E944742C07012E00AC86AB /* RealmConfiguration.swift */,
0687F2A72CCB791A00B2A52F /* UIFont+Extension.swift */,
); );
path = Common; path = Common;
sourceTree = "<group>"; sourceTree = "<group>";
@ -1103,6 +1108,7 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
0687F2AA2CCB7FA500B2A52F /* UIFont+Extension.swift in Sources */,
0632CE2320EC9098003FDF46 /* NotificationViewController.swift in Sources */, 0632CE2320EC9098003FDF46 /* NotificationViewController.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@ -1138,6 +1144,7 @@
066E0C8C2BB6AC9A00873838 /* AddSoundCell.swift in Sources */, 066E0C8C2BB6AC9A00873838 /* AddSoundCell.swift in Sources */,
065BE4502563D939002A8CA4 /* SoundCellViewModel.swift in Sources */, 065BE4502563D939002A8CA4 /* SoundCellViewModel.swift in Sources */,
06F08EA729B1DDFE006AB9CA /* Error+Extension.swift in Sources */, 06F08EA729B1DDFE006AB9CA /* Error+Extension.swift in Sources */,
0687F2A82CCB791A00B2A52F /* UIFont+Extension.swift in Sources */,
06B1158F247BB1FB006D91FB /* Message.swift in Sources */, 06B1158F247BB1FB006D91FB /* Message.swift in Sources */,
06172FDA27F6DAEF002333A4 /* ServerListTableViewCell.swift in Sources */, 06172FDA27F6DAEF002333A4 /* ServerListTableViewCell.swift in Sources */,
0653677829B727A60038BDB8 /* CryptoSettingRelay.swift in Sources */, 0653677829B727A60038BDB8 /* CryptoSettingRelay.swift in Sources */,
@ -1218,6 +1225,7 @@
06E9447C2C07052F00AC86AB /* ImageProcessor.swift in Sources */, 06E9447C2C07052F00AC86AB /* ImageProcessor.swift in Sources */,
06E9446A2C06E4A200AC86AB /* CiphertextProcessor.swift in Sources */, 06E9446A2C06E4A200AC86AB /* CiphertextProcessor.swift in Sources */,
06E944712C06FF4C00AC86AB /* AutoCopyProcessor.swift in Sources */, 06E944712C06FF4C00AC86AB /* AutoCopyProcessor.swift in Sources */,
0687F2A92CCB791A00B2A52F /* UIFont+Extension.swift in Sources */,
06F08EA829B1DE0A006AB9CA /* Error+Extension.swift in Sources */, 06F08EA829B1DE0A006AB9CA /* Error+Extension.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;

View File

@ -0,0 +1,15 @@
//
// UIFont+Extension.swift
// Bark
//
// Created by huangfeng on 10/25/24.
// Copyright © 2024 Fin. All rights reserved.
//
import UIKit
extension UIFont {
class func preferredFont(ofSize size: CGFloat, weight: Weight = .regular) -> UIFont {
return UIFontMetrics.default.scaledFont(for: UIFont.systemFont(ofSize: size, weight: weight))
}
}

View File

@ -20,7 +20,8 @@ class CrashReportViewController: UIViewController {
let crashedTitle = UILabel() let crashedTitle = UILabel()
crashedTitle.text = NSLocalizedString("crashed") crashedTitle.text = NSLocalizedString("crashed")
crashedTitle.font = UIFont.boldSystemFont(ofSize: 30) crashedTitle.font = UIFont.preferredFont(ofSize: 30, weight: .bold)
crashedTitle.adjustsFontForContentSizeCategory = true
crashedTitle.textColor = UIColor(r255: 239, g255: 77, b255: 77) crashedTitle.textColor = UIColor(r255: 239, g255: 77, b255: 77)
self.view.addSubview(crashedTitle) self.view.addSubview(crashedTitle)
@ -31,13 +32,15 @@ class CrashReportViewController: UIViewController {
contentlabel.isScrollEnabled = false contentlabel.isScrollEnabled = false
contentlabel.textContainerInset = .zero contentlabel.textContainerInset = .zero
contentlabel.textContainer.lineFragmentPadding = 0 contentlabel.textContainer.lineFragmentPadding = 0
contentlabel.font = UIFont.systemFont(ofSize: 14) contentlabel.font = UIFont.preferredFont(ofSize: 14)
contentlabel.adjustsFontForContentSizeCategory = true
contentlabel.textColor = UIColor(r255: 51, g255: 51, b255: 51) contentlabel.textColor = UIColor(r255: 51, g255: 51, b255: 51)
contentlabel.text = NSLocalizedString("crashContent") contentlabel.text = NSLocalizedString("crashContent")
self.view.addSubview(contentlabel) self.view.addSubview(contentlabel)
let copyButton = UIButton() let copyButton = UIButton()
copyButton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 16) copyButton.titleLabel?.font = UIFont.preferredFont(ofSize: 16, weight: .bold)
copyButton.titleLabel?.adjustsFontForContentSizeCategory = true
copyButton.setTitleColor(UIColor.white, for: .normal) copyButton.setTitleColor(UIColor.white, for: .normal)
copyButton.setTitle(NSLocalizedString("copyCrashLog"), for: .normal) copyButton.setTitle(NSLocalizedString("copyCrashLog"), for: .normal)
copyButton.backgroundColor = UIColor(r255: 239, g255: 77, b255: 77) copyButton.backgroundColor = UIColor(r255: 239, g255: 77, b255: 77)

View File

@ -16,14 +16,16 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
let keyTextField: BorderTextField = { let keyTextField: BorderTextField = {
let textField = BorderTextField(title: "Key") let textField = BorderTextField(title: "Key")
textField.font = UIFont.systemFont(ofSize: 14) textField.font = UIFont.preferredFont(ofSize: 14)
textField.adjustsFontForContentSizeCategory = true
textField.placeholder = String(format: NSLocalizedString("enterKey"), 16) textField.placeholder = String(format: NSLocalizedString("enterKey"), 16)
return textField return textField
}() }()
let ivTextField: BorderTextField = { let ivTextField: BorderTextField = {
let textField = BorderTextField(title: "IV") let textField = BorderTextField(title: "IV")
textField.font = UIFont.systemFont(ofSize: 14) textField.font = UIFont.preferredFont(ofSize: 14)
textField.adjustsFontForContentSizeCategory = true
textField.placeholder = String(format: NSLocalizedString("enterIv"), 16) // todo: update iv length textField.placeholder = String(format: NSLocalizedString("enterIv"), 16) // todo: update iv length
return textField return textField
}() }()
@ -41,7 +43,8 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
let btn = GradientButton() let btn = GradientButton()
btn.setTitle(NSLocalizedString("copyExample"), for: .normal) btn.setTitle(NSLocalizedString("copyExample"), for: .normal)
btn.setTitleColor(UIColor.white, for: .normal) btn.setTitleColor(UIColor.white, for: .normal)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .medium) btn.titleLabel?.font = UIFont.preferredFont(ofSize: 14, weight: .medium)
btn.titleLabel?.adjustsFontForContentSizeCategory = true
btn.layer.cornerRadius = 8 btn.layer.cornerRadius = 8
btn.clipsToBounds = true btn.clipsToBounds = true
btn.applyGradient( btn.applyGradient(
@ -70,7 +73,8 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
func getTitleLabel(title: String) -> UILabel { func getTitleLabel(title: String) -> UILabel {
let label = UILabel() let label = UILabel()
label.font = UIFont.systemFont(ofSize: 14) label.font = UIFont.preferredFont(ofSize: 14)
label.adjustsFontForContentSizeCategory = true
label.textColor = BKColor.grey.darken4 label.textColor = BKColor.grey.darken4
label.text = title label.text = title
return label return label

View File

@ -43,7 +43,8 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
let label = UILabel() let label = UILabel()
label.text = NSLocalizedString("DeploymentDocuments") label.text = NSLocalizedString("DeploymentDocuments")
label.textColor = BKColor.blue.base label.textColor = BKColor.blue.base
label.font = UIFont.systemFont(ofSize: 12) label.font = UIFont.preferredFont(ofSize: 12)
label.adjustsFontForContentSizeCategory = true
label.transition([.scale(0.85), .opacity(0), .translate(x: 50)]) label.transition([.scale(0.85), .opacity(0), .translate(x: 50)])
label.isUserInteractionEnabled = true label.isUserInteractionEnabled = true
label.addGestureRecognizer(UITapGestureRecognizer()) label.addGestureRecognizer(UITapGestureRecognizer())

View File

@ -137,12 +137,12 @@ extension SoundsViewController: UITableViewDelegate {
string: fullText, string: fullText,
attributes: [ attributes: [
NSAttributedString.Key.foregroundColor: BKColor.grey.darken3, NSAttributedString.Key.foregroundColor: BKColor.grey.darken3,
NSAttributedString.Key.font: RobotoFont.regular(with: 14) NSAttributedString.Key.font: UIFont.preferredFont(ofSize: 14)
] ]
) )
attrStr.setAttributes([ attrStr.setAttributes([
NSAttributedString.Key.foregroundColor: BKColor.lightBlue.darken3, NSAttributedString.Key.foregroundColor: BKColor.lightBlue.darken3,
NSAttributedString.Key.font: RobotoFont.regular(with: 14) NSAttributedString.Key.font: UIFont.preferredFont(ofSize: 14)
], range: (fullText as NSString).range(of: highlightText)) ], range: (fullText as NSString).range(of: highlightText))
let label = UILabel() let label = UILabel()

View File

@ -15,7 +15,8 @@ class AddSoundCell: UITableViewCell {
button.setImage(UIImage(named: "music_note-music_note_symbol"), for: .normal) button.setImage(UIImage(named: "music_note-music_note_symbol"), for: .normal)
button.setTitleColor(BKColor.lightBlue.darken3, for: .normal) button.setTitleColor(BKColor.lightBlue.darken3, for: .normal)
button.tintColor = BKColor.lightBlue.darken3 button.tintColor = BKColor.lightBlue.darken3
button.titleLabel?.font = UIFont.systemFont(ofSize: 16) button.titleLabel?.font = UIFont.preferredFont(ofSize: 16)
button.titleLabel?.adjustsFontForContentSizeCategory = true
// UITableView didSelectRowAt // UITableView didSelectRowAt
button.isUserInteractionEnabled = false button.isUserInteractionEnabled = false
return button return button

View File

@ -65,7 +65,8 @@ class BorderTextField: InsetTextField {
self.insets = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16) self.insets = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16)
self.textColor = BKColor.grey.darken3 self.textColor = BKColor.grey.darken3
self.font = UIFont.systemFont(ofSize: 14) self.font = UIFont.preferredFont(ofSize: 14)
self.adjustsFontForContentSizeCategory = true
self.textAlignment = .left self.textAlignment = .left
self.insertSubview(backgroundView, at: 0) self.insertSubview(backgroundView, at: 0)
@ -78,7 +79,7 @@ class BorderTextField: InsetTextField {
override var placeholder: String? { override var placeholder: String? {
didSet{ didSet{
self.attributedPlaceholder = NSAttributedString(string: placeholder ?? "" , attributes: [ self.attributedPlaceholder = NSAttributedString(string: placeholder ?? "" , attributes: [
.font: self.font ?? UIFont.systemFont(ofSize: 14), .font: self.font ?? UIFont.preferredFont(ofSize: 14),
.foregroundColor: BKColor.grey.darken1 .foregroundColor: BKColor.grey.darken1
]) ])
} }

View File

@ -15,7 +15,8 @@ class DropBoxView: UIView {
let valueLabel: UILabel = { let valueLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = UIFont.systemFont(ofSize: 14) label.font = UIFont.preferredFont(ofSize: 14)
label.adjustsFontForContentSizeCategory = true
label.textColor = BKColor.grey.darken3 label.textColor = BKColor.grey.darken3
return label return label
}() }()

View File

@ -27,7 +27,8 @@ class MessageTableViewCell: BaseTableViewCell<MessageTableViewCellViewModel> {
label.isScrollEnabled = false label.isScrollEnabled = false
label.textContainerInset = .zero label.textContainerInset = .zero
label.textContainer.lineFragmentPadding = 0 label.textContainer.lineFragmentPadding = 0
label.font = RobotoFont.regular(with: 14) label.font = UIFont.preferredFont(ofSize: 14)
label.adjustsFontForContentSizeCategory = true
label.textColor = BKColor.grey.darken4 label.textColor = BKColor.grey.darken4
return label return label
}() }()
@ -35,7 +36,8 @@ class MessageTableViewCell: BaseTableViewCell<MessageTableViewCellViewModel> {
let dateLabel: UILabel = { let dateLabel: UILabel = {
let label = BKLabel() let label = BKLabel()
label.hitTestSlop = UIEdgeInsets(top: -5, left: -5, bottom: -5, right: -5) label.hitTestSlop = UIEdgeInsets(top: -5, left: -5, bottom: -5, right: -5)
label.font = RobotoFont.medium(with: 11) label.font = UIFont.preferredFont(ofSize: 11, weight: .medium)
label.adjustsFontForContentSizeCategory = true
label.textColor = BKColor.grey.base label.textColor = BKColor.grey.base
label.isUserInteractionEnabled = true label.isUserInteractionEnabled = true
label.addGestureRecognizer(UITapGestureRecognizer()) label.addGestureRecognizer(UITapGestureRecognizer())
@ -97,19 +99,19 @@ class MessageTableViewCell: BaseTableViewCell<MessageTableViewCellViewModel> {
let text = NSMutableAttributedString( let text = NSMutableAttributedString(
string: body, string: body,
attributes: [.font: RobotoFont.regular(with: 14), .foregroundColor: BKColor.grey.darken4] attributes: [.font: UIFont.preferredFont(ofSize: 14), .foregroundColor: BKColor.grey.darken4]
) )
if title.count > 0 { if title.count > 0 {
// spacer // spacer
text.insert(NSAttributedString( text.insert(NSAttributedString(
string: "\n", string: "\n",
attributes: [.font: RobotoFont.medium(with: 6)] attributes: [.font: UIFont.systemFont(ofSize: 6, weight: .medium)]
), at: 0) ), at: 0)
text.insert(NSAttributedString( text.insert(NSAttributedString(
string: title + "\n", string: title + "\n",
attributes: [.font: RobotoFont.medium(with: 16), .foregroundColor: BKColor.grey.darken4] attributes: [.font: UIFont.preferredFont(ofSize: 16, weight: .medium), .foregroundColor: BKColor.grey.darken4]
), at: 0) ), at: 0)
} }
@ -117,11 +119,11 @@ class MessageTableViewCell: BaseTableViewCell<MessageTableViewCellViewModel> {
// spacer // spacer
text.append(NSAttributedString( text.append(NSAttributedString(
string: "\n ", string: "\n ",
attributes: [.font: RobotoFont.medium(with: 8)] attributes: [.font: UIFont.systemFont(ofSize: 8, weight: .medium)]
)) ))
text.append(NSAttributedString(string: "\n\(url)", attributes: [ text.append(NSAttributedString(string: "\n\(url)", attributes: [
.font: RobotoFont.regular(with: 14), .font: UIFont.preferredFont(ofSize: 14),
.foregroundColor: BKColor.grey.darken4, .foregroundColor: BKColor.grey.darken4,
.link: url .link: url
])) ]))

View File

@ -15,7 +15,8 @@ class PreviewCardCell: BaseTableViewCell<PreviewCardCellViewModel> {
let titleLabel: UILabel = { let titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = RobotoFont.regular(with: 14) label.font = UIFont.preferredFont(ofSize: 14)
label.adjustsFontForContentSizeCategory = true
label.textColor = BKColor.grey.darken3 label.textColor = BKColor.grey.darken3
label.numberOfLines = 0 label.numberOfLines = 0
return label return label
@ -23,7 +24,8 @@ class PreviewCardCell: BaseTableViewCell<PreviewCardCellViewModel> {
let bodyLabel: UILabel = { let bodyLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = RobotoFont.regular(with: 14) label.font = UIFont.preferredFont(ofSize: 14)
label.adjustsFontForContentSizeCategory = true
label.textColor = BKColor.grey.darken2 label.textColor = BKColor.grey.darken2
label.numberOfLines = 0 label.numberOfLines = 0
return label return label
@ -31,7 +33,8 @@ class PreviewCardCell: BaseTableViewCell<PreviewCardCellViewModel> {
let noticeLabel: UILabel = { let noticeLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = RobotoFont.regular(with: 12) label.font = UIFont.preferredFont(ofSize: 12)
label.adjustsFontForContentSizeCategory = true
label.textColor = BKColor.grey.base label.textColor = BKColor.grey.base
label.numberOfLines = 0 label.numberOfLines = 0
label.isUserInteractionEnabled = true label.isUserInteractionEnabled = true
@ -58,7 +61,8 @@ class PreviewCardCell: BaseTableViewCell<PreviewCardCellViewModel> {
let label = UILabel() let label = UILabel()
label.lineBreakMode = .byCharWrapping label.lineBreakMode = .byCharWrapping
label.numberOfLines = 0 label.numberOfLines = 0
label.font = RobotoFont.regular(with: 14) label.font = UIFont.preferredFont(ofSize: 14)
label.adjustsFontForContentSizeCategory = true
return label return label
}() }()

View File

@ -48,13 +48,13 @@ class PreviewCardCellViewModel: ViewModel {
let noticeStr = "\(previewModel.notice ?? "")" let noticeStr = "\(previewModel.notice ?? "")"
let noticeAttrStr = NSMutableAttributedString(string: noticeStr, attributes: [ let noticeAttrStr = NSMutableAttributedString(string: noticeStr, attributes: [
NSAttributedString.Key.foregroundColor: BKColor.grey.base, NSAttributedString.Key.foregroundColor: BKColor.grey.base,
NSAttributedString.Key.font: RobotoFont.regular(with: 12) NSAttributedString.Key.font: UIFont.preferredFont(ofSize: 12)
]) ])
if let moreInfo = previewModel.moreInfo { if let moreInfo = previewModel.moreInfo {
noticeAttrStr.append(NSMutableAttributedString(string: " \(moreInfo)", attributes: [ noticeAttrStr.append(NSMutableAttributedString(string: " \(moreInfo)", attributes: [
NSAttributedString.Key.foregroundColor: BKColor.blue.base, NSAttributedString.Key.foregroundColor: BKColor.blue.base,
NSAttributedString.Key.font: RobotoFont.regular(with: 12) NSAttributedString.Key.font: UIFont.preferredFont(ofSize: 12)
])) ]))
} }
notice.accept(noticeAttrStr) notice.accept(noticeAttrStr)
@ -69,30 +69,30 @@ class PreviewCardCellViewModel: ViewModel {
let attrStr = NSMutableAttributedString(string: "") let attrStr = NSMutableAttributedString(string: "")
attrStr.append(NSAttributedString(string: serverUrl.absoluteString, attributes: [ attrStr.append(NSAttributedString(string: serverUrl.absoluteString, attributes: [
NSAttributedString.Key.foregroundColor: BKColor.grey.darken4, NSAttributedString.Key.foregroundColor: BKColor.grey.darken4,
NSAttributedString.Key.font: RobotoFont.regular(with: fontSize) NSAttributedString.Key.font: UIFont.preferredFont(ofSize: fontSize)
])) ]))
let key = ServerManager.shared.currentServer.key let key = ServerManager.shared.currentServer.key
attrStr.append(NSAttributedString(string: "/\(key.count > 0 ? key : "Your Key")", attributes: [ attrStr.append(NSAttributedString(string: "/\(key.count > 0 ? key : "Your Key")", attributes: [
NSAttributedString.Key.foregroundColor: BKColor.grey.darken3, NSAttributedString.Key.foregroundColor: BKColor.grey.darken3,
NSAttributedString.Key.font: RobotoFont.regular(with: fontSize) NSAttributedString.Key.font: UIFont.preferredFont(ofSize: fontSize)
])) ]))
if let modelTitle = previewModel.title { if let modelTitle = previewModel.title {
attrStr.append(NSAttributedString(string: "/\(modelTitle)", attributes: [ attrStr.append(NSAttributedString(string: "/\(modelTitle)", attributes: [
NSAttributedString.Key.foregroundColor: BKColor.grey.darken1, NSAttributedString.Key.foregroundColor: BKColor.grey.darken1,
NSAttributedString.Key.font: RobotoFont.regular(with: fontSize) NSAttributedString.Key.font: UIFont.preferredFont(ofSize: fontSize)
])) ]))
} }
if let modelBody = previewModel.body { if let modelBody = previewModel.body {
attrStr.append(NSAttributedString(string: "/\(modelBody)", attributes: [ attrStr.append(NSAttributedString(string: "/\(modelBody)", attributes: [
NSAttributedString.Key.foregroundColor: BKColor.grey.base, NSAttributedString.Key.foregroundColor: BKColor.grey.base,
NSAttributedString.Key.font: RobotoFont.regular(with: fontSize) NSAttributedString.Key.font: UIFont.preferredFont(ofSize: fontSize)
])) ]))
} }
if let queryParameter = previewModel.queryParameter { if let queryParameter = previewModel.queryParameter {
attrStr.append(NSAttributedString(string: "?\(queryParameter)", attributes: [ attrStr.append(NSAttributedString(string: "?\(queryParameter)", attributes: [
NSAttributedString.Key.foregroundColor: BKColor.grey.lighten1, NSAttributedString.Key.foregroundColor: BKColor.grey.lighten1,
NSAttributedString.Key.font: RobotoFont.regular(with: fontSize) NSAttributedString.Key.font: UIFont.preferredFont(ofSize: fontSize)
])) ]))
} }

View File

@ -25,7 +25,8 @@ class ServerListTableViewCell: BaseTableViewCell<ServerListTableViewCellViewMode
let addressLabel: UILabel = { let addressLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = RobotoFont.medium(with: 14) label.font = UIFont.preferredFont(ofSize: 14, weight: .medium)
label.adjustsFontForContentSizeCategory = true
label.textColor = BKColor.grey.darken4 label.textColor = BKColor.grey.darken4
label.numberOfLines = 0 label.numberOfLines = 0
return label return label
@ -33,7 +34,8 @@ class ServerListTableViewCell: BaseTableViewCell<ServerListTableViewCellViewMode
let keyLabel: UILabel = { let keyLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = RobotoFont.regular(with: 12) label.font = UIFont.preferredFont(ofSize: 12)
label.adjustsFontForContentSizeCategory = true
label.textColor = BKColor.grey.darken4 label.textColor = BKColor.grey.darken4
label.numberOfLines = 0 label.numberOfLines = 0
return label return label

View File

@ -15,7 +15,8 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
let label = UILabel() let label = UILabel()
label.textColor = UIColor(named: "notification_copy_color") label.textColor = UIColor(named: "notification_copy_color")
label.text = NSLocalizedString("Copy", comment: "") label.text = NSLocalizedString("Copy", comment: "")
label.font = UIFont.systemFont(ofSize: 16) label.font = UIFont.preferredFont(ofSize: 16)
label.adjustsFontForContentSizeCategory = true
label.textAlignment = .center label.textAlignment = .center
return label return label
}() }()