mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix navigation bar title appearance in various places
This commit is contained in:
parent
f622f7668e
commit
532490d2ac
@ -118,7 +118,7 @@ private final class AuthDataTransferSplashScreenNode: ViewControllerTracingNode
|
|||||||
|
|
||||||
let buttonText: String
|
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 textFont = Font.regular(16.0)
|
||||||
let textColor = self.presentationData.theme.list.itemPrimaryTextColor
|
let textColor = self.presentationData.theme.list.itemPrimaryTextColor
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ private let archivedChatsIcon = UIImage(bundleImageName: "Avatar/ArchiveAvatarIc
|
|||||||
private let repliesIcon = generateTintedImage(image: UIImage(bundleImageName: "Avatar/RepliesMessagesIcon"), color: .white)
|
private let repliesIcon = generateTintedImage(image: UIImage(bundleImageName: "Avatar/RepliesMessagesIcon"), color: .white)
|
||||||
|
|
||||||
public func avatarPlaceholderFont(size: CGFloat) -> UIFont {
|
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 {
|
public enum AvatarNodeClipStyle {
|
||||||
|
@ -5,6 +5,8 @@ import Display
|
|||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
import ActivityIndicator
|
import ActivityIndicator
|
||||||
|
|
||||||
|
private let titleFont = Font.with(size: 17.0, design: .regular, weight: .semibold, traits: [.monospacedNumbers])
|
||||||
|
|
||||||
struct NetworkStatusTitle: Equatable {
|
struct NetworkStatusTitle: Equatable {
|
||||||
let text: String
|
let text: String
|
||||||
let activity: Bool
|
let activity: Bool
|
||||||
@ -40,7 +42,7 @@ final class ChatListTitleView: UIView, NavigationBarTitleView, NavigationBarTitl
|
|||||||
self._title = title
|
self._title = title
|
||||||
|
|
||||||
if self._title != oldValue {
|
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.buttonView.accessibilityLabel = self.title.text
|
||||||
self.activityIndicator.isHidden = !self.title.activity
|
self.activityIndicator.isHidden = !self.title.activity
|
||||||
|
|
||||||
@ -101,7 +103,7 @@ final class ChatListTitleView: UIView, NavigationBarTitleView, NavigationBarTitl
|
|||||||
|
|
||||||
var theme: PresentationTheme {
|
var theme: PresentationTheme {
|
||||||
didSet {
|
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)
|
self.lockView.updateTheme(self.theme)
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public final class CounterContollerTitleView: UIView {
|
|||||||
public var title: CounterContollerTitle = CounterContollerTitle(title: "", counter: "") {
|
public var title: CounterContollerTitle = CounterContollerTitle(title: "", counter: "") {
|
||||||
didSet {
|
didSet {
|
||||||
if self.title != oldValue {
|
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.subtitleNode.attributedText = NSAttributedString(string: self.title.counter, font: Font.regular(13.0), textColor: self.theme.rootController.navigationBar.secondaryTextColor)
|
||||||
|
|
||||||
self.accessibilityLabel = self.title.title
|
self.accessibilityLabel = self.title.title
|
||||||
|
@ -68,7 +68,7 @@ private let upperLimitDate = Date(timeIntervalSince1970: Double(Int32.max - 1))
|
|||||||
private let controlFont = Font.regular(17.0)
|
private let controlFont = Font.regular(17.0)
|
||||||
private let dayFont = Font.regular(13.0)
|
private let dayFont = Font.regular(13.0)
|
||||||
private let dateFont = Font.with(size: 17.0, design: .regular, traits: .monospacedNumbers)
|
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 = {
|
private var calendar: Calendar = {
|
||||||
var calendar = Calendar(identifier: .gregorian)
|
var calendar = Calendar(identifier: .gregorian)
|
||||||
|
@ -20,9 +20,8 @@ public struct Font {
|
|||||||
self.rawValue = 0
|
self.rawValue = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
public static let bold = Traits(rawValue: 1 << 0)
|
public static let italic = Traits(rawValue: 1 << 0)
|
||||||
public static let italic = Traits(rawValue: 1 << 1)
|
public static let monospacedNumbers = Traits(rawValue: 1 << 1)
|
||||||
public static let monospacedNumbers = Traits(rawValue: 1 << 2)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Weight {
|
public enum Weight {
|
||||||
@ -31,15 +30,36 @@ public struct Font {
|
|||||||
case medium
|
case medium
|
||||||
case semibold
|
case semibold
|
||||||
case bold
|
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 {
|
public static func with(size: CGFloat, design: Design = .regular, weight: Weight = .regular, traits: Traits = []) -> UIFont {
|
||||||
if #available(iOS 13.0, *) {
|
if #available(iOS 13.0, *) {
|
||||||
let descriptor = UIFont.systemFont(ofSize: size).fontDescriptor
|
let descriptor = UIFont.systemFont(ofSize: size).fontDescriptor
|
||||||
var symbolicTraits = descriptor.symbolicTraits
|
var symbolicTraits = descriptor.symbolicTraits
|
||||||
if traits.contains(.bold) {
|
|
||||||
symbolicTraits.insert(.traitBold)
|
|
||||||
}
|
|
||||||
if traits.contains(.italic) {
|
if traits.contains(.italic) {
|
||||||
symbolicTraits.insert(.traitItalic)
|
symbolicTraits.insert(.traitItalic)
|
||||||
}
|
}
|
||||||
@ -64,21 +84,8 @@ public struct Font {
|
|||||||
updatedDescriptor = updatedDescriptor?.withDesign(.default)
|
updatedDescriptor = updatedDescriptor?.withDesign(.default)
|
||||||
}
|
}
|
||||||
if weight != .regular {
|
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([
|
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 {
|
} else {
|
||||||
switch design {
|
switch design {
|
||||||
case .regular:
|
case .regular:
|
||||||
if traits.contains(.bold) && traits.contains(.italic) {
|
if traits.contains(.italic) {
|
||||||
if let descriptor = UIFont.systemFont(ofSize: size).fontDescriptor.withSymbolicTraits([.traitBold, .traitItalic]) {
|
if let descriptor = UIFont.systemFont(ofSize: size, weight: weight.weight).fontDescriptor.withSymbolicTraits([.traitItalic]) {
|
||||||
return UIFont(descriptor: descriptor, size: size)
|
return UIFont(descriptor: descriptor, size: size)
|
||||||
} else {
|
} else {
|
||||||
return UIFont.italicSystemFont(ofSize: size)
|
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 {
|
} else {
|
||||||
return UIFont.systemFont(ofSize: size)
|
return UIFont.systemFont(ofSize: size, weight: weight.weight)
|
||||||
}
|
}
|
||||||
case .serif:
|
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)
|
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)
|
return UIFont(name: "Georgia-Bold", size: size - 1.0) ?? UIFont.systemFont(ofSize: size)
|
||||||
} else if traits.contains(.italic) {
|
} else if traits.contains(.italic) {
|
||||||
return UIFont(name: "Georgia-Italic", size: size - 1.0) ?? UIFont.systemFont(ofSize: size)
|
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)
|
return UIFont(name: "Georgia", size: size - 1.0) ?? UIFont.systemFont(ofSize: size)
|
||||||
}
|
}
|
||||||
case .monospace:
|
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)
|
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)
|
return UIFont(name: "Menlo-Bold", size: size - 1.0) ?? UIFont.systemFont(ofSize: size)
|
||||||
} else if traits.contains(.italic) {
|
} else if traits.contains(.italic) {
|
||||||
return UIFont(name: "Menlo-Italic", size: size - 1.0) ?? UIFont.systemFont(ofSize: size)
|
return UIFont(name: "Menlo-Italic", size: size - 1.0) ?? UIFont.systemFont(ofSize: size)
|
||||||
|
@ -40,7 +40,7 @@ final class GameControllerTitleView: UIView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func set(title: String, subtitle: String) {
|
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)
|
self.infoNode.attributedText = NSAttributedString(string: subtitle, font: Font.regular(13.0), textColor: self.theme.rootController.navigationBar.secondaryTextColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ private func extensionImage(fileExtension: String?) -> UIImage? {
|
|||||||
return nil
|
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 {
|
private struct FetchControls {
|
||||||
let fetch: () -> Void
|
let fetch: () -> Void
|
||||||
|
@ -17,7 +17,7 @@ import UrlWhitelist
|
|||||||
import AccountContext
|
import AccountContext
|
||||||
import TelegramStringFormatting
|
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))
|
private let iconTextBackgroundImage = generateStretchableFilledCircleImage(radius: 6.0, color: UIColor(rgb: 0xFF9500))
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import AsyncDisplayKit
|
|||||||
import Display
|
import Display
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
|
||||||
private let textFont = Font.with(size: 13.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, traits: [.bold])
|
private let smallTextFont = Font.with(size: 11.0, design: .round, weight: .bold)
|
||||||
|
|
||||||
private class ChatMessageLiveLocationTimerNodeParams: NSObject {
|
private class ChatMessageLiveLocationTimerNodeParams: NSObject {
|
||||||
let backgroundColor: UIColor
|
let backgroundColor: UIColor
|
||||||
|
@ -18,6 +18,9 @@ import PhoneNumberFormat
|
|||||||
import ChatTitleActivityNode
|
import ChatTitleActivityNode
|
||||||
import AnimatedCountLabelNode
|
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 ChatTitleContent {
|
||||||
enum ReplyThreadType {
|
enum ReplyThreadType {
|
||||||
case comments
|
case comments
|
||||||
@ -111,24 +114,24 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
|
|||||||
case let .peer(peerView, _, isScheduledMessages):
|
case let .peer(peerView, _, isScheduledMessages):
|
||||||
if peerView.peerId.isReplies {
|
if peerView.peerId.isReplies {
|
||||||
let typeText: String = self.strings.DialogList_Replies
|
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
|
isEnabled = false
|
||||||
} else if isScheduledMessages {
|
} else if isScheduledMessages {
|
||||||
if peerView.peerId == self.account.peerId {
|
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 {
|
} 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
|
isEnabled = false
|
||||||
} else {
|
} else {
|
||||||
if let peer = peerViewMainPeer(peerView) {
|
if let peer = peerViewMainPeer(peerView) {
|
||||||
if peerView.peerId == self.account.peerId {
|
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 {
|
} else {
|
||||||
if !peerView.peerIsContact, let user = peer as? TelegramUser, !user.flags.contains(.isSupport), user.botInfo == nil, let phone = user.phone, !phone.isEmpty {
|
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 {
|
} 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 {
|
if peer.isFake {
|
||||||
@ -147,7 +150,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case let .replyThread(type, count):
|
case let .replyThread(type, count):
|
||||||
let textFont = Font.medium(17.0)
|
let textFont = titleFont
|
||||||
let textColor = titleTheme.rootController.navigationBar.primaryTextColor
|
let textColor = titleTheme.rootController.navigationBar.primaryTextColor
|
||||||
|
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
@ -215,8 +218,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
|
|||||||
|
|
||||||
isEnabled = false
|
isEnabled = false
|
||||||
case let .custom(text, _, enabled):
|
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: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))]
|
||||||
segments = [.text(0, NSAttributedString(string: text, font: font, textColor: titleTheme.rootController.navigationBar.primaryTextColor))]
|
|
||||||
isEnabled = enabled
|
isEnabled = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +308,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
|
|||||||
case .online:
|
case .online:
|
||||||
infoText = ""
|
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:
|
case .online:
|
||||||
if let (peerId, inputActivities) = self.inputActivities, !inputActivities.isEmpty, inputActivitiesAllowed {
|
if let (peerId, inputActivities) = self.inputActivities, !inputActivities.isEmpty, inputActivitiesAllowed {
|
||||||
var stringValue = ""
|
var stringValue = ""
|
||||||
@ -353,7 +355,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let color = titleTheme.rootController.navigationBar.accentTextColor
|
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 {
|
switch mergedActivity {
|
||||||
case .typingText:
|
case .typingText:
|
||||||
state = .typingText(string, color)
|
state = .typingText(string, color)
|
||||||
@ -375,23 +377,23 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
|
|||||||
if let peer = peerViewMainPeer(peerView) {
|
if let peer = peerViewMainPeer(peerView) {
|
||||||
let servicePeer = isServicePeer(peer)
|
let servicePeer = isServicePeer(peer)
|
||||||
if peer.id == self.account.peerId || isScheduledMessages || peer.id.isReplies {
|
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)
|
state = .info(string, .generic)
|
||||||
} else if let user = peer as? TelegramUser {
|
} else if let user = peer as? TelegramUser {
|
||||||
if user.isDeleted {
|
if user.isDeleted {
|
||||||
state = .none
|
state = .none
|
||||||
} else if servicePeer {
|
} 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)
|
state = .info(string, .generic)
|
||||||
} else if user.flags.contains(.isSupport) {
|
} else if user.flags.contains(.isSupport) {
|
||||||
let statusText = self.strings.Bot_GenericSupportStatus
|
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)
|
state = .info(string, .generic)
|
||||||
} else if let _ = user.botInfo {
|
} else if let _ = user.botInfo {
|
||||||
let statusText = self.strings.Bot_GenericBotStatus
|
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)
|
state = .info(string, .generic)
|
||||||
} else if let peer = peerViewMainPeer(peerView) {
|
} else if let peer = peerViewMainPeer(peerView) {
|
||||||
let timestamp = CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970
|
let timestamp = CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970
|
||||||
@ -403,10 +405,10 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
|
|||||||
userPresence = TelegramUserPresence(status: .none, lastActivity: 0)
|
userPresence = TelegramUserPresence(status: .none, lastActivity: 0)
|
||||||
}
|
}
|
||||||
let (string, activity) = stringAndActivityForUserPresence(strings: self.strings, dateTimeFormat: self.dateTimeFormat, presence: userPresence, relativeTo: Int32(timestamp))
|
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)
|
state = .info(attributedString, activity ? .online : .lastSeenTime)
|
||||||
} else {
|
} 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)
|
state = .info(string, .generic)
|
||||||
}
|
}
|
||||||
} else if let group = peer as? TelegramGroup {
|
} else if let group = peer as? TelegramGroup {
|
||||||
@ -428,11 +430,11 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
|
|||||||
if onlineCount > 1 {
|
if onlineCount > 1 {
|
||||||
let string = NSMutableAttributedString()
|
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_StatusMembers(Int32(group.participantCount))), ", font: subtitleFont, 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_StatusOnline(Int32(onlineCount)), font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor))
|
||||||
state = .info(string, .generic)
|
state = .info(string, .generic)
|
||||||
} else {
|
} 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)
|
state = .info(string, .generic)
|
||||||
}
|
}
|
||||||
} else if let channel = peer as? TelegramChannel {
|
} else if let channel = peer as? TelegramChannel {
|
||||||
@ -440,17 +442,17 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
|
|||||||
if memberCount == 0 {
|
if memberCount == 0 {
|
||||||
let string: NSAttributedString
|
let string: NSAttributedString
|
||||||
if case .group = channel.info {
|
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 {
|
} 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)
|
state = .info(string, .generic)
|
||||||
} else {
|
} else {
|
||||||
if case .group = channel.info, let onlineMemberCount = onlineMemberCount, onlineMemberCount > 1 {
|
if case .group = channel.info, let onlineMemberCount = onlineMemberCount, onlineMemberCount > 1 {
|
||||||
let string = NSMutableAttributedString()
|
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_StatusMembers(Int32(memberCount))), ", font: subtitleFont, 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_StatusOnline(Int32(onlineMemberCount)), font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor))
|
||||||
state = .info(string, .generic)
|
state = .info(string, .generic)
|
||||||
} else {
|
} else {
|
||||||
let membersString: String
|
let membersString: String
|
||||||
@ -459,24 +461,24 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
|
|||||||
} else {
|
} else {
|
||||||
membersString = strings.Conversation_StatusSubscribers(memberCount)
|
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)
|
state = .info(string, .generic)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch channel.info {
|
switch channel.info {
|
||||||
case .group:
|
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)
|
state = .info(string, .generic)
|
||||||
case .broadcast:
|
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)
|
state = .info(string, .generic)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case let .custom(_, subtitle?, _):
|
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)
|
state = .info(string, .generic)
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
@ -1968,7 +1968,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
self.avatarOverlayNode.updateTransitionFraction(transitionFraction, transition: transition)
|
self.avatarOverlayNode.updateTransitionFraction(transitionFraction, transition: transition)
|
||||||
|
|
||||||
if self.navigationTitle != presentationData.strings.EditProfile_Title || themeUpdated {
|
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))
|
let navigationTitleSize = self.navigationTitleNode.updateLayout(CGSize(width: width, height: navigationHeight))
|
||||||
@ -1998,11 +1998,11 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
|
|
||||||
if let peer = peer {
|
if let peer = peer {
|
||||||
if peer.id == self.context.account.peerId && !self.isSettings {
|
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 {
|
} 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 {
|
} 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 {
|
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)
|
usernameString = NSAttributedString(string: "", font: Font.regular(15.0), textColor: presentationData.theme.list.itemSecondaryTextColor)
|
||||||
}
|
}
|
||||||
} else {
|
} 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)
|
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)
|
usernameString = NSAttributedString(string: "", font: Font.regular(15.0), textColor: presentationData.theme.list.itemSecondaryTextColor)
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ final class WebSearchBadgeNode: ASDisplayNode {
|
|||||||
private let textNode: ASTextNode
|
private let textNode: ASTextNode
|
||||||
private let backgroundNode: ASImageNode
|
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 = "" {
|
var text: String = "" {
|
||||||
didSet {
|
didSet {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user