Message Actions

LAST EDIT Feb 16 2021

Messages have actions. They will appear if a user long (or force) presses on a message.

ActionsCopied!

  • .reactions

  • .reply

  • .edit

  • .muteUser

  • .flagMessage

  • .flagUser

  • .banUser

  • .copy

  • .delete

CustomizationCopied!

Customizing actions is not yet possible in the new v3 SDK. Stay tuned!

PropertiesCopied!

ChatViewController has messageActions and defaultMessageActionsproperties.

You can customize a list of message actions:

  • override defaultMessageActions in your subclass:

1
2
3
override var defaultMessageActions: ChatViewController.MessageAction { 
    return [.reactions, .copy] 
}
  • change messageActions when you initialize ChatViewController:

1
2
let chatViewController = ChatViewController() 
chatViewController.messageActions = [.reactions, .copy]

or

1
2
3
4
5
6
class MyChatViewController: ChatViewController { 
    required init?(coder aDecoder: NSCoder) { 
        super.init(coder: aDecoder) 
        messageActions = [.reactions, .copy] 
    } 
}

MethodCopied!

You can override long-press action with this method of ChatViewController:

1
open func showActions(from cell: UITableViewCell, for message: Message, locationInView: CGPoint)