From 532490d2ace1cada8f0f0ce7b30926c24260c734 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 28 Apr 2021 14:55:34 +0400 Subject: [PATCH] Fix navigation bar title appearance in various places --- .../AuthTransferConfirmationScreen.swift | 2 +- .../AvatarNode/Sources/AvatarNode.swift | 2 +- .../Sources/ChatListTitleView.swift | 6 +- .../Sources/CounterContollerTitleView.swift | 2 +- .../Sources/DatePickerNode.swift | 2 +- submodules/Display/Source/Font.swift | 69 +++++++++---------- .../Sources/GameControllerTitleView.swift | 2 +- .../Sources/ListMessageFileItemNode.swift | 2 +- .../Sources/ListMessageSnippetItemNode.swift | 2 +- .../ChatMessageLiveLocationTimerNode.swift | 4 +- .../TelegramUI/Sources/ChatTitleView.swift | 58 ++++++++-------- .../Sources/PeerInfo/PeerInfoHeaderNode.swift | 10 +-- .../Sources/WebSearchBadgeNode.swift | 2 +- 13 files changed, 83 insertions(+), 80 deletions(-) diff --git a/submodules/AuthTransferUI/Sources/AuthTransferConfirmationScreen.swift b/submodules/AuthTransferUI/Sources/AuthTransferConfirmationScreen.swift index 284622fae1..a7af260f9e 100644 --- a/submodules/AuthTransferUI/Sources/AuthTransferConfirmationScreen.swift +++ b/submodules/AuthTransferUI/Sources/AuthTransferConfirmationScreen.swift @@ -118,7 +118,7 @@ private final class AuthDataTransferSplashScreenNode: ViewControllerTracingNode let buttonText: String - let badgeFont = Font.with(size: 13.0, design: .round, traits: [.bold]) + let badgeFont = Font.with(size: 13.0, design: .round, weight: .bold) let textFont = Font.regular(16.0) let textColor = self.presentationData.theme.list.itemPrimaryTextColor diff --git a/submodules/AvatarNode/Sources/AvatarNode.swift b/submodules/AvatarNode/Sources/AvatarNode.swift index 3273da60bc..670d1ad420 100644 --- a/submodules/AvatarNode/Sources/AvatarNode.swift +++ b/submodules/AvatarNode/Sources/AvatarNode.swift @@ -19,7 +19,7 @@ private let archivedChatsIcon = UIImage(bundleImageName: "Avatar/ArchiveAvatarIc private let repliesIcon = generateTintedImage(image: UIImage(bundleImageName: "Avatar/RepliesMessagesIcon"), color: .white) public func avatarPlaceholderFont(size: CGFloat) -> UIFont { - return Font.with(size: size, design: .round, traits: [.bold]) + return Font.with(size: size, design: .round, weight: .bold) } public enum AvatarNodeClipStyle { diff --git a/submodules/ChatListUI/Sources/ChatListTitleView.swift b/submodules/ChatListUI/Sources/ChatListTitleView.swift index 38e9a9e5a7..4de4c02f1d 100644 --- a/submodules/ChatListUI/Sources/ChatListTitleView.swift +++ b/submodules/ChatListUI/Sources/ChatListTitleView.swift @@ -5,6 +5,8 @@ import Display import TelegramPresentationData import ActivityIndicator +private let titleFont = Font.with(size: 17.0, design: .regular, weight: .semibold, traits: [.monospacedNumbers]) + struct NetworkStatusTitle: Equatable { let text: String let activity: Bool @@ -40,7 +42,7 @@ final class ChatListTitleView: UIView, NavigationBarTitleView, NavigationBarTitl self._title = title if self._title != oldValue { - self.titleNode.attributedText = NSAttributedString(string: self.title.text, font: Font.bold(17.0), textColor: self.theme.rootController.navigationBar.primaryTextColor) + self.titleNode.attributedText = NSAttributedString(string: self.title.text, font: titleFont, textColor: self.theme.rootController.navigationBar.primaryTextColor) self.buttonView.accessibilityLabel = self.title.text self.activityIndicator.isHidden = !self.title.activity @@ -101,7 +103,7 @@ final class ChatListTitleView: UIView, NavigationBarTitleView, NavigationBarTitl var theme: PresentationTheme { didSet { - self.titleNode.attributedText = NSAttributedString(string: self.title.text, font: Font.bold(17.0), textColor: self.theme.rootController.navigationBar.primaryTextColor) + self.titleNode.attributedText = NSAttributedString(string: self.title.text, font: titleFont, textColor: self.theme.rootController.navigationBar.primaryTextColor) self.lockView.updateTheme(self.theme) diff --git a/submodules/CounterContollerTitleView/Sources/CounterContollerTitleView.swift b/submodules/CounterContollerTitleView/Sources/CounterContollerTitleView.swift index 2fd165435e..3e6872815e 100644 --- a/submodules/CounterContollerTitleView/Sources/CounterContollerTitleView.swift +++ b/submodules/CounterContollerTitleView/Sources/CounterContollerTitleView.swift @@ -22,7 +22,7 @@ public final class CounterContollerTitleView: UIView { public var title: CounterContollerTitle = CounterContollerTitle(title: "", counter: "") { didSet { if self.title != oldValue { - self.titleNode.attributedText = NSAttributedString(string: self.title.title, font: Font.bold(17.0), textColor: self.theme.rootController.navigationBar.primaryTextColor) + self.titleNode.attributedText = NSAttributedString(string: self.title.title, font: Font.semibold(17.0), textColor: self.theme.rootController.navigationBar.primaryTextColor) self.subtitleNode.attributedText = NSAttributedString(string: self.title.counter, font: Font.regular(13.0), textColor: self.theme.rootController.navigationBar.secondaryTextColor) self.accessibilityLabel = self.title.title diff --git a/submodules/DatePickerNode/Sources/DatePickerNode.swift b/submodules/DatePickerNode/Sources/DatePickerNode.swift index 9f1c168462..6e9a596c78 100644 --- a/submodules/DatePickerNode/Sources/DatePickerNode.swift +++ b/submodules/DatePickerNode/Sources/DatePickerNode.swift @@ -68,7 +68,7 @@ private let upperLimitDate = Date(timeIntervalSince1970: Double(Int32.max - 1)) private let controlFont = Font.regular(17.0) private let dayFont = Font.regular(13.0) private let dateFont = Font.with(size: 17.0, design: .regular, traits: .monospacedNumbers) -private let selectedDateFont = Font.with(size: 17.0, design: .regular, traits: [.bold, .monospacedNumbers]) +private let selectedDateFont = Font.with(size: 17.0, design: .regular, weight: .bold, traits: .monospacedNumbers) private var calendar: Calendar = { var calendar = Calendar(identifier: .gregorian) diff --git a/submodules/Display/Source/Font.swift b/submodules/Display/Source/Font.swift index 46787501bf..a8d231c6da 100644 --- a/submodules/Display/Source/Font.swift +++ b/submodules/Display/Source/Font.swift @@ -20,9 +20,8 @@ public struct Font { self.rawValue = 0 } - public static let bold = Traits(rawValue: 1 << 0) - public static let italic = Traits(rawValue: 1 << 1) - public static let monospacedNumbers = Traits(rawValue: 1 << 2) + public static let italic = Traits(rawValue: 1 << 0) + public static let monospacedNumbers = Traits(rawValue: 1 << 1) } public enum Weight { @@ -31,15 +30,36 @@ public struct Font { case medium case semibold case bold + + var isBold: Bool { + switch self { + case .medium, .semibold, .bold: + return true + default: + return false + } + } + + var weight: UIFont.Weight { + switch self { + case .light: + return .light + case .medium: + return .medium + case .semibold: + return .semibold + case .bold: + return .bold + default: + return .regular + } + } } public static func with(size: CGFloat, design: Design = .regular, weight: Weight = .regular, traits: Traits = []) -> UIFont { if #available(iOS 13.0, *) { let descriptor = UIFont.systemFont(ofSize: size).fontDescriptor var symbolicTraits = descriptor.symbolicTraits - if traits.contains(.bold) { - symbolicTraits.insert(.traitBold) - } if traits.contains(.italic) { symbolicTraits.insert(.traitItalic) } @@ -64,21 +84,8 @@ public struct Font { updatedDescriptor = updatedDescriptor?.withDesign(.default) } if weight != .regular { - let fontWeight: UIFont.Weight - switch weight { - case .light: - fontWeight = .light - case .medium: - fontWeight = .medium - case .semibold: - fontWeight = .semibold - case .bold: - fontWeight = .bold - default: - fontWeight = .regular - } updatedDescriptor = updatedDescriptor?.addingAttributes([ - UIFontDescriptor.AttributeName.traits: [UIFontDescriptor.TraitKey.weight: fontWeight] + UIFontDescriptor.AttributeName.traits: [UIFontDescriptor.TraitKey.weight: weight.weight] ]) } @@ -90,27 +97,19 @@ public struct Font { } else { switch design { case .regular: - if traits.contains(.bold) && traits.contains(.italic) { - if let descriptor = UIFont.systemFont(ofSize: size).fontDescriptor.withSymbolicTraits([.traitBold, .traitItalic]) { + if traits.contains(.italic) { + if let descriptor = UIFont.systemFont(ofSize: size, weight: weight.weight).fontDescriptor.withSymbolicTraits([.traitItalic]) { return UIFont(descriptor: descriptor, size: size) } else { return UIFont.italicSystemFont(ofSize: size) } - } else if traits.contains(.bold) { - if #available(iOS 8.2, *) { - return UIFont.boldSystemFont(ofSize: size) - } else { - return CTFontCreateWithName("HelveticaNeue-Bold" as CFString, size, nil) - } - } else if traits.contains(.italic) { - return UIFont.italicSystemFont(ofSize: size) } else { - return UIFont.systemFont(ofSize: size) + return UIFont.systemFont(ofSize: size, weight: weight.weight) } case .serif: - if traits.contains(.bold) && traits.contains(.italic) { + if weight.isBold && traits.contains(.italic) { return UIFont(name: "Georgia-BoldItalic", size: size - 1.0) ?? UIFont.systemFont(ofSize: size) - } else if traits.contains(.bold) { + } else if weight.isBold { return UIFont(name: "Georgia-Bold", size: size - 1.0) ?? UIFont.systemFont(ofSize: size) } else if traits.contains(.italic) { return UIFont(name: "Georgia-Italic", size: size - 1.0) ?? UIFont.systemFont(ofSize: size) @@ -118,9 +117,9 @@ public struct Font { return UIFont(name: "Georgia", size: size - 1.0) ?? UIFont.systemFont(ofSize: size) } case .monospace: - if traits.contains(.bold) && traits.contains(.italic) { + if weight.isBold && traits.contains(.italic) { return UIFont(name: "Menlo-BoldItalic", size: size - 1.0) ?? UIFont.systemFont(ofSize: size) - } else if traits.contains(.bold) { + } else if weight.isBold { return UIFont(name: "Menlo-Bold", size: size - 1.0) ?? UIFont.systemFont(ofSize: size) } else if traits.contains(.italic) { return UIFont(name: "Menlo-Italic", size: size - 1.0) ?? UIFont.systemFont(ofSize: size) diff --git a/submodules/GameUI/Sources/GameControllerTitleView.swift b/submodules/GameUI/Sources/GameControllerTitleView.swift index ec012f2fae..6c565228a9 100644 --- a/submodules/GameUI/Sources/GameControllerTitleView.swift +++ b/submodules/GameUI/Sources/GameControllerTitleView.swift @@ -40,7 +40,7 @@ final class GameControllerTitleView: UIView { } func set(title: String, subtitle: String) { - self.titleNode.attributedText = NSAttributedString(string: title, font: Font.medium(17.0), textColor: self.theme.rootController.navigationBar.primaryTextColor) + self.titleNode.attributedText = NSAttributedString(string: title, font: Font.semibold(17.0), textColor: self.theme.rootController.navigationBar.primaryTextColor) self.infoNode.attributedText = NSAttributedString(string: subtitle, font: Font.regular(13.0), textColor: self.theme.rootController.navigationBar.secondaryTextColor) } diff --git a/submodules/ListMessageItem/Sources/ListMessageFileItemNode.swift b/submodules/ListMessageItem/Sources/ListMessageFileItemNode.swift index a90ad8e571..69d9195410 100644 --- a/submodules/ListMessageItem/Sources/ListMessageFileItemNode.swift +++ b/submodules/ListMessageItem/Sources/ListMessageFileItemNode.swift @@ -88,7 +88,7 @@ private func extensionImage(fileExtension: String?) -> UIImage? { return nil } } -private let extensionFont = Font.with(size: 15.0, design: .round, traits: [.bold]) +private let extensionFont = Font.with(size: 15.0, design: .round, weight: .bold) private struct FetchControls { let fetch: () -> Void diff --git a/submodules/ListMessageItem/Sources/ListMessageSnippetItemNode.swift b/submodules/ListMessageItem/Sources/ListMessageSnippetItemNode.swift index 9c55e664a3..9abcc35f2e 100644 --- a/submodules/ListMessageItem/Sources/ListMessageSnippetItemNode.swift +++ b/submodules/ListMessageItem/Sources/ListMessageSnippetItemNode.swift @@ -17,7 +17,7 @@ import UrlWhitelist import AccountContext import TelegramStringFormatting -private let iconFont = Font.with(size: 30.0, design: .round, traits: [.bold]) +private let iconFont = Font.with(size: 30.0, design: .round, weight: .bold) private let iconTextBackgroundImage = generateStretchableFilledCircleImage(radius: 6.0, color: UIColor(rgb: 0xFF9500)) diff --git a/submodules/LiveLocationTimerNode/Sources/ChatMessageLiveLocationTimerNode.swift b/submodules/LiveLocationTimerNode/Sources/ChatMessageLiveLocationTimerNode.swift index 2294ce1298..16ae49897a 100644 --- a/submodules/LiveLocationTimerNode/Sources/ChatMessageLiveLocationTimerNode.swift +++ b/submodules/LiveLocationTimerNode/Sources/ChatMessageLiveLocationTimerNode.swift @@ -4,8 +4,8 @@ import AsyncDisplayKit import Display import TelegramPresentationData -private let textFont = Font.with(size: 13.0, design: .round, traits: [.bold]) -private let smallTextFont = Font.with(size: 11.0, design: .round, traits: [.bold]) +private let textFont = Font.with(size: 13.0, design: .round, weight: .bold) +private let smallTextFont = Font.with(size: 11.0, design: .round, weight: .bold) private class ChatMessageLiveLocationTimerNodeParams: NSObject { let backgroundColor: UIColor diff --git a/submodules/TelegramUI/Sources/ChatTitleView.swift b/submodules/TelegramUI/Sources/ChatTitleView.swift index fc9cefb143..f55c4a9b95 100644 --- a/submodules/TelegramUI/Sources/ChatTitleView.swift +++ b/submodules/TelegramUI/Sources/ChatTitleView.swift @@ -18,6 +18,9 @@ import PhoneNumberFormat import ChatTitleActivityNode import AnimatedCountLabelNode +private let titleFont = Font.with(size: 17.0, design: .regular, weight: .semibold, traits: [.monospacedNumbers]) +private let subtitleFont = Font.regular(13.0) + enum ChatTitleContent { enum ReplyThreadType { case comments @@ -111,24 +114,24 @@ final class ChatTitleView: UIView, NavigationBarTitleView { case let .peer(peerView, _, isScheduledMessages): if peerView.peerId.isReplies { let typeText: String = self.strings.DialogList_Replies - segments = [.text(0, NSAttributedString(string: typeText, font: Font.medium(17.0), textColor: titleTheme.rootController.navigationBar.primaryTextColor))] + segments = [.text(0, NSAttributedString(string: typeText, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] isEnabled = false } else if isScheduledMessages { if peerView.peerId == self.account.peerId { - segments = [.text(0, NSAttributedString(string: self.strings.ScheduledMessages_RemindersTitle, font: Font.medium(17.0), textColor: titleTheme.rootController.navigationBar.primaryTextColor))] + segments = [.text(0, NSAttributedString(string: self.strings.ScheduledMessages_RemindersTitle, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] } else { - segments = [.text(0, NSAttributedString(string: self.strings.ScheduledMessages_Title, font: Font.medium(17.0), textColor: titleTheme.rootController.navigationBar.primaryTextColor))] + segments = [.text(0, NSAttributedString(string: self.strings.ScheduledMessages_Title, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] } isEnabled = false } else { if let peer = peerViewMainPeer(peerView) { if peerView.peerId == self.account.peerId { - segments = [.text(0, NSAttributedString(string: self.strings.Conversation_SavedMessages, font: Font.medium(17.0), textColor: titleTheme.rootController.navigationBar.primaryTextColor))] + segments = [.text(0, NSAttributedString(string: self.strings.Conversation_SavedMessages, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] } else { if !peerView.peerIsContact, let user = peer as? TelegramUser, !user.flags.contains(.isSupport), user.botInfo == nil, let phone = user.phone, !phone.isEmpty { - segments = [.text(0, NSAttributedString(string: formatPhoneNumber(phone), font: Font.medium(17.0), textColor: titleTheme.rootController.navigationBar.primaryTextColor))] + segments = [.text(0, NSAttributedString(string: formatPhoneNumber(phone), font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] } else { - segments = [.text(0, NSAttributedString(string: peer.displayTitle(strings: self.strings, displayOrder: self.nameDisplayOrder), font: Font.medium(17.0), textColor: titleTheme.rootController.navigationBar.primaryTextColor))] + segments = [.text(0, NSAttributedString(string: peer.displayTitle(strings: self.strings, displayOrder: self.nameDisplayOrder), font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] } } if peer.isFake { @@ -147,7 +150,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView { } } case let .replyThread(type, count): - let textFont = Font.medium(17.0) + let textFont = titleFont let textColor = titleTheme.rootController.navigationBar.primaryTextColor if count > 0 { @@ -215,8 +218,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView { isEnabled = false case let .custom(text, _, enabled): - let font = Font.with(size: 17.0, design: .regular, weight: .medium, traits: .monospacedNumbers) - segments = [.text(0, NSAttributedString(string: text, font: font, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] + segments = [.text(0, NSAttributedString(string: text, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] isEnabled = enabled } @@ -306,7 +308,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView { case .online: infoText = "" } - state = .info(NSAttributedString(string: infoText, font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor), .generic) + state = .info(NSAttributedString(string: infoText, font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor), .generic) case .online: if let (peerId, inputActivities) = self.inputActivities, !inputActivities.isEmpty, inputActivitiesAllowed { var stringValue = "" @@ -353,7 +355,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView { } } let color = titleTheme.rootController.navigationBar.accentTextColor - let string = NSAttributedString(string: stringValue, font: Font.regular(13.0), textColor: color) + let string = NSAttributedString(string: stringValue, font: subtitleFont, textColor: color) switch mergedActivity { case .typingText: state = .typingText(string, color) @@ -375,23 +377,23 @@ final class ChatTitleView: UIView, NavigationBarTitleView { if let peer = peerViewMainPeer(peerView) { let servicePeer = isServicePeer(peer) if peer.id == self.account.peerId || isScheduledMessages || peer.id.isReplies { - let string = NSAttributedString(string: "", font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + let string = NSAttributedString(string: "", font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) state = .info(string, .generic) } else if let user = peer as? TelegramUser { if user.isDeleted { state = .none } else if servicePeer { - let string = NSAttributedString(string: "", font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + let string = NSAttributedString(string: "", font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) state = .info(string, .generic) } else if user.flags.contains(.isSupport) { let statusText = self.strings.Bot_GenericSupportStatus - let string = NSAttributedString(string: statusText, font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + let string = NSAttributedString(string: statusText, font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) state = .info(string, .generic) } else if let _ = user.botInfo { let statusText = self.strings.Bot_GenericBotStatus - let string = NSAttributedString(string: statusText, font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + let string = NSAttributedString(string: statusText, font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) state = .info(string, .generic) } else if let peer = peerViewMainPeer(peerView) { let timestamp = CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970 @@ -403,10 +405,10 @@ final class ChatTitleView: UIView, NavigationBarTitleView { userPresence = TelegramUserPresence(status: .none, lastActivity: 0) } let (string, activity) = stringAndActivityForUserPresence(strings: self.strings, dateTimeFormat: self.dateTimeFormat, presence: userPresence, relativeTo: Int32(timestamp)) - let attributedString = NSAttributedString(string: string, font: Font.regular(13.0), textColor: activity ? titleTheme.rootController.navigationBar.accentTextColor : titleTheme.rootController.navigationBar.secondaryTextColor) + let attributedString = NSAttributedString(string: string, font: subtitleFont, textColor: activity ? titleTheme.rootController.navigationBar.accentTextColor : titleTheme.rootController.navigationBar.secondaryTextColor) state = .info(attributedString, activity ? .online : .lastSeenTime) } else { - let string = NSAttributedString(string: "", font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + let string = NSAttributedString(string: "", font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) state = .info(string, .generic) } } else if let group = peer as? TelegramGroup { @@ -428,11 +430,11 @@ final class ChatTitleView: UIView, NavigationBarTitleView { if onlineCount > 1 { let string = NSMutableAttributedString() - string.append(NSAttributedString(string: "\(strings.Conversation_StatusMembers(Int32(group.participantCount))), ", font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor)) - string.append(NSAttributedString(string: strings.Conversation_StatusOnline(Int32(onlineCount)), font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor)) + string.append(NSAttributedString(string: "\(strings.Conversation_StatusMembers(Int32(group.participantCount))), ", font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor)) + string.append(NSAttributedString(string: strings.Conversation_StatusOnline(Int32(onlineCount)), font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor)) state = .info(string, .generic) } else { - let string = NSAttributedString(string: strings.Conversation_StatusMembers(Int32(group.participantCount)), font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + let string = NSAttributedString(string: strings.Conversation_StatusMembers(Int32(group.participantCount)), font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) state = .info(string, .generic) } } else if let channel = peer as? TelegramChannel { @@ -440,17 +442,17 @@ final class ChatTitleView: UIView, NavigationBarTitleView { if memberCount == 0 { let string: NSAttributedString if case .group = channel.info { - string = NSAttributedString(string: strings.Group_Status, font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + string = NSAttributedString(string: strings.Group_Status, font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) } else { - string = NSAttributedString(string: strings.Channel_Status, font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + string = NSAttributedString(string: strings.Channel_Status, font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) } state = .info(string, .generic) } else { if case .group = channel.info, let onlineMemberCount = onlineMemberCount, onlineMemberCount > 1 { let string = NSMutableAttributedString() - string.append(NSAttributedString(string: "\(strings.Conversation_StatusMembers(Int32(memberCount))), ", font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor)) - string.append(NSAttributedString(string: strings.Conversation_StatusOnline(Int32(onlineMemberCount)), font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor)) + string.append(NSAttributedString(string: "\(strings.Conversation_StatusMembers(Int32(memberCount))), ", font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor)) + string.append(NSAttributedString(string: strings.Conversation_StatusOnline(Int32(onlineMemberCount)), font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor)) state = .info(string, .generic) } else { let membersString: String @@ -459,24 +461,24 @@ final class ChatTitleView: UIView, NavigationBarTitleView { } else { membersString = strings.Conversation_StatusSubscribers(memberCount) } - let string = NSAttributedString(string: membersString, font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + let string = NSAttributedString(string: membersString, font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) state = .info(string, .generic) } } } else { switch channel.info { case .group: - let string = NSAttributedString(string: strings.Group_Status, font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + let string = NSAttributedString(string: strings.Group_Status, font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) state = .info(string, .generic) case .broadcast: - let string = NSAttributedString(string: strings.Channel_Status, font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + let string = NSAttributedString(string: strings.Channel_Status, font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) state = .info(string, .generic) } } } } case let .custom(_, subtitle?, _): - let string = NSAttributedString(string: subtitle, font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor) + let string = NSAttributedString(string: subtitle, font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) state = .info(string, .generic) default: break diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift index 55a21e25ee..59eea97116 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift @@ -1968,7 +1968,7 @@ final class PeerInfoHeaderNode: ASDisplayNode { self.avatarOverlayNode.updateTransitionFraction(transitionFraction, transition: transition) if self.navigationTitle != presentationData.strings.EditProfile_Title || themeUpdated { - self.navigationTitleNode.attributedText = NSAttributedString(string: presentationData.strings.EditProfile_Title, font: Font.bold(17.0), textColor: presentationData.theme.rootController.navigationBar.primaryTextColor) + self.navigationTitleNode.attributedText = NSAttributedString(string: presentationData.strings.EditProfile_Title, font: Font.semibold(17.0), textColor: presentationData.theme.rootController.navigationBar.primaryTextColor) } let navigationTitleSize = self.navigationTitleNode.updateLayout(CGSize(width: width, height: navigationHeight)) @@ -1998,11 +1998,11 @@ final class PeerInfoHeaderNode: ASDisplayNode { if let peer = peer { if peer.id == self.context.account.peerId && !self.isSettings { - titleString = NSAttributedString(string: presentationData.strings.Conversation_SavedMessages, font: Font.medium(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor) + titleString = NSAttributedString(string: presentationData.strings.Conversation_SavedMessages, font: Font.semibold(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor) } else if peer.id == self.context.account.peerId && !self.isSettings { - titleString = NSAttributedString(string: presentationData.strings.DialogList_Replies, font: Font.medium(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor) + titleString = NSAttributedString(string: presentationData.strings.DialogList_Replies, font: Font.semibold(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor) } else { - titleString = NSAttributedString(string: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), font: Font.medium(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor) + titleString = NSAttributedString(string: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), font: Font.semibold(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor) } if self.isSettings, let user = peer as? TelegramUser { @@ -2028,7 +2028,7 @@ final class PeerInfoHeaderNode: ASDisplayNode { usernameString = NSAttributedString(string: "", font: Font.regular(15.0), textColor: presentationData.theme.list.itemSecondaryTextColor) } } else { - titleString = NSAttributedString(string: " ", font: Font.medium(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor) + titleString = NSAttributedString(string: " ", font: Font.semibold(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor) subtitleString = NSAttributedString(string: " ", font: Font.regular(15.0), textColor: presentationData.theme.list.itemSecondaryTextColor) usernameString = NSAttributedString(string: "", font: Font.regular(15.0), textColor: presentationData.theme.list.itemSecondaryTextColor) } diff --git a/submodules/WebSearchUI/Sources/WebSearchBadgeNode.swift b/submodules/WebSearchUI/Sources/WebSearchBadgeNode.swift index 36dd99037d..c52090e332 100644 --- a/submodules/WebSearchUI/Sources/WebSearchBadgeNode.swift +++ b/submodules/WebSearchUI/Sources/WebSearchBadgeNode.swift @@ -12,7 +12,7 @@ final class WebSearchBadgeNode: ASDisplayNode { private let textNode: ASTextNode private let backgroundNode: ASImageNode - private let font: UIFont = Font.with(size: 17.0, design: .round, traits: [.bold]) + private let font: UIFont = Font.with(size: 17.0, design: .round, weight: .bold) var text: String = "" { didSet {