diff --git a/submodules/TelegramUI/Components/MultiScaleTextNode/Sources/MultiScaleTextNode.swift b/submodules/TelegramUI/Components/MultiScaleTextNode/Sources/MultiScaleTextNode.swift index 4036237092..3592a6eb4d 100644 --- a/submodules/TelegramUI/Components/MultiScaleTextNode/Sources/MultiScaleTextNode.swift +++ b/submodules/TelegramUI/Components/MultiScaleTextNode/Sources/MultiScaleTextNode.swift @@ -29,10 +29,12 @@ public final class MultiScaleTextState { public struct Attributes { public var font: UIFont 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.color = color + self.shadowColor = shadowColor } } @@ -84,8 +86,23 @@ public final class MultiScaleTextNode: ASDisplayNode { var mainLayout: MultiScaleTextLayout? for (key, state) in states { if let node = self.stateNodes[key] { - node.tintTextNode.attributedText = NSAttributedString(string: text, font: state.attributes.font, textColor: state.attributes.color) - node.noTintTextNode.attributedText = NSAttributedString(string: text, font: state.attributes.font, textColor: state.attributes.color) + node.tintTextNode.attributedText = NSAttributedString(string: text, attributes: [ + .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.accessibilityLabel = text node.noTintTextNode.isAccessibilityElement = false diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift index 43670b697c..61c3b54eb3 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift @@ -512,11 +512,11 @@ final class PeerInfoHeaderNode: ASDisplayNode { let regularContentButtonBackgroundColor: UIColor 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 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 collapsedHeaderContentButtonForegroundColor = presentationData.theme.list.itemAccentColor @@ -847,6 +847,8 @@ final class PeerInfoHeaderNode: ASDisplayNode { isFake = peer.isFake || peer.isScam } + let titleShadowColor = UIColor(white: 0.0, alpha: 0.1) + if let peer = peer { var title: String if peer.id == self.context.account.peerId && !self.isSettings { @@ -871,7 +873,7 @@ final class PeerInfoHeaderNode: ASDisplayNode { titleStringText = title 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 { var subtitle = formatPhoneNumber(context: self.context, number: user.phone ?? "") @@ -881,7 +883,7 @@ final class PeerInfoHeaderNode: ASDisplayNode { } subtitleStringText = subtitle 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)) } else if let _ = threadData { @@ -893,7 +895,7 @@ final class PeerInfoHeaderNode: ASDisplayNode { subtitleStringText = statusText 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)) @@ -919,7 +921,7 @@ final class PeerInfoHeaderNode: ASDisplayNode { subtitleStringText = statusData.text 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)) @@ -936,18 +938,18 @@ final class PeerInfoHeaderNode: ASDisplayNode { } else { subtitleStringText = " " 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)) } } else { titleStringText = " " 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 = " " 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)) } diff --git a/submodules/TelegramUI/Components/TextFieldComponent/Sources/TextFieldComponent.swift b/submodules/TelegramUI/Components/TextFieldComponent/Sources/TextFieldComponent.swift index c2079d85f3..a4779139ad 100644 --- a/submodules/TelegramUI/Components/TextFieldComponent/Sources/TextFieldComponent.swift +++ b/submodules/TelegramUI/Components/TextFieldComponent/Sources/TextFieldComponent.swift @@ -1059,7 +1059,7 @@ public final class TextFieldComponent: Component { 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 textFrame = CGRect(origin: CGPoint(x: textLeftInset, y: 0.0), size: CGSize(width: size.width - component.insets.left, height: size.height))