Members
StoreName
Properties:
Name | Type | Description |
---|---|---|
APP |
String |
Application-level data management, mainly used for global feature toggle control. |
CONV |
String |
Conversation data management |
CHAT |
String |
Chat data management |
GRP |
String |
Group data management |
USER |
String |
User data management |
FRIEND |
String |
Friend data management |
SEARCH |
String |
Search data management |
CUSTOM |
String |
Custom data management, business side can add custom key-value pairs as needed. |
AppStore
Properties:
Name | Type | Description |
---|---|---|
enableTyping |
Boolean |
Whether typing status feature is enabled, default true |
enabledMessageReadReceipt |
Boolean |
Whether message read receipt feature is enabled, default false, enabled after purchasing flagship package |
enabledEmojiPlugin |
Boolean |
Whether emoji reply plugin capability is enabled, default false, enabled after purchasing flagship package |
enabledOnlineStatus |
Boolean |
Whether user online status capability is enabled, default false, enabled after purchasing flagship package |
enabledCustomerServicePlugin |
Boolean |
Whether customer service plugin capability is enabled, default false, enabled after purchasing customer service plugin |
enabledTranslationPlugin |
Boolean |
Whether text message translation capability is enabled, default false, enabled after purchasing translation plugin |
enableConversationDraft |
Boolean |
Whether conversation draft feature is enabled, default true |
Examples
// UI layer calls the following logic to disable typing status feature
TUIStore.update(StoreName.APP, 'enableTyping', false);
// UI layer calls the following logic to disable conversation draft feature
TUIStore.update(StoreName.APP, 'enableConversationDraft', false);
ConversationStore
Properties:
Name | Type | Description |
---|---|---|
currentConversationID |
String |
Current conversation ID |
conversationList |
Array.<IConversationModel> |
Conversation list |
totalUnreadCount |
Number |
Total unread count of conversations |
Example
// UI layer listening for conversation list update notification
let onConversationListUpdated = function(conversationList) {
console.warn(conversationList);
}
TUIStore.watch(StoreName.CONV, {
conversationList: onConversationListUpdated,
})
ChatStore
Properties:
Name | Type | Description |
---|---|---|
messageList |
Array.<MessageModel> |
Message list |
isCompleted |
Boolean |
Whether roaming messages are fully loaded (used to control 'Load More' button display) |
quoteMessage |
Message | any |
Quoted message information, updated when message is quoted |
typingStatus |
Boolean |
Typing status indicator, default false, updated when typing message if typing status is enabled |
messageSource |
MessageModel |
Used for cloud message search result to jump to specified message |
newMessageList |
Array.<Message> |
New message notification list, provided for TUINotification component |
translateTextInfo |
Record.<string, (string|undefined|boolean)> |
Text message translation information |
Examples
// UI layer listening for current conversation message list update notification
let onMessageListUpdated = function(messageList) {
console.warn(messageList);
}
TUIStore.watch(StoreName.CHAT, {
messageList: onMessageListUpdated,
})
// UI layer update cloud message search result to jump to specified message
TUIStore.update(StoreName.CHAT, 'messageSource', message);
// UI layer listening for cloud message search result to jump to specified message
let onMessageSourceUpdated = function(message) {
console.warn(message);
}
TUIStore.watch(StoreName.CHAT, {
messageSource: onMessageSourceUpdated,
})
// UI layer update text message translation information
TUIStore.update(StoreName.CHAT, 'translateTextInfo', {
conversationID: 'xxx',
messageID: 'xxx',
visible: false,
});
// UI layer listening for text message translation update notification
let onTranslateTextInfoUpdated = function(info) {
// info returns map or undefined
if (info) {
const list = info.get('conversationID') || [];
list.forEach(item => {
const { messageID, visible } = item;
// messageID - ID of the current message being operated
// visible - Whether to display translated text
}
}
}
TUIStore.watch(StoreName.CHAT, {
translateTextInfo: onTranslateTextInfoUpdated,
})
GroupStore
Properties:
Name | Type | Description |
---|---|---|
currentGroupID |
String |
Current group ID |
currentGroup |
Group |
Current group information |
currentGroupMemberList |
Array |
Current group member list |
currentGroupAttributes |
Object |
Current group attribute information |
currentGroupCounters |
Object |
Current group counter information |
groupList |
Array.<Group> |
Group list |
groupSystemNoticeList |
Array.<Message> |
Group system notice list (Note: Store does not store group system notices, instant notification only) |
Example
// UI layer listening for group list update notification
let onGroupListUpdated = function(groupList) {
console.warn(groupList);
}
TUIStore.watch(StoreName.GRP, {
groupList: onGroupListUpdated,
})
UserStore
Properties:
Name | Type | Description |
---|---|---|
userProfile |
Object |
Current logged-in user's profile information |
displayOnlineStatus |
Boolean |
Whether to display user online status, default false: disabled |
displayMessageReadReceipt |
Boolean |
Whether to display message read status, default true: enabled |
kickedOut |
String |
User kick-out type information |
netStateChange |
String |
Network state change information |
userStatusList |
Map.<key, statusInfo> |
List of subscribed users' status information
|
userBlacklist |
Array.<string> |
User blacklist, UI components can get user blacklist by listening to this property |
Example
// UI layer listening for network change notification
let onNetStateChange = function(state) {
console.warn(state);
}
TUIStore.watch(StoreName.USER, {
netStateChange: onNetStateChange,
})
FriendStore
Properties:
Name | Type | Description |
---|---|---|
friendList |
Array.<Friend> |
Friend list, UI components can get friend list by listening to this property |
friendApplicationList |
Array.<FriendApplication> |
Friend application list, UI components can get friend application list by listening to this property |
friendApplicationUnreadCount |
number |
Friend application unread count, UI components can get friend application unread count by listening to this property |
Example
// UI layer listening for friend list update notification
let onFriendListUpdated = function(friendList) {
console.warn(friendList);
}
TUIStore.watch(StoreName.FRIEND, {
friendList: onFriendListUpdated,
})