|
|
|
@ -3,6 +3,7 @@ import 'dart:async'; |
|
|
|
import 'package:cached_network_image/cached_network_image.dart'; |
|
|
|
import 'package:dating_touchme_app/extension/ex_widget.dart'; |
|
|
|
import 'package:dating_touchme_app/rtc/rtm_manager.dart'; |
|
|
|
import 'package:dating_touchme_app/widget/live/live_recharge_popup.dart'; |
|
|
|
import 'package:flutter/widgets.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
@ -240,6 +241,197 @@ class IMManager { |
|
|
|
if(message.body.type == MessageType.CUSTOM){ |
|
|
|
final body = message.body as EMCustomMessageBody; |
|
|
|
if(body.event == "live_room_invite"){ |
|
|
|
|
|
|
|
|
|
|
|
// 获取 RoomController |
|
|
|
final roomController = Get.isRegistered<RoomController>() |
|
|
|
? Get.find<RoomController>() |
|
|
|
: Get.put(RoomController()); |
|
|
|
|
|
|
|
final currentChannelId = RTCManager.instance.currentChannelId; |
|
|
|
print([{"userId": GlobalData().userData?.id, "uid": roomController.rtcChannel.value?.uid}]); |
|
|
|
print('currentChannelId != null && currentChannelId == body.params?["channelId"]'); |
|
|
|
if(currentChannelId != null && currentChannelId == body.params?["channelId"]){ |
|
|
|
if(roomController.rtcChannelDetail.value?.maleInfo == null && GlobalData().userData?.genderCode == 0 && roomController.currentRole != CurrentRole.broadcaster || |
|
|
|
roomController.rtcChannelDetail.value?.femaleInfo == null && GlobalData().userData?.genderCode == 1 && roomController.currentRole != CurrentRole.broadcaster || |
|
|
|
roomController.isLive.value && roomController.currentRole != CurrentRole.broadcaster && !roomController.isLive.value){ |
|
|
|
roomController.setDialogDismiss(true); |
|
|
|
SmartDialog.show( |
|
|
|
alignment: Alignment.center, |
|
|
|
maskColor: Colors.black.withOpacity(0.5), |
|
|
|
onDismiss: () { |
|
|
|
roomController.setDialogDismiss(false); |
|
|
|
}, |
|
|
|
builder: (context) { |
|
|
|
// return LiveRoomGuestListDialog( |
|
|
|
// initialTab: isMaleSeat ? 1 : 0, // 0: 女嘉宾, 1: 男嘉宾 |
|
|
|
// ); |
|
|
|
return ClipRRect( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(16.w)), |
|
|
|
child: Material( |
|
|
|
child: Stack( |
|
|
|
|
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
width: 311.w, |
|
|
|
height: 210.w, |
|
|
|
color: Colors.white, |
|
|
|
padding: EdgeInsets.only( |
|
|
|
top: 53.w, |
|
|
|
left: 23.w, |
|
|
|
right: 23.w, |
|
|
|
bottom: 20.w |
|
|
|
), |
|
|
|
child: Column( |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
"主持人邀请您视频连麦", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 21.w, |
|
|
|
color: const Color.fromRGBO(117, 98, 249, 1), |
|
|
|
fontWeight: FontWeight.w500 |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(height: 15.w,), |
|
|
|
if(GlobalData().userData?.genderCode == 0) Text( |
|
|
|
"有相亲卡的用户免费", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.w, |
|
|
|
color: const Color.fromRGBO(87, 87, 87, 1), |
|
|
|
fontWeight: FontWeight.w500 |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(height: 28.w,), |
|
|
|
Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
width: 128.w, |
|
|
|
height: 40.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(12.w)), |
|
|
|
color: const Color.fromRGBO(237, 237, 237, 1) |
|
|
|
), |
|
|
|
child: Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
Image.asset( |
|
|
|
Assets.imagesHangUpIcon, |
|
|
|
width: 26.w, |
|
|
|
height: 26.w, |
|
|
|
), |
|
|
|
SizedBox(width: 5.w,), |
|
|
|
Text( |
|
|
|
"拒绝", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 15.w |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
).onTap((){ |
|
|
|
// 隐藏键盘 |
|
|
|
FocusScope.of(context).unfocus(); |
|
|
|
// 隐藏 overlay |
|
|
|
SmartDialog.dismiss(); |
|
|
|
roomController.setDialogDismiss(false); |
|
|
|
}), |
|
|
|
Container( |
|
|
|
width: 128.w, |
|
|
|
height: 40.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(12.w)), |
|
|
|
color: const Color.fromRGBO(117, 98, 249, 1) |
|
|
|
), |
|
|
|
child: Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
Image.asset( |
|
|
|
Assets.imagesAnswerIcon, |
|
|
|
width: 18.w, |
|
|
|
height: 13.w, |
|
|
|
), |
|
|
|
SizedBox(width: 5.w,), |
|
|
|
Text( |
|
|
|
"接受", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 15.w, |
|
|
|
color: Colors.white |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
).onTap(() async { |
|
|
|
// 隐藏键盘 |
|
|
|
FocusScope.of(context).unfocus(); |
|
|
|
// 隐藏 overlay |
|
|
|
SmartDialog.dismiss(); |
|
|
|
roomController.setDialogDismiss(false); |
|
|
|
|
|
|
|
// 检查是否需要弹出充值弹框 |
|
|
|
if (!roomController.isLive.value) { |
|
|
|
final userData = GlobalData().userData; |
|
|
|
final isMale = userData?.genderCode == 0; |
|
|
|
if (isMale) { |
|
|
|
final cardNum = roomController.linkMicCard.value?.num ?? 0; |
|
|
|
// 如果显示"上麦20玫瑰"且玫瑰数量小于20,弹出充值弹框 |
|
|
|
if (cardNum == 0 && roomController.roseCount.value < 20) { |
|
|
|
roomController.setDialogDismiss(true); |
|
|
|
SmartDialog.show( |
|
|
|
alignment: Alignment.bottomCenter, |
|
|
|
maskColor: Colors.black.withOpacity(0.5), |
|
|
|
onDismiss: (){ |
|
|
|
roomController.setDialogDismiss(false); |
|
|
|
}, |
|
|
|
builder: (_) => const LiveRechargePopup(), |
|
|
|
); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(roomController.isLive.value){ |
|
|
|
await roomController.leaveChat(); |
|
|
|
}else{ |
|
|
|
await roomController.joinChat(GlobalData().userData?.genderCode == 0 ? CurrentRole.maleAudience : CurrentRole.femaleAudience); |
|
|
|
} |
|
|
|
}), |
|
|
|
], |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
Positioned( |
|
|
|
top: 0, |
|
|
|
left: 0, |
|
|
|
child: Container( |
|
|
|
padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 15.w), |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
topLeft: Radius.circular(16.w), |
|
|
|
bottomRight: Radius.circular(16.w), |
|
|
|
), |
|
|
|
color: const Color.fromRGBO(117, 98, 249, 1) |
|
|
|
), |
|
|
|
child: Text( |
|
|
|
GlobalData().userData?.genderCode == 0 ? "20玫瑰" : "免费", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.w, |
|
|
|
color: Colors.white, |
|
|
|
fontWeight: FontWeight.w500 |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
SmartDialog.show( |
|
|
|
alignment: Alignment.center, |
|
|
|
maskColor: Colors.black.withOpacity(0.5), |
|
|
|
@ -255,7 +447,7 @@ class IMManager { |
|
|
|
child: Material( |
|
|
|
child: Container( |
|
|
|
width: 311.w, |
|
|
|
height: 305.w, |
|
|
|
height: 308.w, |
|
|
|
color: Colors.white, |
|
|
|
padding: EdgeInsets.only( |
|
|
|
top: 28.w, |
|
|
|
@ -473,18 +665,12 @@ class IMManager { |
|
|
|
// 隐藏 overlay |
|
|
|
SmartDialog.dismiss(); |
|
|
|
// 获取当前直播间ID |
|
|
|
final currentChannelId = RTCManager.instance.currentChannelId; |
|
|
|
// 隐藏小窗口 |
|
|
|
if (Get.isRegistered<OverlayController>()) { |
|
|
|
final overlayController = Get.find<OverlayController>(); |
|
|
|
overlayController.hide(); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取 RoomController |
|
|
|
final roomController = Get.isRegistered<RoomController>() |
|
|
|
? Get.find<RoomController>() |
|
|
|
: Get.put(RoomController()); |
|
|
|
|
|
|
|
// 如果频道ID一致,取消小窗口并进入直播间 |
|
|
|
if (currentChannelId != null && currentChannelId == body.params?["channelId"]) { |
|
|
|
// 如果当前不在 LiveRoomPage,则导航到 LiveRoomPage |
|
|
|
|