mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Fixes #2765 - Use the keyboard up arrow to edit the last message, use escape to cancel editing or replying.
This commit is contained in:
committed by
Stefan Ceriu
parent
3017100e5e
commit
e05e664f6d
@@ -206,6 +206,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
mode: mode,
|
||||
intentionalMentions: intentionalMentions)
|
||||
}
|
||||
case .editLastMessage:
|
||||
editLastMessage()
|
||||
case .attach(let attachment):
|
||||
attach(attachment)
|
||||
case .handlePasteOrDrop(let provider):
|
||||
@@ -264,6 +266,20 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
}
|
||||
}
|
||||
|
||||
private func editLastMessage() {
|
||||
guard let item = timelineController.timelineItems.reversed().first(where: {
|
||||
guard let item = $0 as? EventBasedMessageTimelineItemProtocol else {
|
||||
return false
|
||||
}
|
||||
|
||||
return item.sender.id == roomProxy.ownUserID && item.isEditable
|
||||
}) else {
|
||||
return
|
||||
}
|
||||
|
||||
roomScreenInteractionHandler.processTimelineItemMenuAction(.edit, itemID: item.id)
|
||||
}
|
||||
|
||||
private func attach(_ attachment: ComposerAttachmentType) {
|
||||
switch attachment {
|
||||
case .camera:
|
||||
|
||||
Reference in New Issue
Block a user