# AVAConversationDelegate

Objective-C

    @protocol AVAConversationDelegate <NSObject>

Swift

    protocol AVAConversationDelegate : NSObjectProtocol

@discussion Delegate protocol for events related to the conversation.

Creating a delegate is optional, and may be used to receive callbacks when important changes happen in the conversation.

Delegate methods are guaranteed to be called from the main thread.

- `-conversation:unreadCountDidChange:`

  @abstract Notifies the delegate of a change in unread message count.

  @discussion Called when conversation data is fetched from the server, or when the user enters the conversation screen.

  #### Declaration

  Objective-C

      - (void)conversation:(nonnull AVAConversation *)conversation
          unreadCountDidChange:(NSUInteger)unreadCount;

  Swift

      optional func conversation(_ conversation: AVAConversation, unreadCountDidChange unreadCount: UInt)

  #### Parameters

  `conversation` | The conversation object that initiated the change.
  `unreadCount` | The new number of unread messages.

- `-conversation:shouldShowInAppNotificationForMessage:`

  @abstract Asks the delegate if an in-app notification should be shown for a message.

  @discussion Called when a new message is received, right before the in-app notification is to be shown for that message. To show your own in-app notification, return NO from this method, and use the AVAMessage object to construct your view.

  See

  AVAMessage

  #### Declaration

  Objective-C

      - (BOOL)conversation:(nonnull AVAConversation *)conversation
          shouldShowInAppNotificationForMessage:(nonnull AVAMessage *)message;

  Swift

      optional func conversation(_ conversation: AVAConversation, shouldShowInAppNotificationFor message: AVAMessage) -> Bool

  #### Parameters

  `conversation` | The conversation object that initiated the change.
  `message` | The message that will be displayed in the notification.

  #### Return Value

  YES to allow AvMessagingSdk to present the notification. NO to suppress the notification, and perform custom handling.

- `-conversation:shouldShowForAction:withInfo:`

  @abstract Asks the delegate if the conversation should show for the given action.

  @discussion Called when the user performs an action that causes the conversation screen to show. Return NO to cancel the display of the conversation screen and perform your own handling of the action.

  See

  AVAAction

  #### Declaration

  Objective-C

      - (BOOL)conversation:(nonnull AVAConversation *)conversation
          shouldShowForAction:(AVAAction)action
                     withInfo:(nullable NSDictionary *)info;

  Swift

      optional func conversation(_ conversation: AVAConversation, shouldShowFor action: AVAAction, withInfo info: [AnyHashable : Any]?) -> Bool

  #### Parameters

  `conversation` | The conversation object.
  `action` | The action the user has taken.
  `info` | An instance of NSDictionary with a `message` object with the latest AVAMessage represented as an NSDictionary

  #### Return Value

  YES to allow default handling. NO to suppress the conversation screen, and perform custom handling.

- `-conversation:willSendMessage:`

  @abstract Gives the delegate the option to modify a message before it is sent

  @discussion Called when a message is about to be sent to give the delegate the option of modify or decorate its content (i.e. add metadata) before sending to AvMessagingSdk. When the message type is `file` or `image`, only the message `metadata` may be updated. Other message properties such as `type` or `text` won’t be considered.

  #### Declaration

  Objective-C

      - (nonnull AVAMessage *)conversation:(nonnull AVAConversation *)conversation
                           willSendMessage:(nonnull AVAMessage *)message;

  Swift

      optional func conversation(_ conversation: AVAConversation, willSend message: AVAMessage) -> AVAMessage

  #### Return Value

  the message to be sent

- `-conversation:willDisplayMessage:`

  @abstract Gives the delegate the option to modify a message before it is displayed. If nil is returned the message will be hidden

  @discussion Called when a message is about to be displayed to the user to give the delegate the option of modifying its content before display or hide it

  #### Declaration

  Objective-C

      - (nullable AVAMessage *)conversation:(nonnull AVAConversation *)conversation
                         willDisplayMessage:(nonnull AVAMessage *)message;

  Swift

      optional func conversation(_ conversation: AVAConversation, willDisplay message: AVAMessage) -> AVAMessage?

  #### Return Value

  the message to be displayed. If nil, the message won’t get displayed

