mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-31 15:37:01 +00:00
Fixed message editing key shortcut
This commit is contained in:
parent
de0432d66a
commit
c0d2c663ef
@ -6843,23 +6843,22 @@ public final class ChatController: TelegramController, GalleryHiddenMediaTarget,
|
||||
}
|
||||
})
|
||||
]
|
||||
|
||||
if let message = self.chatDisplayNode.historyNode.latestMessageInCurrentHistoryView(), !message.flags.contains(.Incoming) {
|
||||
inputShortcuts.append(KeyShortcut(input: UIKeyInputUpArrow, action: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
var canEdit = false
|
||||
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { state in
|
||||
if state.interfaceState.effectiveInputState.inputText.length == 0 && state.interfaceState.editMessage == nil {
|
||||
canEdit = true
|
||||
}
|
||||
return state
|
||||
})
|
||||
if canEdit {
|
||||
strongSelf.interfaceInteraction?.setupEditMessage(message.id)
|
||||
}
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
var canEdit = false
|
||||
self.updateChatPresentationInterfaceState(animated: false, interactive: false, { state in
|
||||
if state.interfaceState.effectiveInputState.inputText.length == 0 && state.interfaceState.editMessage == nil {
|
||||
canEdit = true
|
||||
}
|
||||
return state
|
||||
})
|
||||
|
||||
if canEdit, let message = self.chatDisplayNode.historyNode.firstMessageForEditInCurrentHistoryView() {
|
||||
inputShortcuts.append(KeyShortcut(input: UIKeyInputUpArrow, action: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
strongSelf.interfaceInteraction?.setupEditMessage(message.id)
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
let otherShortcuts: [KeyShortcut] = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user