For "scroll to bottom" button in chat, instead of glass, tint badge.
This commit is contained in:
parent
a23a721e58
commit
38bbe659fa
@ -184,8 +184,9 @@ extension ConversationViewController {
|
||||
set {
|
||||
viewState.conversationStyle = newValue
|
||||
if #available(iOS 26, *) {
|
||||
viewState.scrollDownButton.tintColor = newValue.chatColorValue.asLiquidGlassTintColor()
|
||||
viewState.scrollToNextMentionButton.tintColor = newValue.chatColorValue.asLiquidGlassTintColor()
|
||||
let tintColor = newValue.chatColorValue.asChatUIElementTintColor()
|
||||
viewState.scrollDownButton.badgeTintColor = tintColor
|
||||
viewState.scrollToNextMentionButton.badgeTintColor = tintColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ public class ConversationInputToolbar: UIView, QuotedReplyPreviewDelegate {
|
||||
func update(conversationStyle: ConversationStyle) {
|
||||
self.conversationStyle = conversationStyle
|
||||
if #available(iOS 26, *), let sendButton = trailingEdgeControl as? UIButton {
|
||||
sendButton.tintColor = conversationStyle.chatColorValue.asLiquidGlassTintColor()
|
||||
sendButton.tintColor = conversationStyle.chatColorValue.asChatUIElementTintColor()
|
||||
}
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ public class ConversationInputToolbar: UIView, QuotedReplyPreviewDelegate {
|
||||
},
|
||||
accessibilityIdentifier: UIView.accessibilityIdentifier(in: self, name: "sendButton"),
|
||||
)
|
||||
button.tintColor = conversationStyle.bubbleChatColorOutgoing.asLiquidGlassTintColor()
|
||||
button.tintColor = conversationStyle.bubbleChatColorOutgoing.asChatUIElementTintColor()
|
||||
return button
|
||||
}
|
||||
|
||||
|
||||
@ -18,13 +18,18 @@ public class ConversationScrollButton: UIButton {
|
||||
}
|
||||
}
|
||||
|
||||
var badgeTintColor: UIColor! {
|
||||
get { unreadBadge.backgroundColor ?? UIColor.Signal.accent }
|
||||
set { unreadBadge.backgroundColor = newValue ?? UIColor.Signal.accent }
|
||||
}
|
||||
|
||||
init(iconName: String) {
|
||||
self.iconName = iconName
|
||||
super.init(frame: .zero)
|
||||
|
||||
var configuration: UIButton.Configuration?
|
||||
if #available(iOS 26, *) {
|
||||
configuration = .prominentGlass()
|
||||
configuration = .glass()
|
||||
}
|
||||
if configuration == nil {
|
||||
configuration = .gray()
|
||||
@ -50,6 +55,14 @@ public class ConversationScrollButton: UIButton {
|
||||
addUnreadLabel()
|
||||
}
|
||||
|
||||
override public func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||
super.traitCollectionDidChange(previousTraitCollection)
|
||||
|
||||
if previousTraitCollection?.userInterfaceStyle != traitCollection.userInterfaceStyle {
|
||||
applyUnreadBadgeStroke()
|
||||
}
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
@ -95,5 +108,16 @@ public class ConversationScrollButton: UIButton {
|
||||
unreadBadge.centerXAnchor.constraint(equalTo: centerXAnchor),
|
||||
unreadBadge.bottomAnchor.constraint(equalTo: topAnchor, constant: pillViewOverlap),
|
||||
])
|
||||
|
||||
applyUnreadBadgeStroke()
|
||||
}
|
||||
|
||||
private func applyUnreadBadgeStroke() {
|
||||
let strokeColor = switch traitCollection.userInterfaceStyle {
|
||||
case .dark: UIColor(white: 1, alpha: 0.1)
|
||||
default: UIColor(white: 0, alpha: 0.1)
|
||||
}
|
||||
unreadBadge.layer.borderWidth = 1
|
||||
unreadBadge.layer.borderColor = strokeColor.cgColor
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ public extension UIColor {
|
||||
@available(iOS 26, *)
|
||||
public extension ColorOrGradientValue {
|
||||
|
||||
func asLiquidGlassTintColor() -> UIColor {
|
||||
func asChatUIElementTintColor() -> UIColor {
|
||||
let bubbleColor: UIColor = {
|
||||
switch self {
|
||||
case .transparent, .blur:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user