diff --git a/lib/business_logic/view_models/tui_chat_global_model.dart b/lib/business_logic/view_models/tui_chat_global_model.dart index 697dda9..9518ebd 100644 --- a/lib/business_logic/view_models/tui_chat_global_model.dart +++ b/lib/business_logic/view_models/tui_chat_global_model.dart @@ -197,7 +197,7 @@ class TUIChatGlobalModel extends ChangeNotifier implements TIMUIKitClass { clearCurrentConversation() { // Only keep the last 20 messages when existing a chat. - _messageListMap[currentSelectedConv] = (_messageListMap[currentSelectedConv] ?? []).sublist(max(0, ((_messageListMap[currentSelectedConv] ?? []).length - 10))); + _messageListMap[currentSelectedConv] = (_messageListMap[currentSelectedConv] ?? []).sublist(0, min(10, ((_messageListMap[currentSelectedConv] ?? []).length - 1))); if (_currentConversationList.isNotEmpty) { _currentConversationList.removeLast(); } @@ -539,8 +539,7 @@ class TUIChatGlobalModel extends ChangeNotifier implements TIMUIKitClass { } _receivedNewMessageCount = 0; final tempCurrentMsgList = _messageListMap[convID] ?? []; - final currentMsg = tempCurrentMsgList..sublist(max(0, (tempCurrentMsgList.length - 30))); - _messageListMap[convID] = [newMsg, ...currentMsg]; + _messageListMap[convID] = [newMsg, ...tempCurrentMsgList]; notifyListeners(); final messageID = newMsg.msgID; final needReadReceipt = newMsg.needReadReceipt ?? false; @@ -561,8 +560,7 @@ class TUIChatGlobalModel extends ChangeNotifier implements TIMUIKitClass { } } else if (convID != null) { final tempCurrentMsgList = _messageListMap[convID] ?? []; - final currentMsg = tempCurrentMsgList..sublist(max(0, (tempCurrentMsgList.length - 20))); - _messageListMap[convID] = [newMsg, ...currentMsg]; + _messageListMap[convID] = [newMsg, ...tempCurrentMsgList]; notifyListeners(); } } diff --git a/lib/data_services/core/core_services_implements.dart b/lib/data_services/core/core_services_implements.dart index 317c171..7aa4958 100644 --- a/lib/data_services/core/core_services_implements.dart +++ b/lib/data_services/core/core_services_implements.dart @@ -129,6 +129,7 @@ class CoreServicesImpl implements CoreServices { onKickedOffline: listener.onKickedOffline, onUserStatusChanged: (List userStatusList) { updateUserStatusList(userStatusList); + listener.onUserStatusChanged(userStatusList); }, onSelfInfoUpdated: (V2TimUserFullInfo info) { listener.onSelfInfoUpdated(info); diff --git a/lib/ui/views/TIMUIKitChat/tim_uikit_chat.dart b/lib/ui/views/TIMUIKitChat/tim_uikit_chat.dart index 840d953..6a83ca8 100644 --- a/lib/ui/views/TIMUIKitChat/tim_uikit_chat.dart +++ b/lib/ui/views/TIMUIKitChat/tim_uikit_chat.dart @@ -230,7 +230,7 @@ class _TUIChatState extends TIMUIKitState { axis: Axis.vertical, ); - Widget? joinInGroupCallWidget; + Widget? _joinInGroupCallWidget; @override void initState() { @@ -352,8 +352,13 @@ class _TUIChatState extends TIMUIKitState { if (_getConvType() != ConvType.group) { return; } - joinInGroupCallWidget = await TUICore.instance.raiseExtension(TUIExtensionID.joinInGroup, {GROUP_ID: widget.conversationID!}); - setState(() {}); + final w = await TUICore.instance.raiseExtension(TUIExtensionID.joinInGroup, {GROUP_ID: widget.conversationID!}); + if(w != _joinInGroupCallWidget){ + + setState(() { + _joinInGroupCallWidget = w; + }); + } } @override @@ -461,7 +466,7 @@ class _TUIChatState extends TIMUIKitState { if (widget.customAppBar != null) widget.customAppBar!, if (filteredApplicationList.isNotEmpty) _renderJoinGroupApplication(filteredApplicationList.length, theme), if (widget.topFixWidget != null) widget.topFixWidget!, - if (joinInGroupCallWidget != null) Center(child: joinInGroupCallWidget!), + if (_joinInGroupCallWidget != null) Center(child: _joinInGroupCallWidget!), Expanded( child: Container( color: theme.chatBgColor, diff --git a/pubspec.yaml b/pubspec.yaml index a77d32c..a9e7a68 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: tencent_cloud_chat_uikit description: A powerful chat UI component library and business logic for Tencent Cloud Chat, creating seamless in-app chat modules for delightful user experiences. -version: 2.5.1+4 +version: 2.5.1+5 homepage: https://trtc.io/products/chat?utm_source=gfs&utm_medium=link&utm_campaign=%E6%B8%A0%E9%81%93&_channel_track_key=k6WgfCKn repository: https://github.com/TencentCloud/chat-uikit-flutter documentation: https://comm.qq.com/im/doc/flutter/en/TUIKit/readme.html