Hide the "Leave a message" button in the Chat SDK

The default behavior of the Chat SDK is to show a "Leave a message" option when you have no agents available (iOS screenshot below).

For some workflows this isn't the preferred behavior and so you may wish to hide this option. This article walks you through how to do that.

Android

Hide the button

The first thing you'll want to do is hide the button. To do this, add the following to styles.xml .

<style name="no_agents_button" parent="_no_agents_button"> <item name="android:visibility">invisible</item> </style>

Update strings

As you'll see from the screenshot above, the string on that page references leaving a message. Follow these instructions to change the text of the string. The no_agents_message is the string that you'll update.

iOS

Hide the button

Again, the first thing you'll want to do is hide the button. Add the following to your app.

Swift:

UIButton.appearance(whenContainedInInstancesOf: [ZDCLoadingErrorView.self]).alpha = 0

Objective-C:

[UIButton appearanceWhenContainedIn:[ZDCLoadingErrorView class], nil].alpha = 0;

Update strings

As above, the label on that page mentions leaving a message. Follow these instructions to change the text of the string. The ios.ZDCChat.noAgentsMessage is the string that you'll update.