mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Shared media improvements
This commit is contained in:
@@ -2,12 +2,19 @@ import Foundation
|
||||
import UIKit
|
||||
|
||||
public struct ToolbarAction: Equatable {
|
||||
public enum Color: Equatable {
|
||||
case accent
|
||||
case custom(UIColor)
|
||||
}
|
||||
|
||||
public let title: String
|
||||
public let isEnabled: Bool
|
||||
public let color: Color
|
||||
|
||||
public init(title: String, isEnabled: Bool) {
|
||||
public init(title: String, isEnabled: Bool, color: Color = .accent) {
|
||||
self.title = title
|
||||
self.isEnabled = isEnabled
|
||||
self.color = color
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,8 +117,23 @@ public final class ToolbarNode: ASDisplayNode {
|
||||
|
||||
self.rightTitle.attributedText = NSAttributedString(string: toolbar.rightAction?.title ?? "", font: Font.regular(17.0), textColor: (toolbar.rightAction?.isEnabled ?? false) ? self.theme.tabBarSelectedTextColor : self.theme.tabBarTextColor)
|
||||
self.rightButton.accessibilityLabel = toolbar.rightAction?.title
|
||||
|
||||
self.middleTitle.attributedText = NSAttributedString(string: toolbar.middleAction?.title ?? "", font: Font.regular(17.0), textColor: (toolbar.middleAction?.isEnabled ?? false) ? self.theme.tabBarSelectedTextColor : self.theme.tabBarTextColor)
|
||||
|
||||
let middleColor: UIColor
|
||||
if let middleAction = toolbar.middleAction {
|
||||
if middleAction.isEnabled {
|
||||
switch middleAction.color {
|
||||
case .accent:
|
||||
middleColor = self.theme.tabBarSelectedTextColor
|
||||
case let .custom(color):
|
||||
middleColor = color
|
||||
}
|
||||
} else {
|
||||
middleColor = self.theme.tabBarTextColor
|
||||
}
|
||||
} else {
|
||||
middleColor = self.theme.tabBarTextColor
|
||||
}
|
||||
self.middleTitle.attributedText = NSAttributedString(string: toolbar.middleAction?.title ?? "", font: Font.regular(17.0), textColor: middleColor)
|
||||
self.middleButton.accessibilityLabel = toolbar.middleAction?.title
|
||||
|
||||
var size = size
|
||||
|
||||
Reference in New Issue
Block a user