|
|
@ -1,11 +1,14 @@ |
|
|
import 'package:get/get.dart'; |
|
|
import 'package:get/get.dart'; |
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
|
import 'package:tdesign_flutter/tdesign_flutter.dart'; |
|
|
|
|
|
|
|
|
import '../../im/im_manager.dart'; |
|
|
import '../../im/im_manager.dart'; |
|
|
import '../../im/chat_presence_manager.dart'; |
|
|
import '../../im/chat_presence_manager.dart'; |
|
|
import '../../model/home/marriage_data.dart'; |
|
|
import '../../model/home/marriage_data.dart'; |
|
|
import '../../model/live/gift_product_model.dart'; |
|
|
import '../../model/live/gift_product_model.dart'; |
|
|
import '../../network/network_service.dart'; |
|
|
import '../../network/network_service.dart'; |
|
|
|
|
|
import '../../widget/live/live_recharge_popup.dart'; |
|
|
import 'package:im_flutter_sdk/im_flutter_sdk.dart'; |
|
|
import 'package:im_flutter_sdk/im_flutter_sdk.dart'; |
|
|
import 'conversation_controller.dart'; |
|
|
import 'conversation_controller.dart'; |
|
|
|
|
|
|
|
|
@ -1080,15 +1083,15 @@ class ChatController extends GetxController { |
|
|
try { |
|
|
try { |
|
|
final message = await IMManager.instance.sendCustomMessage(userId, 'call', callParams); |
|
|
final message = await IMManager.instance.sendCustomMessage(userId, 'call', callParams); |
|
|
if (message != null) { |
|
|
if (message != null) { |
|
|
// 发送成功,替换临时消息 |
|
|
|
|
|
final index = messages.indexWhere((msg) => msg.msgId == tempMessage.msgId); |
|
|
|
|
|
if (index != -1) { |
|
|
|
|
|
|
|
|
// 发送成功,替换临时消息 |
|
|
|
|
|
final index = messages.indexWhere((msg) => msg.msgId == tempMessage.msgId); |
|
|
|
|
|
if (index != -1) { |
|
|
messages[index] = message; |
|
|
messages[index] = message; |
|
|
} |
|
|
|
|
|
update(); |
|
|
|
|
|
// 更新会话列表 |
|
|
|
|
|
_refreshConversationList(); |
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
update(); |
|
|
|
|
|
// 更新会话列表 |
|
|
|
|
|
_refreshConversationList(); |
|
|
|
|
|
return true; |
|
|
} else { |
|
|
} else { |
|
|
// 发送失败,消息状态会自动变为FAIL |
|
|
// 发送失败,消息状态会自动变为FAIL |
|
|
update(); |
|
|
update(); |
|
|
@ -1743,9 +1746,20 @@ class ChatController extends GetxController { |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
if (response.data.isSuccess && !response.data.data['success']) { |
|
|
if (response.data.isSuccess && !response.data.data['success']) { |
|
|
SmartDialog.showToast( |
|
|
|
|
|
response.data.data['code'] == 'E0002' ? '玫瑰不足请充值' : '发送礼物失败', |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
final code = response.data.data['code']; |
|
|
|
|
|
if (code == 'E0002') { |
|
|
|
|
|
// 玫瑰不足,显示 toast 并弹出充值弹框 |
|
|
|
|
|
SmartDialog.showToast('玫瑰不足请充值'); |
|
|
|
|
|
SmartDialog.show( |
|
|
|
|
|
alignment: Alignment.bottomCenter, |
|
|
|
|
|
maskColor: Get.context != null |
|
|
|
|
|
? TDTheme.of(Get.context!).fontGyColor2 |
|
|
|
|
|
: Colors.black.withOpacity(0.5), |
|
|
|
|
|
builder: (_) => const LiveRechargePopup(), |
|
|
|
|
|
); |
|
|
|
|
|
} else { |
|
|
|
|
|
SmartDialog.showToast('发送礼物失败'); |
|
|
|
|
|
} |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|