- `-conversation:didReceiveMessages:`

  @abstract Notifies the delegate of new incoming messages.

  @discussion Called when new messages are received from the server.

  See

  AVAMessage

  #### Declaration

  Objective-C

      - (void)conversation:(nonnull AVAConversation *)conversation
          didReceiveMessages:(nonnull NSArray *)messages;

  Swift

      optional func conversation(_ conversation: AVAConversation, didReceiveMessages messages: [Any])

  #### Parameters

  `conversation` | The conversation object.
  `messages` | An array of AVAMessage objects representing the new messages.

- `-conversation:didReceivePreviousMessages:`

  @abstract Notifies the delegate when older messages in the conversation history have been received

  @discussion Called when older messages in the conversation history are received from the server

  #### Declaration

  Objective-C

      - (void)conversation:(nonnull AVAConversation *)conversation
          didReceivePreviousMessages:(nonnull NSArray *)messages;

  Swift

      optional func conversation(_ conversation: AVAConversation, didReceivePreviousMessages messages: [Any])

  #### Parameters

  `conversation` | The conversation object
  `messages` | The messages that have been fetched

- `-conversation:didReceiveActivity:`

  @abstract Notifies the delegate of new conversation activity

  @discussion Called when a new activity is received from the server

  #### Declaration

  Objective-C

      - (void)conversation:(nonnull AVAConversation *)conversation
          didReceiveActivity:(nonnull AVAConversationActivity *)activity;

  Swift

      optional func conversation(_ conversation: AVAConversation, didReceive activity: AVAConversationActivity)

  #### Parameters

  `conversation` | The conversation object
  `activity` | The activity that was received

- `-conversation:shouldHandleMessageAction:`

  @abstract Asks the delegate if default handling should be performed for a message action.

  @discussion Called when the user taps a message action.

  #### Declaration

  Objective-C

      - (BOOL)conversation:(nonnull AVAConversation *)conversation
          shouldHandleMessageAction:(nonnull AVAMessageAction *)action;

  Swift

      optional func conversation(_ conversation: AVAConversation, shouldHandle action: AVAMessageAction) -> Bool

  #### Return Value

  YES to allow default handling. NO to perform custom handling.

- `-conversation:willShowViewController:`

  @abstract Notifies the delegate when the conversation is about to be presented.

  @discussion Called in the viewWillAppear: method of the conversation view controller.

  #### Declaration

  Objective-C

      - (void)conversation:(nonnull AVAConversation *)conversation
          willShowViewController:(id)viewController;

  Swift

      optional func conversation(_ conversation: AVAConversation, willShowViewController viewController: Any!)

- `-conversation:didShowViewController:`

  @abstract Notifies the delegate when presentation of the conversation completes.

  @discussion Called in the viewDidAppear: method of the conversation view controller.

  #### Declaration

  Objective-C

      - (void)conversation:(nonnull AVAConversation *)conversation
          didShowViewController:(id)viewController;

  Swift

      optional func conversation(_ conversation: AVAConversation, didShowViewController viewController: Any!)

- `-conversation:willDismissViewController:`

  @abstract Notifies the delegate when the conversation is about to be dismissed.

  @discussion Called in the viewWillDisappear: method of the conversation view controller.

  #### Declaration

  Objective-C

      - (void)conversation:(nonnull AVAConversation *)conversation
          willDismissViewController:(id)viewController;

  Swift

      optional func conversation(_ conversation: AVAConversation, willDismissViewController viewController: Any!)

- `-conversation:didDismissViewController:`

  @abstract Notifies the delegate when dismissal of the conversation completes.

  @discussion Called in the viewDidDisappear: method of the conversation view controller.

  #### Declaration

  Objective-C

      - (void)conversation:(nonnull AVAConversation *)conversation
          didDismissViewController:(id)viewController;

  Swift

      optional func conversation(_ conversation: AVAConversation, didDismissViewController viewController: Any!)

- `-conversationListDidRefresh:`

  @abstract Notifies the delegate when the conversations list was updated

  #### Declaration

  Objective-C

      - (void)conversationListDidRefresh:
          (nonnull NSArray<AVAConversation *> *)conversationList;

  Swift

      optional func conversationListDidRefresh(_ conversationList: [AVAConversation])

  #### Parameters

  `NSArray<AVAConversation>` | The updated array of AVAConversation

© 2022 . All rights reserved. (Last updated: 2022-06-30)

Generated by jazzy ♪♫ v0.14.2, a Realm project.