From 816c7ca5759eeb0524c3f0c6a3d58a74673cbd92 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Wed, 20 Nov 2019 01:31:20 +0100 Subject: [PATCH] Use Dynamic Type in cells Also fix activity cell layout. --- .../Cells/ActivityTableViewCell.swift | 2 +- .../Cells/DestructiveTableViewCell.swift | 2 +- Passepartout-iOS/Global/Theme+Cells.swift | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Passepartout-iOS/Cells/ActivityTableViewCell.swift b/Passepartout-iOS/Cells/ActivityTableViewCell.swift index 4472d811..c9f2326c 100644 --- a/Passepartout-iOS/Cells/ActivityTableViewCell.swift +++ b/Passepartout-iOS/Cells/ActivityTableViewCell.swift @@ -30,7 +30,7 @@ extension Cells { } class ActivityTableViewCell: UITableViewCell { - private lazy var activityIndicator = UIActivityIndicatorView() + private lazy var activityIndicator = UIActivityIndicatorView(style: .gray) } extension ActivityTableViewCell { diff --git a/Passepartout-iOS/Cells/DestructiveTableViewCell.swift b/Passepartout-iOS/Cells/DestructiveTableViewCell.swift index 5ab9ade2..631b2758 100644 --- a/Passepartout-iOS/Cells/DestructiveTableViewCell.swift +++ b/Passepartout-iOS/Cells/DestructiveTableViewCell.swift @@ -30,7 +30,7 @@ extension Cells { } class DestructiveTableViewCell: UITableViewCell { - @IBOutlet private lazy var labelCaption: UILabel? = { + @IBOutlet private(set) lazy var labelCaption: UILabel? = { let label = UILabel() label.textAlignment = .center contentView.addSubview(label) diff --git a/Passepartout-iOS/Global/Theme+Cells.swift b/Passepartout-iOS/Global/Theme+Cells.swift index 324c62d4..79cfff1e 100644 --- a/Passepartout-iOS/Global/Theme+Cells.swift +++ b/Passepartout-iOS/Global/Theme+Cells.swift @@ -30,6 +30,7 @@ import Convenience extension UITableViewCell { func applyChecked(_ checked: Bool, _ theme: Theme) { + textLabel?.font = .preferredFont(forTextStyle: .body) accessoryType = checked ? .checkmark : .none tintColor = theme.palette.accessory } @@ -45,20 +46,25 @@ extension SingleOptionViewController { extension DestructiveTableViewCell { func apply(_ theme: Theme) { + labelCaption?.font = .preferredFont(forTextStyle: .body) + captionColor = theme.palette.destructive accessoryType = .none selectionStyle = .default - captionColor = theme.palette.destructive } } extension FieldTableViewCell { func apply(_ theme: Theme) { + textLabel?.font = .preferredFont(forTextStyle: .body) + field.font = .preferredFont(forTextStyle: .body) captionColor = theme.palette.primaryText } } extension SettingTableViewCell { func apply(_ theme: Theme) { + textLabel?.font = .preferredFont(forTextStyle: .body) + detailTextLabel?.font = .preferredFont(forTextStyle: .body) leftTextColor = theme.palette.primaryText rightTextColor = theme.palette.secondaryText } @@ -66,12 +72,14 @@ extension SettingTableViewCell { extension ToggleTableViewCell { func apply(_ theme: Theme) { + textLabel?.font = .preferredFont(forTextStyle: .body) captionColor = theme.palette.primaryText } } extension ActivityTableViewCell { func apply(_ theme: Theme) { + textLabel?.font = .preferredFont(forTextStyle: .body) textLabel?.text = nil detailTextLabel?.text = nil } @@ -79,12 +87,17 @@ extension ActivityTableViewCell { extension SettingTableViewCell { func applyAction(_ theme: Theme) { + textLabel?.font = .preferredFont(forTextStyle: .body) + detailTextLabel?.font = .preferredFont(forTextStyle: .body) leftTextColor = theme.palette.action rightTextColor = nil accessoryType = .none } func applyVPN(_ theme: Theme, with vpnStatus: VPNStatus?, error: OpenVPNTunnelProvider.ProviderError?) { + textLabel?.font = .preferredFont(forTextStyle: .body) + detailTextLabel?.font = .preferredFont(forTextStyle: .body) + leftTextColor = theme.palette.primaryText guard let vpnStatus = vpnStatus else { rightText = L10n.Core.Vpn.disabled