Removed the ability to swipe-to-reply to sending/failed outgoing messages

pull/751/head
Morgan Pretty 2 years ago
parent 41ba692a03
commit 4419d31077

@ -131,6 +131,16 @@ extension ContextMenuVC {
) { delegate?.contextMenuDismissed() }
}
}
static func viewModelCanReply(_ cellViewModel: MessageViewModel) -> Bool {
return (
cellViewModel.variant == .standardIncoming || (
cellViewModel.variant == .standardOutgoing &&
cellViewModel.state != .failed &&
cellViewModel.state != .sending
)
)
}
static func actions(
for cellViewModel: MessageViewModel,
@ -161,12 +171,6 @@ extension ContextMenuVC {
)
)
)
let canReply: Bool = (
cellViewModel.variant != .standardOutgoing || (
cellViewModel.state != .failed &&
cellViewModel.state != .sending
)
)
let canCopy: Bool = (
cellViewModel.cellType == .textOnlyMessage || (
(
@ -219,7 +223,7 @@ extension ContextMenuVC {
let generatedActions: [Action] = [
(canRetry ? Action.retry(cellViewModel, delegate) : nil),
(canReply ? Action.reply(cellViewModel, delegate) : nil),
(viewModelCanReply(cellViewModel) ? Action.reply(cellViewModel, delegate) : nil),
(canCopy ? Action.copy(cellViewModel, delegate) : nil),
(canSave ? Action.save(cellViewModel, delegate) : nil),
(canCopySessionId ? Action.copySessionID(cellViewModel, delegate) : nil),

@ -400,11 +400,11 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate {
)
// Swipe to reply
if cellViewModel.variant == .standardIncomingDeleted || cellViewModel.variant == .infoCall {
removeGestureRecognizer(panGestureRecognizer)
if ContextMenuVC.viewModelCanReply(cellViewModel) {
addGestureRecognizer(panGestureRecognizer)
}
else {
addGestureRecognizer(panGestureRecognizer)
removeGestureRecognizer(panGestureRecognizer)
}
// Under bubble content

Loading…
Cancel
Save