mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Alter chat elements to match flat themes
This commit is contained in:
parent
61a20bbbfc
commit
c75bde7573
15 changed files with 113 additions and 24 deletions
|
|
@ -420,6 +420,7 @@ public func makeDefaultDarkPresentationTheme(preview: Bool) -> PresentationTheme
|
|||
|
||||
let inputPanel = PresentationThemeChatInputPanel(
|
||||
panelBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
panelBackgroundColorNoWallpaper: UIColor(rgb: 0x000000),
|
||||
panelSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
panelControlAccentColor: UIColor(rgb: 0xffffff),
|
||||
panelControlColor: UIColor(rgb: 0x808080),
|
||||
|
|
|
|||
|
|
@ -676,6 +676,7 @@ public func makeDefaultDarkTintedPresentationTheme(preview: Bool) -> Presentatio
|
|||
|
||||
let inputPanel = PresentationThemeChatInputPanel(
|
||||
panelBackgroundColor: mainBackgroundColor,
|
||||
panelBackgroundColorNoWallpaper: accentColor.withMultiplied(hue: 1.024, saturation: 0.573, brightness: 0.18),
|
||||
panelSeparatorColor: mainSeparatorColor,
|
||||
panelControlAccentColor: accentColor,
|
||||
panelControlColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
|
|
|
|||
|
|
@ -629,6 +629,7 @@ public func makeDefaultDayPresentationTheme(serviceBackgroundColor: UIColor?, da
|
|||
|
||||
let inputPanel = PresentationThemeChatInputPanel(
|
||||
panelBackgroundColor: UIColor(rgb: 0xf7f7f7),
|
||||
panelBackgroundColorNoWallpaper: UIColor(rgb: 0xffffff),
|
||||
panelSeparatorColor: UIColor(rgb: 0xb2b2b2),
|
||||
panelControlAccentColor: UIColor(rgb: 0x007ee5),
|
||||
panelControlColor: UIColor(rgb: 0x858e99),
|
||||
|
|
|
|||
|
|
@ -847,6 +847,7 @@ public final class PresentationThemeChatInputPanelMediaRecordingControl {
|
|||
|
||||
public final class PresentationThemeChatInputPanel {
|
||||
public let panelBackgroundColor: UIColor
|
||||
public let panelBackgroundColorNoWallpaper: UIColor
|
||||
public let panelSeparatorColor: UIColor
|
||||
public let panelControlAccentColor: UIColor
|
||||
public let panelControlColor: UIColor
|
||||
|
|
@ -864,8 +865,9 @@ public final class PresentationThemeChatInputPanel {
|
|||
public let mediaRecordingDotColor: UIColor
|
||||
public let mediaRecordingControl: PresentationThemeChatInputPanelMediaRecordingControl
|
||||
|
||||
public init(panelBackgroundColor: UIColor, panelSeparatorColor: UIColor, panelControlAccentColor: UIColor, panelControlColor: UIColor, panelControlDisabledColor: UIColor, panelControlDestructiveColor: UIColor, inputBackgroundColor: UIColor, inputStrokeColor: UIColor, inputPlaceholderColor: UIColor, inputTextColor: UIColor, inputControlColor: UIColor, actionControlFillColor: UIColor, actionControlForegroundColor: UIColor, primaryTextColor: UIColor, secondaryTextColor: UIColor, mediaRecordingDotColor: UIColor, mediaRecordingControl: PresentationThemeChatInputPanelMediaRecordingControl) {
|
||||
public init(panelBackgroundColor: UIColor, panelBackgroundColorNoWallpaper: UIColor, panelSeparatorColor: UIColor, panelControlAccentColor: UIColor, panelControlColor: UIColor, panelControlDisabledColor: UIColor, panelControlDestructiveColor: UIColor, inputBackgroundColor: UIColor, inputStrokeColor: UIColor, inputPlaceholderColor: UIColor, inputTextColor: UIColor, inputControlColor: UIColor, actionControlFillColor: UIColor, actionControlForegroundColor: UIColor, primaryTextColor: UIColor, secondaryTextColor: UIColor, mediaRecordingDotColor: UIColor, mediaRecordingControl: PresentationThemeChatInputPanelMediaRecordingControl) {
|
||||
self.panelBackgroundColor = panelBackgroundColor
|
||||
self.panelBackgroundColorNoWallpaper = panelBackgroundColorNoWallpaper
|
||||
self.panelSeparatorColor = panelSeparatorColor
|
||||
self.panelControlAccentColor = panelControlAccentColor
|
||||
self.panelControlColor = panelControlColor
|
||||
|
|
@ -884,8 +886,8 @@ public final class PresentationThemeChatInputPanel {
|
|||
self.mediaRecordingControl = mediaRecordingControl
|
||||
}
|
||||
|
||||
public func withUpdated(panelBackgroundColor: UIColor? = nil, panelSeparatorColor: UIColor? = nil, panelControlAccentColor: UIColor? = nil, panelControlColor: UIColor? = nil, panelControlDisabledColor: UIColor? = nil, panelControlDestructiveColor: UIColor? = nil, inputBackgroundColor: UIColor? = nil, inputStrokeColor: UIColor? = nil, inputPlaceholderColor: UIColor? = nil, inputTextColor: UIColor? = nil, inputControlColor: UIColor? = nil, actionControlFillColor: UIColor? = nil, actionControlForegroundColor: UIColor? = nil, primaryTextColor: UIColor? = nil, secondaryTextColor: UIColor? = nil, mediaRecordingDotColor: UIColor? = nil, mediaRecordingControl: PresentationThemeChatInputPanelMediaRecordingControl? = nil) -> PresentationThemeChatInputPanel {
|
||||
return PresentationThemeChatInputPanel(panelBackgroundColor: panelBackgroundColor ?? self.panelBackgroundColor, panelSeparatorColor: panelSeparatorColor ?? self.panelSeparatorColor, panelControlAccentColor: panelControlAccentColor ?? self.panelControlAccentColor, panelControlColor: panelControlColor ?? self.panelControlColor, panelControlDisabledColor: panelControlDisabledColor ?? self.panelControlDisabledColor, panelControlDestructiveColor: panelControlDestructiveColor ?? self.panelControlDestructiveColor, inputBackgroundColor: inputBackgroundColor ?? self.inputBackgroundColor, inputStrokeColor: inputStrokeColor ?? self.inputStrokeColor, inputPlaceholderColor: inputPlaceholderColor ?? self.inputPlaceholderColor, inputTextColor: inputTextColor ?? self.inputTextColor, inputControlColor: inputControlColor ?? self.inputControlColor, actionControlFillColor: actionControlFillColor ?? self.actionControlFillColor, actionControlForegroundColor: actionControlForegroundColor ?? self.actionControlForegroundColor, primaryTextColor: primaryTextColor ?? self.primaryTextColor, secondaryTextColor: secondaryTextColor ?? self.secondaryTextColor, mediaRecordingDotColor: mediaRecordingDotColor ?? self.mediaRecordingDotColor, mediaRecordingControl: mediaRecordingControl ?? self.mediaRecordingControl)
|
||||
public func withUpdated(panelBackgroundColor: UIColor? = nil, panelBackgroundColorNoWallpaper: UIColor? = nil, panelSeparatorColor: UIColor? = nil, panelControlAccentColor: UIColor? = nil, panelControlColor: UIColor? = nil, panelControlDisabledColor: UIColor? = nil, panelControlDestructiveColor: UIColor? = nil, inputBackgroundColor: UIColor? = nil, inputStrokeColor: UIColor? = nil, inputPlaceholderColor: UIColor? = nil, inputTextColor: UIColor? = nil, inputControlColor: UIColor? = nil, actionControlFillColor: UIColor? = nil, actionControlForegroundColor: UIColor? = nil, primaryTextColor: UIColor? = nil, secondaryTextColor: UIColor? = nil, mediaRecordingDotColor: UIColor? = nil, mediaRecordingControl: PresentationThemeChatInputPanelMediaRecordingControl? = nil) -> PresentationThemeChatInputPanel {
|
||||
return PresentationThemeChatInputPanel(panelBackgroundColor: panelBackgroundColor ?? self.panelBackgroundColor, panelBackgroundColorNoWallpaper: panelBackgroundColorNoWallpaper ?? self.panelBackgroundColorNoWallpaper, panelSeparatorColor: panelSeparatorColor ?? self.panelSeparatorColor, panelControlAccentColor: panelControlAccentColor ?? self.panelControlAccentColor, panelControlColor: panelControlColor ?? self.panelControlColor, panelControlDisabledColor: panelControlDisabledColor ?? self.panelControlDisabledColor, panelControlDestructiveColor: panelControlDestructiveColor ?? self.panelControlDestructiveColor, inputBackgroundColor: inputBackgroundColor ?? self.inputBackgroundColor, inputStrokeColor: inputStrokeColor ?? self.inputStrokeColor, inputPlaceholderColor: inputPlaceholderColor ?? self.inputPlaceholderColor, inputTextColor: inputTextColor ?? self.inputTextColor, inputControlColor: inputControlColor ?? self.inputControlColor, actionControlFillColor: actionControlFillColor ?? self.actionControlFillColor, actionControlForegroundColor: actionControlForegroundColor ?? self.actionControlForegroundColor, primaryTextColor: primaryTextColor ?? self.primaryTextColor, secondaryTextColor: secondaryTextColor ?? self.secondaryTextColor, mediaRecordingDotColor: mediaRecordingDotColor ?? self.mediaRecordingDotColor, mediaRecordingControl: mediaRecordingControl ?? self.mediaRecordingControl)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1318,6 +1318,7 @@ extension PresentationThemeChatInputPanelMediaRecordingControl: Codable {
|
|||
extension PresentationThemeChatInputPanel: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case panelBg
|
||||
case panelBgNoWallpaper
|
||||
case panelSeparator
|
||||
case panelControlAccent
|
||||
case panelControl
|
||||
|
|
@ -1338,7 +1339,10 @@ extension PresentationThemeChatInputPanel: Codable {
|
|||
|
||||
public convenience init(from decoder: Decoder) throws {
|
||||
let values = try decoder.container(keyedBy: CodingKeys.self)
|
||||
self.init(panelBackgroundColor: try decodeColor(values, .panelBg),
|
||||
let panelBackgroundColor = try decodeColor(values, .panelBg)
|
||||
let panelBackgroundColorNoWallpaper = try decodeColor(values, .panelBgNoWallpaper)
|
||||
self.init(panelBackgroundColor: panelBackgroundColor,
|
||||
panelBackgroundColorNoWallpaper: panelBackgroundColorNoWallpaper ?? panelBackgroundColor,
|
||||
panelSeparatorColor: try decodeColor(values, .panelSeparator),
|
||||
panelControlAccentColor: try decodeColor(values, .panelControlAccent),
|
||||
panelControlColor: try decodeColor(values, .panelControl),
|
||||
|
|
|
|||
|
|
@ -2687,6 +2687,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||
self.chatDisplayNode.historyNode.contentPositionChanged = { [weak self] offset in
|
||||
if let strongSelf = self {
|
||||
let offsetAlpha: CGFloat
|
||||
let plainInputSeparatorAlpha: CGFloat
|
||||
switch offset {
|
||||
case let .known(offset):
|
||||
if offset < 40.0 {
|
||||
|
|
@ -2694,13 +2695,21 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||
} else {
|
||||
offsetAlpha = 1.0
|
||||
}
|
||||
if offset < 4.0 {
|
||||
plainInputSeparatorAlpha = 0.0
|
||||
} else {
|
||||
plainInputSeparatorAlpha = 1.0
|
||||
}
|
||||
case .unknown:
|
||||
offsetAlpha = 1.0
|
||||
plainInputSeparatorAlpha = 1.0
|
||||
case .none:
|
||||
offsetAlpha = 0.0
|
||||
plainInputSeparatorAlpha = 0.0
|
||||
}
|
||||
|
||||
strongSelf.chatDisplayNode.navigateButtons.displayDownButton = !offsetAlpha.isZero
|
||||
strongSelf.chatDisplayNode.updatePlainInputSeparatorAlpha(plainInputSeparatorAlpha, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5079,14 +5088,17 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||
statusText = strongSelf.presentationData.strings.Undo_ChatCleared
|
||||
}
|
||||
|
||||
strongSelf.present(UndoOverlayController(presentationData: strongSelf.context.sharedContext.currentPresentationData.with { $0 }, content: .removedChat(text: statusText), elevatedLayout: true, action: { shouldCommit in
|
||||
if shouldCommit {
|
||||
strongSelf.present(UndoOverlayController(presentationData: strongSelf.context.sharedContext.currentPresentationData.with { $0 }, content: .removedChat(text: statusText), elevatedLayout: true, action: { value in
|
||||
if value == .commit {
|
||||
let _ = clearHistoryInteractively(postbox: account.postbox, peerId: peerId, type: type).start(completed: {
|
||||
self?.chatDisplayNode.historyNode.historyAppearsCleared = false
|
||||
})
|
||||
} else {
|
||||
return true
|
||||
} else if value == .undo {
|
||||
self?.chatDisplayNode.historyNode.historyAppearsCleared = false
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}), in: .current)
|
||||
}
|
||||
|
||||
|
|
@ -5349,7 +5361,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||
disposable.set((signal
|
||||
|> deliverOnMainQueue).start(completed: { [weak self] in
|
||||
if let strongSelf = self, let layout = strongSelf.validLayout {
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .succeed(text: presentationData.strings.ClearCache_Success("\(dataSizeString(selectedSize, decimalSeparator: presentationData.dateTimeFormat.decimalSeparator))", stringForDeviceType()).0), elevatedLayout: true, action: { _ in }), in: .current)
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .succeed(text: presentationData.strings.ClearCache_Success("\(dataSizeString(selectedSize, decimalSeparator: presentationData.dateTimeFormat.decimalSeparator))", stringForDeviceType()).0), elevatedLayout: true, action: { _ in return false }), in: .current)
|
||||
}
|
||||
}))
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||
|
||||
private let inputPanelBackgroundNode: ASDisplayNode
|
||||
private let inputPanelBackgroundSeparatorNode: ASDisplayNode
|
||||
private var plainInputSeparatorAlpha: CGFloat?
|
||||
private var usePlainInputSeparator: Bool
|
||||
|
||||
private let titleAccessoryPanelContainer: ChatControllerTitlePanelNodeContainer
|
||||
private var titleAccessoryPanelNode: ChatTitleAccessoryPanelNode?
|
||||
|
|
@ -225,7 +227,14 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||
self.loadingNode = ChatLoadingNode(theme: self.chatPresentationInterfaceState.theme, chatWallpaper: self.chatPresentationInterfaceState.chatWallpaper)
|
||||
|
||||
self.inputPanelBackgroundNode = ASDisplayNode()
|
||||
self.inputPanelBackgroundNode.backgroundColor = self.chatPresentationInterfaceState.theme.chat.inputPanel.panelBackgroundColor
|
||||
if self.chatPresentationInterfaceState.chatWallpaper == self.chatPresentationInterfaceState.theme.chat.defaultWallpaper, case .color = self.chatPresentationInterfaceState.chatWallpaper {
|
||||
self.inputPanelBackgroundNode.backgroundColor = self.chatPresentationInterfaceState.theme.chat.inputPanel.panelBackgroundColorNoWallpaper
|
||||
self.usePlainInputSeparator = true
|
||||
} else {
|
||||
self.inputPanelBackgroundNode.backgroundColor = self.chatPresentationInterfaceState.theme.chat.inputPanel.panelBackgroundColor
|
||||
self.usePlainInputSeparator = false
|
||||
self.plainInputSeparatorAlpha = nil
|
||||
}
|
||||
self.inputPanelBackgroundNode.isLayerBacked = true
|
||||
|
||||
self.inputPanelBackgroundSeparatorNode = ASDisplayNode()
|
||||
|
|
@ -1443,7 +1452,17 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||
self.navigateButtons.updateTheme(theme: chatPresentationInterfaceState.theme)
|
||||
|
||||
if themeUpdated {
|
||||
self.inputPanelBackgroundNode.backgroundColor = chatPresentationInterfaceState.theme.chat.inputPanel.panelBackgroundColor
|
||||
if self.chatPresentationInterfaceState.chatWallpaper == self.chatPresentationInterfaceState.theme.chat.defaultWallpaper, case .color = self.chatPresentationInterfaceState.chatWallpaper {
|
||||
self.inputPanelBackgroundNode.backgroundColor = self.chatPresentationInterfaceState.theme.chat.inputPanel.panelBackgroundColorNoWallpaper
|
||||
self.usePlainInputSeparator = true
|
||||
} else {
|
||||
self.inputPanelBackgroundNode.backgroundColor = self.chatPresentationInterfaceState.theme.chat.inputPanel.panelBackgroundColor
|
||||
self.usePlainInputSeparator = false
|
||||
self.plainInputSeparatorAlpha = nil
|
||||
}
|
||||
if let plainInputSeparatorAlpha = self.plainInputSeparatorAlpha {
|
||||
self.updatePlainInputSeparatorAlpha(plainInputSeparatorAlpha, animated: false)
|
||||
}
|
||||
self.inputPanelBackgroundSeparatorNode.backgroundColor = self.chatPresentationInterfaceState.theme.chat.inputPanel.panelSeparatorColor
|
||||
}
|
||||
|
||||
|
|
@ -1657,7 +1676,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||
if case let .peer(id) = self.chatPresentationInterfaceState.chatLocation {
|
||||
peerId = id
|
||||
}
|
||||
let inputNode = ChatMediaInputNode(context: self.context, peerId: peerId, controllerInteraction: self.controllerInteraction, theme: theme, strings: strings, fontSize: fontSize, gifPaneIsActiveUpdated: { [weak self] value in
|
||||
let inputNode = ChatMediaInputNode(context: self.context, peerId: peerId, controllerInteraction: self.controllerInteraction, chatWallpaper: self.chatPresentationInterfaceState.chatWallpaper, theme: theme, strings: strings, fontSize: fontSize, gifPaneIsActiveUpdated: { [weak self] value in
|
||||
if let strongSelf = self, let interfaceInteraction = strongSelf.interfaceInteraction {
|
||||
interfaceInteraction.updateInputModeAndDismissedButtonKeyboardMessageId { state in
|
||||
if case let .media(_, expanded) = state.inputMode {
|
||||
|
|
@ -2275,4 +2294,26 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||
func setEnablePredictiveTextInput(_ value: Bool) {
|
||||
self.textInputPanelNode?.enablePredictiveInput = value
|
||||
}
|
||||
|
||||
func updatePlainInputSeparatorAlpha(_ value: CGFloat, animated: Bool) {
|
||||
if self.usePlainInputSeparator {
|
||||
if let plainInputSeparatorAlpha = self.plainInputSeparatorAlpha {
|
||||
if plainInputSeparatorAlpha != value {
|
||||
self.plainInputSeparatorAlpha = value
|
||||
if animated {
|
||||
let transition: ContainedViewLayoutTransition = .animated(duration: 0.2, curve: .easeInOut)
|
||||
transition.updateAlpha(node: self.inputPanelBackgroundSeparatorNode, alpha: value, beginWithCurrentState: true)
|
||||
} else {
|
||||
self.inputPanelBackgroundSeparatorNode.alpha = value
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.plainInputSeparatorAlpha = value
|
||||
self.inputPanelBackgroundSeparatorNode.alpha = value
|
||||
}
|
||||
} else if self.updatePlainInputSeparatorAlpha != nil {
|
||||
self.plainInputSeparatorAlpha = nil
|
||||
self.inputPanelBackgroundSeparatorNode.alpha = 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ func inputNodeForChatPresentationIntefaceState(_ chatPresentationInterfaceState:
|
|||
if case let .peer(id) = chatPresentationInterfaceState.chatLocation {
|
||||
peerId = id
|
||||
}
|
||||
let inputNode = ChatMediaInputNode(context: context, peerId: peerId, controllerInteraction: controllerInteraction, theme: chatPresentationInterfaceState.theme, strings: chatPresentationInterfaceState.strings, fontSize: chatPresentationInterfaceState.fontSize, gifPaneIsActiveUpdated: { [weak interfaceInteraction] value in
|
||||
let inputNode = ChatMediaInputNode(context: context, peerId: peerId, controllerInteraction: controllerInteraction, chatWallpaper: chatPresentationInterfaceState.chatWallpaper, theme: chatPresentationInterfaceState.theme, strings: chatPresentationInterfaceState.strings, fontSize: chatPresentationInterfaceState.fontSize, gifPaneIsActiveUpdated: { [weak interfaceInteraction] value in
|
||||
if let interfaceInteraction = interfaceInteraction {
|
||||
interfaceInteraction.updateInputModeAndDismissedButtonKeyboardMessageId { state in
|
||||
if case let .media(_, expanded) = state.inputMode {
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ final class ChatMediaInputNode: ChatInputNode {
|
|||
return self._ready.get()
|
||||
}
|
||||
|
||||
init(context: AccountContext, peerId: PeerId?, controllerInteraction: ChatControllerInteraction, theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize, gifPaneIsActiveUpdated: @escaping (Bool) -> Void) {
|
||||
init(context: AccountContext, peerId: PeerId?, controllerInteraction: ChatControllerInteraction, chatWallpaper: TelegramWallpaper, theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize, gifPaneIsActiveUpdated: @escaping (Bool) -> Void) {
|
||||
self.context = context
|
||||
self.peerId = peerId
|
||||
self.controllerInteraction = controllerInteraction
|
||||
|
|
@ -459,7 +459,12 @@ final class ChatMediaInputNode: ChatInputNode {
|
|||
|
||||
self.collectionListPanel = ASDisplayNode()
|
||||
self.collectionListPanel.clipsToBounds = true
|
||||
self.collectionListPanel.backgroundColor = theme.chat.inputPanel.panelBackgroundColor
|
||||
|
||||
if chatWallpaper == theme.chat.defaultWallpaper, case .color = chatWallpaper {
|
||||
self.collectionListPanel.backgroundColor = theme.chat.inputPanel.panelBackgroundColorNoWallpaper
|
||||
} else {
|
||||
self.collectionListPanel.backgroundColor = theme.chat.inputPanel.panelBackgroundColor
|
||||
}
|
||||
|
||||
self.collectionListSeparator = ASDisplayNode()
|
||||
self.collectionListSeparator.isLayerBacked = true
|
||||
|
|
@ -913,12 +918,17 @@ final class ChatMediaInputNode: ChatInputNode {
|
|||
self.searchContainerNodeLoadedDisposable.dispose()
|
||||
}
|
||||
|
||||
private func updateThemeAndStrings(theme: PresentationTheme, strings: PresentationStrings) {
|
||||
private func updateThemeAndStrings(chatWallpaper: TelegramWallpaper, theme: PresentationTheme, strings: PresentationStrings) {
|
||||
if self.theme !== theme || self.strings !== strings {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
|
||||
self.collectionListPanel.backgroundColor = theme.chat.inputPanel.panelBackgroundColor
|
||||
if chatWallpaper == theme.chat.defaultWallpaper, case .color = chatWallpaper {
|
||||
self.collectionListPanel.backgroundColor = theme.chat.inputPanel.panelBackgroundColorNoWallpaper
|
||||
} else {
|
||||
self.collectionListPanel.backgroundColor = theme.chat.inputPanel.panelBackgroundColor
|
||||
}
|
||||
|
||||
self.collectionListSeparator.backgroundColor = theme.chat.inputMediaPanel.panelSeparatorColor
|
||||
self.backgroundColor = theme.chat.inputMediaPanel.stickersBackgroundColor
|
||||
|
||||
|
|
@ -1332,7 +1342,7 @@ final class ChatMediaInputNode: ChatInputNode {
|
|||
self.validLayout = (width, leftInset, rightInset, bottomInset, standardInputHeight, inputHeight, maximumHeight, inputPanelHeight, interfaceState, deviceMetrics, isVisible)
|
||||
|
||||
if self.theme !== interfaceState.theme || self.strings !== interfaceState.strings {
|
||||
self.updateThemeAndStrings(theme: interfaceState.theme, strings: interfaceState.strings)
|
||||
self.updateThemeAndStrings(chatWallpaper: interfaceState.chatWallpaper, theme: interfaceState.theme, strings: interfaceState.strings)
|
||||
}
|
||||
|
||||
var displaySearch = false
|
||||
|
|
|
|||
|
|
@ -1015,7 +1015,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
selectionNode.updateLayout(size: selectionFrame.size)
|
||||
self.subnodeTransform = CATransform3DMakeTranslation(offset, 0.0, 0.0);
|
||||
} else {
|
||||
let selectionNode = ChatMessageSelectionNode(theme: item.presentationData.theme.theme, toggle: { [weak self] value in
|
||||
let selectionNode = ChatMessageSelectionNode(wallpaper: item.presentationData.theme.wallpaper, theme: item.presentationData.theme.theme, toggle: { [weak self] value in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
item.controllerInteraction.toggleMessagesSelection([item.message.id], value)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2661,7 +2661,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
|||
selectionNode.updateLayout(size: selectionFrame.size)
|
||||
self.subnodeTransform = CATransform3DMakeTranslation(offset, 0.0, 0.0);
|
||||
} else {
|
||||
let selectionNode = ChatMessageSelectionNode(theme: item.presentationData.theme.theme, toggle: { [weak self] value in
|
||||
let selectionNode = ChatMessageSelectionNode(wallpaper: item.presentationData.theme.wallpaper, theme: item.presentationData.theme.theme, toggle: { [weak self] value in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
switch item.content {
|
||||
case let .message(message, _, _, _):
|
||||
|
|
|
|||
|
|
@ -770,7 +770,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
|||
selectionNode.updateSelected(selected, animated: animated)
|
||||
self.subnodeTransform = CATransform3DMakeTranslation(offset, 0.0, 0.0);
|
||||
} else {
|
||||
let selectionNode = ChatMessageSelectionNode(theme: item.presentationData.theme.theme, toggle: { [weak self] value in
|
||||
let selectionNode = ChatMessageSelectionNode(wallpaper: item.presentationData.theme.wallpaper, theme: item.presentationData.theme.theme, toggle: { [weak self] value in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
item.controllerInteraction.toggleMessagesSelection([item.message.id], value)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import UIKit
|
|||
import AsyncDisplayKit
|
||||
import TelegramPresentationData
|
||||
import CheckNode
|
||||
import SyncCore
|
||||
|
||||
final class ChatMessageSelectionNode: ASDisplayNode {
|
||||
private let toggle: (Bool) -> Void
|
||||
|
|
@ -10,9 +11,17 @@ final class ChatMessageSelectionNode: ASDisplayNode {
|
|||
private(set) var selected = false
|
||||
private let checkNode: CheckNode
|
||||
|
||||
init(theme: PresentationTheme, toggle: @escaping (Bool) -> Void) {
|
||||
init(wallpaper: TelegramWallpaper, theme: PresentationTheme, toggle: @escaping (Bool) -> Void) {
|
||||
self.toggle = toggle
|
||||
self.checkNode = CheckNode(strokeColor: theme.list.itemCheckColors.strokeColor, fillColor: theme.list.itemCheckColors.fillColor, foregroundColor: theme.list.itemCheckColors.foregroundColor, style: .overlay)
|
||||
|
||||
let style: CheckNodeStyle
|
||||
if wallpaper == theme.chat.defaultWallpaper, case .color = wallpaper {
|
||||
style = .plain
|
||||
} else {
|
||||
style = .overlay
|
||||
}
|
||||
|
||||
self.checkNode = CheckNode(strokeColor: theme.list.itemCheckColors.strokeColor, fillColor: theme.list.itemCheckColors.fillColor, foregroundColor: theme.list.itemCheckColors.foregroundColor, style: style)
|
||||
self.checkNode.isUserInteractionEnabled = false
|
||||
|
||||
super.init()
|
||||
|
|
|
|||
|
|
@ -796,7 +796,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||
selectionNode.updateSelected(selected, animated: animated)
|
||||
self.subnodeTransform = CATransform3DMakeTranslation(offset, 0.0, 0.0);
|
||||
} else {
|
||||
let selectionNode = ChatMessageSelectionNode(theme: item.presentationData.theme.theme, toggle: { [weak self] value in
|
||||
let selectionNode = ChatMessageSelectionNode(wallpaper: item.presentationData.theme.wallpaper, theme: item.presentationData.theme.theme, toggle: { [weak self] value in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
item.controllerInteraction.toggleMessagesSelection([item.message.id], value)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -724,7 +724,15 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
|||
|
||||
let textFieldMinHeight = calclulateTextFieldMinHeight(interfaceState, metrics: metrics)
|
||||
let minimalInputHeight: CGFloat = 2.0 + textFieldMinHeight
|
||||
self.textInputBackgroundNode.image = textInputBackgroundImage(backgroundColor: interfaceState.theme.chat.inputPanel.panelBackgroundColor, strokeColor: interfaceState.theme.chat.inputPanel.inputStrokeColor, diameter: minimalInputHeight)
|
||||
|
||||
let backgroundColor: UIColor
|
||||
if interfaceState.theme.chat.defaultWallpaper == interfaceState.chatWallpaper, case .color = interfaceState.chatWallpaper {
|
||||
backgroundColor = interfaceState.theme.chat.inputPanel.panelBackgroundColorNoWallpaper
|
||||
} else {
|
||||
backgroundColor = interfaceState.theme.chat.inputPanel.panelBackgroundColor
|
||||
}
|
||||
|
||||
self.textInputBackgroundNode.image = textInputBackgroundImage(backgroundColor: backgroundColor, strokeColor: interfaceState.theme.chat.inputPanel.inputStrokeColor, diameter: minimalInputHeight)
|
||||
|
||||
self.searchLayoutClearButton.setImage(PresentationResourcesChat.chatInputTextFieldClearImage(interfaceState.theme), for: [])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue