Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2026-02-03 15:33:33 +04:00
commit 0e58f827b6
7 changed files with 37 additions and 18 deletions

View file

@ -239,12 +239,18 @@ open class ViewControllerComponentContainer: ViewController {
}
}
public enum BaseNavigationColors {
case plain
case blocks
}
public var node: Node {
return self.displayNode as! Node
}
private var presentationData: PresentationData
private var theme: Theme
private let baseNavigationColors: BaseNavigationColors
public private(set) var component: AnyComponent<ViewControllerComponentContainer.Environment>
private var presentationDataDisposable: Disposable?
@ -260,10 +266,12 @@ open class ViewControllerComponentContainer: ViewController {
statusBarStyle: StatusBarStyle = .default,
presentationMode: PresentationMode = .default,
theme: Theme = .default,
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil,
baseNavigationColors: BaseNavigationColors = .plain,
) where C.EnvironmentType == ViewControllerComponentContainer.Environment {
self.component = AnyComponent(component)
self.theme = theme
self.baseNavigationColors = baseNavigationColors
var effectiveUpdatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)
if let updatedPresentationData {
@ -282,7 +290,7 @@ open class ViewControllerComponentContainer: ViewController {
case .transparent:
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true, style: .glass)
case .default:
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, style: .glass)
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: false, hideBadge: false, hideSeparator: true, style: .glass, edgeEffectColor: self.baseNavigationColors == .blocks ? self.presentationData.theme.list.itemBlocksBackgroundColor : nil)
}
super.init(navigationBarPresentationData: navigationBarPresentationData)
@ -297,10 +305,12 @@ open class ViewControllerComponentContainer: ViewController {
statusBarStyle: StatusBarStyle = .default,
presentationMode: PresentationMode = .default,
theme: Theme = .default,
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>),
baseNavigationColors: BaseNavigationColors = .plain
) where C.EnvironmentType == ViewControllerComponentContainer.Environment {
self.component = AnyComponent(component)
self.theme = theme
self.baseNavigationColors = baseNavigationColors
let presentationData = updatedPresentationData.initial
self.presentationData = presentationData
@ -312,7 +322,7 @@ open class ViewControllerComponentContainer: ViewController {
case .transparent:
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true, style: .glass)
case .default:
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, style: .glass)
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: false, hideBadge: false, hideSeparator: true, style: .glass, edgeEffectColor: self.baseNavigationColors == .blocks ? self.presentationData.theme.list.itemBlocksBackgroundColor : nil)
}
super.init(navigationBarPresentationData: navigationBarPresentationData)
@ -360,7 +370,7 @@ open class ViewControllerComponentContainer: ViewController {
case .transparent:
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true, style: .glass)
case .default:
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, style: .glass)
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: false, hideBadge: false, hideSeparator: true, style: .glass, edgeEffectColor: strongSelf.baseNavigationColors == .blocks ? strongSelf.presentationData.theme.list.itemBlocksBackgroundColor : nil)
}
if let navigationBarPresentationData {
strongSelf.navigationBar?.updatePresentationData(navigationBarPresentationData, transition: .immediate)

View file

@ -307,7 +307,7 @@ open class GalleryControllerNode: ASDisplayNode, ASScrollViewDelegate, ASGesture
}
transition.updateFrame(view: self.headerEdgeEffectView, frame: edgeEffectFrame)
self.headerEdgeEffectView.update(content: .black, alpha: 0.65, rect: edgeEffectFrame, edge: .top, edgeSize: min(edgeEffectHeight, edgeEffectFrame.height), transition: ComponentTransition(transition))
transition.updateAlpha(layer: self.headerEdgeEffectView.layer, alpha: self.areControlsHidden ? 0.0 : 0.25)
transition.updateAlpha(layer: self.headerEdgeEffectView.layer, alpha: self.areControlsHidden ? 0.0 : 0.5)
if let navigationBar = self.navigationBar {
transition.updateFrame(node: navigationBar, frame: CGRect(origin: CGPoint(x: 0.0, y: self.areControlsHidden ? -navigationBarHeight : 0.0), size: CGSize(width: layout.size.width, height: navigationBarHeight)))
@ -441,7 +441,7 @@ open class GalleryControllerNode: ASDisplayNode, ASScrollViewDelegate, ASGesture
self.footerNode.animateIn(transition: .animated(duration: 0.15, curve: .linear))
ComponentTransition.easeInOut(duration: 0.15).animateView {
self.headerEdgeEffectView.alpha = 0.25
self.headerEdgeEffectView.alpha = 0.5
self.titleView?.alpha = 1.0
}
}
@ -548,7 +548,7 @@ open class GalleryControllerNode: ASDisplayNode, ASScrollViewDelegate, ASGesture
if let overlayNode = self.overlayNode {
overlayNode.alpha = transition
}
self.headerEdgeEffectView.alpha = transition
self.headerEdgeEffectView.alpha = transition * 0.5
self.titleView?.alpha = transition
}

View file

