修改缘分匹配城市无法显示

This commit is contained in:
CYH 2023-08-10 16:53:31 +03:00
parent d8cc691814
commit 1d0438db92
2 changed files with 41 additions and 30 deletions

View File

@ -435,41 +435,44 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
bool isSameCity = false; bool isSameCity = false;
if (snapshot.connectionState == if (snapshot.connectionState ==
ConnectionState.done) { ConnectionState.done) {
snapshot.data!.forEach((element) { if ((snapshot.data ?? []).isNotEmpty) {
if (element.userID == conversationItem.userID) { snapshot.data!.forEach((element) {
userFullInfo = element; if (element.userID == conversationItem.userID) {
} userFullInfo = element;
}); }
// });
V2TimUserFullInfo myuserFullInfo = //
snapshot.data!.first; V2TimUserFullInfo myuserFullInfo =
snapshot.data!.first;
if (userFullInfo!.customInfo! if (userFullInfo!.customInfo!
.containsKey('Label')) { .containsKey('Label')) {
var otherInfo = jsonDecode(userFullInfo! var otherInfo = jsonDecode(userFullInfo!
.customInfo!['Label'] .customInfo!['Label']
.toString()); .toString());
var myInfo = jsonDecode(myuserFullInfo! var myInfo = jsonDecode(myuserFullInfo!
.customInfo!['Label'] .customInfo!['Label']
.toString()); .toString());
if (myInfo['city'] if (myInfo['city']
.toString() .toString()
.contains(otherInfo['city'].toString())) { .contains(otherInfo['city'].toString())) {
isSameCity = true; isSameCity = true;
}
} }
}
if (userFullInfo != null) { if (userFullInfo != null) {
List<String> userIdList = List<String> userIdList =
userFullInfo!.userID!.split('_'); userFullInfo!.userID!.split('_');
if (userIdList.length >= 4) { if (userIdList.length >= 4) {
if (int.parse(userIdList[2]) == 10) { if (int.parse(userIdList[2]) == 10) {
isOfficial = true; isOfficial = true;
} else { } else {
isOfficial = false; isOfficial = false;
}
} }
} }
} }
} }
Widget conversationLineItem() { Widget conversationLineItem() {

View File

@ -32,7 +32,11 @@ final TUIChatSeparateViewModel chatSeparateViewModel =
TUIChatSeparateViewModel(); TUIChatSeparateViewModel();
void main() { void main() {
FlutterError.onError = (FlutterErrorDetails details) {
FlutterError.dumpErrorToConsole(details);
// if (kReleaseMode)
// //线
};
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized(); WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding); FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
runApp(const MyApp()); runApp(const MyApp());
@ -94,6 +98,7 @@ createCustomMsg(String userId, String imId) async {
Map<String, dynamic> info = {}; Map<String, dynamic> info = {};
if (data['data']['both_cities'] != null) { if (data['data']['both_cities'] != null) {
List city = data['data']['both_cities']; List city = data['data']['both_cities'];
print('城市'+city.toString());
if (city.isNotEmpty) { if (city.isNotEmpty) {
desc = '你们都在$city留下过足迹'; desc = '你们都在$city留下过足迹';
} }
@ -113,6 +118,9 @@ createCustomMsg(String userId, String imId) async {
} }
} }
if (desc.isNotEmpty) { if (desc.isNotEmpty) {
if (data['data']['both_cities'] != null) {
info['city'] = desc;
}
info['interests'] = data['data']['interests'] ?? []; info['interests'] = data['data']['interests'] ?? [];
info['guide_text'] = data['data']['guide_text'] ?? ''; info['guide_text'] = data['data']['guide_text'] ?? '';
info['my'] = data['data']['my'] ?? ''; info['my'] = data['data']['my'] ?? '';