diff --git a/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift b/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift index e017ad6411..91c2503013 100644 --- a/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift +++ b/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift @@ -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 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)? = nil + updatedPresentationData: (initial: PresentationData, signal: Signal)? = 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) 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) + updatedPresentationData: (initial: PresentationData, signal: Signal), + 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) diff --git a/submodules/GalleryUI/Sources/GalleryControllerNode.swift b/submodules/GalleryUI/Sources/GalleryControllerNode.swift index 52183263d7..fd0c22debb 100644 --- a/submodules/GalleryUI/Sources/GalleryControllerNode.swift +++ b/submodules/GalleryUI/Sources/GalleryControllerNode.swift @@ -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 } diff --git a/submodules/GalleryUI/Sources/GalleryFooterNode.swift b/submodules/GalleryUI/Sources/GalleryFooterNode.swift index d0a21cf5c4..950314e0fb 100644 --- a/submodules/GalleryUI/Sources/GalleryFooterNode.swift +++ b/submodules/GalleryUI/Sources/GalleryFooterNode.swift @@ -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) diff --git a/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift b/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift index 3e5e6bf2a1..ff636a0183 100644 --- a/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift +++ b/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift @@ -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) + } } } diff --git a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift index 783f4e1160..49ee25c73b 100644 --- a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift @@ -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) } } diff --git a/submodules/ShareController/Sources/ShareControllerNode.swift b/submodules/ShareController/Sources/ShareControllerNode.swift index 3203932381..40330e5e34 100644 --- a/submodules/ShareController/Sources/ShareControllerNode.swift +++ b/submodules/ShareController/Sources/ShareControllerNode.swift @@ -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) diff --git a/submodules/TelegramPresentationData/Sources/ComponentsThemes.swift b/submodules/TelegramPresentationData/Sources/ComponentsThemes.swift index c712d7796c..0f9f22faa0 100644 --- a/submodules/TelegramPresentationData/Sources/ComponentsThemes.swift +++ b/submodules/TelegramPresentationData/Sources/ComponentsThemes.swift @@ -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) {