mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix music panel
This commit is contained in:
parent
4c57aa9ff8
commit
3ce28d1d18
@ -1721,7 +1721,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
|
||||
})
|
||||
}
|
||||
|
||||
let mediaAccessoryPanel = MediaNavigationAccessoryPanel(context: self.context)
|
||||
let mediaAccessoryPanel = MediaNavigationAccessoryPanel(context: self.context, displayBackground: true)
|
||||
mediaAccessoryPanel.containerNode.headerNode.displayScrubber = item.playbackData?.type != .instantVideo
|
||||
mediaAccessoryPanel.close = { [weak self] in
|
||||
if let strongSelf = self, let (_, _, _, _, type, _) = strongSelf.playlistStateAndType {
|
||||
|
@ -8,22 +8,33 @@ import TelegramPresentationData
|
||||
import AccountContext
|
||||
|
||||
public final class MediaNavigationAccessoryContainerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
||||
private let displayBackground: Bool
|
||||
|
||||
public let backgroundNode: ASDisplayNode
|
||||
public let separatorNode: ASDisplayNode
|
||||
public let headerNode: MediaNavigationAccessoryHeaderNode
|
||||
|
||||
private let currentHeaderHeight: CGFloat = MediaNavigationAccessoryHeaderNode.minimizedHeight
|
||||
|
||||
private var presentationData: PresentationData
|
||||
|
||||
init(context: AccountContext) {
|
||||
init(context: AccountContext, displayBackground: Bool) {
|
||||
self.displayBackground = displayBackground
|
||||
|
||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
self.backgroundNode = ASDisplayNode()
|
||||
self.separatorNode = ASDisplayNode()
|
||||
self.headerNode = MediaNavigationAccessoryHeaderNode(presentationData: self.presentationData)
|
||||
|
||||
super.init()
|
||||
|
||||
if self.displayBackground {
|
||||
self.backgroundNode.backgroundColor = self.presentationData.theme.rootController.navigationBar.opaqueBackgroundColor
|
||||
self.separatorNode.backgroundColor = self.presentationData.theme.rootController.navigationBar.separatorColor
|
||||
}
|
||||
self.addSubnode(self.backgroundNode)
|
||||
self.addSubnode(self.separatorNode)
|
||||
|
||||
self.addSubnode(self.headerNode)
|
||||
}
|
||||
@ -31,6 +42,11 @@ public final class MediaNavigationAccessoryContainerNode: ASDisplayNode, UIGestu
|
||||
func updatePresentationData(_ presentationData: PresentationData) {
|
||||
self.presentationData = presentationData
|
||||
|
||||
if self.displayBackground {
|
||||
self.backgroundNode.backgroundColor = self.presentationData.theme.rootController.navigationBar.opaqueBackgroundColor
|
||||
self.separatorNode.backgroundColor = self.presentationData.theme.rootController.navigationBar.separatorColor
|
||||
}
|
||||
|
||||
self.headerNode.updatePresentationData(presentationData)
|
||||
}
|
||||
|
||||
@ -44,6 +60,7 @@ public final class MediaNavigationAccessoryContainerNode: ASDisplayNode, UIGestu
|
||||
|
||||
func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
transition.updateFrame(node: self.backgroundNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: self.currentHeaderHeight)))
|
||||
transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: self.currentHeaderHeight - UIScreenPixel), size: CGSize(width: size.width, height: UIScreenPixel)))
|
||||
|
||||
let headerHeight = self.currentHeaderHeight
|
||||
transition.updateFrame(node: self.headerNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: headerHeight)))
|
||||
|
@ -16,8 +16,8 @@ public final class MediaNavigationAccessoryPanel: ASDisplayNode {
|
||||
public var playPrevious: (() -> Void)?
|
||||
public var playNext: (() -> Void)?
|
||||
|
||||
public init(context: AccountContext) {
|
||||
self.containerNode = MediaNavigationAccessoryContainerNode(context: context)
|
||||
public init(context: AccountContext, displayBackground: Bool = false) {
|
||||
self.containerNode = MediaNavigationAccessoryContainerNode(context: context, displayBackground: displayBackground)
|
||||
|
||||
super.init()
|
||||
|
||||
|
@ -205,7 +205,7 @@ final class PeerInfoListPaneNode: ASDisplayNode, PeerInfoPaneNode {
|
||||
})
|
||||
}
|
||||
|
||||
let mediaAccessoryPanel = MediaNavigationAccessoryPanel(context: self.context)
|
||||
let mediaAccessoryPanel = MediaNavigationAccessoryPanel(context: self.context, displayBackground: true)
|
||||
mediaAccessoryPanel.containerNode.headerNode.displayScrubber = item.playbackData?.type != .instantVideo
|
||||
mediaAccessoryPanel.close = { [weak self] in
|
||||
if let strongSelf = self, let (_, _, _, _, type, _) = strongSelf.playlistStateAndType {
|
||||
|
Loading…
x
Reference in New Issue
Block a user