mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
[WIP] Topics
This commit is contained in:
parent
643d650fd1
commit
38912b874e
@ -749,7 +749,7 @@ public protocol SharedAccountContext: AnyObject {
|
|||||||
func navigateToChat(accountId: AccountRecordId, peerId: PeerId, messageId: MessageId?)
|
func navigateToChat(accountId: AccountRecordId, peerId: PeerId, messageId: MessageId?)
|
||||||
func openChatMessage(_ params: OpenChatMessageParams) -> Bool
|
func openChatMessage(_ params: OpenChatMessageParams) -> Bool
|
||||||
func messageFromPreloadedChatHistoryViewForLocation(id: MessageId, location: ChatHistoryLocationInput, context: AccountContext, chatLocation: ChatLocation, subject: ChatControllerSubject?, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>, tagMask: MessageTags?) -> Signal<(MessageIndex?, Bool), NoError>
|
func messageFromPreloadedChatHistoryViewForLocation(id: MessageId, location: ChatHistoryLocationInput, context: AccountContext, chatLocation: ChatLocation, subject: ChatControllerSubject?, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>, tagMask: MessageTags?) -> Signal<(MessageIndex?, Bool), NoError>
|
||||||
func makeOverlayAudioPlayerController(context: AccountContext, peerId: PeerId, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, playlistLocation: SharedMediaPlaylistLocation?, parentNavigationController: NavigationController?) -> ViewController & OverlayAudioPlayerController
|
func makeOverlayAudioPlayerController(context: AccountContext, chatLocation: ChatLocation, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, playlistLocation: SharedMediaPlaylistLocation?, parentNavigationController: NavigationController?) -> ViewController & OverlayAudioPlayerController
|
||||||
func makePeerInfoController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, peer: Peer, mode: PeerInfoControllerMode, avatarInitiallyExpanded: Bool, fromChat: Bool, requestsContext: PeerInvitationImportersContext?) -> ViewController?
|
func makePeerInfoController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, peer: Peer, mode: PeerInfoControllerMode, avatarInitiallyExpanded: Bool, fromChat: Bool, requestsContext: PeerInvitationImportersContext?) -> ViewController?
|
||||||
func makeChannelAdminController(context: AccountContext, peerId: PeerId, adminId: PeerId, initialParticipant: ChannelParticipant) -> ViewController?
|
func makeChannelAdminController(context: AccountContext, peerId: PeerId, adminId: PeerId, initialParticipant: ChannelParticipant) -> ViewController?
|
||||||
func makeDeviceContactInfoController(context: AccountContext, subject: DeviceContactInfoSubject, completed: (() -> Void)?, cancelled: (() -> Void)?) -> ViewController
|
func makeDeviceContactInfoController(context: AccountContext, subject: DeviceContactInfoSubject, completed: (() -> Void)?, cancelled: (() -> Void)?) -> ViewController
|
||||||
|
@ -2519,20 +2519,20 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
|
|||||||
guard let strongSelf = self, let navigationController = strongSelf.navigationController, let (state, _, _, order, type, account) = strongSelf.playlistStateAndType else {
|
guard let strongSelf = self, let navigationController = strongSelf.navigationController, let (state, _, _, order, type, account) = strongSelf.playlistStateAndType else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if let id = state.id as? PeerMessagesMediaPlaylistItemId {
|
if let id = state.id as? PeerMessagesMediaPlaylistItemId, let playlistLocation = strongSelf.playlistLocation as? PeerMessagesPlaylistLocation {
|
||||||
if type == .music {
|
if type == .music {
|
||||||
if let playlistLocation = strongSelf.playlistLocation as? PeerMessagesPlaylistLocation, case .custom = playlistLocation {
|
if case .custom = playlistLocation {
|
||||||
let controllerContext: AccountContext
|
let controllerContext: AccountContext
|
||||||
if account.id == strongSelf.context.account.id {
|
if account.id == strongSelf.context.account.id {
|
||||||
controllerContext = strongSelf.context
|
controllerContext = strongSelf.context
|
||||||
} else {
|
} else {
|
||||||
controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
|
controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
|
||||||
}
|
}
|
||||||
let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, peerId: id.messageId.peerId, type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: playlistLocation, parentNavigationController: navigationController)
|
let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, chatLocation: .peer(id: id.messageId.peerId), type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: playlistLocation, parentNavigationController: navigationController)
|
||||||
strongSelf.interaction.dismissInput()
|
strongSelf.interaction.dismissInput()
|
||||||
strongSelf.interaction.present(controller, nil)
|
strongSelf.interaction.present(controller, nil)
|
||||||
} else {
|
} else if case let .messages(chatLocation, _, _) = playlistLocation {
|
||||||
let signal = strongSelf.context.sharedContext.messageFromPreloadedChatHistoryViewForLocation(id: id.messageId, location: ChatHistoryLocationInput(content: .InitialSearch(location: .id(id.messageId), count: 60, highlight: true), id: 0), context: strongSelf.context, chatLocation: .peer(id: id.messageId.peerId), subject: nil, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>(value: nil), tagMask: EngineMessage.Tags.music)
|
let signal = strongSelf.context.sharedContext.messageFromPreloadedChatHistoryViewForLocation(id: id.messageId, location: ChatHistoryLocationInput(content: .InitialSearch(location: .id(id.messageId), count: 60, highlight: true), id: 0), context: strongSelf.context, chatLocation: chatLocation, subject: nil, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>(value: nil), tagMask: EngineMessage.Tags.music)
|
||||||
|
|
||||||
var cancelImpl: (() -> Void)?
|
var cancelImpl: (() -> Void)?
|
||||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||||
@ -2569,7 +2569,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
|
|||||||
} else {
|
} else {
|
||||||
controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
|
controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
|
||||||
}
|
}
|
||||||
let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, peerId: id.messageId.peerId, type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: nil, parentNavigationController: navigationController)
|
let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, chatLocation: chatLocation, type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: nil, parentNavigationController: navigationController)
|
||||||
strongSelf.interaction.dismissInput()
|
strongSelf.interaction.dismissInput()
|
||||||
strongSelf.interaction.present(controller, nil)
|
strongSelf.interaction.present(controller, nil)
|
||||||
} else if index.1 {
|
} else if index.1 {
|
||||||
|
@ -743,20 +743,20 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
|
|||||||
guard let strongSelf = self, let _ = strongSelf.navigationController as? NavigationController, let (state, _, _, order, type, account) = strongSelf.playlistStateAndType else {
|
guard let strongSelf = self, let _ = strongSelf.navigationController as? NavigationController, let (state, _, _, order, type, account) = strongSelf.playlistStateAndType else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if let id = state.id as? PeerMessagesMediaPlaylistItemId {
|
if let id = state.id as? PeerMessagesMediaPlaylistItemId, let playlistLocation = strongSelf.playlistLocation as? PeerMessagesPlaylistLocation {
|
||||||
if type == .music {
|
if type == .music {
|
||||||
if let playlistLocation = strongSelf.playlistLocation as? PeerMessagesPlaylistLocation, case .custom = playlistLocation {
|
if case .custom = playlistLocation {
|
||||||
let controllerContext: AccountContext
|
let controllerContext: AccountContext
|
||||||
if account.id == strongSelf.context.account.id {
|
if account.id == strongSelf.context.account.id {
|
||||||
controllerContext = strongSelf.context
|
controllerContext = strongSelf.context
|
||||||
} else {
|
} else {
|
||||||
controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
|
controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
|
||||||
}
|
}
|
||||||
let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, peerId: id.messageId.peerId, type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: playlistLocation, parentNavigationController: strongSelf.navigationController as? NavigationController)
|
let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, chatLocation: .peer(id: id.messageId.peerId), type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: playlistLocation, parentNavigationController: strongSelf.navigationController as? NavigationController)
|
||||||
strongSelf.displayNode.view.window?.endEditing(true)
|
strongSelf.displayNode.view.window?.endEditing(true)
|
||||||
strongSelf.present(controller, in: .window(.root))
|
strongSelf.present(controller, in: .window(.root))
|
||||||
} else {
|
} else if case let .messages(chatLocation, _, _) = playlistLocation {
|
||||||
let signal = strongSelf.context.sharedContext.messageFromPreloadedChatHistoryViewForLocation(id: id.messageId, location: ChatHistoryLocationInput(content: .InitialSearch(location: .id(id.messageId), count: 60, highlight: true), id: 0), context: strongSelf.context, chatLocation: .peer(id: id.messageId.peerId), subject: nil, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>(value: nil), tagMask: MessageTags.music)
|
let signal = strongSelf.context.sharedContext.messageFromPreloadedChatHistoryViewForLocation(id: id.messageId, location: ChatHistoryLocationInput(content: .InitialSearch(location: .id(id.messageId), count: 60, highlight: true), id: 0), context: strongSelf.context, chatLocation: chatLocation, subject: nil, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>(value: nil), tagMask: MessageTags.music)
|
||||||
|
|
||||||
var cancelImpl: (() -> Void)?
|
var cancelImpl: (() -> Void)?
|
||||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||||
@ -793,7 +793,7 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
|
|||||||
} else {
|
} else {
|
||||||
controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
|
controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
|
||||||
}
|
}
|
||||||
let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, peerId: id.messageId.peerId, type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: nil, parentNavigationController: strongSelf.navigationController as? NavigationController)
|
let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, chatLocation: chatLocation, type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: nil, parentNavigationController: strongSelf.navigationController as? NavigationController)
|
||||||
strongSelf.displayNode.view.window?.endEditing(true)
|
strongSelf.displayNode.view.window?.endEditing(true)
|
||||||
strongSelf.present(controller, in: .window(.root))
|
strongSelf.present(controller, in: .window(.root))
|
||||||
} else if index.1 {
|
} else if index.1 {
|
||||||
|
@ -545,11 +545,11 @@ private final class MultipartFetchManager {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
self.markSpeedRecord()
|
/*self.markSpeedRecord()
|
||||||
self.speedTimer = SwiftSignalKit.Timer(timeout: 1.0, repeat: true, completion: { [weak self] in
|
self.speedTimer = SwiftSignalKit.Timer(timeout: 1.0, repeat: true, completion: { [weak self] in
|
||||||
self?.markSpeedRecord()
|
self?.markSpeedRecord()
|
||||||
}, queue: self.queue)
|
}, queue: self.queue)
|
||||||
self.speedTimer?.start()
|
self.speedTimer?.start()*/
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
|
@ -830,12 +830,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var openChatLocation = strongSelf.chatLocation
|
let openChatLocation = strongSelf.chatLocation
|
||||||
if case let .replyThread(replyThreadMessage) = openChatLocation {
|
/*if case let .replyThread(replyThreadMessage) = openChatLocation {
|
||||||
if message.threadId != makeMessageThreadId(replyThreadMessage.messageId) {
|
if message.threadId != makeMessageThreadId(replyThreadMessage.messageId) {
|
||||||
openChatLocation = .peer(id: message.id.peerId)
|
openChatLocation = .peer(id: message.id.peerId)
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return context.sharedContext.openChatMessage(OpenChatMessageParams(context: context, updatedPresentationData: strongSelf.updatedPresentationData, chatLocation: openChatLocation, chatLocationContextHolder: strongSelf.chatLocationContextHolder, message: message, standalone: false, reverseMessageGalleryOrder: false, mode: mode, navigationController: strongSelf.effectiveNavigationController, dismissInput: {
|
return context.sharedContext.openChatMessage(OpenChatMessageParams(context: context, updatedPresentationData: strongSelf.updatedPresentationData, chatLocation: openChatLocation, chatLocationContextHolder: strongSelf.chatLocationContextHolder, message: message, standalone: false, reverseMessageGalleryOrder: false, mode: mode, navigationController: strongSelf.effectiveNavigationController, dismissInput: {
|
||||||
self?.chatDisplayNode.dismissInput()
|
self?.chatDisplayNode.dismissInput()
|
||||||
|
@ -11,7 +11,7 @@ import UndoUI
|
|||||||
|
|
||||||
final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayerController {
|
final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayerController {
|
||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
let peerId: PeerId
|
let chatLocation: ChatLocation
|
||||||
let type: MediaManagerPlayerType
|
let type: MediaManagerPlayerType
|
||||||
let initialMessageId: MessageId
|
let initialMessageId: MessageId
|
||||||
let initialOrder: MusicPlaybackSettingsOrder
|
let initialOrder: MusicPlaybackSettingsOrder
|
||||||
@ -27,9 +27,9 @@ final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayer
|
|||||||
|
|
||||||
private var accountInUseDisposable: Disposable?
|
private var accountInUseDisposable: Disposable?
|
||||||
|
|
||||||
init(context: AccountContext, peerId: PeerId, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, playlistLocation: SharedMediaPlaylistLocation? = nil, parentNavigationController: NavigationController?) {
|
init(context: AccountContext, chatLocation: ChatLocation, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, playlistLocation: SharedMediaPlaylistLocation? = nil, parentNavigationController: NavigationController?) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.peerId = peerId
|
self.chatLocation = chatLocation
|
||||||
self.type = type
|
self.type = type
|
||||||
self.initialMessageId = initialMessageId
|
self.initialMessageId = initialMessageId
|
||||||
self.initialOrder = initialOrder
|
self.initialOrder = initialOrder
|
||||||
@ -54,7 +54,7 @@ final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
override public func loadDisplayNode() {
|
override public func loadDisplayNode() {
|
||||||
self.displayNode = OverlayAudioPlayerControllerNode(context: self.context, peerId: self.peerId, type: self.type, initialMessageId: self.initialMessageId, initialOrder: self.initialOrder, playlistLocation: self.playlistLocation, requestDismiss: { [weak self] in
|
self.displayNode = OverlayAudioPlayerControllerNode(context: self.context, chatLocation: self.chatLocation, type: self.type, initialMessageId: self.initialMessageId, initialOrder: self.initialOrder, playlistLocation: self.playlistLocation, requestDismiss: { [weak self] in
|
||||||
self?.dismiss()
|
self?.dismiss()
|
||||||
}, requestShare: { [weak self] messageId in
|
}, requestShare: { [weak self] messageId in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
|
@ -16,7 +16,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, UIGestu
|
|||||||
|
|
||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
|
|
||||||
private let peerId: PeerId
|
private let chatLocation: ChatLocation
|
||||||
private var presentationData: PresentationData
|
private var presentationData: PresentationData
|
||||||
private let type: MediaManagerPlayerType
|
private let type: MediaManagerPlayerType
|
||||||
private let requestDismiss: () -> Void
|
private let requestDismiss: () -> Void
|
||||||
@ -44,9 +44,9 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, UIGestu
|
|||||||
private var presentationDataDisposable: Disposable?
|
private var presentationDataDisposable: Disposable?
|
||||||
private let replacementHistoryNodeReadyDisposable = MetaDisposable()
|
private let replacementHistoryNodeReadyDisposable = MetaDisposable()
|
||||||
|
|
||||||
init(context: AccountContext, peerId: PeerId, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, playlistLocation: SharedMediaPlaylistLocation?, requestDismiss: @escaping () -> Void, requestShare: @escaping (MessageId) -> Void, requestSearchByArtist: @escaping (String) -> Void) {
|
init(context: AccountContext, chatLocation: ChatLocation, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, playlistLocation: SharedMediaPlaylistLocation?, requestDismiss: @escaping () -> Void, requestShare: @escaping (MessageId) -> Void, requestSearchByArtist: @escaping (String) -> Void) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.peerId = peerId
|
self.chatLocation = chatLocation
|
||||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
self.type = type
|
self.type = type
|
||||||
self.requestDismiss = requestDismiss
|
self.requestDismiss = requestDismiss
|
||||||
@ -197,7 +197,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, UIGestu
|
|||||||
self.isGlobalSearch = false
|
self.isGlobalSearch = false
|
||||||
}
|
}
|
||||||
|
|
||||||
self.historyNode = ChatHistoryListNode(context: context, updatedPresentationData: (context.sharedContext.currentPresentationData.with({ $0 }), context.sharedContext.presentationData), chatLocation: .peer(id: peerId), chatLocationContextHolder: chatLocationContextHolder, tagMask: tagMask, source: source, subject: .message(id: .id(initialMessageId), highlight: true, timecode: nil), controllerInteraction: self.controllerInteraction, selectedMessages: .single(nil), mode: .list(search: false, reversed: self.currentIsReversed, displayHeaders: .none, hintLinks: false, isGlobalSearch: self.isGlobalSearch))
|
self.historyNode = ChatHistoryListNode(context: context, updatedPresentationData: (context.sharedContext.currentPresentationData.with({ $0 }), context.sharedContext.presentationData), chatLocation: chatLocation, chatLocationContextHolder: chatLocationContextHolder, tagMask: tagMask, source: source, subject: .message(id: .id(initialMessageId), highlight: true, timecode: nil), controllerInteraction: self.controllerInteraction, selectedMessages: .single(nil), mode: .list(search: false, reversed: self.currentIsReversed, displayHeaders: .none, hintLinks: false, isGlobalSearch: self.isGlobalSearch))
|
||||||
self.historyNode.clipsToBounds = true
|
self.historyNode.clipsToBounds = true
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
@ -539,7 +539,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, UIGestu
|
|||||||
}
|
}
|
||||||
|
|
||||||
let chatLocationContextHolder = Atomic<ChatLocationContextHolder?>(value: nil)
|
let chatLocationContextHolder = Atomic<ChatLocationContextHolder?>(value: nil)
|
||||||
let historyNode = ChatHistoryListNode(context: self.context, updatedPresentationData: (self.context.sharedContext.currentPresentationData.with({ $0 }), self.context.sharedContext.presentationData), chatLocation: .peer(id: self.peerId), chatLocationContextHolder: chatLocationContextHolder, tagMask: tagMask, subject: .message(id: .id(messageId), highlight: true, timecode: nil), controllerInteraction: self.controllerInteraction, selectedMessages: .single(nil), mode: .list(search: false, reversed: self.currentIsReversed, displayHeaders: .none, hintLinks: false, isGlobalSearch: self.isGlobalSearch))
|
let historyNode = ChatHistoryListNode(context: self.context, updatedPresentationData: (self.context.sharedContext.currentPresentationData.with({ $0 }), self.context.sharedContext.presentationData), chatLocation: self.chatLocation, chatLocationContextHolder: chatLocationContextHolder, tagMask: tagMask, subject: .message(id: .id(messageId), highlight: true, timecode: nil), controllerInteraction: self.controllerInteraction, selectedMessages: .single(nil), mode: .list(search: false, reversed: self.currentIsReversed, displayHeaders: .none, hintLinks: false, isGlobalSearch: self.isGlobalSearch))
|
||||||
historyNode.clipsToBounds = true
|
historyNode.clipsToBounds = true
|
||||||
historyNode.preloadPages = true
|
historyNode.preloadPages = true
|
||||||
historyNode.stackFromBottom = true
|
historyNode.stackFromBottom = true
|
||||||
|
@ -49,6 +49,7 @@ final class PeerInfoListPaneNode: ASDisplayNode, PeerInfoPaneNode {
|
|||||||
private var playlistPreloadDisposable: Disposable?
|
private var playlistPreloadDisposable: Disposable?
|
||||||
|
|
||||||
private var playlistStateAndType: (SharedMediaPlaylistItem, SharedMediaPlaylistItem?, SharedMediaPlaylistItem?, MusicPlaybackSettingsOrder, MediaManagerPlayerType, Account)?
|
private var playlistStateAndType: (SharedMediaPlaylistItem, SharedMediaPlaylistItem?, SharedMediaPlaylistItem?, MusicPlaybackSettingsOrder, MediaManagerPlayerType, Account)?
|
||||||
|
private var playlistLocation: SharedMediaPlaylistLocation?
|
||||||
private var mediaAccessoryPanelContainer: PassthroughContainerNode
|
private var mediaAccessoryPanelContainer: PassthroughContainerNode
|
||||||
private var mediaAccessoryPanel: (MediaNavigationAccessoryPanel, MediaManagerPlayerType)?
|
private var mediaAccessoryPanel: (MediaNavigationAccessoryPanel, MediaManagerPlayerType)?
|
||||||
private var dismissingPanel: ASDisplayNode?
|
private var dismissingPanel: ASDisplayNode?
|
||||||
@ -135,8 +136,10 @@ final class PeerInfoListPaneNode: ASDisplayNode, PeerInfoPaneNode {
|
|||||||
|
|
||||||
if let playlistStateAndType = playlistStateAndType {
|
if let playlistStateAndType = playlistStateAndType {
|
||||||
strongSelf.playlistStateAndType = (playlistStateAndType.1.item, playlistStateAndType.1.previousItem, playlistStateAndType.1.nextItem, playlistStateAndType.1.order, playlistStateAndType.2, playlistStateAndType.0)
|
strongSelf.playlistStateAndType = (playlistStateAndType.1.item, playlistStateAndType.1.previousItem, playlistStateAndType.1.nextItem, playlistStateAndType.1.order, playlistStateAndType.2, playlistStateAndType.0)
|
||||||
|
strongSelf.playlistLocation = playlistStateAndType.1.playlistLocation
|
||||||
} else {
|
} else {
|
||||||
strongSelf.playlistStateAndType = nil
|
strongSelf.playlistStateAndType = nil
|
||||||
|
strongSelf.playlistLocation = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if let (size, topInset, sideInset, bottomInset, visibleHeight, isScrollingLockedAtTop, expandProgress, presentationData) = strongSelf.currentParams {
|
if let (size, topInset, sideInset, bottomInset, visibleHeight, isScrollingLockedAtTop, expandProgress, presentationData) = strongSelf.currentParams {
|
||||||
@ -334,7 +337,7 @@ final class PeerInfoListPaneNode: ASDisplayNode, PeerInfoPaneNode {
|
|||||||
guard let strongSelf = self, let _ = strongSelf.chatControllerInteraction.navigationController(), let (state, _, _, order, type, account) = strongSelf.playlistStateAndType else {
|
guard let strongSelf = self, let _ = strongSelf.chatControllerInteraction.navigationController(), let (state, _, _, order, type, account) = strongSelf.playlistStateAndType else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if let id = state.id as? PeerMessagesMediaPlaylistItemId {
|
if let id = state.id as? PeerMessagesMediaPlaylistItemId, let playlistLocation = strongSelf.playlistLocation as? PeerMessagesPlaylistLocation, case let .messages(chatLocation, _, _) = playlistLocation {
|
||||||
if type == .music {
|
if type == .music {
|
||||||
let signal = strongSelf.context.sharedContext.messageFromPreloadedChatHistoryViewForLocation(id: id.messageId, location: ChatHistoryLocationInput(content: .InitialSearch(location: .id(id.messageId), count: 60, highlight: true), id: 0), context: strongSelf.context, chatLocation: .peer(id: id.messageId.peerId), subject: nil, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>(value: nil), tagMask: MessageTags.music)
|
let signal = strongSelf.context.sharedContext.messageFromPreloadedChatHistoryViewForLocation(id: id.messageId, location: ChatHistoryLocationInput(content: .InitialSearch(location: .id(id.messageId), count: 60, highlight: true), id: 0), context: strongSelf.context, chatLocation: .peer(id: id.messageId.peerId), subject: nil, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>(value: nil), tagMask: MessageTags.music)
|
||||||
|
|
||||||
@ -373,7 +376,7 @@ final class PeerInfoListPaneNode: ASDisplayNode, PeerInfoPaneNode {
|
|||||||
} else {
|
} else {
|
||||||
controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
|
controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
|
||||||
}
|
}
|
||||||
let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, peerId: id.messageId.peerId, type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: nil, parentNavigationController: strongSelf.chatControllerInteraction.navigationController())
|
let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, chatLocation: chatLocation, type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: nil, parentNavigationController: strongSelf.chatControllerInteraction.navigationController())
|
||||||
strongSelf.view.window?.endEditing(true)
|
strongSelf.view.window?.endEditing(true)
|
||||||
strongSelf.chatControllerInteraction.presentController(controller, nil)
|
strongSelf.chatControllerInteraction.presentController(controller, nil)
|
||||||
} else if index.1 {
|
} else if index.1 {
|
||||||
|
@ -347,12 +347,12 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist {
|
|||||||
self.messagesLocation = location
|
self.messagesLocation = location
|
||||||
|
|
||||||
switch self.messagesLocation {
|
switch self.messagesLocation {
|
||||||
case let .messages(_, _, messageId), let .singleMessage(messageId), let .custom(_, messageId, _):
|
case let .messages(_, _, messageId), let .singleMessage(messageId), let .custom(_, messageId, _):
|
||||||
self.loadItem(anchor: .messageId(messageId), navigation: .later)
|
self.loadItem(anchor: .messageId(messageId), navigation: .later)
|
||||||
case let .recentActions(message):
|
case let .recentActions(message):
|
||||||
self.loadingItem = false
|
self.loadingItem = false
|
||||||
self.currentItem = (message, [])
|
self.currentItem = (message, [])
|
||||||
self.updateState()
|
self.updateState()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,8 +1030,8 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public func makeOverlayAudioPlayerController(context: AccountContext, peerId: PeerId, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, playlistLocation: SharedMediaPlaylistLocation?, parentNavigationController: NavigationController?) -> ViewController & OverlayAudioPlayerController {
|
public func makeOverlayAudioPlayerController(context: AccountContext, chatLocation: ChatLocation, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, playlistLocation: SharedMediaPlaylistLocation?, parentNavigationController: NavigationController?) -> ViewController & OverlayAudioPlayerController {
|
||||||
return OverlayAudioPlayerControllerImpl(context: context, peerId: peerId, type: type, initialMessageId: initialMessageId, initialOrder: initialOrder, playlistLocation: playlistLocation, parentNavigationController: parentNavigationController)
|
return OverlayAudioPlayerControllerImpl(context: context, chatLocation: chatLocation, type: type, initialMessageId: initialMessageId, initialOrder: initialOrder, playlistLocation: playlistLocation, parentNavigationController: parentNavigationController)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func makeTempAccountContext(account: Account) -> AccountContext {
|
public func makeTempAccountContext(account: Account) -> AccountContext {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user