SCSChatInterface
@interface SCSChatInterface : NSObject
The SCSChatInterface class is the main UI interface to the chat SDK.
This object provides functionality to show a pre-chat form, display the chat
session UI, and handle notifications.
To get an instance of this class, use the SCServiceCloud.chatUI property
on +[SCServiceCloud sharedInstance].
For core chat behavior unrelated to the UI (such as subscribing to session events), see SCSChat.
See
SCSChat
-
Pass a
UNNotificationto this method to request that the chat feed maximize if required. The chat feed will only maximize if the notification was scheduled by this chat client.Declaration
Objective-C
- (void)handleNotification:(nonnull UNNotification *)notification;Swift
func handle(_ notification: UNNotification)Parameters
notificationThe
UNNotificationthat chat will respond to. -
Determines whether a notification should be displayed in the foreground. Returns
trueif the chat feed is not currently maximized.Declaration
Objective-C
- (BOOL)shouldDisplayNotificationInForeground;Swift
func shouldDisplayNotificationInForeground() -> Bool -
Starts a chat session with the default UI. If you want to build your own custom UI, use
-[SCSChat startSessionWithConfiguration:completion:]instead.Declaration
Objective-C
- (void)showChatWithConfiguration:(nonnull SCSChatConfiguration *)configuration;Swift
func showChat(with configuration: SCSChatConfiguration)Parameters
configurationThe
SCSChatConfigurationobject which represents the session configuration. -
Starts a chat session with the default UI. If you set
showPrechattotrue, this method displays the pre-chat form with the configured fields before starting a chat session.If you wish to configure pre-chat separately, or wish to modify data before starting a chat session see
-showPrechatWithFields:completion:.Declaration
Objective-C
- (void)showChatWithConfiguration:(nonnull SCSChatConfiguration *)configuration showPrechat:(BOOL)prechat;Swift
func showChat(with configuration: SCSChatConfiguration, showPrechat prechat: Bool)Parameters
configurationSCSChatConfigurationobject that represents the session configuration.prechatIndicates whether to display pre-chat UI before starting a session. Note: If the
SCSChatConfiguration.prechatFieldsproperty isnil, this value is ignored. -
Dismisses the chat interface.
Declaration
Objective-C
- (void)dismissChat;Swift
func dismissChat() -
Shows the pre-chat UI with the specified pre-chat fields.
Note
If the user cancels, the
prechatFieldscontents will be unchanged in the completion block.Declaration
Objective-C
- (void)showPrechatWithFields: (nonnull NSArray<SCSPrechatObject *> *)prechatFields modal:(BOOL)modal completion:(nonnull SCSPrechatCompletion)completion;Swift
func showPrechat(withFields prechatFields: [SCSPrechatObject], modal: Bool, completion: @escaping SCSPrechatCompletion)Parameters
prechatFieldsArray of
SCSPrechatObjectobjects that represents the pre-chat configuration.modalIndicates whether this view displays as a modal UI (
true), or as a non-modal full-screen UI (false).completionContains an array of pre-chat fields populated with the user input. Also includes a
BOOLdetermining whether the user submitted the form without canceling. -
Shows the pre-chat UI with the specified pre-chat fields. This method shows a non-modal, full-screen view. To support a modal view, see
-showPrechatWithFields:modal:completion:.Note
If the user cancels, the
prechatFieldscontents will be unchanged in the completion block.Declaration
Objective-C
- (void)showPrechatWithFields: (nonnull NSArray<SCSPrechatObject *> *)prechatFields completion:(nonnull SCSPrechatCompletion)completion;Swift
func showPrechat(withFields prechatFields: [SCSPrechatObject], completion: @escaping SCSPrechatCompletion)Parameters
prechatFieldsArray of
SCSPrechatObjectobjects that represents the pre-chat configuration.completionContains an array of pre-chat fields populated with the user input. Also includes a
BOOLthat indicates whether the user submitted the form without canceling.
Install in Dash
SCSChatInterface Class Reference