Browse Source

Merge remote-tracking branch 'origin/wr_202303' into wr_202303

# Conflicts:
#	lib/im/chat_details_page.dart
wr_202303
wurong 4 months ago
parent
commit
4730856f68
  1. 11
      lib/im/chat_details_page.dart
  2. 10
      lib/im/im_view/im_page.dart

11
lib/im/chat_details_page.dart

@ -10,7 +10,6 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/im/database/message.dart';
import 'package:huixiang/im/im_view/w_popup_menu.dart';
import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/im_user.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
@ -125,7 +124,8 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
Future messageShowTime() async {
List<Message> messagePages = await hxDatabase.queryTList(conversation);
for (var value in messages) {
Message message = messagePages.firstWhere((element) => value.id == element.id, orElse: () => null);
Message message = messagePages
.firstWhere((element) => value.id == element.id, orElse: () => null);
value.showTime = message != null;
}
}
@ -143,8 +143,10 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
}
}
if (apiService == null)
apiService = ApiService(Dio(), context: context, token: value.getString("token"));
BaseData<UserInfo> baseData = await apiService.queryInfo().catchError((onError) {});
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
BaseData<UserInfo> baseData =
await apiService.queryInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
userInfo = baseData.data;
@ -328,6 +330,7 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
setState(() {
needShowSmiley = false;
emojiShowing = false;
isKeyBoardShow = emojiShowing;
moreShow = false;

10
lib/im/im_view/im_page.dart

@ -102,7 +102,7 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
listenerRefresh(Message message) async {
await sortConversation(lastMessageMap);
await queryUnreadCount(conversationId);
await queryUnreadCount(conversationIds);
debugPrint("messages_records : ${message.toJson()}");
if (contactMap[message.fromId] == null) {
@ -134,14 +134,11 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
.map((e) => e.conversationId)
.toSet()
.toList();
conversationIds.forEach((element) {
debugPrint("conversationIds: ${element}");
});
}
/// update conversation unreadcount
queryUnreadCount(conversationId) async {
unreadCountMap = await hxDatabase.messageUnreadCount(conversationId);
queryUnreadCount(conversationIds) async {
unreadCountMap = await hxDatabase.messageUnreadCount(conversationIds);
}
/// update imuser info by mids
@ -366,7 +363,6 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
children: conversationIds.map((e) {
debugPrint("---conversationIds: ${e}");
int position = conversationIds.indexOf(e);
return ClipRRect(
// borderRadius: BorderRadius.all(Radius.circular(4)),

Loading…
Cancel
Save