Skip to content

Commit 0e58f82

Browse files
committed
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2 parents 2ba1f61 + 93b10b7 commit 0e58f82

7 files changed

Lines changed: 37 additions & 18 deletions

File tree

submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,18 @@ open class ViewControllerComponentContainer: ViewController {
239239
}
240240
}
241241

242+
public enum BaseNavigationColors {
243+
case plain
244+
case blocks
245+
}
246+
242247
public var node: Node {
243248
return self.displayNode as! Node
244249
}
245250

246251
private var presentationData: PresentationData
247252
private var theme: Theme
253+
private let baseNavigationColors: BaseNavigationColors
248254
public private(set) var component: AnyComponent<ViewControllerComponentContainer.Environment>
249255

250256
private var presentationDataDisposable: Disposable?
@@ -260,10 +266,12 @@ open class ViewControllerComponentContainer: ViewController {
260266
statusBarStyle: StatusBarStyle = .default,
261267
presentationMode: PresentationMode = .default,
262268
theme: Theme = .default,
263-
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil
269+
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil,
270+
baseNavigationColors: BaseNavigationColors = .plain,
264271
) where C.EnvironmentType == ViewControllerComponentContainer.Environment {
265272
self.component = AnyComponent(component)
266273
self.theme = theme
274+
self.baseNavigationColors = baseNavigationColors
267275

268276
var effectiveUpdatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)
269277
if let updatedPresentationData {
@@ -282,7 +290,7 @@ open class ViewControllerComponentContainer: ViewController {
282290
case .transparent:
283291
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true, style: .glass)
284292
case .default:
285-
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, style: .glass)
293+
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: false, hideBadge: false, hideSeparator: true, style: .glass, edgeEffectColor: self.baseNavigationColors == .blocks ? self.presentationData.theme.list.itemBlocksBackgroundColor : nil)
286294
}
287295
super.init(navigationBarPresentationData: navigationBarPresentationData)
288296

@@ -297,10 +305,12 @@ open class ViewControllerComponentContainer: ViewController {
297305
statusBarStyle: StatusBarStyle = .default,
298306
presentationMode: PresentationMode = .default,
299307
theme: Theme = .default,
300-
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)
308+
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>),
309+
baseNavigationColors: BaseNavigationColors = .plain
301310
) where C.EnvironmentType == ViewControllerComponentContainer.Environment {
302311
self.component = AnyComponent(component)
303312
self.theme = theme
313+
self.baseNavigationColors = baseNavigationColors
304314

305315
let presentationData = updatedPresentationData.initial
306316
self.presentationData = presentationData
@@ -312,7 +322,7 @@ open class ViewControllerComponentContainer: ViewController {
312322
case .transparent:
313323
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true, style: .glass)
314324
case .default:
315-
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, style: .glass)
325+
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: false, hideBadge: false, hideSeparator: true, style: .glass, edgeEffectColor: self.baseNavigationColors == .blocks ? self.presentationData.theme.list.itemBlocksBackgroundColor : nil)
316326
}
317327
super.init(navigationBarPresentationData: navigationBarPresentationData)
318328

@@ -360,7 +370,7 @@ open class ViewControllerComponentContainer: ViewController {
360370
case .transparent:
361371
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true, style: .glass)
362372
case .default:
363-
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, style: .glass)
373+
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: false, hideBadge: false, hideSeparator: true, style: .glass, edgeEffectColor: strongSelf.baseNavigationColors == .blocks ? strongSelf.presentationData.theme.list.itemBlocksBackgroundColor : nil)
364374
}
365375
if let navigationBarPresentationData {
366376
strongSelf.navigationBar?.updatePresentationData(navigationBarPresentationData, transition: .immediate)

submodules/GalleryUI/Sources/GalleryControllerNode.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ open class GalleryControllerNode: ASDisplayNode, ASScrollViewDelegate, ASGesture
307307
}
308308
transition.updateFrame(view: self.headerEdgeEffectView, frame: edgeEffectFrame)
309309
self.headerEdgeEffectView.update(content: .black, alpha: 0.65, rect: edgeEffectFrame, edge: .top, edgeSize: min(edgeEffectHeight, edgeEffectFrame.height), transition: ComponentTransition(transition))
310-
transition.updateAlpha(layer: self.headerEdgeEffectView.layer, alpha: self.areControlsHidden ? 0.0 : 0.25)
310+
transition.updateAlpha(layer: self.headerEdgeEffectView.layer, alpha: self.areControlsHidden ? 0.0 : 0.5)
311311

312312
if let navigationBar = self.navigationBar {
313313
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
441441
self.footerNode.animateIn(transition: .animated(duration: 0.15, curve: .linear))
442442

443443
ComponentTransition.easeInOut(duration: 0.15).animateView {
444-
self.headerEdgeEffectView.alpha = 0.25
444+
self.headerEdgeEffectView.alpha = 0.5
445445
self.titleView?.alpha = 1.0
446446
}
447447
}
@@ -548,7 +548,7 @@ open class GalleryControllerNode: ASDisplayNode, ASScrollViewDelegate, ASGesture
548548
if let overlayNode = self.overlayNode {
549549
overlayNode.alpha = transition
550550
}
551-
self.headerEdgeEffectView.alpha = transition
551+
self.headerEdgeEffectView.alpha = transition * 0.5
552552
self.titleView?.alpha = transition
553553
}
554554

