mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Merge commit 'd8a1e46218e7289aff55e6b211dc002262ac9cd2'
This commit is contained in:
commit
d43b84497c
@ -4037,9 +4037,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
})], parseMarkdown: true), in: .window(.root), with: nil)
|
||||
}
|
||||
})
|
||||
}, requestMessageUpdate: { [weak self] id in
|
||||
}, requestMessageUpdate: { [weak self] id, scroll in
|
||||
if let strongSelf = self {
|
||||
strongSelf.chatDisplayNode.historyNode.requestMessageUpdate(id)
|
||||
strongSelf.chatDisplayNode.historyNode.requestMessageUpdate(id, andScrollToItem: scroll)
|
||||
}
|
||||
}, cancelInteractiveKeyboardGestures: { [weak self] in
|
||||
(self?.view.window as? WindowHost)?.cancelInteractiveKeyboardGestures()
|
||||
|
@ -142,7 +142,7 @@ public final class ChatControllerInteraction {
|
||||
let openJoinLink: (String) -> Void
|
||||
let openWebView: (String, String, Bool, Bool) -> Void
|
||||
|
||||
let requestMessageUpdate: (MessageId) -> Void
|
||||
let requestMessageUpdate: (MessageId, Bool) -> Void
|
||||
let cancelInteractiveKeyboardGestures: () -> Void
|
||||
let dismissTextInput: () -> Void
|
||||
let scrollToMessageId: (MessageIndex) -> Void
|
||||
@ -248,7 +248,7 @@ public final class ChatControllerInteraction {
|
||||
openLargeEmojiInfo: @escaping (String, String?, TelegramMediaFile) -> Void,
|
||||
openJoinLink: @escaping (String) -> Void,
|
||||
openWebView: @escaping (String, String, Bool, Bool) -> Void,
|
||||
requestMessageUpdate: @escaping (MessageId) -> Void,
|
||||
requestMessageUpdate: @escaping (MessageId, Bool) -> Void,
|
||||
cancelInteractiveKeyboardGestures: @escaping () -> Void,
|
||||
dismissTextInput: @escaping () -> Void,
|
||||
scrollToMessageId: @escaping (MessageIndex) -> Void,
|
||||
|
@ -3111,7 +3111,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
}
|
||||
}
|
||||
|
||||
func requestMessageUpdate(_ id: MessageId) {
|
||||
func requestMessageUpdate(_ id: MessageId, andScrollToItem scroll: Bool = false) {
|
||||
if let historyView = self.historyView {
|
||||
var messageItem: ChatMessageItem?
|
||||
self.forEachItemNode({ itemNode in
|
||||
@ -3150,7 +3150,13 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
item = ListMessageItem(presentationData: presentationData, context: self.context, chatLocation: self.chatLocation, interaction: ListMessageItemInteraction(controllerInteraction: self.controllerInteraction), message: message, selection: selection, displayHeader: displayHeader, hintIsLink: hintLinks, isGlobalSearchResult: isGlobalSearch)
|
||||
}
|
||||
let updateItem = ListViewUpdateItem(index: index, previousIndex: index, item: item, directionHint: nil)
|
||||
self.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [updateItem], options: [.AnimateInsertion], scrollToItem: nil, additionalScrollDistance: 0.0, updateSizeAndInsets: nil, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
|
||||
|
||||
var scrollToItem: ListViewScrollToItem?
|
||||
if scroll {
|
||||
scrollToItem = ListViewScrollToItem(index: index, position: .center(.top), animated: true, curve: .Spring(duration: 0.4), directionHint: .Down, displayLink: true)
|
||||
}
|
||||
|
||||
self.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [updateItem], options: [.AnimateInsertion], scrollToItem: scrollToItem, additionalScrollDistance: 0.0, updateSizeAndInsets: nil, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
|
||||
break loop
|
||||
}
|
||||
default:
|
||||
|
@ -49,7 +49,7 @@ class ChatMessageFileBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
|
||||
self.interactiveFileNode.requestUpdateLayout = { [weak self] _ in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id)
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id, false)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,27 +67,29 @@ class ChatMessageInstantVideoBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
|
||||
self.interactiveVideoNode.requestUpdateLayout = { [weak self] _ in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id)
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id, false)
|
||||
}
|
||||
}
|
||||
self.interactiveVideoNode.updateTranscriptionExpanded = { [weak self] state in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
let previous = strongSelf.audioTranscriptionState
|
||||
strongSelf.audioTranscriptionState = state
|
||||
strongSelf.interactiveFileNode.audioTranscriptionState = state
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id)
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id, state != .inProgress && previous != state)
|
||||
}
|
||||
}
|
||||
self.interactiveVideoNode.updateTranscriptionText = { [weak self] text in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
strongSelf.interactiveFileNode.forcedAudioTranscriptionText = text
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id)
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id, false)
|
||||
}
|
||||
}
|
||||
self.interactiveFileNode.updateTranscriptionExpanded = { [weak self] state in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
let previous = strongSelf.audioTranscriptionState
|
||||
strongSelf.audioTranscriptionState = state
|
||||
strongSelf.interactiveVideoNode.audioTranscriptionState = state
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id)
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id, previous != state)
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,7 +107,7 @@ class ChatMessageInstantVideoBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
|
||||
self.interactiveFileNode.requestUpdateLayout = { [weak self] _ in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id)
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id, false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,10 +277,6 @@ class ChatMessageInstantVideoBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
strongSelf.item = item
|
||||
strongSelf.isExpanded = isExpanded
|
||||
|
||||
if currentExpanded != isExpanded {
|
||||
item.controllerInteraction.scrollToMessageId(item.message.index)
|
||||
}
|
||||
|
||||
if firstTime {
|
||||
strongSelf.interactiveFileNode.isHidden = true
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
if let strongSelf = self {
|
||||
strongSelf.timeoutTimer?.0.invalidate()
|
||||
strongSelf.timeoutTimer = nil
|
||||
item.controllerInteraction.requestMessageUpdate(item.message.id)
|
||||
item.controllerInteraction.requestMessageUpdate(item.message.id, false)
|
||||
}
|
||||
}, queue: Queue.mainQueue())
|
||||
strongSelf.timeoutTimer = (timer, timeoutDeadline)
|
||||
|
@ -103,7 +103,7 @@ final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
self.contentNode.requestUpdateLayout = { [weak self] in
|
||||
if let strongSelf = self, let item = strongSelf.item {
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id)
|
||||
let _ = item.controllerInteraction.requestMessageUpdate(item.message.id, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
|
||||
}, openLargeEmojiInfo: { _, _, _ in
|
||||
}, openJoinLink: { _ in
|
||||
}, openWebView: { _, _, _, _ in
|
||||
}, requestMessageUpdate: { _ in
|
||||
}, requestMessageUpdate: { _, _ in
|
||||
}, cancelInteractiveKeyboardGestures: {
|
||||
}, dismissTextInput: {
|
||||
}, scrollToMessageId: { _ in
|
||||
|
@ -161,7 +161,7 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
|
||||
}, openLargeEmojiInfo: { _, _, _ in
|
||||
}, openJoinLink: { _ in
|
||||
}, openWebView: { _, _, _, _ in
|
||||
}, requestMessageUpdate: { _ in
|
||||
}, requestMessageUpdate: { _, _ in
|
||||
}, cancelInteractiveKeyboardGestures: {
|
||||
}, dismissTextInput: {
|
||||
}, scrollToMessageId: { _ in
|
||||
|
@ -154,7 +154,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, UIGestu
|
||||
}, openLargeEmojiInfo: { _, _, _ in
|
||||
}, openJoinLink: { _ in
|
||||
}, openWebView: { _, _, _, _ in
|
||||
}, requestMessageUpdate: { _ in
|
||||
}, requestMessageUpdate: { _, _ in
|
||||
}, cancelInteractiveKeyboardGestures: {
|
||||
}, dismissTextInput: {
|
||||
}, scrollToMessageId: { _ in
|
||||
|
@ -2592,7 +2592,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
}, openLargeEmojiInfo: { _, _, _ in
|
||||
}, openJoinLink: { _ in
|
||||
}, openWebView: { _, _, _, _ in
|
||||
}, requestMessageUpdate: { _ in
|
||||
}, requestMessageUpdate: { _, _ in
|
||||
}, cancelInteractiveKeyboardGestures: {
|
||||
}, dismissTextInput: {
|
||||
}, scrollToMessageId: { _ in
|
||||
|
@ -1348,7 +1348,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
}, openLargeEmojiInfo: { _, _, _ in
|
||||
}, openJoinLink: { _ in
|
||||
}, openWebView: { _, _, _, _ in
|
||||
}, requestMessageUpdate: { _ in
|
||||
}, requestMessageUpdate: { _, _ in
|
||||
}, cancelInteractiveKeyboardGestures: {
|
||||
}, dismissTextInput: {
|
||||
}, scrollToMessageId: { _ in
|
||||
|
Loading…
x
Reference in New Issue
Block a user