Skip to main content

Preset Switches

Global IM UIKit provides a set of preset switches to control the enabling and disabling of certain features. These switches can be accessed via the RCKitCommand enumeration.

Preset Switches List

Preset SwitchDefaultDescription
RCKitCommand.SHOW_CONNECTION_STATUStrueWhether to display connection status change reminders in the opened conversation window
RCKitCommand.SHOW_MESSAGE_STATEtrueWhether to display the read status of messages;
When disabled, only the sending status of messages will be shown in the message bubble
RCKitCommand.FOCUS_ON_LATEST_MESSAGEtrueHow to display the message list when entering a conversation, only supported on Electron platform:
true: Scroll to the bottom to show the latest message
false: Display the last read position
RCKitCommand.AT_ALLtrueWhether to support the @all function in group chats
RCKitCommand.SHOW_USER_ONLINE_STATEfalseWhether to display user online status, which requires the reqUserOnlineStatus hook defined during initialization to take effect.
RCKitCommand.PROMPT_SENDER_WHEN_QUOTE_MESSAGEtrueWhether to @ the message sender by default when quoting or replying to a message
RCKitCommand.DELETE_MESSAGES_WHILE_DELETE_CONVERSSATIONtrueWhether to delete messages stored locally and on the remote server when deleting a conversation

Modifying Switch States

Switch state modifications only take effect if made before kitApp.ready() is called; otherwise, they will not be applied.

For example, to modify the state of the RCKitCommand.SHOW_CONNECTION_STATUS switch, use the following code:

import { RCKitCommand } from '@rongcloud/global-im-uikit';

kitApp.setCommand(RCKitCommand.SHOW_CONNECTION_STATUS, false);

Retrieving Switch States

import { RCKitCommand } from '@rongcloud/global-im-uikit';

const bool = kitApp.getCommandSwitch(RCKitCommand.SHOW_CONNECTION_STATUS);