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/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/im/database/message.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/main.dart';
import 'package:huixiang/retrofit/data/im_user.dart'; import 'package:huixiang/retrofit/data/im_user.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
@ -125,7 +124,8 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
Future messageShowTime() async { Future messageShowTime() async {
List<Message> messagePages = await hxDatabase.queryTList(conversation); List<Message> messagePages = await hxDatabase.queryTList(conversation);
for (var value in messages) { 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; value.showTime = message != null;
} }
} }
@ -143,8 +143,10 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
} }
} }
if (apiService == null) if (apiService == null)
apiService = ApiService(Dio(), context: context, token: value.getString("token")); apiService =
BaseData<UserInfo> baseData = await apiService.queryInfo().catchError((onError) {}); ApiService(Dio(), context: context, token: value.getString("token"));
BaseData<UserInfo> baseData =
await apiService.queryInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
userInfo = baseData.data; userInfo = baseData.data;
@ -328,6 +330,7 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
onTap: () { onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
setState(() { setState(() {
needShowSmiley = false;
emojiShowing = false; emojiShowing = false;
isKeyBoardShow = emojiShowing; isKeyBoardShow = emojiShowing;
moreShow = false; 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 { listenerRefresh(Message message) async {
await sortConversation(lastMessageMap); await sortConversation(lastMessageMap);
await queryUnreadCount(conversationId); await queryUnreadCount(conversationIds);
debugPrint("messages_records : ${message.toJson()}"); debugPrint("messages_records : ${message.toJson()}");
if (contactMap[message.fromId] == null) { if (contactMap[message.fromId] == null) {
@ -134,14 +134,11 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
.map((e) => e.conversationId) .map((e) => e.conversationId)
.toSet() .toSet()
.toList(); .toList();
conversationIds.forEach((element) {
debugPrint("conversationIds: ${element}");
});
} }
/// update conversation unreadcount /// update conversation unreadcount
queryUnreadCount(conversationId) async { queryUnreadCount(conversationIds) async {
unreadCountMap = await hxDatabase.messageUnreadCount(conversationId); unreadCountMap = await hxDatabase.messageUnreadCount(conversationIds);
} }
/// update imuser info by mids /// update imuser info by mids
@ -366,7 +363,6 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
children: conversationIds.map((e) { children: conversationIds.map((e) {
debugPrint("---conversationIds: ${e}");
int position = conversationIds.indexOf(e); int position = conversationIds.indexOf(e);
return ClipRRect( return ClipRRect(
// borderRadius: BorderRadius.all(Radius.circular(4)), // borderRadius: BorderRadius.all(Radius.circular(4)),

Loading…
Cancel
Save