OMCConversationDelegate Protocol Reference

Conforms to NSObject
Declared in OMCConversation.h

Overview

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:

Notifies the delegate of a change in unread message count.

- (void)conversation:(OMCConversation *)conversation unreadCountDidChange:(NSUInteger)unreadCount

Parameters

conversation

The conversation object that initiated the change.

unreadCount

The new number of unread messages.

Discussion

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

Declared In

OMCConversation.h

– conversation:shouldShowInAppNotificationForMessage:

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

- (BOOL)conversation:(OMCConversation *)conversation shouldShowInAppNotificationForMessage:(OMCMessage *)message

Parameters

conversation

The conversation object that initiated the change.

message

The message that will be displayed in the notification.

Return Value

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

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 OMCMessage object to construct your view.

See Also

Declared In

OMCConversation.h

– conversation:shouldShowForAction:withInfo:

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

- (BOOL)conversation:(OMCConversation *)conversation shouldShowForAction:(OMCAction)action withInfo:(nullable NSDictionary *)info

Parameters

conversation

The conversation object.

action

The action the user has taken.

info

An instance of NSDictionary with a message object with the latest OMCMessage represented as an NSDictionary

Return Value

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

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 Also

Declared In

OMCConversation.h

– conversation:willSendMessage:

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

- (OMCMessage *)conversation:(OMCConversation *)conversation willSendMessage:(OMCMessage *)message

Return Value

the message to be 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 Bots

Declared In

OMCConversation.h

– conversation:willDisplayMessage:

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

- (nullable OMCMessage *)conversation:(OMCConversation *)conversation willDisplayMessage:(OMCMessage *)message

Return Value

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

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

Declared In

OMCConversation.h

– conversation:didReceiveMessages:

Notifies the delegate of new incoming messages.

- (void)conversation:(OMCConversation *)conversation didReceiveMessages:(NSArray *)messages

Parameters

conversation

The conversation object.

messages

An array of OMCMessage objects representing the new messages.

Discussion

Called when new messages are received from the server.

See Also

Declared In

OMCConversation.h

– conversation:didReceivePreviousMessages:

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

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

- (void)conversation:(OMCConversation *)conversation didReceivePreviousMessages:(NSArray *)messages

Parameters

conversation

The conversation object

messages

The messages that have been fetched

Declared In

OMCConversation.h

– conversation:didReceiveActivity:

Notifies the delegate of new conversation activity

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

- (void)conversation:(OMCConversation *)conversation didReceiveActivity:(OMCConversationActivity *)activity

Parameters

conversation

The conversation object

activity

The activity that was received

Declared In

OMCConversation.h

– conversation:shouldHandleMessageAction:

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

- (BOOL)conversation:(OMCConversation *)conversation shouldHandleMessageAction:(OMCMessageAction *)action

Return Value

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

Discussion

Called when the user taps a message action.

Declared In

OMCConversation.h

– conversation:willShowViewController:

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

- (void)conversation:(OMCConversation *)conversation willShowViewController:(UIViewController *)viewController

Discussion

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

Declared In

OMCConversation.h

– conversation:didShowViewController:

Notifies the delegate when presentation of the conversation completes.

- (void)conversation:(OMCConversation *)conversation didShowViewController:(UIViewController *)viewController

Discussion

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

Declared In

OMCConversation.h

– conversation:willDismissViewController:

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

- (void)conversation:(OMCConversation *)conversation willDismissViewController:(UIViewController *)viewController

Discussion

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

Declared In

OMCConversation.h

– conversation:didDismissViewController:

Notifies the delegate when dismissal of the conversation completes.

- (void)conversation:(OMCConversation *)conversation didDismissViewController:(UIViewController *)viewController

Discussion

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

Declared In

OMCConversation.h