submodules/GalleryUI/Sources/GalleryFooterNode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public final class GalleryFooterNode: ASDisplayNode {
155155
if let backgroundLayoutInfo, backgroundLayoutInfo.needsShadow {
156156
self.defaultEdgeEffectAlpha = 1.0
157157
} else {
158-
self.defaultEdgeEffectAlpha = 0.25
158+
self.defaultEdgeEffectAlpha = 0.5
159159
}
160160
ComponentTransition(transition).setAlpha(view: self.edgeEffectView, alpha: self.visibilityAlpha * self.defaultEdgeEffectAlpha)
161161

submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,9 @@ private class ImageRecognitionOverlayContentNode: GalleryOverlayContentNode {
16241624
return
16251625
}
16261626
self.appeared = true
1627-
ComponentTransition.easeInOut(duration: 0.2).setAlpha(view: self.backgroundContainer, alpha: 1.0)
1627+
if self.isSelected {
1628+
ComponentTransition.easeInOut(duration: 0.2).setAlpha(view: self.backgroundContainer, alpha: 1.0)
1629+
}
16281630
}
16291631

16301632
override func updateLayout(size: CGSize, metrics: LayoutMetrics, insets: UIEdgeInsets, isHidden: Bool, transition: ContainedViewLayoutTransition) {
@@ -1669,7 +1671,9 @@ private class ImageRecognitionOverlayContentNode: GalleryOverlayContentNode {
16691671
self.backgroundContainer.alpha = 1.0
16701672
} else {
16711673
self.backgroundContainer.alpha = 0.0
1672-
ComponentTransition.easeInOut(duration: 0.2).setAlpha(view: self.backgroundContainer, alpha: 1.0)
1674+
if self.isSelected {
1675+
ComponentTransition.easeInOut(duration: 0.2).setAlpha(view: self.backgroundContainer, alpha: 1.0)
1676+
}
16731677
}
16741678
}
16751679

submodules/PremiumUI/Sources/PremiumIntroScreen.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3958,7 +3958,12 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
39583958
var copyLinkImpl: ((String) -> Void)?
39593959
var shareLinkImpl: ((String) -> Void)?
39603960

3961-
self.overNavigationContainer = UIView()
3961+
self.overNavigationContainer = SparseContainerView()
3962+
3963+
var baseNavigationColors: BaseNavigationColors = .plain
3964+
if case .emojiStatus = source {
3965+
baseNavigationColors = .blocks
3966+
}
39623967

39633968
super.init(component: PremiumIntroScreenComponent(
39643969
overNavigationContainer: self.overNavigationContainer,
@@ -3985,7 +3990,7 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
39853990
shareLink: { link in
39863991
shareLinkImpl?(link)
39873992
}
3988-
), navigationBarAppearance: .default, presentationMode: modal ? .modal : .default, theme: forceDark ? .dark : .default, updatedPresentationData: screenContext.updatedPresentationData)
3993+
), navigationBarAppearance: .default, presentationMode: modal ? .modal : .default, theme: forceDark ? .dark : .default, updatedPresentationData: screenContext.updatedPresentationData, baseNavigationColors: baseNavigationColors)
39893994

39903995
self._hasGlassStyle = true
39913996

@@ -4065,7 +4070,7 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
40654070
}
40664071

40674072
if let navigationBar = self.navigationBar {
4068-
navigationBar.view.insertSubview(self.overNavigationContainer, aboveSubview: navigationBar.backgroundView)
4073+
navigationBar.customOverBackgroundContentView.addSubview(self.overNavigationContainer)
40694074
}
40704075
}
40714076

submodules/ShareController/Sources/ShareControllerNode.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ final class ShareControllerNode: ViewControllerTracingNode, ASScrollViewDelegate
547547
if showNamesValue {
548548
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.contextMenu.primaryColor)
549549
} else {
550-
return nil
550+
return UIImage()
551551
}
552552
}, action: { _, _ in
553553
self?.showNames.set(true)
@@ -556,7 +556,7 @@ final class ShareControllerNode: ViewControllerTracingNode, ASScrollViewDelegate
556556
if !showNamesValue {
557557
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.contextMenu.primaryColor)
558558
} else {
559-
return nil
559+
return UIImage()
560560
}
561561
}, action: { _, _ in
562562
self?.showNames.set(false)

submodules/TelegramPresentationData/Sources/ComponentsThemes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public extension NavigationBarPresentationData {
8484
self.init(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme, style: style, glassStyle: glassStyle), strings: NavigationBarStrings(presentationStrings: presentationData.strings))
8585
}
8686

87-
convenience init(presentationData: PresentationData, hideBackground: Bool, hideBadge: Bool, hideSeparator: Bool = false, style: NavigationBar.Style = .legacy, glassStyle: NavigationBar.GlassStyle = .default) {
88-
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))
87+
convenience init(presentationData: PresentationData, hideBackground: Bool, hideBadge: Bool, hideSeparator: Bool = false, style: NavigationBar.Style = .legacy, glassStyle: NavigationBar.GlassStyle = .default, edgeEffectColor: UIColor? = nil) {
88+
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))
8989
}
9090

9191
convenience init(presentationTheme: PresentationTheme, presentationStrings: PresentationStrings, style: NavigationBar.Style = .legacy, glassStyle: NavigationBar.GlassStyle = .default) {

0 commit comments

Comments
 (0)