diff --git a/submodules/SearchBarNode/Sources/SearchBarNode.swift b/submodules/SearchBarNode/Sources/SearchBarNode.swift index 849b091957..bed3d19c0e 100644 --- a/submodules/SearchBarNode/Sources/SearchBarNode.swift +++ b/submodules/SearchBarNode/Sources/SearchBarNode.swift @@ -1012,13 +1012,15 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate { private let forceSeparator: Bool private var theme: SearchBarNodeTheme? private var presentationTheme: PresentationTheme + private var preferClearGlass: Bool private var strings: PresentationStrings? private let cancelText: String? private var isAnimatingOut: Bool = false - public init(theme: SearchBarNodeTheme, presentationTheme: PresentationTheme, strings: PresentationStrings, fieldStyle: SearchBarStyle = .legacy, icon: Icon = .loupe, forceSeparator: Bool = false, displayBackground: Bool = true, cancelText: String? = nil) { + public init(theme: SearchBarNodeTheme, presentationTheme: PresentationTheme, preferClearGlass: Bool = false, strings: PresentationStrings, fieldStyle: SearchBarStyle = .legacy, icon: Icon = .loupe, forceSeparator: Bool = false, displayBackground: Bool = true, cancelText: String? = nil) { self.presentationTheme = presentationTheme + self.preferClearGlass = preferClearGlass self.fieldStyle = fieldStyle self.forceSeparator = forceSeparator @@ -1110,7 +1112,7 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate { self.updateIsEmpty(animated: false) } - public func updateThemeAndStrings(theme: SearchBarNodeTheme, presentationTheme: PresentationTheme, strings: PresentationStrings) { + public func updateThemeAndStrings(theme: SearchBarNodeTheme, presentationTheme: PresentationTheme, preferClearGlass: Bool = false, strings: PresentationStrings) { if self.theme != theme || self.strings !== strings { self.clearButton.accessibilityLabel = strings.WebSearch_RecentSectionClear self.cancelButton.accessibilityLabel = self.cancelText ?? strings.Common_Cancel @@ -1144,6 +1146,7 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate { self.theme = theme self.presentationTheme = presentationTheme + self.preferClearGlass = preferClearGlass self.strings = strings if let (boundingSize, leftInset, rightInset) = self.validLayout { self.updateLayout(boundingSize: boundingSize, leftInset: leftInset, rightInset: rightInset, transition: .immediate) @@ -1224,6 +1227,7 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate { foregroundColor: self.presentationTheme.chat.inputPanel.panelControlColor, backgroundColor: self.presentationTheme.rootController.navigationBar.opaqueBackgroundColor, controlColor: self.presentationTheme.chat.inputPanel.panelControlColor, + preferClearGlass: self.preferClearGlass, transition: transition ) if self.inlineSearchPlaceholderContentsView == nil { diff --git a/submodules/SearchBarNode/Sources/SearchBarPlaceholderNode.swift b/submodules/SearchBarNode/Sources/SearchBarPlaceholderNode.swift index 75c2bc0370..2e8250db45 100644 --- a/submodules/SearchBarNode/Sources/SearchBarPlaceholderNode.swift +++ b/submodules/SearchBarNode/Sources/SearchBarPlaceholderNode.swift @@ -35,8 +35,9 @@ public final class SearchBarPlaceholderContentView: UIView { var controlColor: UIColor var isActive: Bool var additionalPlaceholderInset: CGFloat + var preferClearGlass: Bool - init(placeholderString: NSAttributedString?, compactPlaceholderString: NSAttributedString?, constrainedSize: CGSize, expansionProgress: CGFloat, iconColor: UIColor, foregroundColor: UIColor, backgroundColor: UIColor, controlColor: UIColor, isActive: Bool, additionalPlaceholderInset: CGFloat) { + init(placeholderString: NSAttributedString?, compactPlaceholderString: NSAttributedString?, constrainedSize: CGSize, expansionProgress: CGFloat, iconColor: UIColor, foregroundColor: UIColor, backgroundColor: UIColor, controlColor: UIColor, isActive: Bool, additionalPlaceholderInset: CGFloat, preferClearGlass: Bool) { self.placeholderString = placeholderString self.compactPlaceholderString = compactPlaceholderString self.constrainedSize = constrainedSize @@ -47,6 +48,7 @@ public final class SearchBarPlaceholderContentView: UIView { self.controlColor = controlColor self.isActive = isActive self.additionalPlaceholderInset = additionalPlaceholderInset + self.preferClearGlass = preferClearGlass } } @@ -136,6 +138,7 @@ public final class SearchBarPlaceholderContentView: UIView { foregroundColor: UIColor, backgroundColor: UIColor, controlColor: UIColor, + preferClearGlass: Bool, transition: ContainedViewLayoutTransition ) -> CGFloat { let params = Params( @@ -148,7 +151,8 @@ public final class SearchBarPlaceholderContentView: UIView { backgroundColor: backgroundColor, controlColor: controlColor, isActive: false, - additionalPlaceholderInset: 0.0 + additionalPlaceholderInset: 0.0, + preferClearGlass: preferClearGlass ) self.params = params return self.updateLayout(params: params, transition: transition) @@ -309,7 +313,7 @@ public final class SearchBarPlaceholderContentView: UIView { ComponentTransition(transition).setAlpha(view: glassBackgroundView, alpha: backgroundAlpha) let isDark = params.backgroundColor.hsb.b < 0.5 if params.isActive { - glassBackgroundView.update(size: backgroundFrame.size, cornerRadius: backgroundFrame.height * 0.5, isDark: isDark, tintColor: .init(kind: .panel), isInteractive: true, transition: ComponentTransition(transition)) + glassBackgroundView.update(size: backgroundFrame.size, cornerRadius: backgroundFrame.height * 0.5, isDark: isDark, tintColor: .init(kind: params.preferClearGlass ? .clear : .panel), isInteractive: true, transition: ComponentTransition(transition)) } if params.isActive { @@ -352,7 +356,7 @@ public final class SearchBarPlaceholderContentView: UIView { close.background.frame = closeFrame.offsetBy(dx: closeFrame.width + 40.0, dy: 0.0) let isDark = params.backgroundColor.hsb.b < 0.5 - close.background.update(size: close.background.bounds.size, cornerRadius: close.background.bounds.height * 0.5, isDark: isDark, tintColor: .init(kind: .panel), isInteractive: true, transition: .immediate) + close.background.update(size: close.background.bounds.size, cornerRadius: close.background.bounds.height * 0.5, isDark: isDark, tintColor: .init(kind: params.preferClearGlass ? .clear : .panel), isInteractive: true, transition: .immediate) ComponentTransition.immediate.setScale(view: close.background, scale: 0.001) } @@ -367,7 +371,7 @@ public final class SearchBarPlaceholderContentView: UIView { } let isDark = params.backgroundColor.hsb.b < 0.5 - close.background.update(size: closeFrame.size, cornerRadius: closeFrame.height * 0.5, isDark: isDark, tintColor: .init(kind: .panel), isInteractive: true, transition: closeTransition) + close.background.update(size: closeFrame.size, cornerRadius: closeFrame.height * 0.5, isDark: isDark, tintColor: .init(kind: params.preferClearGlass ? .clear : .panel), isInteractive: true, transition: closeTransition) } else { let transition = ComponentTransition(transition) @@ -378,7 +382,7 @@ public final class SearchBarPlaceholderContentView: UIView { transition.setPosition(view: closeBackground, position: closeFrame.center) transition.setBounds(view: closeBackground, bounds: CGRect(origin: CGPoint(), size: closeFrame.size)) let isDark = params.backgroundColor.hsb.b < 0.5 - closeBackground.update(size: closeFrame.size, cornerRadius: closeFrame.height * 0.5, isDark: isDark, tintColor: .init(kind: .panel), isInteractive: true, transition: transition) + closeBackground.update(size: closeFrame.size, cornerRadius: closeFrame.height * 0.5, isDark: isDark, tintColor: .init(kind: params.preferClearGlass ? .clear : .panel), isInteractive: true, transition: transition) transition.setScale(view: closeBackground, scale: 0.001, completion: { [weak closeBackground] _ in closeBackground?.removeFromSuperview() }) @@ -415,8 +419,9 @@ public class SearchBarPlaceholderNode: ASDisplayNode { var foregroundColor: UIColor var backgroundColor: UIColor var controlColor: UIColor + var preferClearGlass: Bool - init(placeholderString: NSAttributedString?, compactPlaceholderString: NSAttributedString?, constrainedSize: CGSize, expansionProgress: CGFloat, iconColor: UIColor, foregroundColor: UIColor, backgroundColor: UIColor, controlColor: UIColor) { + init(placeholderString: NSAttributedString?, compactPlaceholderString: NSAttributedString?, constrainedSize: CGSize, expansionProgress: CGFloat, iconColor: UIColor, foregroundColor: UIColor, backgroundColor: UIColor, controlColor: UIColor, preferClearGlass: Bool) { self.placeholderString = placeholderString self.compactPlaceholderString = compactPlaceholderString self.constrainedSize = constrainedSize @@ -425,6 +430,7 @@ public class SearchBarPlaceholderNode: ASDisplayNode { self.foregroundColor = foregroundColor self.backgroundColor = backgroundColor self.controlColor = controlColor + self.preferClearGlass = preferClearGlass } } @@ -565,8 +571,8 @@ public class SearchBarPlaceholderNode: ASDisplayNode { } } - public func updateLayout(placeholderString: NSAttributedString?, compactPlaceholderString: NSAttributedString?, constrainedSize: CGSize, expansionProgress: CGFloat, iconColor: UIColor, foregroundColor: UIColor, backgroundColor: UIColor, controlColor: UIColor, transition: ContainedViewLayoutTransition) -> CGFloat { - let params = Params(placeholderString: placeholderString, compactPlaceholderString: compactPlaceholderString, constrainedSize: constrainedSize, expansionProgress: expansionProgress, iconColor: iconColor, foregroundColor: foregroundColor, backgroundColor: backgroundColor, controlColor: controlColor) + public func updateLayout(placeholderString: NSAttributedString?, compactPlaceholderString: NSAttributedString?, constrainedSize: CGSize, expansionProgress: CGFloat, iconColor: UIColor, foregroundColor: UIColor, backgroundColor: UIColor, controlColor: UIColor, preferClearGlass: Bool = false, transition: ContainedViewLayoutTransition) -> CGFloat { + let params = Params(placeholderString: placeholderString, compactPlaceholderString: compactPlaceholderString, constrainedSize: constrainedSize, expansionProgress: expansionProgress, iconColor: iconColor, foregroundColor: foregroundColor, backgroundColor: backgroundColor, controlColor: controlColor, preferClearGlass: preferClearGlass) self.params = params if self.isTakenOut { @@ -579,7 +585,7 @@ public class SearchBarPlaceholderNode: ASDisplayNode { } private func update(params: Params, transition: ContainedViewLayoutTransition) -> CGFloat { - let height = self.contentView.updateLayout(placeholderString: params.placeholderString, compactPlaceholderString: params.compactPlaceholderString, constrainedSize: params.constrainedSize, expansionProgress: params.expansionProgress, iconColor: params.iconColor, foregroundColor: params.foregroundColor, backgroundColor: params.backgroundColor, controlColor: params.controlColor, transition: transition) + let height = self.contentView.updateLayout(placeholderString: params.placeholderString, compactPlaceholderString: params.compactPlaceholderString, constrainedSize: params.constrainedSize, expansionProgress: params.expansionProgress, iconColor: params.iconColor, foregroundColor: params.foregroundColor, backgroundColor: params.backgroundColor, controlColor: params.controlColor, preferClearGlass: params.preferClearGlass, transition: transition) let size = CGSize(width: params.constrainedSize.width, height: height) transition.updateFrame(view: self.containerView, frame: CGRect(origin: CGPoint(), size: size)) transition.updateFrame(view: self.contentView, frame: CGRect(origin: CGPoint(), size: size)) diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageSelectionInputPanelNode/Sources/ChatMessageSelectionInputPanelNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageSelectionInputPanelNode/Sources/ChatMessageSelectionInputPanelNode.swift index 5d94a160fa..6047a3099b 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageSelectionInputPanelNode/Sources/ChatMessageSelectionInputPanelNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageSelectionInputPanelNode/Sources/ChatMessageSelectionInputPanelNode.swift @@ -67,10 +67,12 @@ private final class ChatMessageSelectionInputPanelNodeViewForOverlayContent: UIV private final class GlassButtonView: UIView { private struct Params: Equatable { let theme: PresentationTheme + let preferClearGlass: Bool let size: CGSize - init(theme: PresentationTheme, size: CGSize) { + init(theme: PresentationTheme, preferClearGlass: Bool, size: CGSize) { self.theme = theme + self.preferClearGlass = preferClearGlass self.size = size } @@ -78,6 +80,9 @@ private final class GlassButtonView: UIView { if lhs.theme !== rhs.theme { return false } + if lhs.preferClearGlass != rhs.preferClearGlass { + return false + } if lhs.size != rhs.size { return false } @@ -152,8 +157,8 @@ private final class GlassButtonView: UIView { fatalError("init(coder:) has not been implemented") } - func update(theme: PresentationTheme, size: CGSize, transition: ComponentTransition) { - let params = Params(theme: theme, size: size) + func update(theme: PresentationTheme, preferClearGlass: Bool, size: CGSize, transition: ComponentTransition) { + let params = Params(theme: theme, preferClearGlass: preferClearGlass, size: size) if self.params != params { self.iconView.tintColor = params.theme.chat.inputPanel.panelControlColor self.params = params @@ -172,7 +177,7 @@ private final class GlassButtonView: UIView { transition.setFrame(view: self.button, frame: CGRect(origin: CGPoint(), size: params.size)) transition.setFrame(view: self.backgroundView, frame: CGRect(origin: CGPoint(), size: params.size)) - self.backgroundView.update(size: params.size, cornerRadius: min(params.size.width, params.size.height) * 0.5, isDark: params.theme.overallDarkAppearance, tintColor: .init(kind: .panel), isInteractive: isEnabled, transition: transition) + self.backgroundView.update(size: params.size, cornerRadius: min(params.size.width, params.size.height) * 0.5, isDark: params.theme.overallDarkAppearance, tintColor: .init(kind: params.preferClearGlass ? .clear : .panel), isInteractive: isEnabled, transition: transition) self.iconView.alpha = isEnabled ? 1.0 : 0.5 self.iconView.tintMask.alpha = self.iconView.alpha @@ -603,7 +608,7 @@ public final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode { buttonFrame = CGRect(origin: CGPoint(x: offset, y: 0.0), size: buttonSize) } transition.updateFrame(view: button, frame: buttonFrame) - button.update(theme: interfaceState.theme, size: buttonFrame.size, transition: ComponentTransition(transition)) + button.update(theme: interfaceState.theme, preferClearGlass: interfaceState.preferredGlassType == .clear, size: buttonFrame.size, transition: ComponentTransition(transition)) offset += buttonSize.width + spacing } diff --git a/submodules/TelegramUI/Components/Chat/ChatSearchNavigationContentNode/Sources/ChatSearchNavigationContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatSearchNavigationContentNode/Sources/ChatSearchNavigationContentNode.swift index 255f17845d..20c1e1b8fe 100644 --- a/submodules/TelegramUI/Components/Chat/ChatSearchNavigationContentNode/Sources/ChatSearchNavigationContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatSearchNavigationContentNode/Sources/ChatSearchNavigationContentNode.swift @@ -19,6 +19,7 @@ private let searchBarFont = Font.regular(17.0) public final class ChatSearchNavigationContentNode: NavigationBarContentNode { private let context: AccountContext private var theme: PresentationTheme + private var preferClearGlass: Bool private let strings: PresentationStrings private let chatLocation: ChatLocation @@ -39,6 +40,7 @@ public final class ChatSearchNavigationContentNode: NavigationBarContentNode { public init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, chatLocation: ChatLocation, interaction: ChatPanelInterfaceInteraction, presentationInterfaceState: ChatPresentationInterfaceState) { self.context = context self.theme = theme + self.preferClearGlass = presentationInterfaceState.preferredGlassType == .clear self.strings = strings self.chatLocation = chatLocation self.interaction = interaction @@ -65,6 +67,7 @@ public final class ChatSearchNavigationContentNode: NavigationBarContentNode { keyboard: theme.rootController.keyboardColor ), presentationTheme: theme, + preferClearGlass: presentationInterfaceState.preferredGlassType == .clear, strings: strings, fieldStyle: .inlineNavigation, forceSeparator: false, @@ -159,7 +162,7 @@ public final class ChatSearchNavigationContentNode: NavigationBarContentNode { self.backgroundContainer.update(size: size, isDark: self.theme.overallDarkAppearance, transition: transition) transition.setFrame(view: self.backgroundView, frame: backgroundFrame) - self.backgroundView.update(size: backgroundFrame.size, cornerRadius: backgroundFrame.height * 0.5, isDark: self.theme.overallDarkAppearance, tintColor: .init(kind: .panel), isInteractive: true, transition: transition) + self.backgroundView.update(size: backgroundFrame.size, cornerRadius: backgroundFrame.height * 0.5, isDark: self.theme.overallDarkAppearance, tintColor: .init(kind: self.preferClearGlass ? .clear : .panel), isInteractive: true, transition: transition) if self.iconView.image == nil { self.iconView.image = UIImage(bundleImageName: "Navigation/Search")?.withRenderingMode(.alwaysTemplate) @@ -222,7 +225,7 @@ public final class ChatSearchNavigationContentNode: NavigationBarContentNode { self.close.icon.tintColor = self.theme.chat.inputPanel.panelControlColor transition.setFrame(view: self.close.background, frame: closeFrame) - self.close.background.update(size: closeFrame.size, cornerRadius: closeFrame.height * 0.5, isDark: self.theme.overallDarkAppearance, tintColor: .init(kind: .panel), isInteractive: true, transition: transition) + self.close.background.update(size: closeFrame.size, cornerRadius: closeFrame.height * 0.5, isDark: self.theme.overallDarkAppearance, tintColor: .init(kind: self.preferClearGlass ? .clear : .panel), isInteractive: true, transition: transition) return size } @@ -250,6 +253,7 @@ public final class ChatSearchNavigationContentNode: NavigationBarContentNode { keyboard: presentationInterfaceState.theme.rootController.keyboardColor ), presentationTheme: presentationInterfaceState.theme, + preferClearGlass: presentationInterfaceState.preferredGlassType == .clear, strings: presentationInterfaceState.strings ) @@ -289,8 +293,9 @@ public final class ChatSearchNavigationContentNode: NavigationBarContentNode { } } - if presentationInterfaceState.theme != self.theme { + if presentationInterfaceState.theme != self.theme || (presentationInterfaceState.preferredGlassType == .clear) != self.preferClearGlass { self.theme = presentationInterfaceState.theme + self.preferClearGlass = presentationInterfaceState.preferredGlassType == .clear if let params = self.params { let _ = self.updateLayout(size: params.size, leftInset: params.leftInset, rightInset: params.rightInset, transition: .immediate) } diff --git a/submodules/TelegramUI/Sources/ChatControllerNode.swift b/submodules/TelegramUI/Sources/ChatControllerNode.swift index 34957782a2..7b19171d2c 100644 --- a/submodules/TelegramUI/Sources/ChatControllerNode.swift +++ b/submodules/TelegramUI/Sources/ChatControllerNode.swift @@ -763,7 +763,7 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate { self.plainInputSeparatorAlpha = nil } - self.navigateButtons = ChatHistoryNavigationButtons(theme: self.chatPresentationInterfaceState.theme, dateTimeFormat: self.chatPresentationInterfaceState.dateTimeFormat, backgroundNode: self.backgroundNode, isChatRotated: historyNodeRotated) + self.navigateButtons = ChatHistoryNavigationButtons(theme: self.chatPresentationInterfaceState.theme, preferClearGlass: self.chatPresentationInterfaceState.preferredGlassType == .clear, dateTimeFormat: self.chatPresentationInterfaceState.dateTimeFormat, backgroundNode: self.backgroundNode, isChatRotated: historyNodeRotated) self.navigateButtons.accessibilityElementsHidden = true super.init() @@ -3469,7 +3469,7 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate { let updateInputTextState = self.chatPresentationInterfaceState.interfaceState.effectiveInputState != chatPresentationInterfaceState.interfaceState.effectiveInputState self.chatPresentationInterfaceState = chatPresentationInterfaceState - self.navigateButtons.update(theme: chatPresentationInterfaceState.theme, dateTimeFormat: chatPresentationInterfaceState.dateTimeFormat, backgroundNode: self.backgroundNode) + self.navigateButtons.update(theme: chatPresentationInterfaceState.theme, preferClearGlass: chatPresentationInterfaceState.preferredGlassType == .clear, dateTimeFormat: chatPresentationInterfaceState.dateTimeFormat, backgroundNode: self.backgroundNode) if themeUpdated { if case let .color(color) = self.chatPresentationInterfaceState.chatWallpaper, UIColor(rgb: color).isEqual(self.chatPresentationInterfaceState.theme.chat.inputPanel.panelBackgroundColorNoWallpaper) { diff --git a/submodules/TelegramUI/Sources/ChatHistoryNavigationButtonNode.swift b/submodules/TelegramUI/Sources/ChatHistoryNavigationButtonNode.swift index 454b22ab31..5d8436bc89 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryNavigationButtonNode.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryNavigationButtonNode.swift @@ -47,10 +47,12 @@ class ChatHistoryNavigationButtonNode: ContextControllerSourceNode { } private var theme: PresentationTheme + private var preferClearGlass: Bool private let type: ChatHistoryNavigationButtonType - init(theme: PresentationTheme, backgroundNode: WallpaperBackgroundNode, type: ChatHistoryNavigationButtonType) { + init(theme: PresentationTheme, preferClearGlass: Bool, backgroundNode: WallpaperBackgroundNode, type: ChatHistoryNavigationButtonType) { self.theme = theme + self.preferClearGlass = preferClearGlass self.type = type self.containerNode = ContextExtractedContentContainingNode() @@ -95,7 +97,7 @@ class ChatHistoryNavigationButtonNode: ContextControllerSourceNode { self.containerNode.contentNode.view.addSubview(self.backgroundView) self.backgroundView.frame = CGRect(origin: CGPoint(), size: size) - self.backgroundView.update(size: size, cornerRadius: size.height * 0.5, isDark: theme.overallDarkAppearance, tintColor: .init(kind: .panel), isInteractive: true, transition: .immediate) + self.backgroundView.update(size: size, cornerRadius: size.height * 0.5, isDark: theme.overallDarkAppearance, tintColor: .init(kind: self.preferClearGlass ? .clear : .panel), isInteractive: true, transition: .immediate) self.imageView.tintColor = theme.chat.inputPanel.panelControlColor self.backgroundView.contentView.addSubview(self.imageView) @@ -107,11 +109,12 @@ class ChatHistoryNavigationButtonNode: ContextControllerSourceNode { self.frame = CGRect(origin: CGPoint(), size: size) } - func updateTheme(theme: PresentationTheme, backgroundNode: WallpaperBackgroundNode) { - if self.theme !== theme { + func updateTheme(theme: PresentationTheme, preferClearGlass: Bool, backgroundNode: WallpaperBackgroundNode) { + if self.theme !== theme || self.preferClearGlass != preferClearGlass { self.theme = theme + self.preferClearGlass = preferClearGlass - self.backgroundView.update(size: self.backgroundView.bounds.size, cornerRadius: self.backgroundView.bounds.size.height * 0.5, isDark: theme.overallDarkAppearance, tintColor: .init(kind: .panel), transition: .immediate) + self.backgroundView.update(size: self.backgroundView.bounds.size, cornerRadius: self.backgroundView.bounds.size.height * 0.5, isDark: theme.overallDarkAppearance, tintColor: .init(kind: self.preferClearGlass ? .clear : .panel), transition: .immediate) self.imageView.tintColor = theme.chat.inputPanel.panelControlColor switch self.type { diff --git a/submodules/TelegramUI/Sources/ChatHistoryNavigationButtons.swift b/submodules/TelegramUI/Sources/ChatHistoryNavigationButtons.swift index c860391d1f..4a01de75a8 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryNavigationButtons.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryNavigationButtons.swift @@ -26,6 +26,7 @@ final class ChatHistoryNavigationButtons: ASDisplayNode { } private var theme: PresentationTheme + private var preferClearGlass: Bool private var dateTimeFormat: PresentationDateTimeFormat private let isChatRotated: Bool @@ -95,24 +96,25 @@ final class ChatHistoryNavigationButtons: ASDisplayNode { } } - init(theme: PresentationTheme, dateTimeFormat: PresentationDateTimeFormat, backgroundNode: WallpaperBackgroundNode, isChatRotated: Bool) { + init(theme: PresentationTheme, preferClearGlass: Bool, dateTimeFormat: PresentationDateTimeFormat, backgroundNode: WallpaperBackgroundNode, isChatRotated: Bool) { self.isChatRotated = isChatRotated self.theme = theme + self.preferClearGlass = preferClearGlass self.dateTimeFormat = dateTimeFormat - self.mentionsButton = ChatHistoryNavigationButtonNode(theme: theme, backgroundNode: backgroundNode, type: .mentions) + self.mentionsButton = ChatHistoryNavigationButtonNode(theme: theme, preferClearGlass: preferClearGlass, backgroundNode: backgroundNode, type: .mentions) self.mentionsButton.alpha = 0.0 self.mentionsButton.isHidden = true - self.reactionsButton = ChatHistoryNavigationButtonNode(theme: theme, backgroundNode: backgroundNode, type: .reactions) + self.reactionsButton = ChatHistoryNavigationButtonNode(theme: theme, preferClearGlass: preferClearGlass, backgroundNode: backgroundNode, type: .reactions) self.reactionsButton.alpha = 0.0 self.reactionsButton.isHidden = true - self.downButton = ChatHistoryNavigationButtonNode(theme: theme, backgroundNode: backgroundNode, type: isChatRotated ? .down : .up) + self.downButton = ChatHistoryNavigationButtonNode(theme: theme, preferClearGlass: preferClearGlass, backgroundNode: backgroundNode, type: isChatRotated ? .down : .up) self.downButton.alpha = 0.0 self.downButton.isHidden = true - self.upButton = ChatHistoryNavigationButtonNode(theme: theme, backgroundNode: backgroundNode, type: isChatRotated ? .up : .down) + self.upButton = ChatHistoryNavigationButtonNode(theme: theme, preferClearGlass: preferClearGlass, backgroundNode: backgroundNode, type: isChatRotated ? .up : .down) self.upButton.alpha = 0.0 self.upButton.isHidden = true @@ -139,14 +141,15 @@ final class ChatHistoryNavigationButtons: ASDisplayNode { super.didLoad() } - func update(theme: PresentationTheme, dateTimeFormat: PresentationDateTimeFormat, backgroundNode: WallpaperBackgroundNode) { + func update(theme: PresentationTheme, preferClearGlass: Bool, dateTimeFormat: PresentationDateTimeFormat, backgroundNode: WallpaperBackgroundNode) { self.theme = theme + self.preferClearGlass = preferClearGlass self.dateTimeFormat = dateTimeFormat - self.reactionsButton.updateTheme(theme: theme, backgroundNode: backgroundNode) - self.mentionsButton.updateTheme(theme: theme, backgroundNode: backgroundNode) - self.downButton.updateTheme(theme: theme, backgroundNode: backgroundNode) - self.upButton.updateTheme(theme: theme, backgroundNode: backgroundNode) + self.reactionsButton.updateTheme(theme: theme, preferClearGlass: preferClearGlass, backgroundNode: backgroundNode) + self.mentionsButton.updateTheme(theme: theme, preferClearGlass: preferClearGlass, backgroundNode: backgroundNode) + self.downButton.updateTheme(theme: theme, preferClearGlass: preferClearGlass, backgroundNode: backgroundNode) + self.upButton.updateTheme(theme: theme, preferClearGlass: preferClearGlass, backgroundNode: backgroundNode) } private var absoluteRect: (CGRect, CGSize)? diff --git a/submodules/TelegramUI/Sources/ChatTagSearchInputPanelNode.swift b/submodules/TelegramUI/Sources/ChatTagSearchInputPanelNode.swift index f9dea3edae..3aa6cd9d48 100644 --- a/submodules/TelegramUI/Sources/ChatTagSearchInputPanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatTagSearchInputPanelNode.swift @@ -561,7 +561,7 @@ final class ChatTagSearchInputPanelNode: ChatInputPanelNode { var leftControlsBackgroundFrame = CGRect(origin: CGPoint(x: params.leftInset, y: floor((height - 40.0) * 0.5)), size: CGSize(width: 0.0, height: 40.0)) leftControlsBackgroundFrame.size.width = max(40.0, leftControlsRect.maxX - leftControlsBackgroundFrame.minX) transition.setFrame(view: self.leftControlsBackgroundView, frame: leftControlsBackgroundFrame) - self.leftControlsBackgroundView.update(size: leftControlsBackgroundFrame.size, cornerRadius: leftControlsBackgroundFrame.height * 0.5, isDark: params.interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel), transition: transition) + self.leftControlsBackgroundView.update(size: leftControlsBackgroundFrame.size, cornerRadius: leftControlsBackgroundFrame.height * 0.5, isDark: params.interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: params.interfaceState.preferredGlassType == .clear ? .clear : .panel), transition: transition) transition.setAlpha(view: self.leftControlsBackgroundView, alpha: leftControlsRect.isEmpty ? 0.0 : 1.0) let rightControlsFrames: [CGRect?] = [ @@ -583,7 +583,7 @@ final class ChatTagSearchInputPanelNode: ChatInputPanelNode { rightControlsBackgroundFrame.size.width = max(40.0, rightControlsRect.maxX - rightControlsRect.minX + 8.0 * 2.0) rightControlsBackgroundFrame.origin.x -= rightControlsBackgroundFrame.width transition.setFrame(view: self.rightControlsBackgroundView, frame: rightControlsBackgroundFrame) - self.rightControlsBackgroundView.update(size: rightControlsBackgroundFrame.size, cornerRadius: rightControlsBackgroundFrame.height * 0.5, isDark: params.interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel), transition: transition) + self.rightControlsBackgroundView.update(size: rightControlsBackgroundFrame.size, cornerRadius: rightControlsBackgroundFrame.height * 0.5, isDark: params.interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: params.interfaceState.preferredGlassType == .clear ? .clear : .panel), transition: transition) self.rightControlsBackgroundView.isHidden = rightControlsRect.isEmpty transition.setFrame(view: self.backgroundContainerView, frame: CGRect(origin: CGPoint(), size: CGSize(width: params.width, height: height)))