mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
cbe1571515
@ -29,10 +29,12 @@ public final class MultiScaleTextState {
|
|||||||
public struct Attributes {
|
public struct Attributes {
|
||||||
public var font: UIFont
|
public var font: UIFont
|
||||||
public var color: UIColor
|
public var color: UIColor
|
||||||
|
public var shadowColor: UIColor?
|
||||||
|
|
||||||
public init(font: UIFont, color: UIColor) {
|
public init(font: UIFont, color: UIColor, shadowColor: UIColor? = nil) {
|
||||||
self.font = font
|
self.font = font
|
||||||
self.color = color
|
self.color = color
|
||||||
|
self.shadowColor = shadowColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,8 +86,23 @@ public final class MultiScaleTextNode: ASDisplayNode {
|
|||||||
var mainLayout: MultiScaleTextLayout?
|
var mainLayout: MultiScaleTextLayout?
|
||||||
for (key, state) in states {
|
for (key, state) in states {
|
||||||
if let node = self.stateNodes[key] {
|
if let node = self.stateNodes[key] {
|
||||||
node.tintTextNode.attributedText = NSAttributedString(string: text, font: state.attributes.font, textColor: state.attributes.color)
|
node.tintTextNode.attributedText = NSAttributedString(string: text, attributes: [
|
||||||
node.noTintTextNode.attributedText = NSAttributedString(string: text, font: state.attributes.font, textColor: state.attributes.color)
|
.font: state.attributes.font,
|
||||||
|
.foregroundColor: state.attributes.color
|
||||||
|
])
|
||||||
|
node.noTintTextNode.attributedText = NSAttributedString(string: text, attributes: [
|
||||||
|
.font: state.attributes.font,
|
||||||
|
.foregroundColor: state.attributes.color
|
||||||
|
])
|
||||||
|
if let shadowColor = state.attributes.shadowColor {
|
||||||
|
node.tintTextNode.textShadowColor = shadowColor
|
||||||
|
node.tintTextNode.textShadowBlur = 3.0
|
||||||
|
node.noTintTextNode.textShadowColor = shadowColor
|
||||||
|
node.noTintTextNode.textShadowBlur = 3.0
|
||||||
|
} else {
|
||||||
|
node.tintTextNode.shadowColor = nil
|
||||||
|
node.noTintTextNode.shadowColor = nil
|
||||||
|
}
|
||||||
node.tintTextNode.isAccessibilityElement = true
|
node.tintTextNode.isAccessibilityElement = true
|
||||||
node.tintTextNode.accessibilityLabel = text
|
node.tintTextNode.accessibilityLabel = text
|
||||||
node.noTintTextNode.isAccessibilityElement = false
|
node.noTintTextNode.isAccessibilityElement = false
|
||||||
|
@ -512,11 +512,11 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
|
|
||||||
let regularContentButtonBackgroundColor: UIColor
|
let regularContentButtonBackgroundColor: UIColor
|
||||||
let collapsedHeaderContentButtonBackgroundColor = presentationData.theme.list.itemBlocksBackgroundColor
|
let collapsedHeaderContentButtonBackgroundColor = presentationData.theme.list.itemBlocksBackgroundColor
|
||||||
let expandedAvatarContentButtonBackgroundColor: UIColor = UIColor(white: 1.0, alpha: 0.3)
|
let expandedAvatarContentButtonBackgroundColor: UIColor = UIColor(white: 0.0, alpha: 0.1)
|
||||||
|
|
||||||
let regularHeaderButtonBackgroundColor: UIColor
|
let regularHeaderButtonBackgroundColor: UIColor
|
||||||
let collapsedHeaderButtonBackgroundColor: UIColor = .clear
|
let collapsedHeaderButtonBackgroundColor: UIColor = .clear
|
||||||
let expandedAvatarHeaderButtonBackgroundColor: UIColor = UIColor(white: 1.0, alpha: 0.3)
|
let expandedAvatarHeaderButtonBackgroundColor: UIColor = UIColor(white: 0.0, alpha: 0.1)
|
||||||
|
|
||||||
let regularContentButtonForegroundColor: UIColor = peer?.profileColor != nil ? UIColor.white : presentationData.theme.list.itemAccentColor
|
let regularContentButtonForegroundColor: UIColor = peer?.profileColor != nil ? UIColor.white : presentationData.theme.list.itemAccentColor
|
||||||
let collapsedHeaderContentButtonForegroundColor = presentationData.theme.list.itemAccentColor
|
let collapsedHeaderContentButtonForegroundColor = presentationData.theme.list.itemAccentColor
|
||||||
@ -847,6 +847,8 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
isFake = peer.isFake || peer.isScam
|
isFake = peer.isFake || peer.isScam
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let titleShadowColor = UIColor(white: 0.0, alpha: 0.1)
|
||||||
|
|
||||||
if let peer = peer {
|
if let peer = peer {
|
||||||
var title: String
|
var title: String
|
||||||
if peer.id == self.context.account.peerId && !self.isSettings {
|
if peer.id == self.context.account.peerId && !self.isSettings {
|
||||||
@ -871,7 +873,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
|
|
||||||
titleStringText = title
|
titleStringText = title
|
||||||
titleAttributes = MultiScaleTextState.Attributes(font: Font.medium(28.0), color: .white)
|
titleAttributes = MultiScaleTextState.Attributes(font: Font.medium(28.0), color: .white)
|
||||||
smallTitleAttributes = MultiScaleTextState.Attributes(font: Font.medium(28.0), color: .white)
|
smallTitleAttributes = MultiScaleTextState.Attributes(font: Font.medium(28.0), color: .white, shadowColor: titleShadowColor)
|
||||||
|
|
||||||
if self.isSettings, let user = peer as? TelegramUser {
|
if self.isSettings, let user = peer as? TelegramUser {
|
||||||
var subtitle = formatPhoneNumber(context: self.context, number: user.phone ?? "")
|
var subtitle = formatPhoneNumber(context: self.context, number: user.phone ?? "")
|
||||||
@ -881,7 +883,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
subtitleStringText = subtitle
|
subtitleStringText = subtitle
|
||||||
subtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(17.0), color: .white)
|
subtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(17.0), color: .white)
|
||||||
smallSubtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white)
|
smallSubtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white, shadowColor: titleShadowColor)
|
||||||
|
|
||||||
usernameString = ("", MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white))
|
usernameString = ("", MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white))
|
||||||
} else if let _ = threadData {
|
} else if let _ = threadData {
|
||||||
@ -893,7 +895,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
|
|
||||||
subtitleStringText = statusText
|
subtitleStringText = statusText
|
||||||
subtitleAttributes = MultiScaleTextState.Attributes(font: Font.semibold(16.0), color: subtitleColor)
|
subtitleAttributes = MultiScaleTextState.Attributes(font: Font.semibold(16.0), color: subtitleColor)
|
||||||
smallSubtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white)
|
smallSubtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white, shadowColor: titleShadowColor)
|
||||||
|
|
||||||
usernameString = ("", MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white))
|
usernameString = ("", MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white))
|
||||||
|
|
||||||
@ -919,7 +921,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
|
|
||||||
subtitleStringText = statusData.text
|
subtitleStringText = statusData.text
|
||||||
subtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(17.0), color: subtitleColor)
|
subtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(17.0), color: subtitleColor)
|
||||||
smallSubtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white)
|
smallSubtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white, shadowColor: titleShadowColor)
|
||||||
|
|
||||||
usernameString = ("", MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white))
|
usernameString = ("", MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white))
|
||||||
|
|
||||||
@ -936,18 +938,18 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
} else {
|
} else {
|
||||||
subtitleStringText = " "
|
subtitleStringText = " "
|
||||||
subtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white)
|
subtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white)
|
||||||
smallSubtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white)
|
smallSubtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white, shadowColor: titleShadowColor)
|
||||||
|
|
||||||
usernameString = ("", MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white))
|
usernameString = ("", MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
titleStringText = " "
|
titleStringText = " "
|
||||||
titleAttributes = MultiScaleTextState.Attributes(font: Font.regular(24.0), color: .white)
|
titleAttributes = MultiScaleTextState.Attributes(font: Font.regular(24.0), color: .white)
|
||||||
smallTitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(24.0), color: .white)
|
smallTitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(24.0), color: .white, shadowColor: titleShadowColor)
|
||||||
|
|
||||||
subtitleStringText = " "
|
subtitleStringText = " "
|
||||||
subtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white)
|
subtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white)
|
||||||
smallSubtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white)
|
smallSubtitleAttributes = MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white, shadowColor: titleShadowColor)
|
||||||
|
|
||||||
usernameString = ("", MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white))
|
usernameString = ("", MultiScaleTextState.Attributes(font: Font.regular(16.0), color: .white))
|
||||||
}
|
}
|
||||||
|
@ -1059,7 +1059,7 @@ public final class TextFieldComponent: Component {
|
|||||||
availableSize.width += 32.0
|
availableSize.width += 32.0
|
||||||
}
|
}
|
||||||
|
|
||||||
let textHeight = self.textView.textHeightForWidth(availableSize.width - textLeftInset, rightInset: innerTextInsets.right)
|
let textHeight = self.textView.textHeightForWidth(availableSize.width - component.insets.left, rightInset: innerTextInsets.right)
|
||||||
let size = CGSize(width: availableSize.width, height: min(textHeight, availableSize.height))
|
let size = CGSize(width: availableSize.width, height: min(textHeight, availableSize.height))
|
||||||
|
|
||||||
let textFrame = CGRect(origin: CGPoint(x: textLeftInset, y: 0.0), size: CGSize(width: size.width - component.insets.left, height: size.height))
|
let textFrame = CGRect(origin: CGPoint(x: textLeftInset, y: 0.0), size: CGSize(width: size.width - component.insets.left, height: size.height))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user