68 lines
1.5 KiB
JavaScript
68 lines
1.5 KiB
JavaScript
|
"use strict";
|
||
|
class TUIChatConfig {
|
||
|
constructor() {
|
||
|
this.chatType = "";
|
||
|
this.features = {
|
||
|
DownloadFile: true,
|
||
|
CopyMessage: true,
|
||
|
DeleteMessage: true,
|
||
|
RevokeMessage: true,
|
||
|
QuoteMessage: true,
|
||
|
ForwardMessage: true,
|
||
|
TranslateMessage: true,
|
||
|
VoiceToText: true,
|
||
|
MultiSelection: true,
|
||
|
EmojiReaction: true,
|
||
|
InputEmoji: true,
|
||
|
InputStickers: true,
|
||
|
InputImage: true,
|
||
|
InputVoice: true,
|
||
|
InputVideo: true,
|
||
|
InputFile: true,
|
||
|
InputEvaluation: true,
|
||
|
InputQuickReplies: true,
|
||
|
InputMention: true,
|
||
|
MessageSearch: true,
|
||
|
ReadStatus: true
|
||
|
};
|
||
|
this.theme = "light";
|
||
|
}
|
||
|
static getInstance() {
|
||
|
if (!TUIChatConfig.instance) {
|
||
|
TUIChatConfig.instance = new TUIChatConfig();
|
||
|
}
|
||
|
return TUIChatConfig.instance;
|
||
|
}
|
||
|
setChatType(chatType) {
|
||
|
this.chatType = chatType;
|
||
|
}
|
||
|
getChatType() {
|
||
|
return this.chatType;
|
||
|
}
|
||
|
hideTUIChatFeatures(features) {
|
||
|
if (!features) {
|
||
|
return;
|
||
|
}
|
||
|
features.forEach((feature) => {
|
||
|
if (this.features[feature]) {
|
||
|
this.features[feature] = false;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
getFeatureConfig(key) {
|
||
|
if (key) {
|
||
|
return this.features[key];
|
||
|
}
|
||
|
return this.features;
|
||
|
}
|
||
|
setTheme(theme) {
|
||
|
this.theme = theme;
|
||
|
}
|
||
|
getTheme() {
|
||
|
return this.theme;
|
||
|
}
|
||
|
}
|
||
|
const ChatConfig = TUIChatConfig.getInstance();
|
||
|
ChatConfig.hideTUIChatFeatures.bind(ChatConfig);
|
||
|
exports.ChatConfig = ChatConfig;
|