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

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;
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<String> userIdList =
userFullInfo!.userID!.split('_');
if (userIdList.length >= 4) {
if (int.parse(userIdList[2]) == 10) {
isOfficial = true;
} else {
isOfficial = false;
if (userFullInfo != null) {
List<String> userIdList =
userFullInfo!.userID!.split('_');
if (userIdList.length >= 4) {
if (int.parse(userIdList[2]) == 10) {
isOfficial = true;
} else {
isOfficial = false;
}
}
}
}
}
Widget conversationLineItem() {

View File

@ -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<String, dynamic> 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'] ?? '';