SKTConversationDelegate Protocol Reference

Conforms to NSObject
Declared in SKTConversation.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:(SKTConversation *)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

SKTConversation.h

– conversation:shouldShowInAppNotificationForMessage:

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

- (BOOL)conversation:(SKTConversation *)conversation shouldShowInAppNotificationForMessage:(SKTMessage *)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 Smooch 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 SKTMessage object to construct your view.

See Also

Declared In

SKTConversation.h

– conversation:shouldShowForAction:withInfo:

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

- (BOOL)conversation:(SKTConversation *)conversation shouldShowForAction:(SKTAction)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 SKTMessage 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

SKTConversation.h

– conversation:willSendMessage:

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

- (SKTMessage *)conversation:(SKTConversation *)conversation willSendMessage:(SKTMessage *)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 Smooch

Declared In

SKTConversation.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 SKTMessage *)conversation:(SKTConversation *)conversation willDisplayMessage:(SKTMessage *)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

SKTConversation.h

– conversation:didReceiveMessages:

Notifies the delegate of new incoming messages.

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

Parameters

conversation

The conversation object.

messages

An array of SKTMessage objects representing the new messages.

Discussion

Called when new messages are received from the server.

See Also

Declared In

SKTConversation.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:(SKTConversation *)conversation didReceivePreviousMessages:(NSArray *)messages

Parameters

conversation

The conversation object

messages

The messages that have been fetched

Declared In

SKTConversation.h

– conversation:didReceiveActivity:

Notifies the delegate of new conversation activity

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

- (void)conversation:(SKTConversation *)conversation didReceiveActivity:(SKTConversationActivity *)activity

Parameters

conversation

The conversation object

activity

The activity that was received

Declared In

SKTConversation.h

– conversation:shouldHandleMessageAction:

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

- (BOOL)conversation:(SKTConversation *)conversation shouldHandleMessageAction:(SKTMessageAction *)action

Return Value

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

Discussion

Called when the user taps a message action.

Declared In

SKTConversation.h

– conversation:willShowViewController:

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

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

Discussion

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

Declared In

SKTConversation.h

– conversation:didShowViewController:

Notifies the delegate when presentation of the conversation completes.

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

Discussion

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

Declared In

SKTConversation.h

– conversation:willDismissViewController:

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

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

Discussion

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

Declared In

SKTConversation.h

– conversation:didDismissViewController:

Notifies the delegate when dismissal of the conversation completes.

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

Discussion

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

Declared In

SKTConversation.h