From 1d0438db922660331e68d2b7850b56b9774ad39f Mon Sep 17 00:00:00 2001 From: CYH <13923927013@163.com> Date: Thu, 10 Aug 2023 16:53:31 +0300 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=98=E5=88=86=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E5=9F=8E=E5=B8=82=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tim_uikit_conversation.dart | 61 ++++++++++--------- circle_app/lib/main.dart | 10 ++- 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart index 4588653..b2ead9b 100644 --- a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart +++ b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart @@ -435,41 +435,44 @@ class _TIMConversationState extends TIMUIKitState { bool isSameCity = false; if (snapshot.connectionState == ConnectionState.done) { - snapshot.data!.forEach((element) { - if (element.userID == conversationItem.userID) { - userFullInfo = element; - } - }); - //自己的信息 - V2TimUserFullInfo myuserFullInfo = - snapshot.data!.first; + if ((snapshot.data ?? []).isNotEmpty) { + snapshot.data!.forEach((element) { + if (element.userID == conversationItem.userID) { + userFullInfo = element; + } + }); + //自己的信息 + V2TimUserFullInfo myuserFullInfo = + snapshot.data!.first; - if (userFullInfo!.customInfo! - .containsKey('Label')) { - var otherInfo = jsonDecode(userFullInfo! - .customInfo!['Label'] - .toString()); - var myInfo = jsonDecode(myuserFullInfo! - .customInfo!['Label'] - .toString()); - if (myInfo['city'] - .toString() - .contains(otherInfo['city'].toString())) { - isSameCity = true; + if (userFullInfo!.customInfo! + .containsKey('Label')) { + var otherInfo = jsonDecode(userFullInfo! + .customInfo!['Label'] + .toString()); + var myInfo = jsonDecode(myuserFullInfo! + .customInfo!['Label'] + .toString()); + if (myInfo['city'] + .toString() + .contains(otherInfo['city'].toString())) { + isSameCity = true; + } } - } - if (userFullInfo != null) { - List userIdList = - userFullInfo!.userID!.split('_'); - if (userIdList.length >= 4) { - if (int.parse(userIdList[2]) == 10) { - isOfficial = true; - } else { - isOfficial = false; + if (userFullInfo != null) { + List userIdList = + userFullInfo!.userID!.split('_'); + if (userIdList.length >= 4) { + if (int.parse(userIdList[2]) == 10) { + isOfficial = true; + } else { + isOfficial = false; + } } } } + } Widget conversationLineItem() { diff --git a/circle_app/lib/main.dart b/circle_app/lib/main.dart index 0c3b631..1d69cae 100644 --- a/circle_app/lib/main.dart +++ b/circle_app/lib/main.dart @@ -32,7 +32,11 @@ final TUIChatSeparateViewModel chatSeparateViewModel = TUIChatSeparateViewModel(); void main() { - + FlutterError.onError = (FlutterErrorDetails details) { + FlutterError.dumpErrorToConsole(details); + // if (kReleaseMode) + // //处理线上错误,如统计上传 + }; WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized(); FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding); runApp(const MyApp()); @@ -94,6 +98,7 @@ createCustomMsg(String userId, String imId) async { Map info = {}; if (data['data']['both_cities'] != null) { List city = data['data']['both_cities']; + print('城市'+city.toString()); if (city.isNotEmpty) { desc = '你们都在$city留下过足迹'; } @@ -113,6 +118,9 @@ createCustomMsg(String userId, String imId) async { } } if (desc.isNotEmpty) { + if (data['data']['both_cities'] != null) { + info['city'] = desc; + } info['interests'] = data['data']['interests'] ?? []; info['guide_text'] = data['data']['guide_text'] ?? ''; info['my'] = data['data']['my'] ?? '';