From b6fcc88f67b05463a1124e388ba241af1349755b Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Tue, 30 Dec 2025 02:05:00 +0800 Subject: [PATCH] Fixes --- ...onSequenceCountrySelectionController.swift | 8 +-- .../ChatSearchNavigationContentNode.swift | 2 +- .../Sources/GlassBackgroundComponent.swift | 13 +++- .../Sources/LegacyGlassView.swift | 62 ++++++++++--------- .../Sources/HorizontalTabsComponent.swift | 4 ++ .../LiquidLens/Sources/LiquidLensView.swift | 13 ++-- .../Sources/NavigationBarImpl.swift | 2 +- .../Sources/PeerSelectionScreen.swift | 2 +- .../Sources/LiveStreamSettingsScreen.swift | 4 +- 9 files changed, 62 insertions(+), 48 deletions(-) diff --git a/submodules/CountrySelectionUI/Sources/AuthorizationSequenceCountrySelectionController.swift b/submodules/CountrySelectionUI/Sources/AuthorizationSequenceCountrySelectionController.swift index 72af6873c4..90aed124f0 100644 --- a/submodules/CountrySelectionUI/Sources/AuthorizationSequenceCountrySelectionController.swift +++ b/submodules/CountrySelectionUI/Sources/AuthorizationSequenceCountrySelectionController.swift @@ -394,9 +394,9 @@ public final class AuthorizationSequenceCountrySelectionController: ViewControll id: "close", component: AnyComponent(GlassBarButtonComponent( size: barButtonSize, - backgroundColor: self.theme.rootController.navigationBar.glassBarButtonBackgroundColor, + backgroundColor: nil, isDark: self.theme.overallDarkAppearance, - state: .generic, + state: .glass, component: AnyComponentWithIdentity(id: "close", component: AnyComponent( BundleIconComponent( name: "Navigation/Close", @@ -415,9 +415,9 @@ public final class AuthorizationSequenceCountrySelectionController: ViewControll id: "search", component: AnyComponent(GlassBarButtonComponent( size: barButtonSize, - backgroundColor: self.theme.rootController.navigationBar.glassBarButtonBackgroundColor, + backgroundColor: nil, isDark: self.theme.overallDarkAppearance, - state: .generic, + state: .glass, component: AnyComponentWithIdentity(id: "search", component: AnyComponent( BundleIconComponent( name: "Navigation/Search", diff --git a/submodules/TelegramUI/Components/Chat/ChatSearchNavigationContentNode/Sources/ChatSearchNavigationContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatSearchNavigationContentNode/Sources/ChatSearchNavigationContentNode.swift index eee01e3198..a72ca22915 100644 --- a/submodules/TelegramUI/Components/Chat/ChatSearchNavigationContentNode/Sources/ChatSearchNavigationContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatSearchNavigationContentNode/Sources/ChatSearchNavigationContentNode.swift @@ -92,7 +92,7 @@ public final class ChatSearchNavigationContentNode: NavigationBarContentNode { self.backgroundView.contentView.addSubview(self.searchBar.view) self.backgroundContainer.contentView.addSubview(self.close.background) - self.close.background.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.onCloseTapGesture(_:)))) + self.close.background.contentView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.onCloseTapGesture(_:)))) self.searchBar.cancel = { [weak self] in self?.searchBar.deactivate(clear: false) diff --git a/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift b/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift index 23949cc8d2..6415f65048 100644 --- a/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift +++ b/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift @@ -503,7 +503,18 @@ public class GlassBackgroundView: UIView { } if let foregroundView = self.foregroundView { - foregroundView.image = GlassBackgroundView.generateLegacyGlassImage(size: CGSize(width: outerCornerRadius * 2.0, height: outerCornerRadius * 2.0), inset: shadowInset, isDark: isDark, fillColor: tintColor.color) + let fillColor: UIColor + switch tintColor.kind { + case .panel: + if isDark { + fillColor = UIColor(white: 1.0, alpha: 1.0).mixedWith(.black, alpha: 1.0 - 0.11).withAlphaComponent(0.85) + } else { + fillColor = UIColor(white: 1.0, alpha: 0.7) + } + case .custom: + fillColor = tintColor.color + } + foregroundView.image = GlassBackgroundView.generateLegacyGlassImage(size: CGSize(width: outerCornerRadius * 2.0, height: outerCornerRadius * 2.0), inset: shadowInset, isDark: isDark, fillColor: fillColor) } else { if let nativeParamsView = self.nativeParamsView, let nativeView = self.nativeView { if #available(iOS 26.0, *) { diff --git a/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/LegacyGlassView.swift b/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/LegacyGlassView.swift index 8040ddf289..b688f816d3 100644 --- a/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/LegacyGlassView.swift +++ b/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/LegacyGlassView.swift @@ -138,37 +138,39 @@ final class LegacyGlassView: UIView { transition.setCornerRadius(layer: self.layer, cornerRadius: cornerRadius) transition.setFrame(layer: backdropLayer, frame: CGRect(origin: CGPoint(), size: size)) - let size = CGSize(width: max(1.0, size.width), height: max(1.0, size.height)) - let cornerRadius = min(min(size.width, size.height) * 0.5, cornerRadius) - let displacementMagnitudePoints: CGFloat = 20.0 - let displacementMagnitudeU = displacementMagnitudePoints / size.width - let displacementMagnitudeV = displacementMagnitudePoints / size.height - let outerEdgeDistance = 2.0 - - if let displacementMap = generateDisplacementMap(size: size, cornerRadius: cornerRadius, edgeDistance: min(12.0, cornerRadius), scale: 1.0) { - let meshTransform = generateGlassMeshFromDisplacementMap( - size: size, - cornerRadius: cornerRadius, - displacementMap: displacementMap, - displacementMagnitudeU: displacementMagnitudeU, - displacementMagnitudeV: displacementMagnitudeV, - cornerResolution: 12, - outerEdgeDistance: outerEdgeDistance, - bezier: DisplacementBezier( - x1: 0.816137566137566, - y1: 0.20502645502645533, - x2: 0.5806878306878306, - y2: 0.873015873015873 - ) - ).mesh.makeValue() + if !"".isEmpty { + let size = CGSize(width: max(1.0, size.width), height: max(1.0, size.height)) + let cornerRadius = min(min(size.width, size.height) * 0.5, cornerRadius) + let displacementMagnitudePoints: CGFloat = 20.0 + let displacementMagnitudeU = displacementMagnitudePoints / size.width + let displacementMagnitudeV = displacementMagnitudePoints / size.height + let outerEdgeDistance = 2.0 - if let meshTransform { - if !transition.animation.isImmediate, let previousTransform = backdropLayer.value(forKey: "meshTransform") as? NSObject { - backdropLayer.removeAnimation(forKey: "meshTransform") - backdropLayer.setValue(meshTransform, forKey: "meshTransform") - transition.animateMeshTransform(layer: backdropLayer, from: previousTransform, to: meshTransform) - } else { - backdropLayer.setValue(meshTransform, forKey: "meshTransform") + if let displacementMap = generateDisplacementMap(size: size, cornerRadius: cornerRadius, edgeDistance: min(12.0, cornerRadius), scale: 1.0) { + let meshTransform = generateGlassMeshFromDisplacementMap( + size: size, + cornerRadius: cornerRadius, + displacementMap: displacementMap, + displacementMagnitudeU: displacementMagnitudeU, + displacementMagnitudeV: displacementMagnitudeV, + cornerResolution: 12, + outerEdgeDistance: outerEdgeDistance, + bezier: DisplacementBezier( + x1: 0.816137566137566, + y1: 0.20502645502645533, + x2: 0.5806878306878306, + y2: 0.873015873015873 + ) + ).mesh.makeValue() + + if let meshTransform { + if !transition.animation.isImmediate, let previousTransform = backdropLayer.value(forKey: "meshTransform") as? NSObject { + backdropLayer.removeAnimation(forKey: "meshTransform") + backdropLayer.setValue(meshTransform, forKey: "meshTransform") + transition.animateMeshTransform(layer: backdropLayer, from: previousTransform, to: meshTransform) + } else { + backdropLayer.setValue(meshTransform, forKey: "meshTransform") + } } } } diff --git a/submodules/TelegramUI/Components/HorizontalTabsComponent/Sources/HorizontalTabsComponent.swift b/submodules/TelegramUI/Components/HorizontalTabsComponent/Sources/HorizontalTabsComponent.swift index 7e40c4a4e9..789b261304 100644 --- a/submodules/TelegramUI/Components/HorizontalTabsComponent/Sources/HorizontalTabsComponent.swift +++ b/submodules/TelegramUI/Components/HorizontalTabsComponent/Sources/HorizontalTabsComponent.swift @@ -577,6 +577,10 @@ public final class HorizontalTabsComponent: Component { if !component.liftWhileSwitching { isLifted = false } + if #available(iOS 26.0, *) { + } else { + isLifted = false + } self.lensView.update(size: CGSize(width: layoutData.size.width - 3.0 * 2.0, height: layoutData.size.height - 3.0 * 2.0), selectionOrigin: CGPoint(x: -self.scrollView.contentOffset.x + layoutData.selectedItemFrame.minX, y: 0.0), selectionSize: CGSize(width: layoutData.selectedItemFrame.width, height: layoutData.size.height - 3.0 * 2.0), inset: 0.0, liftedInset: 6.0, isDark: component.theme.overallDarkAppearance, isLifted: isLifted, transition: transition) transition.setPosition(view: self.selectedScrollView, position: CGRect(origin: CGPoint(x: 3.0, y: 0.0), size: CGSize(width: layoutData.size.width - 3.0 * 2.0, height: layoutData.size.height - 3.0 * 2.0)).center) diff --git a/submodules/TelegramUI/Components/LiquidLens/Sources/LiquidLensView.swift b/submodules/TelegramUI/Components/LiquidLens/Sources/LiquidLensView.swift index 96fc7ee3c1..af354e936c 100644 --- a/submodules/TelegramUI/Components/LiquidLens/Sources/LiquidLensView.swift +++ b/submodules/TelegramUI/Components/LiquidLens/Sources/LiquidLensView.swift @@ -248,15 +248,12 @@ public final class LiquidLensView: UIView { lensView.setValue(UIColor(white: 0.0, alpha: 0.1), forKey: "restingBackgroundColor") } else { - if case .noContainer = kind { + let legacySelectionView = GlassBackgroundView.ContentImageView() + self.legacySelectionView = legacySelectionView + if let backgroundView = self.backgroundView { + backgroundView.contentView.insertSubview(legacySelectionView, at: 0) } else { - let legacySelectionView = GlassBackgroundView.ContentImageView() - self.legacySelectionView = legacySelectionView - if let backgroundView = self.backgroundView { - backgroundView.contentView.insertSubview(legacySelectionView, at: 0) - } else { - self.containerView.insertSubview(legacySelectionView, at: 0) - } + self.containerView.insertSubview(legacySelectionView, at: 0) } let legacyContentMaskView = UIView() diff --git a/submodules/TelegramUI/Components/NavigationBarImpl/Sources/NavigationBarImpl.swift b/submodules/TelegramUI/Components/NavigationBarImpl/Sources/NavigationBarImpl.swift index 85702c934a..a0bee77972 100644 --- a/submodules/TelegramUI/Components/NavigationBarImpl/Sources/NavigationBarImpl.swift +++ b/submodules/TelegramUI/Components/NavigationBarImpl/Sources/NavigationBarImpl.swift @@ -1232,7 +1232,7 @@ public final class NavigationBarImpl: ASDisplayNode, NavigationBar { return nil } - if self.passthroughTouches && (result == self.view || result == self.buttonsContainerNode.view || result == self.backgroundNode.view || result == self.backgroundNode.backgroundView) { + if self.passthroughTouches && (result == self.view || result == self.buttonsContainerNode.view || result == self.backgroundNode.view || result == self.backgroundNode.backgroundView || result == self.backgroundContainer?.contentView) { return nil } diff --git a/submodules/TelegramUI/Components/Settings/PeerSelectionScreen/Sources/PeerSelectionScreen.swift b/submodules/TelegramUI/Components/Settings/PeerSelectionScreen/Sources/PeerSelectionScreen.swift index fa1afbf7d6..f41221d719 100644 --- a/submodules/TelegramUI/Components/Settings/PeerSelectionScreen/Sources/PeerSelectionScreen.swift +++ b/submodules/TelegramUI/Components/Settings/PeerSelectionScreen/Sources/PeerSelectionScreen.swift @@ -480,7 +480,7 @@ final class PeerSelectionScreenComponent: Component { theme: searchBarTheme, presentationTheme: environment.theme, strings: environment.strings, - fieldStyle: .modern, + fieldStyle: .glass, displayBackground: false ) searchBarNode.placeholderString = NSAttributedString(string: environment.strings.Common_Search, font: Font.regular(17.0), textColor: searchBarTheme.placeholder) diff --git a/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/LiveStreamSettingsScreen.swift b/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/LiveStreamSettingsScreen.swift index a858adb83b..d1ccccce3d 100644 --- a/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/LiveStreamSettingsScreen.swift +++ b/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/LiveStreamSettingsScreen.swift @@ -883,9 +883,9 @@ final class LiveStreamSettingsScreenComponent: Component { transition: transition, component: AnyComponent(GlassBarButtonComponent( size: barButtonSize, - backgroundColor: environment.theme.rootController.navigationBar.glassBarButtonBackgroundColor, + backgroundColor: nil, isDark: environment.theme.overallDarkAppearance, - state: .generic, + state: .glass, component: AnyComponentWithIdentity(id: "close", component: AnyComponent( BundleIconComponent( name: "Navigation/Close",