smooth the hide and show of the input accessory view

This commit is contained in:
Ryan Zhao 2021-08-05 16:55:49 +10:00
parent 4904d2cdcf
commit b714565480
1 changed files with 17 additions and 2 deletions

View File

@ -546,10 +546,19 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
}
func delete(_ viewItem: ConversationViewItem) {
func showInputAccessoryView() {
UIView.animate(withDuration: 0.25, animations: {
self.inputAccessoryView?.isHidden = false
self.inputAccessoryView?.alpha = 1
})
}
if viewItem.interaction.interactionType() == .outgoingMessage {
let alertVC = UIAlertController.init(title: nil, message: nil, preferredStyle: .actionSheet)
let deleteLocallyAction = UIAlertAction.init(title: NSLocalizedString("delete_message_for_me", comment: ""), style: .destructive) { _ in
self.deleteLocally(viewItem)
showInputAccessoryView()
}
alertVC.addAction(deleteLocallyAction)
@ -559,12 +568,18 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
}
let deleteRemotelyAction = UIAlertAction.init(title: title, style: .destructive) { _ in
self.deleteForEveryone(viewItem)
showInputAccessoryView()
}
alertVC.addAction(deleteRemotelyAction)
let cancelAction = UIAlertAction.init(title: NSLocalizedString("TXT_CANCEL_TITLE", comment: ""), style: .cancel, handler: nil)
let cancelAction = UIAlertAction.init(title: NSLocalizedString("TXT_CANCEL_TITLE", comment: ""), style: .cancel) {_ in
showInputAccessoryView()
}
alertVC.addAction(cancelAction)
self.navigationController?.presentAlert(alertVC)
self.inputAccessoryView?.isHidden = true
self.inputAccessoryView?.alpha = 0
self.presentAlert(alertVC)
} else {
deleteLocally(viewItem)
}