Disable two-finger selection in chat preview

This commit is contained in:
Ilya Laktyushin 2021-02-15 02:03:52 +04:00
parent 16ddcccc14
commit eabc08372b
2 changed files with 12 additions and 5 deletions

View File

@ -1158,6 +1158,14 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
previewing = false
}
var isSelectionEnabled = true
if previewing {
isSelectionEnabled = false
} else if case .pinnedMessages = self.chatPresentationInterfaceState.subject {
isSelectionEnabled = false
}
self.historyNode.isSelectionGestureEnabled = isSelectionEnabled
var inputPanelSize: CGSize?
var immediatelyLayoutInputPanelAndAnimateAppearance = false
var secondaryInputPanelSize: CGSize?

View File

@ -573,7 +573,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
}
}
}
private(set) var isScrollAtBottomPosition = false
public var isScrollAtBottomPositionUpdated: (() -> Void)?
@ -589,6 +589,8 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
let isTopReplyThreadMessageShown = ValuePromise<Bool>(false, ignoreRepeated: true)
let topVisibleMessageRange = ValuePromise<ChatTopVisibleMessageRange?>(nil, ignoreRepeated: true)
var isSelectionGestureEnabled = true
private let clientId: Atomic<Int32>
public init(context: AccountContext, chatLocation: ChatLocation, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>, tagMask: MessageTags?, source: ChatHistoryListSource = .default, subject: ChatControllerSubject?, controllerInteraction: ChatControllerInteraction, selectedMessages: Signal<Set<MessageId>?, NoError>, mode: ChatHistoryListMode = .bubbles) {
@ -1173,10 +1175,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
guard let strongSelf = self else {
return false
}
if case .pinnedMessages = strongSelf.subject {
return false
}
return true
return strongSelf.isSelectionGestureEnabled
}
self.view.addGestureRecognizer(selectionRecognizer)
}