@ -155,7 +155,7 @@ public final class GalleryFooterNode: ASDisplayNode {
if let backgroundLayoutInfo, backgroundLayoutInfo.needsShadow {
self.defaultEdgeEffectAlpha = 1.0
} else {
self.defaultEdgeEffectAlpha = 0.25
self.defaultEdgeEffectAlpha = 0.5
}
ComponentTransition(transition).setAlpha(view: self.edgeEffectView, alpha: self.visibilityAlpha * self.defaultEdgeEffectAlpha)

View file

@ -1624,7 +1624,9 @@ private class ImageRecognitionOverlayContentNode: GalleryOverlayContentNode {
return
}
self.appeared = true
ComponentTransition.easeInOut(duration: 0.2).setAlpha(view: self.backgroundContainer, alpha: 1.0)
if self.isSelected {
ComponentTransition.easeInOut(duration: 0.2).setAlpha(view: self.backgroundContainer, alpha: 1.0)
}
}
override func updateLayout(size: CGSize, metrics: LayoutMetrics, insets: UIEdgeInsets, isHidden: Bool, transition: ContainedViewLayoutTransition) {
@ -1669,7 +1671,9 @@ private class ImageRecognitionOverlayContentNode: GalleryOverlayContentNode {
self.backgroundContainer.alpha = 1.0
} else {
self.backgroundContainer.alpha = 0.0
ComponentTransition.easeInOut(duration: 0.2).setAlpha(view: self.backgroundContainer, alpha: 1.0)
if self.isSelected {
ComponentTransition.easeInOut(duration: 0.2).setAlpha(view: self.backgroundContainer, alpha: 1.0)
}
}
}

View file

@ -3958,7 +3958,12 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
var copyLinkImpl: ((String) -> Void)?
var shareLinkImpl: ((String) -> Void)?
self.overNavigationContainer = UIView()
self.overNavigationContainer = SparseContainerView()
var baseNavigationColors: BaseNavigationColors = .plain
if case .emojiStatus = source {
baseNavigationColors = .blocks
}
super.init(component: PremiumIntroScreenComponent(
overNavigationContainer: self.overNavigationContainer,
@ -3985,7 +3990,7 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
shareLink: { link in
shareLinkImpl?(link)
}
), navigationBarAppearance: .default, presentationMode: modal ? .modal : .default, theme: forceDark ? .dark : .default, updatedPresentationData: screenContext.updatedPresentationData)
), navigationBarAppearance: .default, presentationMode: modal ? .modal : .default, theme: forceDark ? .dark : .default, updatedPresentationData: screenContext.updatedPresentationData, baseNavigationColors: baseNavigationColors)
self._hasGlassStyle = true
@ -4065,7 +4070,7 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
}
if let navigationBar = self.navigationBar {
navigationBar.view.insertSubview(self.overNavigationContainer, aboveSubview: navigationBar.backgroundView)
navigationBar.customOverBackgroundContentView.addSubview(self.overNavigationContainer)
}
}

View file

@ -547,7 +547,7 @@ final class ShareControllerNode: ViewControllerTracingNode, ASScrollViewDelegate
if showNamesValue {
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.contextMenu.primaryColor)
} else {
return nil
return UIImage()
}
}, action: { _, _ in
self?.showNames.set(true)
@ -556,7 +556,7 @@ final class ShareControllerNode: ViewControllerTracingNode, ASScrollViewDelegate
if !showNamesValue {
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.contextMenu.primaryColor)
} else {
return nil
return UIImage()
}
}, action: { _, _ in
self?.showNames.set(false)

View file

@ -84,8 +84,8 @@ public extension NavigationBarPresentationData {
self.init(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme, style: style, glassStyle: glassStyle), strings: NavigationBarStrings(presentationStrings: presentationData.strings))
}
convenience init(presentationData: PresentationData, hideBackground: Bool, hideBadge: Bool, hideSeparator: Bool = false, style: NavigationBar.Style = .legacy, glassStyle: NavigationBar.GlassStyle = .default) {
self.init(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme, hideBackground: hideBackground, hideBadge: hideBadge, hideSeparator: hideSeparator, edgeEffectColor: hideBackground ? .clear : nil, style: style, glassStyle: glassStyle), strings: NavigationBarStrings(presentationStrings: presentationData.strings))
convenience init(presentationData: PresentationData, hideBackground: Bool, hideBadge: Bool, hideSeparator: Bool = false, style: NavigationBar.Style = .legacy, glassStyle: NavigationBar.GlassStyle = .default, edgeEffectColor: UIColor? = nil) {
self.init(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme, hideBackground: hideBackground, hideBadge: hideBadge, hideSeparator: hideSeparator, edgeEffectColor: hideBackground ? .clear : edgeEffectColor, style: style, glassStyle: glassStyle), strings: NavigationBarStrings(presentationStrings: presentationData.strings))
}
convenience init(presentationTheme: PresentationTheme, presentationStrings: PresentationStrings, style: NavigationBar.Style = .legacy, glassStyle: NavigationBar.GlassStyle = .default) {