123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- class TUIChatConfig {
- static instance: TUIChatConfig;
- private chatType: string;
- private features: Record<string, any>;
- constructor() {
- this.chatType = '';
- this.features = {
- DownloadFile: true,
- CopyMessage: true,
- DeleteMessage: true,
- RevokeMessage: true,
- modifyMessage: 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,
- };
- }
- static getInstance(): TUIChatConfig {
- if (!TUIChatConfig.instance) {
- TUIChatConfig.instance = new TUIChatConfig();
- }
- return TUIChatConfig.instance;
- }
- setChatType(chatType: string) {
- this.chatType = chatType;
- }
- getChatType() {
- return this.chatType;
- }
- hideTUIChatFeatures(features: string[]) {
- if (!features) {
- return;
- }
- features.forEach((feature: string) => {
- if (this.features[feature]) {
- this.features[feature] = false;
- }
- });
- }
- getFeatureConfig(key?: string) {
- if (key) {
- return this.features[key];
- }
- return this.features;
- }
- }
- const ChatConfig = TUIChatConfig.getInstance();
- const hideTUIChatFeatures = ChatConfig.hideTUIChatFeatures.bind(ChatConfig);
- export {
- hideTUIChatFeatures,
- };
- export default ChatConfig;
|