mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Comments [WIP]
This commit is contained in:
parent
d04a765ba7
commit
9eea375b66
@ -329,7 +329,7 @@ public struct ChatTextInputStateText: PostboxCoding, Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum ChatControllerSubject: Equatable {
|
public enum ChatControllerSubject: Equatable {
|
||||||
case message(MessageId)
|
case message(id: MessageId, highlight: Bool)
|
||||||
case scheduledMessages
|
case scheduledMessages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ public enum ChatHistoryInitialSearchLocation: Equatable {
|
|||||||
|
|
||||||
public enum ChatHistoryLocation: Equatable {
|
public enum ChatHistoryLocation: Equatable {
|
||||||
case Initial(count: Int)
|
case Initial(count: Int)
|
||||||
case InitialSearch(location: ChatHistoryInitialSearchLocation, count: Int)
|
case InitialSearch(location: ChatHistoryInitialSearchLocation, count: Int, highlight: Bool)
|
||||||
case Navigation(index: MessageHistoryAnchorIndex, anchorIndex: MessageHistoryAnchorIndex, count: Int)
|
case Navigation(index: MessageHistoryAnchorIndex, anchorIndex: MessageHistoryAnchorIndex, count: Int, highlight: Bool)
|
||||||
case Scroll(index: MessageHistoryAnchorIndex, anchorIndex: MessageHistoryAnchorIndex, sourceIndex: MessageHistoryAnchorIndex, scrollPosition: ListViewScrollPosition, animated: Bool)
|
case Scroll(index: MessageHistoryAnchorIndex, anchorIndex: MessageHistoryAnchorIndex, sourceIndex: MessageHistoryAnchorIndex, scrollPosition: ListViewScrollPosition, animated: Bool, highlight: Bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ChatHistoryLocationInput: Equatable {
|
public struct ChatHistoryLocationInput: Equatable {
|
||||||
|
@ -669,7 +669,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
|||||||
if let layout = strongSelf.validLayout, case .regular = layout.metrics.widthClass {
|
if let layout = strongSelf.validLayout, case .regular = layout.metrics.widthClass {
|
||||||
scrollToEndIfExists = true
|
scrollToEndIfExists = true
|
||||||
}
|
}
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(actualPeerId), subject: .message(messageId), purposefulAction: {
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(actualPeerId), subject: .message(id: messageId, highlight: true), purposefulAction: {
|
||||||
self?.deactivateSearch(animated: false)
|
self?.deactivateSearch(animated: false)
|
||||||
}, scrollToEndIfExists: scrollToEndIfExists, options: strongSelf.groupId == PeerGroupId.root ? [.removeOnMasterDetails] : []))
|
}, scrollToEndIfExists: scrollToEndIfExists, options: strongSelf.groupId == PeerGroupId.root ? [.removeOnMasterDetails] : []))
|
||||||
strongSelf.chatListDisplayNode.containerNode.currentItemNode.clearHighlightAnimated(true)
|
strongSelf.chatListDisplayNode.containerNode.currentItemNode.clearHighlightAnimated(true)
|
||||||
@ -1780,7 +1780,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
|||||||
sourceRect = CGRect(x: sourceRect.minX, y: sourceRect.minY + bounds.minY, width: bounds.width, height: bounds.height)
|
sourceRect = CGRect(x: sourceRect.minX, y: sourceRect.minY + bounds.minY, width: bounds.width, height: bounds.height)
|
||||||
sourceRect.size.height -= UIScreenPixel
|
sourceRect.size.height -= UIScreenPixel
|
||||||
|
|
||||||
let chatController = self.context.sharedContext.makeChatController(context: self.context, chatLocation: .peer(messageId.peerId), subject: .message(messageId), botStart: nil, mode: .standard(previewing: true))
|
let chatController = self.context.sharedContext.makeChatController(context: self.context, chatLocation: .peer(messageId.peerId), subject: .message(id: messageId, highlight: true), botStart: nil, mode: .standard(previewing: true))
|
||||||
chatController.canReadHistory.set(false)
|
chatController.canReadHistory.set(false)
|
||||||
chatController.containerLayoutUpdated(ContainerViewLayout(size: contentSize, metrics: LayoutMetrics(), deviceMetrics: layout.deviceMetrics, intrinsicInsets: UIEdgeInsets(), safeInsets: UIEdgeInsets(), statusBarHeight: nil, inputHeight: nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: false), transition: .immediate)
|
chatController.containerLayoutUpdated(ContainerViewLayout(size: contentSize, metrics: LayoutMetrics(), deviceMetrics: layout.deviceMetrics, intrinsicInsets: UIEdgeInsets(), safeInsets: UIEdgeInsets(), statusBarHeight: nil, inputHeight: nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: false), transition: .immediate)
|
||||||
return (chatController, sourceRect)
|
return (chatController, sourceRect)
|
||||||
|
@ -1726,7 +1726,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
|
|||||||
}
|
}
|
||||||
if let id = state.id as? PeerMessagesMediaPlaylistItemId {
|
if let id = state.id as? PeerMessagesMediaPlaylistItemId {
|
||||||
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), id: 0), context: strongSelf.context, chatLocation: .peer(id.messageId.peerId), 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.messageId.peerId), 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 }
|
||||||
|
@ -57,7 +57,7 @@ public final class HashtagSearchController: TelegramBaseController {
|
|||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.openMessageFromSearchDisposable.set((storedMessageFromSearchPeer(account: strongSelf.context.account, peer: peer) |> deliverOnMainQueue).start(next: { actualPeerId in
|
strongSelf.openMessageFromSearchDisposable.set((storedMessageFromSearchPeer(account: strongSelf.context.account, peer: peer) |> deliverOnMainQueue).start(next: { actualPeerId in
|
||||||
if let strongSelf = self, let navigationController = strongSelf.navigationController as? NavigationController {
|
if let strongSelf = self, let navigationController = strongSelf.navigationController as? NavigationController {
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(actualPeerId), subject: message.id.peerId == actualPeerId ? .message(message.id) : nil, keepStack: .always))
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(actualPeerId), subject: message.id.peerId == actualPeerId ? .message(id: message.id, highlight: true) : nil, keepStack: .always))
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
strongSelf.controllerNode.listNode.clearHighlightAnimated(true)
|
strongSelf.controllerNode.listNode.clearHighlightAnimated(true)
|
||||||
|
@ -497,7 +497,7 @@ public func channelStatsController(context: AccountContext, peerId: PeerId, cach
|
|||||||
}
|
}
|
||||||
navigateToMessageImpl = { [weak controller] messageId in
|
navigateToMessageImpl = { [weak controller] messageId in
|
||||||
if let navigationController = controller?.navigationController as? NavigationController {
|
if let navigationController = controller?.navigationController as? NavigationController {
|
||||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(messageId.peerId), subject: .message(messageId), keepStack: .always, useExisting: false, purposefulAction: {}, peekData: nil))
|
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(messageId.peerId), subject: .message(id: messageId, highlight: true), keepStack: .always, useExisting: false, purposefulAction: {}, peekData: nil))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return controller
|
return controller
|
||||||
|
@ -258,7 +258,7 @@ public func messageStatsController(context: AccountContext, messageId: MessageId
|
|||||||
}
|
}
|
||||||
navigateToMessageImpl = { [weak controller] messageId in
|
navigateToMessageImpl = { [weak controller] messageId in
|
||||||
if let navigationController = controller?.navigationController as? NavigationController {
|
if let navigationController = controller?.navigationController as? NavigationController {
|
||||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(messageId.peerId), subject: .message(messageId), keepStack: .always, useExisting: false, purposefulAction: {}, peekData: nil))
|
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(messageId.peerId), subject: .message(id: messageId, highlight: true), keepStack: .always, useExisting: false, purposefulAction: {}, peekData: nil))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return controller
|
return controller
|
||||||
|
@ -557,7 +557,7 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
|
|||||||
}
|
}
|
||||||
if let id = state.id as? PeerMessagesMediaPlaylistItemId {
|
if let id = state.id as? PeerMessagesMediaPlaylistItemId {
|
||||||
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), id: 0), context: strongSelf.context, chatLocation: .peer(id.messageId.peerId), 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.messageId.peerId), 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 }
|
||||||
|
@ -155,6 +155,8 @@ enum FetchMessageHistoryHoleThreadInput: CustomStringConvertible {
|
|||||||
struct FetchMessageHistoryHoleResult: Equatable {
|
struct FetchMessageHistoryHoleResult: Equatable {
|
||||||
var removedIndices: IndexSet
|
var removedIndices: IndexSet
|
||||||
var strictRemovedIndices: IndexSet
|
var strictRemovedIndices: IndexSet
|
||||||
|
var actualPeerId: PeerId?
|
||||||
|
var actualThreadId: Int64?
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetchMessageHistoryHole(accountPeerId: PeerId, source: FetchMessageHistoryHoleSource, postbox: Postbox, peerInput: FetchMessageHistoryHoleThreadInput, namespace: MessageId.Namespace, direction: MessageHistoryViewRelativeHoleDirection, space: MessageHistoryHoleSpace, count rawCount: Int) -> Signal<FetchMessageHistoryHoleResult, NoError> {
|
func fetchMessageHistoryHole(accountPeerId: PeerId, source: FetchMessageHistoryHoleSource, postbox: Postbox, peerInput: FetchMessageHistoryHoleThreadInput, namespace: MessageId.Namespace, direction: MessageHistoryViewRelativeHoleDirection, space: MessageHistoryHoleSpace, count rawCount: Int) -> Signal<FetchMessageHistoryHoleResult, NoError> {
|
||||||
@ -180,7 +182,7 @@ func fetchMessageHistoryHole(accountPeerId: PeerId, source: FetchMessageHistoryH
|
|||||||
}
|
}
|
||||||
|> mapToSignal { (inputPeer, hash) -> Signal<FetchMessageHistoryHoleResult, NoError> in
|
|> mapToSignal { (inputPeer, hash) -> Signal<FetchMessageHistoryHoleResult, NoError> in
|
||||||
guard let inputPeer = inputPeer else {
|
guard let inputPeer = inputPeer else {
|
||||||
return .single(FetchMessageHistoryHoleResult(removedIndices: IndexSet(), strictRemovedIndices: IndexSet()))
|
return .single(FetchMessageHistoryHoleResult(removedIndices: IndexSet(), strictRemovedIndices: IndexSet(), actualPeerId: nil, actualThreadId: nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
print("fetchMessageHistoryHole for \(peerInput) direction \(direction) space \(space)")
|
print("fetchMessageHistoryHole for \(peerInput) direction \(direction) space \(space)")
|
||||||
@ -537,7 +539,9 @@ func fetchMessageHistoryHole(accountPeerId: PeerId, source: FetchMessageHistoryH
|
|||||||
|
|
||||||
return FetchMessageHistoryHoleResult(
|
return FetchMessageHistoryHoleResult(
|
||||||
removedIndices: IndexSet(integersIn: Int(filledRange.lowerBound) ... Int(filledRange.upperBound)),
|
removedIndices: IndexSet(integersIn: Int(filledRange.lowerBound) ... Int(filledRange.upperBound)),
|
||||||
strictRemovedIndices: strictFilledIndices
|
strictRemovedIndices: strictFilledIndices,
|
||||||
|
actualPeerId: storeMessages.first?.id.peerId,
|
||||||
|
actualThreadId: storeMessages.first?.threadId
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -227,6 +227,9 @@ public extension RenderedPeer {
|
|||||||
|
|
||||||
public func isServicePeer(_ peer: Peer) -> Bool {
|
public func isServicePeer(_ peer: Peer) -> Bool {
|
||||||
if let peer = peer as? TelegramUser {
|
if let peer = peer as? TelegramUser {
|
||||||
|
if peer.id.isReplies {
|
||||||
|
return true
|
||||||
|
}
|
||||||
return (peer.id.namespace == Namespaces.Peer.CloudUser && (peer.id.id == 777000 || peer.id.id == 333000))
|
return (peer.id.namespace == Namespaces.Peer.CloudUser && (peer.id.id == 777000 || peer.id.id == 333000))
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -374,9 +374,9 @@ public class ReplyThreadHistoryContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public struct ChatReplyThreadMessage: Equatable {
|
public struct ChatReplyThreadMessage: Equatable {
|
||||||
public enum Anchor {
|
public enum Anchor: Equatable {
|
||||||
case automatic
|
case automatic
|
||||||
case lowerBound
|
case lowerBoundMessage(MessageIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
public var messageId: MessageId
|
public var messageId: MessageId
|
||||||
@ -606,17 +606,13 @@ public func fetchChannelReplyThreadMessage(account: Account, messageId: MessageI
|
|||||||
}
|
}
|
||||||
|
|
||||||
let inputAnchor: HistoryViewInputAnchor
|
let inputAnchor: HistoryViewInputAnchor
|
||||||
let initialAnchor: ChatReplyThreadMessage.Anchor
|
|
||||||
switch anchor {
|
switch anchor {
|
||||||
case .lowerBound:
|
case .lowerBound:
|
||||||
inputAnchor = .lowerBound
|
inputAnchor = .lowerBound
|
||||||
initialAnchor = .lowerBound
|
|
||||||
case .upperBound:
|
case .upperBound:
|
||||||
inputAnchor = .upperBound
|
inputAnchor = .upperBound
|
||||||
initialAnchor = .automatic
|
|
||||||
case let .message(id):
|
case let .message(id):
|
||||||
inputAnchor = .message(id)
|
inputAnchor = .message(id)
|
||||||
initialAnchor = .automatic
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let testView = transaction.getMessagesHistoryViewState(
|
let testView = transaction.getMessagesHistoryViewState(
|
||||||
@ -635,27 +631,57 @@ public func fetchChannelReplyThreadMessage(account: Account, messageId: MessageI
|
|||||||
namespaces: .not(Namespaces.Message.allScheduled)
|
namespaces: .not(Namespaces.Message.allScheduled)
|
||||||
)
|
)
|
||||||
if !testView.isLoading {
|
if !testView.isLoading {
|
||||||
|
let initialAnchor: ChatReplyThreadMessage.Anchor
|
||||||
|
switch anchor {
|
||||||
|
case .lowerBound:
|
||||||
|
if let entry = testView.entries.first {
|
||||||
|
initialAnchor = .lowerBoundMessage(entry.index)
|
||||||
|
} else {
|
||||||
|
initialAnchor = .automatic
|
||||||
|
}
|
||||||
|
case .upperBound:
|
||||||
|
initialAnchor = .automatic
|
||||||
|
case .message:
|
||||||
|
initialAnchor = .automatic
|
||||||
|
}
|
||||||
|
|
||||||
return .single((FetchMessageHistoryHoleResult(removedIndices: IndexSet(), strictRemovedIndices: IndexSet()), initialAnchor))
|
return .single((FetchMessageHistoryHoleResult(removedIndices: IndexSet(), strictRemovedIndices: IndexSet()), initialAnchor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let direction: MessageHistoryViewRelativeHoleDirection
|
let direction: MessageHistoryViewRelativeHoleDirection
|
||||||
let initialAnchor: ChatReplyThreadMessage.Anchor
|
|
||||||
switch anchor {
|
switch anchor {
|
||||||
case .lowerBound:
|
case .lowerBound:
|
||||||
direction = .range(start: MessageId(peerId: commentsPeerId, namespace: Namespaces.Message.Cloud, id: 1), end: MessageId(peerId: commentsPeerId, namespace: Namespaces.Message.Cloud, id: Int32.max - 1))
|
direction = .range(start: MessageId(peerId: commentsPeerId, namespace: Namespaces.Message.Cloud, id: 1), end: MessageId(peerId: commentsPeerId, namespace: Namespaces.Message.Cloud, id: Int32.max - 1))
|
||||||
initialAnchor = .lowerBound
|
|
||||||
case .upperBound:
|
case .upperBound:
|
||||||
direction = .range(start: MessageId(peerId: commentsPeerId, namespace: Namespaces.Message.Cloud, id: Int32.max - 1), end: MessageId(peerId: commentsPeerId, namespace: Namespaces.Message.Cloud, id: 1))
|
direction = .range(start: MessageId(peerId: commentsPeerId, namespace: Namespaces.Message.Cloud, id: Int32.max - 1), end: MessageId(peerId: commentsPeerId, namespace: Namespaces.Message.Cloud, id: 1))
|
||||||
initialAnchor = .automatic
|
|
||||||
case let .message(id):
|
case let .message(id):
|
||||||
direction = .aroundId(id)
|
direction = .aroundId(id)
|
||||||
initialAnchor = .automatic
|
|
||||||
}
|
}
|
||||||
return fetchMessageHistoryHole(accountPeerId: account.peerId, source: .network(account.network), postbox: account.postbox, peerInput: peerInput, namespace: Namespaces.Message.Cloud, direction: direction, space: .everywhere, count: 40)
|
return fetchMessageHistoryHole(accountPeerId: account.peerId, source: .network(account.network), postbox: account.postbox, peerInput: peerInput, namespace: Namespaces.Message.Cloud, direction: direction, space: .everywhere, count: 40)
|
||||||
|> castError(FetchChannelReplyThreadMessageError.self)
|
|> castError(FetchChannelReplyThreadMessageError.self)
|
||||||
|> map { result -> (FetchMessageHistoryHoleResult, ChatReplyThreadMessage.Anchor) in
|
|> mapToSignal { result -> Signal<(FetchMessageHistoryHoleResult, ChatReplyThreadMessage.Anchor), FetchChannelReplyThreadMessageError> in
|
||||||
return (result, initialAnchor)
|
return account.postbox.transaction { transaction -> (FetchMessageHistoryHoleResult, ChatReplyThreadMessage.Anchor) in
|
||||||
|
let initialAnchor: ChatReplyThreadMessage.Anchor
|
||||||
|
switch anchor {
|
||||||
|
case .lowerBound:
|
||||||
|
if let actualPeerId = result.actualPeerId, let actualThreadId = result.actualThreadId {
|
||||||
|
if let firstMessage = transaction.getMessagesWithThreadId(peerId: actualPeerId, namespace: Namespaces.Message.Cloud, threadId: actualThreadId, from: MessageIndex.lowerBound(peerId: actualPeerId, namespace: Namespaces.Message.Cloud), includeFrom: false, to: MessageIndex.upperBound(peerId: actualPeerId, namespace: Namespaces.Message.Cloud), limit: 1).first {
|
||||||
|
initialAnchor = .lowerBoundMessage(firstMessage.index)
|
||||||
|
} else {
|
||||||
|
initialAnchor = .automatic
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
initialAnchor = .automatic
|
||||||
|
}
|
||||||
|
case .upperBound:
|
||||||
|
initialAnchor = .automatic
|
||||||
|
case .message:
|
||||||
|
initialAnchor = .automatic
|
||||||
|
}
|
||||||
|
return (result, initialAnchor)
|
||||||
|
}
|
||||||
|
|> castError(FetchChannelReplyThreadMessageError.self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|> castError(FetchChannelReplyThreadMessageError.self)
|
|> castError(FetchChannelReplyThreadMessageError.self)
|
||||||
|
@ -702,7 +702,7 @@ final class AuthorizedApplicationContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let navigateToMessage = {
|
let navigateToMessage = {
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: strongSelf.rootController, context: strongSelf.context, chatLocation: .peer(messageId.peerId), subject: .message(messageId)))
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: strongSelf.rootController, context: strongSelf.context, chatLocation: .peer(messageId.peerId), subject: .message(id: messageId, highlight: true)))
|
||||||
}
|
}
|
||||||
|
|
||||||
if chatIsVisible {
|
if chatIsVisible {
|
||||||
@ -773,7 +773,7 @@ final class AuthorizedApplicationContext {
|
|||||||
|
|
||||||
if visiblePeerId != peerId || messageId != nil {
|
if visiblePeerId != peerId || messageId != nil {
|
||||||
if self.rootController.rootTabController != nil {
|
if self.rootController.rootTabController != nil {
|
||||||
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: self.rootController, context: self.context, chatLocation: .peer(peerId), subject: messageId.flatMap { .message($0) }, activateInput: activateInput))
|
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: self.rootController, context: self.context, chatLocation: .peer(peerId), subject: messageId.flatMap { .message(id: $0, highlight: true) }, activateInput: activateInput))
|
||||||
} else {
|
} else {
|
||||||
self.scheduledOpenChatWithPeerId = (peerId, messageId, activateInput)
|
self.scheduledOpenChatWithPeerId = (peerId, messageId, activateInput)
|
||||||
}
|
}
|
||||||
|
@ -5115,7 +5115,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let navigationController = strongSelf.effectiveNavigationController {
|
if let navigationController = strongSelf.effectiveNavigationController {
|
||||||
let subject: ChatControllerSubject? = sourceMessageId.flatMap(ChatControllerSubject.message)
|
let subject: ChatControllerSubject? = sourceMessageId.flatMap { ChatControllerSubject.message(id: $0, highlight: true) }
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .replyThread(replyThreadResult), subject: subject, keepStack: .always))
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .replyThread(replyThreadResult), subject: subject, keepStack: .always))
|
||||||
}
|
}
|
||||||
}, statuses: ChatPanelInterfaceInteractionStatuses(editingMessage: self.editingMessage.get(), startingBot: self.startingBot.get(), unblockingPeer: self.unblockingPeer.get(), searching: self.searching.get(), loadingMessage: self.loadingMessage.get(), inlineSearch: self.performingInlineSearch.get()))
|
}, statuses: ChatPanelInterfaceInteractionStatuses(editingMessage: self.editingMessage.get(), startingBot: self.startingBot.get(), unblockingPeer: self.unblockingPeer.get(), searching: self.searching.get(), loadingMessage: self.loadingMessage.get(), inlineSearch: self.performingInlineSearch.get()))
|
||||||
@ -8189,7 +8189,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
|
|
||||||
func scrollToEndOfHistory() {
|
func scrollToEndOfHistory() {
|
||||||
let locationInput = ChatHistoryLocationInput(content: .Scroll(index: .upperBound, anchorIndex: .upperBound, sourceIndex: .lowerBound, scrollPosition: .top(0.0), animated: true), id: 0)
|
let locationInput = ChatHistoryLocationInput(content: .Scroll(index: .upperBound, anchorIndex: .upperBound, sourceIndex: .lowerBound, scrollPosition: .top(0.0), animated: true, highlight: false), id: 0)
|
||||||
|
|
||||||
let historyView = preloadedChatHistoryViewForLocation(locationInput, context: self.context, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, fixedCombinedReadStates: nil, tagMask: nil, additionalData: [])
|
let historyView = preloadedChatHistoryViewForLocation(locationInput, context: self.context, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, fixedCombinedReadStates: nil, tagMask: nil, additionalData: [])
|
||||||
let signal = historyView
|
let signal = historyView
|
||||||
@ -8253,7 +8253,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
|
|
||||||
func scrollToStartOfHistory() {
|
func scrollToStartOfHistory() {
|
||||||
let locationInput = ChatHistoryLocationInput(content: .Scroll(index: .lowerBound, anchorIndex: .lowerBound, sourceIndex: .upperBound, scrollPosition: .bottom(0.0), animated: true), id: 0)
|
let locationInput = ChatHistoryLocationInput(content: .Scroll(index: .lowerBound, anchorIndex: .lowerBound, sourceIndex: .upperBound, scrollPosition: .bottom(0.0), animated: true, highlight: false), id: 0)
|
||||||
|
|
||||||
let historyView = preloadedChatHistoryViewForLocation(locationInput, context: self.context, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, fixedCombinedReadStates: nil, tagMask: nil, additionalData: [])
|
let historyView = preloadedChatHistoryViewForLocation(locationInput, context: self.context, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, fixedCombinedReadStates: nil, tagMask: nil, additionalData: [])
|
||||||
let signal = historyView
|
let signal = historyView
|
||||||
@ -8400,9 +8400,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
|
|
||||||
let subject: ChatControllerSubject?
|
let subject: ChatControllerSubject?
|
||||||
if let atMessageId = atMessageId {
|
if let atMessageId = atMessageId {
|
||||||
subject = .message(atMessageId)
|
subject = .message(id: atMessageId, highlight: true)
|
||||||
} else if result.scrollToLowerBound {
|
} else if let index = result.scrollToLowerBoundMessage {
|
||||||
subject = .message(MessageId(peerId: result.message.messageId.peerId, namespace: Namespaces.Message.Cloud, id: 1))
|
subject = .message(id: index.id, highlight: false)
|
||||||
} else {
|
} else {
|
||||||
subject = nil
|
subject = nil
|
||||||
}
|
}
|
||||||
@ -8456,7 +8456,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
|
|
||||||
if case let .peer(peerId) = self.chatLocation, let messageId = messageLocation.messageId, (messageId.peerId != peerId && !forceInCurrentChat) || (self.presentationInterfaceState.isScheduledMessages && messageId.id != 0 && !Namespaces.Message.allScheduled.contains(messageId.namespace)) {
|
if case let .peer(peerId) = self.chatLocation, let messageId = messageLocation.messageId, (messageId.peerId != peerId && !forceInCurrentChat) || (self.presentationInterfaceState.isScheduledMessages && messageId.id != 0 && !Namespaces.Message.allScheduled.contains(messageId.namespace)) {
|
||||||
if let navigationController = self.effectiveNavigationController {
|
if let navigationController = self.effectiveNavigationController {
|
||||||
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: self.context, chatLocation: .peer(messageId.peerId), subject: .message(messageId), keepStack: .always))
|
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: self.context, chatLocation: .peer(messageId.peerId), subject: .message(id: messageId, highlight: true), keepStack: .always))
|
||||||
}
|
}
|
||||||
} else if forceInCurrentChat {
|
} else if forceInCurrentChat {
|
||||||
if let _ = fromId, let fromIndex = fromIndex, rememberInStack {
|
if let _ = fromId, let fromIndex = fromIndex, rememberInStack {
|
||||||
@ -8491,7 +8491,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
case .upperBound:
|
case .upperBound:
|
||||||
searchLocation = .index(MessageIndex.upperBound(peerId: self.chatLocation.peerId))
|
searchLocation = .index(MessageIndex.upperBound(peerId: self.chatLocation.peerId))
|
||||||
}
|
}
|
||||||
let historyView = preloadedChatHistoryViewForLocation(ChatHistoryLocationInput(content: .InitialSearch(location: searchLocation, count: 50), id: 0), context: self.context, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, fixedCombinedReadStates: nil, tagMask: nil, additionalData: [])
|
let historyView = preloadedChatHistoryViewForLocation(ChatHistoryLocationInput(content: .InitialSearch(location: searchLocation, count: 50, highlight: true), id: 0), context: self.context, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, fixedCombinedReadStates: nil, tagMask: nil, additionalData: [])
|
||||||
let signal = historyView
|
let signal = historyView
|
||||||
|> mapToSignal { historyView -> Signal<(MessageIndex?, Bool), NoError> in
|
|> mapToSignal { historyView -> Signal<(MessageIndex?, Bool), NoError> in
|
||||||
switch historyView {
|
switch historyView {
|
||||||
@ -8583,7 +8583,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
self.historyNavigationStack.add(fromIndex)
|
self.historyNavigationStack.add(fromIndex)
|
||||||
}
|
}
|
||||||
self.loadingMessage.set(true)
|
self.loadingMessage.set(true)
|
||||||
let historyView = preloadedChatHistoryViewForLocation(ChatHistoryLocationInput(content: .InitialSearch(location: searchLocation, count: 50), id: 0), context: self.context, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, fixedCombinedReadStates: nil, tagMask: nil, additionalData: [])
|
let historyView = preloadedChatHistoryViewForLocation(ChatHistoryLocationInput(content: .InitialSearch(location: searchLocation, count: 50, highlight: true), id: 0), context: self.context, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, fixedCombinedReadStates: nil, tagMask: nil, additionalData: [])
|
||||||
let signal = historyView
|
let signal = historyView
|
||||||
|> mapToSignal { historyView -> Signal<MessageIndex?, NoError> in
|
|> mapToSignal { historyView -> Signal<MessageIndex?, NoError> in
|
||||||
switch historyView {
|
switch historyView {
|
||||||
@ -8606,7 +8606,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
completion?()
|
completion?()
|
||||||
} else {
|
} else {
|
||||||
if let navigationController = strongSelf.effectiveNavigationController {
|
if let navigationController = strongSelf.effectiveNavigationController {
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(messageLocation.peerId), subject: messageLocation.messageId.flatMap { .message($0) }))
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(messageLocation.peerId), subject: messageLocation.messageId.flatMap { .message(id: $0, highlight: true) }))
|
||||||
}
|
}
|
||||||
completion?()
|
completion?()
|
||||||
}
|
}
|
||||||
@ -8618,7 +8618,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
if let navigationController = self.effectiveNavigationController {
|
if let navigationController = self.effectiveNavigationController {
|
||||||
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: self.context, chatLocation: .peer(messageLocation.peerId), subject: messageLocation.messageId.flatMap { .message($0) }))
|
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: self.context, chatLocation: .peer(messageLocation.peerId), subject: messageLocation.messageId.flatMap { .message(id: $0, highlight: true) }))
|
||||||
}
|
}
|
||||||
completion?()
|
completion?()
|
||||||
}
|
}
|
||||||
@ -9205,7 +9205,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
switch navigation {
|
switch navigation {
|
||||||
case let .chat(_, subject, peekData):
|
case let .chat(_, subject, peekData):
|
||||||
if case .peer(peerId) = strongSelf.chatLocation {
|
if case .peer(peerId) = strongSelf.chatLocation {
|
||||||
if let subject = subject, case let .message(messageId) = subject {
|
if let subject = subject, case let .message(messageId, _) = subject {
|
||||||
strongSelf.navigateToMessage(from: nil, to: .id(messageId))
|
strongSelf.navigateToMessage(from: nil, to: .id(messageId))
|
||||||
}
|
}
|
||||||
} else if let navigationController = strongSelf.effectiveNavigationController {
|
} else if let navigationController = strongSelf.effectiveNavigationController {
|
||||||
|
@ -83,7 +83,7 @@ public enum ChatHistoryListMode: Equatable {
|
|||||||
enum ChatHistoryViewScrollPosition {
|
enum ChatHistoryViewScrollPosition {
|
||||||
case unread(index: MessageIndex)
|
case unread(index: MessageIndex)
|
||||||
case positionRestoration(index: MessageIndex, relativeOffset: CGFloat)
|
case positionRestoration(index: MessageIndex, relativeOffset: CGFloat)
|
||||||
case index(index: MessageHistoryAnchorIndex, position: ListViewScrollPosition, directionHint: ListViewScrollToItemDirectionHint, animated: Bool)
|
case index(index: MessageHistoryAnchorIndex, position: ListViewScrollPosition, directionHint: ListViewScrollToItemDirectionHint, animated: Bool, highlight: Bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ChatHistoryViewUpdateType {
|
enum ChatHistoryViewUpdateType {
|
||||||
@ -399,9 +399,9 @@ private func extractAssociatedData(chatLocation: ChatLocation, view: MessageHist
|
|||||||
private extension ChatHistoryLocationInput {
|
private extension ChatHistoryLocationInput {
|
||||||
var isAtUpperBound: Bool {
|
var isAtUpperBound: Bool {
|
||||||
switch self.content {
|
switch self.content {
|
||||||
case .Navigation(index: .upperBound, anchorIndex: .upperBound, count: _):
|
case .Navigation(index: .upperBound, anchorIndex: .upperBound, count: _, highlight: _):
|
||||||
return true
|
return true
|
||||||
case .Scroll(index: .upperBound, anchorIndex: .upperBound, sourceIndex: _, scrollPosition: _, animated: _):
|
case .Scroll(index: .upperBound, anchorIndex: .upperBound, sourceIndex: _, scrollPosition: _, animated: _, highlight: _):
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
@ -795,10 +795,10 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
if let filteredEntries = historyView?.filteredEntries, let visibleRange = displayRange.visibleRange {
|
if let filteredEntries = historyView?.filteredEntries, let visibleRange = displayRange.visibleRange {
|
||||||
let lastEntry = filteredEntries[filteredEntries.count - 1 - visibleRange.lastIndex]
|
let lastEntry = filteredEntries[filteredEntries.count - 1 - visibleRange.lastIndex]
|
||||||
|
|
||||||
strongSelf.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Navigation(index: .message(lastEntry.index), anchorIndex: .message(lastEntry.index), count: historyMessageCount), id: (strongSelf.chatHistoryLocationValue?.id).flatMap({ $0 + 1 }) ?? 0)
|
strongSelf.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Navigation(index: .message(lastEntry.index), anchorIndex: .message(lastEntry.index), count: historyMessageCount, highlight: false), id: (strongSelf.chatHistoryLocationValue?.id).flatMap({ $0 + 1 }) ?? 0)
|
||||||
} else {
|
} else {
|
||||||
if let subject = subject, case let .message(messageId) = subject {
|
if let subject = subject, case let .message(messageId, highlight) = subject {
|
||||||
strongSelf.chatHistoryLocationValue = ChatHistoryLocationInput(content: .InitialSearch(location: .id(messageId), count: 60), id: (strongSelf.chatHistoryLocationValue?.id).flatMap({ $0 + 1 }) ?? 0)
|
strongSelf.chatHistoryLocationValue = ChatHistoryLocationInput(content: .InitialSearch(location: .id(messageId), count: 60, highlight: highlight), id: (strongSelf.chatHistoryLocationValue?.id).flatMap({ $0 + 1 }) ?? 0)
|
||||||
} else if var chatHistoryLocation = strongSelf.chatHistoryLocationValue {
|
} else if var chatHistoryLocation = strongSelf.chatHistoryLocationValue {
|
||||||
chatHistoryLocation.id += 1
|
chatHistoryLocation.id += 1
|
||||||
strongSelf.chatHistoryLocationValue = chatHistoryLocation
|
strongSelf.chatHistoryLocationValue = chatHistoryLocation
|
||||||
@ -886,10 +886,10 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
|
|
||||||
if scrollPosition == nil, let originalScrollPosition = originalScrollPosition {
|
if scrollPosition == nil, let originalScrollPosition = originalScrollPosition {
|
||||||
switch originalScrollPosition {
|
switch originalScrollPosition {
|
||||||
case let .index(index, position, _, _):
|
case let .index(index, position, _, _, highlight):
|
||||||
if case .upperBound = index {
|
if case .upperBound = index {
|
||||||
if let previous = previous, previous.filteredEntries.isEmpty {
|
if let previous = previous, previous.filteredEntries.isEmpty {
|
||||||
updatedScrollPosition = .index(index: index, position: position, directionHint: .Down, animated: false)
|
updatedScrollPosition = .index(index: index, position: position, directionHint: .Down, animated: false, highlight: highlight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -972,8 +972,8 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if let subject = subject, case let .message(messageId) = subject {
|
if let subject = subject, case let .message(messageId, highlight) = subject {
|
||||||
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .InitialSearch(location: .id(messageId), count: 60), id: 0)
|
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .InitialSearch(location: .id(messageId), count: 60, highlight: highlight), id: 0)
|
||||||
} else {
|
} else {
|
||||||
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Initial(count: 60), id: 0)
|
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Initial(count: 60), id: 0)
|
||||||
}
|
}
|
||||||
@ -1334,14 +1334,14 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
|
|
||||||
if let loaded = displayedRange.loadedRange, let firstEntry = historyView.filteredEntries.first, let lastEntry = historyView.filteredEntries.last {
|
if let loaded = displayedRange.loadedRange, let firstEntry = historyView.filteredEntries.first, let lastEntry = historyView.filteredEntries.last {
|
||||||
if loaded.firstIndex < 5 && historyView.originalView.laterId != nil {
|
if loaded.firstIndex < 5 && historyView.originalView.laterId != nil {
|
||||||
let locationInput: ChatHistoryLocation = .Navigation(index: .message(lastEntry.index), anchorIndex: .message(lastEntry.index), count: historyMessageCount)
|
let locationInput: ChatHistoryLocation = .Navigation(index: .message(lastEntry.index), anchorIndex: .message(lastEntry.index), count: historyMessageCount, highlight: false)
|
||||||
if self.chatHistoryLocationValue?.content != locationInput {
|
if self.chatHistoryLocationValue?.content != locationInput {
|
||||||
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: locationInput, id: self.takeNextHistoryLocationId())
|
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: locationInput, id: self.takeNextHistoryLocationId())
|
||||||
}
|
}
|
||||||
} else if loaded.firstIndex < 5, historyView.originalView.laterId == nil, !historyView.originalView.holeLater, let chatHistoryLocationValue = self.chatHistoryLocationValue, !chatHistoryLocationValue.isAtUpperBound, historyView.originalView.anchorIndex != .upperBound {
|
} else if loaded.firstIndex < 5, historyView.originalView.laterId == nil, !historyView.originalView.holeLater, let chatHistoryLocationValue = self.chatHistoryLocationValue, !chatHistoryLocationValue.isAtUpperBound, historyView.originalView.anchorIndex != .upperBound {
|
||||||
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Navigation(index: .upperBound, anchorIndex: .upperBound, count: historyMessageCount), id: self.takeNextHistoryLocationId())
|
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Navigation(index: .upperBound, anchorIndex: .upperBound, count: historyMessageCount, highlight: false), id: self.takeNextHistoryLocationId())
|
||||||
} else if loaded.lastIndex >= historyView.filteredEntries.count - 5 && historyView.originalView.earlierId != nil {
|
} else if loaded.lastIndex >= historyView.filteredEntries.count - 5 && historyView.originalView.earlierId != nil {
|
||||||
let locationInput: ChatHistoryLocation = .Navigation(index: .message(firstEntry.index), anchorIndex: .message(firstEntry.index), count: historyMessageCount)
|
let locationInput: ChatHistoryLocation = .Navigation(index: .message(firstEntry.index), anchorIndex: .message(firstEntry.index), count: historyMessageCount, highlight: false)
|
||||||
if self.chatHistoryLocationValue?.content != locationInput {
|
if self.chatHistoryLocationValue?.content != locationInput {
|
||||||
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: locationInput, id: self.takeNextHistoryLocationId())
|
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: locationInput, id: self.takeNextHistoryLocationId())
|
||||||
}
|
}
|
||||||
@ -1373,7 +1373,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
currentMessage = messages.first?.0
|
currentMessage = messages.first?.0
|
||||||
}
|
}
|
||||||
if let message = currentMessage, let anchorMessage = self.anchorMessageInCurrentHistoryView() {
|
if let message = currentMessage, let anchorMessage = self.anchorMessageInCurrentHistoryView() {
|
||||||
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Scroll(index: .message(message.index), anchorIndex: .message(message.index), sourceIndex: .upperBound, scrollPosition: .bottom(0.0), animated: true), id: self.takeNextHistoryLocationId())
|
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Scroll(index: .message(message.index), anchorIndex: .message(message.index), sourceIndex: .upperBound, scrollPosition: .bottom(0.0), animated: true, highlight: false), id: self.takeNextHistoryLocationId())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1402,13 +1402,13 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let currentMessage = currentMessage {
|
if let currentMessage = currentMessage {
|
||||||
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Scroll(index: .message(currentMessage.index), anchorIndex: .message(currentMessage.index), sourceIndex: .upperBound, scrollPosition: .top(0.0), animated: true), id: self.takeNextHistoryLocationId())
|
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Scroll(index: .message(currentMessage.index), anchorIndex: .message(currentMessage.index), sourceIndex: .upperBound, scrollPosition: .top(0.0), animated: true, highlight: true), id: self.takeNextHistoryLocationId())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func scrollToStartOfHistory() {
|
public func scrollToStartOfHistory() {
|
||||||
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Scroll(index: .lowerBound, anchorIndex: .lowerBound, sourceIndex: .upperBound, scrollPosition: .bottom(0.0), animated: true), id: self.takeNextHistoryLocationId())
|
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Scroll(index: .lowerBound, anchorIndex: .lowerBound, sourceIndex: .upperBound, scrollPosition: .bottom(0.0), animated: true, highlight: false), id: self.takeNextHistoryLocationId())
|
||||||
}
|
}
|
||||||
|
|
||||||
public func scrollToEndOfHistory() {
|
public func scrollToEndOfHistory() {
|
||||||
@ -1416,13 +1416,13 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
case .known(0.0):
|
case .known(0.0):
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
let locationInput = ChatHistoryLocationInput(content: .Scroll(index: .upperBound, anchorIndex: .upperBound, sourceIndex: .lowerBound, scrollPosition: .top(0.0), animated: true), id: self.takeNextHistoryLocationId())
|
let locationInput = ChatHistoryLocationInput(content: .Scroll(index: .upperBound, anchorIndex: .upperBound, sourceIndex: .lowerBound, scrollPosition: .top(0.0), animated: true, highlight: false), id: self.takeNextHistoryLocationId())
|
||||||
self.chatHistoryLocationValue = locationInput
|
self.chatHistoryLocationValue = locationInput
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func scrollToMessage(from fromIndex: MessageIndex, to toIndex: MessageIndex, animated: Bool, highlight: Bool = true, scrollPosition: ListViewScrollPosition = .center(.bottom)) {
|
public func scrollToMessage(from fromIndex: MessageIndex, to toIndex: MessageIndex, animated: Bool, highlight: Bool = true, scrollPosition: ListViewScrollPosition = .center(.bottom)) {
|
||||||
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Scroll(index: .message(toIndex), anchorIndex: .message(toIndex), sourceIndex: .message(fromIndex), scrollPosition: scrollPosition, animated: animated), id: self.takeNextHistoryLocationId())
|
self.chatHistoryLocationValue = ChatHistoryLocationInput(content: .Scroll(index: .message(toIndex), anchorIndex: .message(toIndex), sourceIndex: .message(fromIndex), scrollPosition: scrollPosition, animated: animated, highlight: highlight), id: self.takeNextHistoryLocationId())
|
||||||
}
|
}
|
||||||
|
|
||||||
public func anchorMessageInCurrentHistoryView() -> Message? {
|
public func anchorMessageInCurrentHistoryView() -> Message? {
|
||||||
|
@ -32,9 +32,9 @@ func chatHistoryViewForLocation(_ location: ChatHistoryLocationInput, context: A
|
|||||||
if scheduled {
|
if scheduled {
|
||||||
var first = true
|
var first = true
|
||||||
var chatScrollPosition: ChatHistoryViewScrollPosition?
|
var chatScrollPosition: ChatHistoryViewScrollPosition?
|
||||||
if case let .Scroll(index, _, sourceIndex, position, animated) = location.content {
|
if case let .Scroll(index, _, sourceIndex, position, animated, highlight) = location.content {
|
||||||
let directionHint: ListViewScrollToItemDirectionHint = sourceIndex > index ? .Down : .Up
|
let directionHint: ListViewScrollToItemDirectionHint = sourceIndex > index ? .Down : .Up
|
||||||
chatScrollPosition = .index(index: index, position: position, directionHint: directionHint, animated: animated)
|
chatScrollPosition = .index(index: index, position: position, directionHint: directionHint, animated: animated, highlight: highlight)
|
||||||
}
|
}
|
||||||
return account.viewTracker.scheduledMessagesViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder), additionalData: additionalData)
|
return account.viewTracker.scheduledMessagesViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder), additionalData: additionalData)
|
||||||
|> map { view, updateType, initialData -> ChatHistoryViewUpdate in
|
|> map { view, updateType, initialData -> ChatHistoryViewUpdate in
|
||||||
@ -146,7 +146,7 @@ func chatHistoryViewForLocation(_ location: ChatHistoryLocationInput, context: A
|
|||||||
return .HistoryView(view: view, type: .Initial(fadeIn: fadeIn), scrollPosition: scrollPosition, flashIndicators: false, originalScrollPosition: nil, initialData: ChatHistoryCombinedInitialData(initialData: initialData, buttonKeyboardMessage: view.topTaggedMessages.first, cachedData: cachedData, cachedDataMessages: cachedDataMessages, readStateData: readStateData), id: location.id)
|
return .HistoryView(view: view, type: .Initial(fadeIn: fadeIn), scrollPosition: scrollPosition, flashIndicators: false, originalScrollPosition: nil, initialData: ChatHistoryCombinedInitialData(initialData: initialData, buttonKeyboardMessage: view.topTaggedMessages.first, cachedData: cachedData, cachedDataMessages: cachedDataMessages, readStateData: readStateData), id: location.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case let .InitialSearch(searchLocation, count):
|
case let .InitialSearch(searchLocation, count, highlight):
|
||||||
var preloaded = false
|
var preloaded = false
|
||||||
var fadeIn = false
|
var fadeIn = false
|
||||||
|
|
||||||
@ -198,10 +198,10 @@ func chatHistoryViewForLocation(_ location: ChatHistoryLocationInput, context: A
|
|||||||
}
|
}
|
||||||
|
|
||||||
preloaded = true
|
preloaded = true
|
||||||
return .HistoryView(view: view, type: reportUpdateType, scrollPosition: .index(index: anchorIndex, position: .center(.bottom), directionHint: .Down, animated: false), flashIndicators: false, originalScrollPosition: nil, initialData: ChatHistoryCombinedInitialData(initialData: initialData, buttonKeyboardMessage: view.topTaggedMessages.first, cachedData: cachedData, cachedDataMessages: cachedDataMessages, readStateData: readStateData), id: location.id)
|
return .HistoryView(view: view, type: reportUpdateType, scrollPosition: .index(index: anchorIndex, position: .center(.bottom), directionHint: .Down, animated: false, highlight: highlight), flashIndicators: false, originalScrollPosition: nil, initialData: ChatHistoryCombinedInitialData(initialData: initialData, buttonKeyboardMessage: view.topTaggedMessages.first, cachedData: cachedData, cachedDataMessages: cachedDataMessages, readStateData: readStateData), id: location.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case let .Navigation(index, anchorIndex, count):
|
case let .Navigation(index, anchorIndex, count, highlight):
|
||||||
var first = true
|
var first = true
|
||||||
return account.viewTracker.aroundMessageHistoryViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder), index: index, anchorIndex: anchorIndex, count: count, fixedCombinedReadStates: fixedCombinedReadStates, tagMask: tagMask, orderStatistics: orderStatistics, additionalData: additionalData) |> map { view, updateType, initialData -> ChatHistoryViewUpdate in
|
return account.viewTracker.aroundMessageHistoryViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder), index: index, anchorIndex: anchorIndex, count: count, fixedCombinedReadStates: fixedCombinedReadStates, tagMask: tagMask, orderStatistics: orderStatistics, additionalData: additionalData) |> map { view, updateType, initialData -> ChatHistoryViewUpdate in
|
||||||
let (cachedData, cachedDataMessages, readStateData) = extractAdditionalData(view: view, chatLocation: chatLocation)
|
let (cachedData, cachedDataMessages, readStateData) = extractAdditionalData(view: view, chatLocation: chatLocation)
|
||||||
@ -215,9 +215,9 @@ func chatHistoryViewForLocation(_ location: ChatHistoryLocationInput, context: A
|
|||||||
}
|
}
|
||||||
return .HistoryView(view: view, type: .Generic(type: genericType), scrollPosition: nil, flashIndicators: false, originalScrollPosition: nil, initialData: ChatHistoryCombinedInitialData(initialData: initialData, buttonKeyboardMessage: view.topTaggedMessages.first, cachedData: cachedData, cachedDataMessages: cachedDataMessages, readStateData: readStateData), id: location.id)
|
return .HistoryView(view: view, type: .Generic(type: genericType), scrollPosition: nil, flashIndicators: false, originalScrollPosition: nil, initialData: ChatHistoryCombinedInitialData(initialData: initialData, buttonKeyboardMessage: view.topTaggedMessages.first, cachedData: cachedData, cachedDataMessages: cachedDataMessages, readStateData: readStateData), id: location.id)
|
||||||
}
|
}
|
||||||
case let .Scroll(index, anchorIndex, sourceIndex, scrollPosition, animated):
|
case let .Scroll(index, anchorIndex, sourceIndex, scrollPosition, animated, highlight):
|
||||||
let directionHint: ListViewScrollToItemDirectionHint = sourceIndex > index ? .Down : .Up
|
let directionHint: ListViewScrollToItemDirectionHint = sourceIndex > index ? .Down : .Up
|
||||||
let chatScrollPosition = ChatHistoryViewScrollPosition.index(index: index, position: scrollPosition, directionHint: directionHint, animated: animated)
|
let chatScrollPosition = ChatHistoryViewScrollPosition.index(index: index, position: scrollPosition, directionHint: directionHint, animated: animated, highlight: highlight)
|
||||||
var first = true
|
var first = true
|
||||||
return account.viewTracker.aroundMessageHistoryViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder), index: index, anchorIndex: anchorIndex, count: 128, fixedCombinedReadStates: fixedCombinedReadStates, tagMask: tagMask, orderStatistics: orderStatistics, additionalData: additionalData)
|
return account.viewTracker.aroundMessageHistoryViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder), index: index, anchorIndex: anchorIndex, count: 128, fixedCombinedReadStates: fixedCombinedReadStates, tagMask: tagMask, orderStatistics: orderStatistics, additionalData: additionalData)
|
||||||
|> map { view, updateType, initialData -> ChatHistoryViewUpdate in
|
|> map { view, updateType, initialData -> ChatHistoryViewUpdate in
|
||||||
@ -305,7 +305,7 @@ struct ReplyThreadInfo {
|
|||||||
var message: ChatReplyThreadMessage
|
var message: ChatReplyThreadMessage
|
||||||
var isChannelPost: Bool
|
var isChannelPost: Bool
|
||||||
var isEmpty: Bool
|
var isEmpty: Bool
|
||||||
var scrollToLowerBound: Bool
|
var scrollToLowerBoundMessage: MessageIndex?
|
||||||
var contextHolder: Atomic<ChatLocationContextHolder?>
|
var contextHolder: Atomic<ChatLocationContextHolder?>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,12 +326,12 @@ func fetchAndPreloadReplyThreadInfo(context: AccountContext, subject: ReplyThrea
|
|||||||
let chatLocationContextHolder = Atomic<ChatLocationContextHolder?>(value: nil)
|
let chatLocationContextHolder = Atomic<ChatLocationContextHolder?>(value: nil)
|
||||||
|
|
||||||
let input: ChatHistoryLocationInput
|
let input: ChatHistoryLocationInput
|
||||||
let scrollToLowerBound: Bool
|
var scrollToLowerBoundMessage: MessageIndex?
|
||||||
switch replyThreadMessage.initialAnchor {
|
switch replyThreadMessage.initialAnchor {
|
||||||
case .automatic:
|
case .automatic:
|
||||||
if let atMessageId = atMessageId {
|
if let atMessageId = atMessageId {
|
||||||
input = ChatHistoryLocationInput(
|
input = ChatHistoryLocationInput(
|
||||||
content: .InitialSearch(location: .id(atMessageId), count: 40),
|
content: .InitialSearch(location: .id(atMessageId), count: 40, highlight: true),
|
||||||
id: 0
|
id: 0
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@ -340,13 +340,12 @@ func fetchAndPreloadReplyThreadInfo(context: AccountContext, subject: ReplyThrea
|
|||||||
id: 0
|
id: 0
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
scrollToLowerBound = false
|
case let .lowerBoundMessage(index):
|
||||||
case .lowerBound:
|
|
||||||
input = ChatHistoryLocationInput(
|
input = ChatHistoryLocationInput(
|
||||||
content: .Navigation(index: .lowerBound, anchorIndex: .lowerBound, count: 40),
|
content: .Navigation(index: .message(index), anchorIndex: .message(index), count: 40, highlight: false),
|
||||||
id: 0
|
id: 0
|
||||||
)
|
)
|
||||||
scrollToLowerBound = true
|
scrollToLowerBoundMessage = index
|
||||||
}
|
}
|
||||||
|
|
||||||
let preloadSignal = preloadedChatHistoryViewForLocation(
|
let preloadSignal = preloadedChatHistoryViewForLocation(
|
||||||
@ -380,7 +379,7 @@ func fetchAndPreloadReplyThreadInfo(context: AccountContext, subject: ReplyThrea
|
|||||||
message: replyThreadMessage,
|
message: replyThreadMessage,
|
||||||
isChannelPost: replyThreadMessage.isChannelPost,
|
isChannelPost: replyThreadMessage.isChannelPost,
|
||||||
isEmpty: isEmpty,
|
isEmpty: isEmpty,
|
||||||
scrollToLowerBound: scrollToLowerBound,
|
scrollToLowerBoundMessage: scrollToLowerBoundMessage,
|
||||||
contextHolder: chatLocationContextHolder
|
contextHolder: chatLocationContextHolder
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1127,7 +1127,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
for attribute in item.content.firstMessage.attributes {
|
for attribute in item.content.firstMessage.attributes {
|
||||||
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
||||||
openPeerId = attribute.messageId.peerId
|
openPeerId = attribute.messageId.peerId
|
||||||
navigate = .chat(textInputState: nil, subject: .message(attribute.messageId), peekData: nil)
|
navigate = .chat(textInputState: nil, subject: .message(id: attribute.messageId, highlight: true), peekData: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1259,7 +1259,9 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if item.content.firstMessage.id.peerId.isRepliesOrSavedMessages(accountPeerId: item.context.account.peerId) {
|
if item.content.firstMessage.id.peerId.isReplies {
|
||||||
|
item.controllerInteraction.openReplyThreadOriginalMessage(item.content.firstMessage)
|
||||||
|
} else if item.content.firstMessage.id.peerId.isRepliesOrSavedMessages(accountPeerId: item.context.account.peerId) {
|
||||||
for attribute in item.content.firstMessage.attributes {
|
for attribute in item.content.firstMessage.attributes {
|
||||||
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
||||||
item.controllerInteraction.navigateToMessage(item.content.firstMessage.id, attribute.messageId)
|
item.controllerInteraction.navigateToMessage(item.content.firstMessage.id, attribute.messageId)
|
||||||
|
@ -2502,7 +2502,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
|||||||
for attribute in item.content.firstMessage.attributes {
|
for attribute in item.content.firstMessage.attributes {
|
||||||
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
||||||
openPeerId = attribute.messageId.peerId
|
openPeerId = attribute.messageId.peerId
|
||||||
navigate = .chat(textInputState: nil, subject: .message(attribute.messageId), peekData: nil)
|
navigate = .chat(textInputState: nil, subject: .message(id: attribute.messageId, highlight: true), peekData: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
|||||||
for attribute in item.content.firstMessage.attributes {
|
for attribute in item.content.firstMessage.attributes {
|
||||||
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
||||||
openPeerId = attribute.messageId.peerId
|
openPeerId = attribute.messageId.peerId
|
||||||
navigate = .chat(textInputState: nil, subject: .message(attribute.messageId), peekData: nil)
|
navigate = .chat(textInputState: nil, subject: .message(id: attribute.messageId, highlight: true), peekData: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,7 +754,9 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if item.content.firstMessage.id.peerId.isRepliesOrSavedMessages(accountPeerId: item.context.account.peerId) {
|
if item.content.firstMessage.id.peerId.isReplies {
|
||||||
|
item.controllerInteraction.openReplyThreadOriginalMessage(item.content.firstMessage)
|
||||||
|
} else if item.content.firstMessage.id.peerId.isRepliesOrSavedMessages(accountPeerId: item.context.account.peerId) {
|
||||||
for attribute in item.content.firstMessage.attributes {
|
for attribute in item.content.firstMessage.attributes {
|
||||||
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
||||||
item.controllerInteraction.navigateToMessage(item.content.firstMessage.id, attribute.messageId)
|
item.controllerInteraction.navigateToMessage(item.content.firstMessage.id, attribute.messageId)
|
||||||
|
@ -735,7 +735,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
for attribute in item.content.firstMessage.attributes {
|
for attribute in item.content.firstMessage.attributes {
|
||||||
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
||||||
openPeerId = attribute.messageId.peerId
|
openPeerId = attribute.messageId.peerId
|
||||||
navigate = .chat(textInputState: nil, subject: .message(attribute.messageId), peekData: nil)
|
navigate = .chat(textInputState: nil, subject: .message(id: attribute.messageId, highlight: true), peekData: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -820,7 +820,9 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if item.content.firstMessage.id.peerId.isRepliesOrSavedMessages(accountPeerId: item.context.account.peerId) {
|
if item.content.firstMessage.id.peerId.isReplies {
|
||||||
|
item.controllerInteraction.openReplyThreadOriginalMessage(item.content.firstMessage)
|
||||||
|
} else if item.content.firstMessage.id.peerId.isRepliesOrSavedMessages(accountPeerId: item.context.account.peerId) {
|
||||||
for attribute in item.content.firstMessage.attributes {
|
for attribute in item.content.firstMessage.attributes {
|
||||||
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
if let attribute = attribute as? SourceReferenceMessageAttribute {
|
||||||
item.controllerInteraction.navigateToMessage(item.content.firstMessage.id, attribute.messageId)
|
item.controllerInteraction.navigateToMessage(item.content.firstMessage.id, attribute.messageId)
|
||||||
|
@ -815,11 +815,11 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
|
|||||||
break
|
break
|
||||||
case let .channelMessage(peerId, messageId):
|
case let .channelMessage(peerId, messageId):
|
||||||
if let navigationController = strongSelf.getNavigationController() {
|
if let navigationController = strongSelf.getNavigationController() {
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(peerId), subject: .message(messageId)))
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(peerId), subject: .message(id: messageId, highlight: true)))
|
||||||
}
|
}
|
||||||
case let .replyThreadMessage(replyThreadMessage, messageId):
|
case let .replyThreadMessage(replyThreadMessage, messageId):
|
||||||
if let navigationController = strongSelf.getNavigationController() {
|
if let navigationController = strongSelf.getNavigationController() {
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .replyThread(replyThreadMessage), subject: .message(messageId)))
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .replyThread(replyThreadMessage), subject: .message(id: messageId, highlight: true)))
|
||||||
}
|
}
|
||||||
case let .stickerPack(name):
|
case let .stickerPack(name):
|
||||||
let packReference: StickerPackReference = .name(name)
|
let packReference: StickerPackReference = .name(name)
|
||||||
|
@ -196,7 +196,7 @@ class ChatSearchResultsControllerNode: ViewControllerTracingNode, UIScrollViewDe
|
|||||||
switch item.content {
|
switch item.content {
|
||||||
case let .peer(peer):
|
case let .peer(peer):
|
||||||
if let message = peer.messages.first {
|
if let message = peer.messages.first {
|
||||||
let chatController = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(peer.peer.peerId), subject: .message(message.id), botStart: nil, mode: .standard(previewing: true))
|
let chatController = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(peer.peer.peerId), subject: .message(id: message.id, highlight: true), botStart: nil, mode: .standard(previewing: true))
|
||||||
chatController.canReadHistory.set(false)
|
chatController.canReadHistory.set(false)
|
||||||
let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node)), items: .single([]), reactionItems: [], gesture: gesture)
|
let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node)), items: .single([]), reactionItems: [], gesture: gesture)
|
||||||
presentInGlobalOverlay(contextController)
|
presentInGlobalOverlay(contextController)
|
||||||
|
@ -20,7 +20,7 @@ public func navigateToChatControllerImpl(_ params: NavigateToChatControllerParam
|
|||||||
if let updateTextInputState = params.updateTextInputState {
|
if let updateTextInputState = params.updateTextInputState {
|
||||||
controller.updateTextInputState(updateTextInputState)
|
controller.updateTextInputState(updateTextInputState)
|
||||||
}
|
}
|
||||||
if let subject = params.subject, case let .message(messageId) = subject {
|
if let subject = params.subject, case let .message(messageId, _) = subject {
|
||||||
let navigationController = params.navigationController
|
let navigationController = params.navigationController
|
||||||
let animated = params.animated
|
let animated = params.animated
|
||||||
controller.navigateToMessage(messageLocation: .id(messageId), animated: isFirst, completion: { [weak navigationController, weak controller] in
|
controller.navigateToMessage(messageLocation: .id(messageId), animated: isFirst, completion: { [weak navigationController, weak controller] in
|
||||||
|
@ -89,7 +89,7 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
|||||||
dismissInput()
|
dismissInput()
|
||||||
navigationController?.pushViewController(controller)
|
navigationController?.pushViewController(controller)
|
||||||
case let .channelMessage(peerId, messageId):
|
case let .channelMessage(peerId, messageId):
|
||||||
openPeer(peerId, .chat(textInputState: nil, subject: .message(messageId), peekData: nil))
|
openPeer(peerId, .chat(textInputState: nil, subject: .message(id: messageId, highlight: true), peekData: nil))
|
||||||
case let .replyThreadMessage(replyThreadMessage, messageId):
|
case let .replyThreadMessage(replyThreadMessage, messageId):
|
||||||
if let navigationController = navigationController {
|
if let navigationController = navigationController {
|
||||||
let _ = ChatControllerImpl.openMessageReplies(context: context, navigationController: navigationController, present: { c, a in
|
let _ = ChatControllerImpl.openMessageReplies(context: context, navigationController: navigationController, present: { c, a in
|
||||||
|
@ -165,7 +165,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, UIGestu
|
|||||||
|
|
||||||
let chatLocationContextHolder = Atomic<ChatLocationContextHolder?>(value: nil)
|
let chatLocationContextHolder = Atomic<ChatLocationContextHolder?>(value: nil)
|
||||||
|
|
||||||
self.historyNode = ChatHistoryListNode(context: context, chatLocation: .peer(peerId), chatLocationContextHolder: chatLocationContextHolder, tagMask: tagMask, subject: .message(initialMessageId), controllerInteraction: self.controllerInteraction, selectedMessages: .single(nil), mode: .list(search: false, reversed: self.currentIsReversed, displayHeaders: .none, hintLinks: false, isGlobalSearch: isGlobalSearch))
|
self.historyNode = ChatHistoryListNode(context: context, chatLocation: .peer(peerId), chatLocationContextHolder: chatLocationContextHolder, tagMask: tagMask, subject: .message(id: initialMessageId, highlight: true), controllerInteraction: self.controllerInteraction, selectedMessages: .single(nil), mode: .list(search: false, reversed: self.currentIsReversed, displayHeaders: .none, hintLinks: false, isGlobalSearch: isGlobalSearch))
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, UIGestu
|
|||||||
}
|
}
|
||||||
|
|
||||||
let chatLocationContextHolder = Atomic<ChatLocationContextHolder?>(value: nil)
|
let chatLocationContextHolder = Atomic<ChatLocationContextHolder?>(value: nil)
|
||||||
let historyNode = ChatHistoryListNode(context: self.context, chatLocation: .peer(self.peerId), chatLocationContextHolder: chatLocationContextHolder, tagMask: tagMask, subject: .message(messageId), 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, chatLocation: .peer(self.peerId), chatLocationContextHolder: chatLocationContextHolder, tagMask: tagMask, subject: .message(id: messageId, highlight: true), controllerInteraction: self.controllerInteraction, selectedMessages: .single(nil), mode: .list(search: false, reversed: self.currentIsReversed, displayHeaders: .none, hintLinks: false, isGlobalSearch: self.isGlobalSearch))
|
||||||
historyNode.preloadPages = true
|
historyNode.preloadPages = true
|
||||||
historyNode.stackFromBottom = true
|
historyNode.stackFromBottom = true
|
||||||
historyNode.updateFloatingHeaderOffset = { [weak self] offset, _ in
|
historyNode.updateFloatingHeaderOffset = { [weak self] offset, _ in
|
||||||
|
@ -256,7 +256,7 @@ final class PeerInfoListPaneNode: ASDisplayNode, PeerInfoPaneNode {
|
|||||||
}
|
}
|
||||||
if let id = state.id as? PeerMessagesMediaPlaylistItemId {
|
if let id = state.id as? PeerMessagesMediaPlaylistItemId {
|
||||||
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), id: 0), context: strongSelf.context, chatLocation: .peer(id.messageId.peerId), 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.messageId.peerId), 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 }
|
||||||
|
@ -1600,7 +1600,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.SharedMedia_ViewInChat, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/GoToMessage"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
|
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.SharedMedia_ViewInChat, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/GoToMessage"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
|
||||||
c.dismiss(completion: {
|
c.dismiss(completion: {
|
||||||
if let strongSelf = self, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
|
if let strongSelf = self, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(strongSelf.peerId), subject: .message(message.id)))
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(strongSelf.peerId), subject: .message(id: message.id, highlight: true)))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})))
|
})))
|
||||||
@ -1703,7 +1703,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
items.append(.action(ContextMenuActionItem(text: strings.SharedMedia_ViewInChat, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/GoToMessage"), color: theme.contextMenu.primaryColor) }, action: { c, f in
|
items.append(.action(ContextMenuActionItem(text: strings.SharedMedia_ViewInChat, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/GoToMessage"), color: theme.contextMenu.primaryColor) }, action: { c, f in
|
||||||
c.dismiss(completion: {
|
c.dismiss(completion: {
|
||||||
if let strongSelf = self, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
|
if let strongSelf = self, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(strongSelf.peerId), subject: .message(message.id)))
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(strongSelf.peerId), subject: .message(id: message.id, highlight: true)))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})))
|
})))
|
||||||
|
@ -143,8 +143,8 @@ func preparedChatHistoryViewTransition(from fromView: ChatHistoryView?, to toVie
|
|||||||
index += 1
|
index += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case let .index(scrollIndex, position, directionHint, animated):
|
case let .index(scrollIndex, position, directionHint, animated, highlight):
|
||||||
if case .center = position {
|
if case .center = position, highlight {
|
||||||
scrolledToIndex = scrollIndex
|
scrolledToIndex = scrollIndex
|
||||||
}
|
}
|
||||||
var index = toView.filteredEntries.count - 1
|
var index = toView.filteredEntries.count - 1
|
||||||
|
@ -57,7 +57,7 @@ func handleTextLinkActionImpl(context: AccountContext, peerId: PeerId?, navigate
|
|||||||
openResolvedPeerImpl(peerId, .default)
|
openResolvedPeerImpl(peerId, .default)
|
||||||
case let .channelMessage(peerId, messageId):
|
case let .channelMessage(peerId, messageId):
|
||||||
if let navigationController = controller.navigationController as? NavigationController {
|
if let navigationController = controller.navigationController as? NavigationController {
|
||||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peerId), subject: .message(messageId)))
|
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peerId), subject: .message(id: messageId, highlight: true)))
|
||||||
}
|
}
|
||||||
case let .replyThreadMessage(replyThreadMessage, messageId):
|
case let .replyThreadMessage(replyThreadMessage, messageId):
|
||||||
if let navigationController = controller.navigationController as? NavigationController {
|
if let navigationController = controller.navigationController as? NavigationController {
|
||||||
|
@ -383,7 +383,7 @@ private func resolveInternalUrl(account: Account, url: ParsedInternalUrl) -> Sig
|
|||||||
return .replyThreadMessage(replyThreadMessage: result, messageId: messageId)
|
return .replyThreadMessage(replyThreadMessage: result, messageId: messageId)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return .single(.peer(foundPeer.id, .chat(textInputState: nil, subject: .message(messageId), peekData: nil)))
|
return .single(.peer(foundPeer.id, .chat(textInputState: nil, subject: .message(id: messageId, highlight: true), peekData: nil)))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return .single(.inaccessiblePeer)
|
return .single(.inaccessiblePeer)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user