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.
-
@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.
-
@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.
-
@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 NSDictionaryReturn Value
YES to allow default handling. NO to suppress the conversation screen, and perform custom handling.
-
@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
orimage
, only the messagemetadata
may be updated. Other message properties such astype
ortext
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
-
@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
-
@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.
-
@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
-
@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
-
@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.
-
@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!)
-
@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!)
-
@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!)
-
@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!)
-
@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