NowChatOptions - ClosePrompt(header: String?, message: String, acceptButtonTitle: String, declineButtonTitle: String)
Creates and returns a ClosePrompt object based on the passed parameters. You then pass this object into the NowChatOptions() method to configure the close prompt options within a chat session.
| Name | Type | Description |
|---|---|---|
| header | String | Text to display on the prompt's header. If you don't want to display a prompt header, pass "nil". |
| message | String | Text to display as the prompt's main text. |
| acceptButtonTitle | String | Text to display on the prompt's primary button for closing the chat window. |
| declineButtonTitle | String | Text to display on the prompt's secondary button that dismisses the prompt. |
The following code example shows how to call this function.
func makeChatScreen() -> UIViewController? {
guard let chatService = chatService else { return nil }
let closePrompt = NowChatOptions.ClosePrompt(
header: "Close Window",
message: "Are you sure you want to close the chat window?",
acceptButtonTitle: "Yes",
declineButtonTitle: "No")
let disabledFeatures = [.startNewConversation]
let chatOptions = NowChatOptions(closePrompt: closePrompt,
disabledFeatures: disabledFeatures,
forceNewConversation: true)
let result = chatService.makeChatUI(theme: CarrascoChatTheme(chatColors: ChatColors()), chatOptions: chatOptions)
switch result {
case .success(let chatViewController):
return chatViewController
case .failure(let error):
return nil
}
}