Message Actions

LAST EDIT Apr 09 2021
This page is v2.x only.

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

Actions

Copied!
  • .reactions

  • .reply

  • .edit

  • .muteUser

  • .flagMessage

  • .flagUser

  • .banUser

  • .copy

  • .delete

Customization

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

Properties

Copied!

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] 
    } 
}

Method

Copied!

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

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