Compare commits

...

27 Commits

Author SHA1 Message Date
fuenmao 8df34b0fa7 Merge branch 'dev' 2024-12-27 11:57:09 +08:00
fuenmao 4710b13964 禅道123、124BUG 2024-12-27 11:43:36 +08:00
fuenmao cbc2f012d2 申请发言、结束发言、被管理员关闭发言、单独开关麦、单独开关摄像头状态统一修复 2024-12-26 17:12:50 +08:00
fuenmao 9894600bd0 申请发言权限时,点击的麦克风或者摄像头,得到发言权限后默认打开对应的 2024-12-26 16:57:50 +08:00
fuenmao 9e95286855 优化进入房间http socket 声网调用顺序逻辑 2024-12-26 16:52:17 +08:00
fuenmao 0cf4b4761e 增加房间检测接口 2024-12-26 16:25:14 +08:00
fuenmao 85a475b19b 全员结束会议、被移除提示时间延迟 2024-12-26 16:07:32 +08:00
fuenmao fc9f72b88e 1.增加socket和声网SDK断线重连相关提示弹窗
2.拦截会议室返回按钮,只能右上角弹窗点击“仅自己离开”退出会议
2024-12-26 11:35:57 +08:00
fuenmao 3b2e981d6b 管理员赋予自己发言权限时,默认开启麦克风 2024-12-25 16:59:32 +08:00
fuenmao 7d2f8e543d 自己是全员观看主播时,关闭摄像头情况全员观看ID,回到主持人在来的路上页面 2024-12-25 16:44:35 +08:00
fuenmao 5d04c59a35 1.底部弹窗成员列表共享状态变化
2.底部弹窗成员名字长度优化
3.底部聊天列表添加时间,名字长度优化
2024-12-25 16:35:31 +08:00
fuenmao d488f29ddf 全员观看切换优化 2024-12-25 11:14:06 +08:00
fuenmao 7052764dc8 匿名登录逻辑优化 2024-12-25 09:42:26 +08:00
fuenmao 620f5067d6 1.成员搜索框共享标识问题
2.退出两次确认
2024-12-24 16:44:41 +08:00
fuenmao 8e9e4b2812 1.名字越界问题
2.成员搜索框数量问题
3.成员搜索框共享标识问题
2024-12-24 16:30:30 +08:00
fuenmao 7f53a1a855 匿名登录直接加入会议室跳转页面路径修复 2024-12-24 10:45:09 +08:00
fuenmao 76376f3f32 会议室中,管理员把普通用户下麦后,grid中画面保留了最后一刻的画面,应初始化 2024-12-24 10:00:49 +08:00
fuenmao 8905d24489 成员弹窗搜索优化 2024-12-24 09:36:31 +08:00
fuenmao 7135b7767e 登录/加入会议接口调用弹窗优化 2024-12-24 09:33:09 +08:00
fuenmao 1cabad280c 1.登录页跳转、个人中心退出优化
2.会议首页点击返回键退出APP
2024-12-23 17:49:23 +08:00
fuenmao b3ff943f1c 开启摄像头文案显示逻辑优化 2024-12-18 09:51:23 +08:00
fuenmao 26937a374d 点击开启摄像头的时候也弹出申请发言弹窗,添加变量并在回调里优化逻辑 2024-12-18 09:49:31 +08:00
fuenmao 42f0546b49 远端用户断线退出或杀进程退出逻辑优化 2024-12-18 09:39:28 +08:00
fuenmao e1542212aa 结束发言按钮和布局改动 2024-12-17 16:31:59 +08:00
fuenmao 79d8d0a437 听筒和会议信息浮层,点击覆盖区域可以关闭 2024-12-17 13:56:47 +08:00
fuenmao a113684567 配置大屏显示视频界面类型1 2024-12-17 13:53:01 +08:00
fuenmao 437f98772d 1.配置视频发送小流
2.配置大屏显示视频界面类型
2024-12-17 13:40:17 +08:00
31 changed files with 1317 additions and 710 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

View File

@ -42,6 +42,12 @@ abstract class RetrofitClient {
@Path("roomNum") String roomNum, @Path("roomNum") String roomNum,
); );
///
@GET("/room/checkout")
Future<BaseStructureResult<bool>> checkout(
@Query("roomNum") String roomNum,
);
/// ///
@GET("/room/user") @GET("/room/user")
Future<BaseStructureResult<List<MeetingRoomUser>>> getMeetingRoomAllUser( Future<BaseStructureResult<List<MeetingRoomUser>>> getMeetingRoomAllUser(

View File

@ -21,4 +21,9 @@ class AppConfig {
static const paddingLeft = 20.0; static const paddingLeft = 20.0;
static const paddingRight = 20.0; static const paddingRight = 20.0;
static const paddingbottom = 20.0; static const paddingbottom = 20.0;
//
static const NORMAL_LOGIN = "normal_login";
//
static const ANONYMOUS_LOGIN = "anonymous_login";
} }

View File

@ -14,7 +14,9 @@ class MeetingRoomMsg extends Object{
// 01 // 01
int source; int source;
MeetingRoomMsg(this.uid,this.userName,this.message,this.source); String time;
MeetingRoomMsg(this.uid,this.userName,this.message,this.source,this.time);
factory MeetingRoomMsg.fromJson(Map<String, dynamic> srcJson) => _$MeetingRoomMsgFromJson(srcJson); factory MeetingRoomMsg.fromJson(Map<String, dynamic> srcJson) => _$MeetingRoomMsgFromJson(srcJson);

View File

@ -39,7 +39,10 @@ class MeetingRoomUser extends Object{
@JsonKey(name: 'volume') @JsonKey(name: 'volume')
double? volume = 0.0; double? volume = 0.0;
MeetingRoomUser(this.uid,this.connectId,this.account,this.enableMicr,this.enableCamera,this.screenShareId,this.userName,this.roleId,this.roleName,this.isRoomManager,this.volume); @JsonKey(name: 'enableShare')
bool? enableShare = false;
MeetingRoomUser(this.uid,this.connectId,this.account,this.enableMicr,this.enableCamera,this.screenShareId,this.userName,this.roleId,this.roleName,this.isRoomManager,this.volume,this.enableShare);
factory MeetingRoomUser.fromJson(Map<String, dynamic> srcJson) => _$MeetingRoomUserFromJson(srcJson); factory MeetingRoomUser.fromJson(Map<String, dynamic> srcJson) => _$MeetingRoomUserFromJson(srcJson);

View File

@ -4,7 +4,8 @@ enum AppStorageKey {
token(value: 'TOKEN', label: "登录用户的token"), token(value: 'TOKEN', label: "登录用户的token"),
userInfo(value: 'USERINFO', label: "登录用户的基本信息"), userInfo(value: 'USERINFO', label: "登录用户的基本信息"),
account(value: 'ACCOUNT', label: "用户名"), account(value: 'ACCOUNT', label: "用户名"),
pwd(value: 'PWD', label: "密码"); pwd(value: 'PWD', label: "密码"),
loginType(value: 'LOGINTYPE', label: "登录类型");
final String label; final String label;
final String value; final String value;

View File

@ -14,10 +14,14 @@ class UserStore extends GetxController with RequestToolMixin {
/// ///
String? token; String? token;
///
String? loginType;
/// ///
Rx<UserInfoEntity?> userInfoEntity = Rx(null); Rx<UserInfoEntity?> userInfoEntity = Rx(null);
UserStore init() { UserStore init() {
loginType = StorageService.to.read(AppStorageKey.loginType.value);
token = StorageService.to.read(AppStorageKey.token.value); token = StorageService.to.read(AppStorageKey.token.value);
try { try {
var userDetail = StorageService.to.read(AppStorageKey.userInfo.value); var userDetail = StorageService.to.read(AppStorageKey.userInfo.value);
@ -41,6 +45,12 @@ class UserStore extends GetxController with RequestToolMixin {
StorageService.to.write(AppStorageKey.token.value, token); StorageService.to.write(AppStorageKey.token.value, token);
} }
///
void setLoginType(String loginType) {
this.loginType = loginType;
StorageService.to.write(AppStorageKey.loginType.value, loginType);
}
/// ///
void setUserDetailInfo(UserInfoEntity info) { void setUserDetailInfo(UserInfoEntity info) {
userInfoEntity.value = info; userInfoEntity.value = info;
@ -51,6 +61,7 @@ class UserStore extends GetxController with RequestToolMixin {
void erase() { void erase() {
userInfoEntity.value = null; userInfoEntity.value = null;
token = null; token = null;
loginType = null;
StorageService.to.erase(); StorageService.to.erase();
} }

View File

@ -10,6 +10,7 @@ import 'package:wgshare/utils/package_info_util.dart';
import 'package:wgshare/utils/storage.dart'; import 'package:wgshare/utils/storage.dart';
import 'package:wgshare/utils/utils.dart'; import 'package:wgshare/utils/utils.dart';
import 'common/config/app_config.dart';
import 'common/config/colorUtils.dart'; import 'common/config/colorUtils.dart';
import 'routes/app_pages.dart'; import 'routes/app_pages.dart';
import 'routes/app_routes.dart'; import 'routes/app_routes.dart';
@ -79,7 +80,9 @@ class MyApp extends StatelessWidget {
// //
defaultTransition: Transition.fade, defaultTransition: Transition.fade,
// //
initialRoute: (UserStore.to.token?.isNotEmpty ?? false) && UserStore.to.userInfoEntity.value != null ? Routes.startPage : Routes.loginPage, initialRoute: (UserStore.to.token?.isNotEmpty ?? false) && UserStore.to.userInfoEntity.value != null && UserStore.to.loginType != null && UserStore.to.loginType == AppConfig.NORMAL_LOGIN
? Routes.startPage
: Routes.loginPage,
/// ///
getPages: AppPages.pages, getPages: AppPages.pages,

View File

@ -1,9 +1,12 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:signalr_core/signalr_core.dart'; import 'package:signalr_core/signalr_core.dart';
import 'package:wgshare/common/models/common/base_structure_result.dart'; import 'package:wgshare/common/models/common/base_structure_result.dart';
import 'package:wgshare/common/mixins/request_tool_mixin.dart'; import 'package:wgshare/common/mixins/request_tool_mixin.dart';
import 'package:wgshare/common/store/user_store.dart';
import '../../common/models/meeting_room_item.dart'; import '../../common/models/meeting_room_item.dart';
import '../../utils/toast_utils.dart';
import 'home_state.dart'; import 'home_state.dart';
class HomeLogic extends GetxController with RequestToolMixin { class HomeLogic extends GetxController with RequestToolMixin {
@ -22,8 +25,9 @@ class HomeLogic extends GetxController with RequestToolMixin {
state.refreshController.dispose(); state.refreshController.dispose();
} }
/// ///
Future<void> doHttpGetMeetingRoomList(int pageIndex, int pageSize) async { Future<void> doHttpGetMeetingRoomList(int pageIndex, int pageSize) async {
debugPrint("wgs输出===token${UserStore.to.token}");
BaseStructureResult<MeetingRoomItem> res = await getClient().getMeetingRoomList(pageIndex,pageSize); BaseStructureResult<MeetingRoomItem> res = await getClient().getMeetingRoomList(pageIndex,pageSize);
if(null != res.data){ if(null != res.data){
if(state.pageIndex == 1){ if(state.pageIndex == 1){
@ -54,4 +58,20 @@ class HomeLogic extends GetxController with RequestToolMixin {
doHttpGetMeetingRoomList(state.pageIndex.value,state.pageSize.value); doHttpGetMeetingRoomList(state.pageIndex.value,state.pageSize.value);
} }
/// 退
bool closeOnConfirm(BuildContext context) {
DateTime now = DateTime.now();
// 4, 退
if (state.currentBackPressTime == null ||
now.difference(state.currentBackPressTime!) > const Duration(seconds: 4)) {
state.currentBackPressTime = now;
ToastUtils.showInfo("再按一次退出");
return false;
}
// 退
state.currentBackPressTime = null;
return true;
}
} }

View File

@ -25,4 +25,7 @@ class HomeState {
/// ///
final RxInt totalPage = 0.obs; final RxInt totalPage = 0.obs;
/// 退
DateTime? currentBackPressTime;
} }

View File

@ -19,7 +19,6 @@ class HomePage extends StatefulWidget {
} }
class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin { class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
final logic = Get.put(HomeLogic()); final logic = Get.put(HomeLogic());
final state = Get.find<HomeLogic>().state; final state = Get.find<HomeLogic>().state;
@ -36,155 +35,180 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return Scaffold( return PopScope(
appBar: AppBar( canPop: false,
surfaceTintColor: Colors.white, onPopInvoked: (bool didPop) async {
elevation: 0, if (didPop) {
toolbarHeight: 0, return;
systemOverlayStyle: const SystemUiOverlayStyle( }
statusBarColor: Colors.transparent, if (logic.closeOnConfirm(context)) {
systemNavigationBarColor: Color(0xFF000000), // 退
systemNavigationBarIconBrightness: Brightness.light, SystemNavigator.pop();
statusBarIconBrightness: Brightness.dark, }
statusBarBrightness: Brightness.light, },
child: Scaffold(
appBar: AppBar(
surfaceTintColor: Colors.white,
elevation: 0,
toolbarHeight: 0,
systemOverlayStyle: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor: Color(0xFF000000),
systemNavigationBarIconBrightness: Brightness.light,
statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.light,
),
backgroundColor: Colors.white,
), ),
backgroundColor: Colors.white, body: Obx(() => Column(
), children: [
body: Obx(() => Column( Container(
children: [ width: double.infinity,
Container( height: 44.h,
width: double.infinity, alignment: Alignment.center,
height: 44.h, color: Colors.white,
alignment: Alignment.center, child: Text(
color: Colors.white, '会议列表',
child: Text( style: TextStyle(
'会议列表', fontSize: 16.sp,
style: TextStyle( color: ColorUtil.Color_51_51_51,
fontSize: 16.sp, fontWeight: FontWeight.w500),
color: ColorUtil.Color_51_51_51,
fontWeight: FontWeight.w500
), ),
), ),
), Expanded(
Expanded( child: Container(
child: Container( color: ColorUtil.Color_244_244_244,
color: ColorUtil.Color_244_244_244, child: SmartRefresher(
child: SmartRefresher( enablePullUp: true,
enablePullUp: true, controller: state.refreshController,
controller: state.refreshController, onRefresh: logic.onRefresh,
onRefresh: logic.onRefresh, onLoading: logic.onLoading,
onLoading: logic.onLoading, child: ListView.builder(
child: ListView.builder( itemBuilder: (context, index) {
itemBuilder: (context, index) { return Container(
return Container( width: double.infinity,
width: double.infinity, decoration: const BoxDecoration(
decoration: const BoxDecoration( borderRadius:
borderRadius: BorderRadius.all(Radius.circular(6)), BorderRadius.all(Radius.circular(6)),
color: Colors.white, color: Colors.white,
), ),
margin: EdgeInsets.only(top: index == 0 ? 20 : 12, bottom: index == 19 ? 20 : 0, left: 16, right: 16), margin: EdgeInsets.only(
padding: const EdgeInsets.all(12), top: index == 0 ? 20 : 12,
child: Column( bottom: index == 19 ? 20 : 0,
children: [ left: 16,
Row( right: 16),
mainAxisAlignment: MainAxisAlignment.spaceBetween, padding: const EdgeInsets.all(12),
children: [ child: Column(
Text( children: [
state.meetingRooms.value[index].roomName, Row(
style: TextStyle( mainAxisAlignment:
fontSize: 14.sp, MainAxisAlignment.spaceBetween,
color: ColorUtil.Color_89_88_88, children: [
fontWeight: FontWeight.w500 Text(
state.meetingRooms.value[index].roomName,
style: TextStyle(
fontSize: 14.sp,
color: ColorUtil.Color_89_88_88,
fontWeight: FontWeight.w500),
), ),
), Row(
Row( children: [
children: [ Image.asset(
Image.asset( 'assets/images/index_persons.png',
'assets/images/index_persons.png',
width: 16.w,
height: 16.h,
),
Text(
'${state.meetingRooms.value[index].onlineUserCount}',
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_177_177_177,
),
),
],
)
],
),
SizedBox(height: 20.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(
state.meetingRooms.value[index].roomNum,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_177_177_177,
),
),
SizedBox(width: 6.w),
GestureDetector(
child: Image.asset(
'assets/images/index_copy.png',
width: 16.w, width: 16.w,
height: 16.h, height: 16.h,
), ),
onTap: (){ Text(
Clipboard.setData(ClipboardData(text: state.meetingRooms.value[index].roomNum)); '${state.meetingRooms.value[index].onlineUserCount}',
ToastUtils.showSuccess("复制成功"); style: TextStyle(
}, fontSize: 12.sp,
) color: ColorUtil.Color_177_177_177,
],
),
GestureDetector(
child: Container(
width: 78.w,
height: 30.h,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(6)),
color: ColorUtil.Color_85_117_242,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'进入',
style: TextStyle(
fontSize: 12.sp,
color: Colors.white,
),
), ),
Image.asset( ),
'assets/images/index_right.png', ],
)
],
),
SizedBox(height: 20.h),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(
state.meetingRooms.value[index]
.roomNum,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_177_177_177,
),
),
SizedBox(width: 6.w),
GestureDetector(
child: Image.asset(
'assets/images/index_copy.png',
width: 16.w, width: 16.w,
height: 16.h, height: 16.h,
) ),
], onTap: () {
), Clipboard.setData(ClipboardData(
text: state.meetingRooms
.value[index].roomNum));
ToastUtils.showSuccess("复制成功");
},
)
],
), ),
onTap: (){ GestureDetector(
Get.toNamed(Routes.meetingMainPage, arguments: {"roomNumber": state.meetingRooms.value[index].roomNum}); child: Container(
}, width: 78.w,
) height: 30.h,
], decoration: BoxDecoration(
) borderRadius: const BorderRadius.all(
], Radius.circular(6)),
), color: ColorUtil.Color_85_117_242,
); ),
}, child: Row(
itemCount: state.meetingRooms.value.length, mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text(
'进入',
style: TextStyle(
fontSize: 12.sp,
color: Colors.white,
),
),
Image.asset(
'assets/images/index_right.png',
width: 16.w,
height: 16.h,
)
],
),
),
onTap: () {
Get.toNamed(Routes.meetingMainPage,
arguments: {
"roomNumber": state.meetingRooms
.value[index].roomNum
});
},
)
],
)
],
),
);
},
itemCount: state.meetingRooms.value.length,
),
), ),
), ),
), )
) ],
], ))),
))
); );
} }

View File

@ -7,6 +7,7 @@ import 'package:wgshare/common/mixins/request_tool_mixin.dart';
import 'package:wgshare/utils/device_info.dart'; import 'package:wgshare/utils/device_info.dart';
import 'package:wgshare/utils/toast_utils.dart'; import 'package:wgshare/utils/toast_utils.dart';
import '../../common/config/app_config.dart';
import '../../common/models/common/base_structure_result.dart'; import '../../common/models/common/base_structure_result.dart';
import '../../common/models/user_info_entity.dart'; import '../../common/models/user_info_entity.dart';
import '../../common/store/app_storage_key.dart'; import '../../common/store/app_storage_key.dart';
@ -46,16 +47,17 @@ class LoginLogic extends GetxController with RequestToolMixin {
}else if(state.checkAgreementBool.value != true){ }else if(state.checkAgreementBool.value != true){
ToastUtils.showError("请阅读并勾选相关协议"); ToastUtils.showError("请阅读并勾选相关协议");
}else{ }else{
try{ BaseStructureResult<UserInfoEntity> res = await getClient().login(state.userNameController.text, md5.convert(utf8.encode(state.passwordController.text)).toString());
ToastUtils.showLoading(); if (null != res.data) {
BaseStructureResult<UserInfoEntity> res = await getClient().login(state.userNameController.text, md5.convert(utf8.encode(state.passwordController.text)).toString()); UserStore.to.setToken(res.data!.token);
if (null != res.data) { UserStore.to.setUserDetailInfo(res.data!);
UserStore.to.setToken(res.data!.token); UserStore.to.setLoginType(AppConfig.NORMAL_LOGIN);
UserStore.to.setUserDetailInfo(res.data!); Get.offAllNamed(Routes.startPage);
Get.toNamed(Routes.startPage); state.userNameController.text = "";
} state.passwordController.text = "";
}finally{ state.meetingCodeController.text = "";
ToastUtils.dismiss(); state.nickNameCodeController.text = "";
state.checkAgreementBool.value = false;
} }
} }
} }
@ -71,16 +73,39 @@ class LoginLogic extends GetxController with RequestToolMixin {
}else if(state.checkAgreementBool != true){ }else if(state.checkAgreementBool != true){
ToastUtils.showError("请阅读并勾选相关协议"); ToastUtils.showError("请阅读并勾选相关协议");
}else{ }else{
try{ BaseStructureResult<UserInfoEntity> res = await getClient().anonLogin(await DeviceInfo.getDeviceId(),state.nickNameCodeController.text, state.meetingCodeController.text);
ToastUtils.showLoading(); if (null != res.data) {
BaseStructureResult<UserInfoEntity> res = await getClient().anonLogin(await DeviceInfo.getDeviceId(),state.nickNameCodeController.text, state.meetingCodeController.text); UserStore.to.setToken(res.data!.token);
if (null != res.data) { UserStore.to.setUserDetailInfo(res.data!);
UserStore.to.setToken(res.data!.token); UserStore.to.setLoginType(AppConfig.ANONYMOUS_LOGIN);
UserStore.to.setUserDetailInfo(res.data!); Get.toNamed(Routes.meetingMainPage, arguments: {"roomNumber": state.meetingCodeController.text});
Get.toNamed(Routes.meetingMainPage, arguments: {"roomNumber": state.meetingCodeController.text}); state.userNameController.text = "";
state.passwordController.text = "";
state.meetingCodeController.text = "";
state.nickNameCodeController.text = "";
state.checkAgreementBool.value = false;
}
}
}
///
Future<void> doHttpCheckMeetingRoom() async {
if(state.meetingCodeController.text.isEmpty){
ToastUtils.showError("请输入会议号");
}else if(state.meetingCodeController.text.length != 8){
ToastUtils.showError("请输入正确的会议号");
}else if(state.nickNameCodeController.text.isEmpty){
ToastUtils.showError("请输入昵称");
}else if(state.checkAgreementBool != true){
ToastUtils.showError("请阅读并勾选相关协议");
}else{
BaseStructureResult<bool> res = await getClient().checkout(state.meetingCodeController.text);
if (null != res.data) {
if(res.data == true){
doHttpAnonymousLogin();
}else{
ToastUtils.showError("房间不存在");
} }
}finally{
ToastUtils.dismiss();
} }
} }
} }

View File

@ -378,7 +378,7 @@ class _LoginPageState extends State<LoginPage> {
if (state.pageState.value == 0) { if (state.pageState.value == 0) {
logic.doHttpLogin(); logic.doHttpLogin();
} else { } else {
logic.doHttpAnonymousLogin(); logic.doHttpCheckMeetingRoom();
} }
}, },
) )

View File

@ -1,8 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:agora_rtc_engine/agora_rtc_engine.dart'; import 'package:agora_rtc_engine/agora_rtc_engine.dart';
import 'package:date_format/date_format.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:signalr_core/signalr_core.dart'; import 'package:signalr_core/signalr_core.dart';
import 'package:wgshare/common/store/user_store.dart'; import 'package:wgshare/common/store/user_store.dart';
@ -13,6 +16,7 @@ import '../../common/models/common/base_structure_result.dart';
import '../../common/models/meeting_room_info.dart'; import '../../common/models/meeting_room_info.dart';
import '../../common/models/meeting_room_msg.dart'; import '../../common/models/meeting_room_msg.dart';
import '../../common/models/meeting_room_user.dart'; import '../../common/models/meeting_room_user.dart';
import '../../utils/agora/AgoraUtil.dart';
import '../../utils/permission/PermissionService.dart'; import '../../utils/permission/PermissionService.dart';
import '../../utils/toast_utils.dart'; import '../../utils/toast_utils.dart';
import 'meeting_main_state.dart'; import 'meeting_main_state.dart';
@ -50,17 +54,20 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
state.meetingToken.value = res.data!; state.meetingToken.value = res.data!;
if (isInit == true) { if (isInit == true) {
initRtc();
signalRSocket(); signalRSocket();
}else{
initRtc();
} }
} }
/// ///
/// 1. /// 1.
/// 2. /// 2.
Future<void> mergeFetch() async { Future<void> mergeFetch(bool isAgain) async {
try { try {
ToastUtils.showLoading(); if (isAgain == false) {
ToastUtils.showLoading();
}
var results = await Future.wait([ var results = await Future.wait([
getClient().getMeetingRoomInfo(state.roomNumber.value), getClient().getMeetingRoomInfo(state.roomNumber.value),
@ -92,6 +99,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
/// ///
void getMeetingRoomInfo(MeetingRoomInfo meetingRoomInfo) async { void getMeetingRoomInfo(MeetingRoomInfo meetingRoomInfo) async {
state.meetingRoomInfo.value = meetingRoomInfo; state.meetingRoomInfo.value = meetingRoomInfo;
initRtc();
startTime(); startTime();
} }
@ -99,6 +107,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
void getMeetingRoomAllUser(List<MeetingRoomUser> meetingRoomUsers) async { void getMeetingRoomAllUser(List<MeetingRoomUser> meetingRoomUsers) async {
state.users.value = meetingRoomUsers; state.users.value = meetingRoomUsers;
state.cacheUsers.value = meetingRoomUsers; state.cacheUsers.value = meetingRoomUsers;
update();
doHttpGetTvAnchor(); doHttpGetTvAnchor();
} }
@ -138,6 +147,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
} else { } else {
state.users.value = state.cacheUsers.value; state.users.value = state.cacheUsers.value;
} }
update();
} }
/// ------------------------------------------------------------------------------ /// ------------------------------------------------------------------------------
@ -195,6 +205,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
if (res.data!.toString().length != 9) { if (res.data!.toString().length != 9) {
// //
if (state.remoteUid.value == UserStore.to.userInfoEntity.value!.uid) { if (state.remoteUid.value == UserStore.to.userInfoEntity.value!.uid) {
debugPrint("wgs输出===:当前全员观看是自己");
// //
// ID为0 // ID为0
state.remoteUid.value = "0"; state.remoteUid.value = "0";
@ -205,10 +216,22 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
// //
changePageState(1); changePageState(1);
} else { } else {
// // ,
changePageState(0); var isOtherOpenCamera = false;
for (var i = 0; i < state.cacheUsers.value.length; i++) {
if (state.cacheUsers.value[i].enableCamera == true) {
isOtherOpenCamera = true;
}
}
if(isOtherOpenCamera == false){
changePageState(0);
}else{
state.remoteUid.value = "";
changePageState(1);
}
} }
} else { } else {
debugPrint("wgs输出===:当前全员观看不是自己");
// //
// //
var isCurrentUserIsCamera = false; var isCurrentUserIsCamera = false;
@ -222,7 +245,10 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
if (isCurrentUserIsCamera == true) { if (isCurrentUserIsCamera == true) {
// //
debugPrint("wgs输出===:当前会议室存在全员观看主播时,切换页面到视频状态"); debugPrint("wgs输出===:当前会议室存在全员观看主播时,切换页面到视频状态");
changePageState(1); changePageState(0);
Future.delayed(const Duration(milliseconds: 200), () {
changePageState(1);
});
} else { } else {
// ID为空并切换页面到视频状态 // ID为空并切换页面到视频状态
debugPrint("wgs输出===当前会议室不存在全员观看主播时设置主播ID为空并切换页面到视频状态"); debugPrint("wgs输出===当前会议室不存在全员观看主播时设置主播ID为空并切换页面到视频状态");
@ -231,14 +257,20 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
} }
} }
} else { } else {
// if (state.remoteUid.value ==
/*if(state.remoteUid.value == UserStore.to.userInfoEntity.value!.screenShareId){ UserStore.to.userInfoEntity.value!.screenShareId) {
// //
}else{ } else {
// //
changePageState(1); for (var i = 0; i < state.cacheUsers.value.length; i++) {
}*/ if (state.remoteUid.value ==
state.cacheUsers.value[i].screenShareId) {
state.cacheUsers.value[i].enableShare = true;
}
}
}
} }
update();
} }
/// ///
@ -300,14 +332,52 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
accessTokenFactory: () async => accessTokenFactory: () async =>
await Future.value(UserStore.to.token), await Future.value(UserStore.to.token),
logging: (level, message) => logging: (level, message) =>
debugPrint("wgs输出===SignalR Socket-$message"), debugPrint("wgs输出===SignalR Socket-日志:$message"),
)) ))
// 线410 4 10 10 // 线52 4 4 5 10
.withAutomaticReconnect([10000, 4000, 10000, 10000]).build(); .withAutomaticReconnect([2000, 4000, 4000, 5000, 10000]).build();
await state.hubConnection.value?.start(); await state.hubConnection.value?.start();
joinMeetingToSocket(); //
state.hubConnection.value?.onreconnecting((error) {
debugPrint("wgs输出===SignalR Socket-重连$error");
if (EasyLoading.isShow == false) {
ToastUtils.showLoadingToMask("网络故障,正在重连...", EasyLoadingMaskType.black);
}
});
// 5
state.hubConnection.value?.onreconnected((connectionId) {
debugPrint("wgs输出===SignalR Socket-重连成功$connectionId");
joinMeetingToSocket(true);
ToastUtils.dismiss();
if (EasyLoading.isShow == false) {
ToastUtils.showSuccessToMask("重连成功!", EasyLoadingMaskType.black);
}
});
// 5
state.hubConnection.value?.onclose((error) {
debugPrint("wgs输出===SignalR Socket-重连失败$error");
ToastUtils.dismiss();
if (state.isNormaExit.value == false &&
state.isShowOkAlertDialog.value == false) {
showOkAlertDialog(
context: Get.context!,
title: "提示",
message: "网络错误,请重新加入会议室",
okLabel: "确定",
barrierDismissible: false,
).then((OkCancelResult value) {
Get.back();
Get.back();
});
}
});
joinMeetingToSocket(false);
/// ------------------------------------------------------------------------------ /// ------------------------------------------------------------------------------
/// ///
@ -321,13 +391,22 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
for (MeetingRoomUser mru in state.cacheUsers.value) { for (MeetingRoomUser mru in state.cacheUsers.value) {
if (mru.uid == meetingRoomUser.uid) { if (mru.uid == meetingRoomUser.uid) {
mru.roleId = meetingRoomUser.roleId; mru.roleId = meetingRoomUser.roleId;
mru.enableMicr = true; if(state.defaulOpenState.value == 1){
mru.enableMicr = true;
}
mru.isRoomManager = meetingRoomUser.isRoomManager; mru.isRoomManager = meetingRoomUser.isRoomManager;
} }
} }
if (UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid) { if (UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid) {
state.isSpeak.value = true; state.isSpeak.value = true;
state.isOpenMicrophone.value = true; debugPrint("wgs输出===Socket-状态:${state.defaulOpenState.value}");
if (state.defaulOpenState.value == 1) {
debugPrint("wgs输出===Socket-状态1111111111111");
doHttpSetMicr(true);
} else if (state.defaulOpenState.value == 2) {
debugPrint("wgs输出===Socket-状态2222222222222");
doHttpSetCamer(true);
}
// SDK角色为主播 // SDK角色为主播
setClientRole("主播"); setClientRole("主播");
debugPrint("wgs输出===Socket-开启发言权限:主播"); debugPrint("wgs输出===Socket-开启发言权限:主播");
@ -338,16 +417,20 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
if (mru.uid == meetingRoomUser.uid) { if (mru.uid == meetingRoomUser.uid) {
mru.roleId = meetingRoomUser.roleId; mru.roleId = meetingRoomUser.roleId;
mru.enableMicr = false; mru.enableMicr = false;
mru.enableCamera = false;
mru.isRoomManager = meetingRoomUser.isRoomManager; mru.isRoomManager = meetingRoomUser.isRoomManager;
} }
} }
if (UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid) { if (UserStore.to.userInfoEntity.value!.uid == meetingRoomUser.uid) {
state.isSpeak.value = false; state.isSpeak.value = false;
state.defaulOpenState.value = 0;
state.isOpenMicrophone.value = false; state.isOpenMicrophone.value = false;
state.isOpenCamera.value = false; state.isOpenCamera.value = false;
state.isOpenShare.value = false; state.isOpenShare.value = false;
state.remoteUid.value = "";
//
doHttpSetMicr(false);
doHttpSetCamer(false);
// SDK角色为观众 // SDK角色为观众
setClientRole("观众"); setClientRole("观众");
// //
@ -356,14 +439,18 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
stopPreview(); stopPreview();
// //
state.floating.value?.close(); state.floating.value?.close();
// //
changePageState(0); if (state.remoteUid.value == "0") {
state.remoteUid.value = "";
changePageState(0);
}
// //
// stopScreenCapture(); // stopScreenCapture();
debugPrint("wgs输出===Socket-关闭发言权限:观众"); debugPrint("wgs输出===Socket-关闭发言权限:观众");
} }
} }
update();
}); });
/// ------------------------------------------------------------------------------ /// ------------------------------------------------------------------------------
@ -379,6 +466,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
} }
state.users.value = state.cacheUsers.value; state.users.value = state.cacheUsers.value;
state.isOpenMicrophone.value = e?[0]; state.isOpenMicrophone.value = e?[0];
update();
}); });
/// ///
@ -416,6 +504,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
muteLocalAudioStream(true); muteLocalAudioStream(true);
} }
} }
update();
}); });
/// ------------------------------------------------------------------------------ /// ------------------------------------------------------------------------------
@ -429,6 +518,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
.toList(); .toList();
state.cacheUsers.value.addAll(meetingRoomUsers); state.cacheUsers.value.addAll(meetingRoomUsers);
state.users.value = state.cacheUsers.value; state.users.value = state.cacheUsers.value;
update();
debugPrint("wgs输出===Socket-远端用户或主播加入会议室:$jsonStr"); debugPrint("wgs输出===Socket-远端用户或主播加入会议室:$jsonStr");
}); });
@ -445,6 +535,8 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
} }
} }
state.users.value = state.cacheUsers.value; state.users.value = state.cacheUsers.value;
update();
doHttpGetTvAnchor();
debugPrint("wgs输出===Socket-远端用户或主播离开会议室:$jsonStr"); debugPrint("wgs输出===Socket-远端用户或主播离开会议室:$jsonStr");
}); });
@ -453,15 +545,21 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
// var jsonStr = const Utf8Decoder().convert(json.encode(e).runes.toList()); // var jsonStr = const Utf8Decoder().convert(json.encode(e).runes.toList());
var jsonStr = json.encode(e); var jsonStr = json.encode(e);
debugPrint("wgs输出===Socket-被移除会议:$jsonStr"); debugPrint("wgs输出===Socket-被移除会议:$jsonStr");
Get.back(); state.isNormaExit.value = true;
ToastUtils.showSuccess("你已被移除会议"); ToastUtils.showSuccess("你已被移除会议");
Future.delayed(const Duration(seconds: 1), () {
Get.back();
});
}); });
/// ///
state.hubConnection.value?.on("AllLeave", (e) { state.hubConnection.value?.on("AllLeave", (e) {
debugPrint("wgs输出===Socket-全员结束会议"); debugPrint("wgs输出===Socket-全员结束会议");
Get.back(); state.isNormaExit.value = true;
ToastUtils.showSuccess("会议已结束"); ToastUtils.showSuccess("会议已结束");
Future.delayed(const Duration(seconds: 1), () {
Get.back();
});
}); });
/// ------------------------------------------------------------------------------ /// ------------------------------------------------------------------------------
@ -470,8 +568,9 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
// var jsonStr = const Utf8Decoder().convert(json.encode(e).runes.toList()); // var jsonStr = const Utf8Decoder().convert(json.encode(e).runes.toList());
var jsonStr = json.encode(e); var jsonStr = json.encode(e);
List list = json.decode(jsonStr); List list = json.decode(jsonStr);
MeetingRoomMsg meetingRoomMsg = DateTime dateTime = DateTime.now();
MeetingRoomMsg(list[0], list[1], list[2], 0); MeetingRoomMsg meetingRoomMsg = MeetingRoomMsg(list[0], list[1], list[2],
0, formatDate(dateTime, [HH, ':', nn, ':', ss]));
state.meetingRoomMsgs.value.add(meetingRoomMsg); state.meetingRoomMsgs.value.add(meetingRoomMsg);
update(); update();
Future.delayed(const Duration(milliseconds: 100), () { Future.delayed(const Duration(milliseconds: 100), () {
@ -533,7 +632,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
stopPreview(); stopPreview();
// //
if (state.remoteUid.value == "0") { if (state.remoteUid.value == "0") {
changePageState(0); state.remoteUid.value = "";
} }
// //
if (state.floating.value?.isShowing == true) { if (state.floating.value?.isShowing == true) {
@ -541,6 +640,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
} }
} }
} }
update();
}); });
/// ///
@ -554,10 +654,17 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
} }
/// ///
Future<void> joinMeetingToSocket() async { /// isAgain
Future<void> joinMeetingToSocket(bool isAgain) async {
await state.hubConnection.value?.invoke("joinChannel", await state.hubConnection.value?.invoke("joinChannel",
args: [state.roomNumber.value, false, false, false]); args: [state.roomNumber.value, false, false, false]);
mergeFetch(); mergeFetch(isAgain);
/*if(isAgain == false){
mergeFetch(isAgain);
initRtc(false);
}else{
mergeFetch(true);
}*/
} }
/// ///
@ -569,11 +676,13 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
/// ///
Future<void> sendMsg(String msg) async { Future<void> sendMsg(String msg) async {
DateTime dateTime = DateTime.now();
MeetingRoomMsg meetingRoomMsg = MeetingRoomMsg( MeetingRoomMsg meetingRoomMsg = MeetingRoomMsg(
UserStore.to.userInfoEntity.value!.uid, UserStore.to.userInfoEntity.value!.uid,
UserStore.to.userInfoEntity.value!.userName, UserStore.to.userInfoEntity.value!.userName,
msg, msg,
1); 1,
formatDate(dateTime, [HH, ':', nn, ':', ss]));
state.meetingRoomMsgs.value.add(meetingRoomMsg); state.meetingRoomMsgs.value.add(meetingRoomMsg);
update(); update();
Future.delayed(const Duration(milliseconds: 100), () { Future.delayed(const Duration(milliseconds: 100), () {
@ -608,129 +717,186 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
// //
await state.rctEngine.value?.enableAudioVolumeIndication( await state.rctEngine.value?.enableAudioVolumeIndication(
interval: 200, smooth: 3, reportVad: true); interval: 200, smooth: 3, reportVad: true);
//
await state.rctEngine.value
?.setDualStreamMode(mode: SimulcastStreamMode.enableSimulcastStream);
joinMeetingToRtc(); joinMeetingToRtc();
// //
state.rctEngine.value?.registerEventHandler( state.rctEngine.value?.registerEventHandler(
RtcEngineEventHandler( RtcEngineEventHandler(
// //
onJoinChannelSuccess: (RtcConnection connection, int elapsed) { onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
debugPrint("wgs输出===RTC-自己加入会议室ID${connection.localUid}"); state.isJoinSuccess.value = true;
}, debugPrint("wgs输出===RTC-自己加入会议室ID${connection.localUid}");
},
// //
onLeaveChannel: (RtcConnection connection, RtcStats stats) { onLeaveChannel: (RtcConnection connection, RtcStats stats) {
debugPrint("wgs输出===RTC-自己离开会议室ID${connection.localUid}"); debugPrint("wgs输出===RTC-自己离开会议室ID${connection.localUid}");
}, },
// - // -
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) { onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
debugPrint("wgs输出===RTC-远端用户或主播加入会议室用户或主机的ID$remoteUid"); debugPrint("wgs输出===RTC-远端用户或主播加入会议室用户或主机的ID$remoteUid");
}, },
// - // -
onUserOffline: (RtcConnection connection, int remoteUid, onUserOffline: (RtcConnection connection, int remoteUid,
UserOfflineReasonType reason) async { UserOfflineReasonType reason) async {
debugPrint("wgs输出===RTC-远端用户或主播离开会议室用户或主机的ID$remoteUid"); //
}, if (remoteUid.toString().length == 9) {
for (var i = 0; i < state.cacheUsers.value.length; i++) {
// if (remoteUid.toString() ==
onAudioRoutingChanged: (int routing) { state.cacheUsers.value[i].screenShareId) {
debugPrint("wgs输出===RTC-音频路由切换:$routing"); state.cacheUsers.value[i].enableShare = false;
state.communicationMode.value = routing;
if (routing == 1) {
debugPrint("wgs输出===RTC-音频路由切换为听筒");
} else if (routing == 3) {
debugPrint("wgs输出===RTC-音频路由切换为扬声器");
} else {
debugPrint("wgs输出===RTC-音频路由切换为外接设备");
}
},
//
onLocalAudioStateChanged: (RtcConnection connection,
LocalAudioStreamState state, LocalAudioStreamReason reason) {
debugPrint("wgs输出===RTC-音频采集开关:$state");
},
//
onRemoteVideoStateChanged: (RtcConnection connection,
int remoteUid,
RemoteVideoState remoteVideoState,
RemoteVideoStateReason remoteVideoStateReason,
int elapsed) {
debugPrint(
"wgs输出===RTC-远端视频状态发生改变ID-$remoteUid-状态-$remoteVideoStateReason");
if (remoteVideoStateReason ==
RemoteVideoStateReason.remoteVideoStateReasonRemoteMuted) {
//
if (remoteUid.toString().length != 9) {
//
if (remoteUid.toString() == state.remoteUid.value) {
//
doHttpGetTvAnchor();
}
} else {
//
} }
} }
}, }
update();
debugPrint("wgs输出===RTC-远端用户或主播离开会议室用户或主机的ID$remoteUid");
},
// //
onAudioVolumeIndication: (RtcConnection connection, onAudioRoutingChanged: (int routing) {
List<AudioVolumeInfo> speakers, debugPrint("wgs输出===RTC-音频路由切换:$routing");
int speakerNumber, state.communicationMode.value = routing;
int totalVolume) { if (routing == 1) {
if (speakers.isNotEmpty) { debugPrint("wgs输出===RTC-音频路由切换为听筒");
for (AudioVolumeInfo avi in speakers) { } else if (routing == 3) {
for (MeetingRoomUser mru in state.cacheUsers.value) { debugPrint("wgs输出===RTC-音频路由切换为扬声器");
// } else {
if (avi.uid == 0) { debugPrint("wgs输出===RTC-音频路由切换为外接设备");
//debugPrint("wgs输出===RTC-用户音量提示(自己):${CountMicrophoneVolume.getVolume(avi.volume!)}"); }
},
//
onLocalAudioStateChanged: (RtcConnection connection,
LocalAudioStreamState state, LocalAudioStreamReason reason) {
debugPrint("wgs输出===RTC-音频采集开关:$state");
},
//
onRemoteVideoStateChanged: (RtcConnection connection,
int remoteUid,
RemoteVideoState remoteVideoState,
RemoteVideoStateReason remoteVideoStateReason,
int elapsed) {
debugPrint(
"wgs输出===RTC-远端视频状态发生改变ID-$remoteUid-状态-$remoteVideoStateReason");
if (remoteVideoStateReason ==
RemoteVideoStateReason.remoteVideoStateReasonRemoteMuted) {
//
if (remoteUid.toString().length != 9) {
//
if (remoteUid.toString() == state.remoteUid.value) {
//
doHttpGetTvAnchor();
}
} else {
//
}
}
},
//
onAudioVolumeIndication: (RtcConnection connection,
List<AudioVolumeInfo> speakers,
int speakerNumber,
int totalVolume) {
if (speakers.isNotEmpty) {
for (AudioVolumeInfo avi in speakers) {
for (MeetingRoomUser mru in state.cacheUsers.value) {
//
if (avi.uid == 0) {
//debugPrint("wgs输出===RTC-用户音量提示(自己):${CountMicrophoneVolume.getVolume(avi.volume!)}");
mru.volume = CountMicrophoneVolume.getVolume(avi.volume!);
state.microphoneVolume.value =
CountMicrophoneVolume.getVolume(avi.volume!);
} else {
if (avi.uid.toString() == mru.uid) {
//debugPrint("wgs输出===RTC-用户音量提示(远端用户):${speakers[0].uid}--${speakers[0].volume}");
mru.volume = CountMicrophoneVolume.getVolume(avi.volume!); mru.volume = CountMicrophoneVolume.getVolume(avi.volume!);
state.microphoneVolume.value =
CountMicrophoneVolume.getVolume(avi.volume!);
} else {
if (avi.uid.toString() == mru.uid) {
//debugPrint("wgs输出===RTC-用户音量提示(远端用户):${speakers[0].uid}--${speakers[0].volume}");
mru.volume = CountMicrophoneVolume.getVolume(avi.volume!);
if (avi.volume != 0) { if (avi.volume != 0) {
state.spokesman.value = mru.userName; state.spokesman.value = mru.userName;
state.spokesmanVolume.value = state.spokesmanVolume.value =
CountMicrophoneVolume.getVolume(avi.volume!); CountMicrophoneVolume.getVolume(avi.volume!);
} else { } else {
state.spokesman.value = ""; state.spokesman.value = "";
state.spokesmanVolume.value = 0; state.spokesmanVolume.value = 0;
}
} }
} }
} }
} }
} }
}, }
},
// //
onClientRoleChanged: (RtcConnection connection, ClientRoleType oldRole, onClientRoleChanged: (RtcConnection connection,
ClientRoleType newRole, ClientRoleOptions newRoleOptions) { ClientRoleType oldRole,
debugPrint( ClientRoleType newRole,
"wgs输出===RTC-切换用户角色为:${newRole == ClientRoleType.clientRoleBroadcaster ? "主播" : "观众"}"); ClientRoleOptions newRoleOptions) {
}, debugPrint(
"wgs输出===RTC-切换用户角色为:${newRole == ClientRoleType.clientRoleBroadcaster ? "主播" : "观众"}");
},
// token即将在30秒内过期回调 // token即将在30秒内过期回调
onTokenPrivilegeWillExpire: (RtcConnection connection, String token) { onTokenPrivilegeWillExpire: (RtcConnection connection, String token) {
doHttpGetMeetingToken(false); doHttpGetMeetingToken(false);
}, },
// //
onLocalVideoStateChanged: (VideoSourceType source, onLocalVideoStateChanged: (VideoSourceType source,
LocalVideoStreamState state, LocalVideoStreamReason reason) { LocalVideoStreamState state, LocalVideoStreamReason reason) {
debugPrint("wgs输出===RTC-本地视频状态发生改变:$source--$state--$reason"); debugPrint("wgs输出===RTC-本地视频状态发生改变:$source--$state--$reason");
}, },
// //
/*onPermissionError: (PermissionType permissionType){ onConnectionStateChanged: (RtcConnection connection,
ConnectionStateType stateType,
ConnectionChangedReasonType reason) {
debugPrint("wgs输出===RTC-网络连接状态发生改变:"
"会议室编号(${connection.channelId}"
"网络状态($stateType-${AgoraUtil.getConnectionStateChangedType(stateType)}"
"网络改变原因($reason-${AgoraUtil.getConnectionChangedReasonType(reason)}");
if (stateType == ConnectionStateType.connectionStateReconnecting) {
if (EasyLoading.isShow == false) {
ToastUtils.showLoadingToMask(
"网络故障,正在重连...", EasyLoadingMaskType.black);
}
} else if (stateType == ConnectionStateType.connectionStateConnected &&
reason ==
ConnectionChangedReasonType.connectionChangedRejoinSuccess) {
ToastUtils.dismiss();
if (EasyLoading.isShow == false) {
ToastUtils.showSuccessToMask("重连成功!", EasyLoadingMaskType.black);
}
} else if (reason ==
ConnectionChangedReasonType.connectionChangedLost) {
// 15signalR Socket一致SDK继续重连
Future.delayed(const Duration(milliseconds: 15000), () {
ToastUtils.dismiss();
if (state.isShowOkAlertDialog.value == false) {
showOkAlertDialog(
context: Get.context!,
title: "提示",
message: "网络错误,请重新加入会议室",
okLabel: "确定",
barrierDismissible: false,
).then((OkCancelResult value) {
Get.back();
Get.back();
});
}
});
}
}
//
/*onPermissionError: (PermissionType permissionType){
debugPrint("wgs输出===RTC-获取设备权限出错:$permissionType"); debugPrint("wgs输出===RTC-获取设备权限出错:$permissionType");
if(permissionType == PermissionType.screenCapture){ if(permissionType == PermissionType.screenCapture){
// //
@ -738,7 +904,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
stopScreenCapture(); stopScreenCapture();
} }
}*/ }*/
), ),
); );
} }

View File

@ -46,6 +46,10 @@ class MeetingMainState {
/// ///
late Rx<MeetingRoomInfo?> meetingRoomInfo = Rx(null); late Rx<MeetingRoomInfo?> meetingRoomInfo = Rx(null);
/// showOkAlertDialog
late RxBool isShowOkAlertDialog = false.obs;
/// 退退
late RxBool isNormaExit = false.obs;
/// ///
late RxString duration = "".obs; late RxString duration = "".obs;
@ -60,6 +64,8 @@ class MeetingMainState {
/// ///
late RxBool isSpeak = false.obs; late RxBool isSpeak = false.obs;
/// 012
late RxInt defaulOpenState = 0.obs;
/// ///
late RxBool isOpenMicrophone = false.obs; late RxBool isOpenMicrophone = false.obs;
/// ///
@ -70,6 +76,8 @@ class MeetingMainState {
late RxBool isOpenShare = false.obs; late RxBool isOpenShare = false.obs;
/// ID /// ID
late RxString remoteUid = "".obs; late RxString remoteUid = "".obs;
///
late RxBool isJoinSuccess = false.obs;
/// ///
late RxString spokesman = "".obs; late RxString spokesman = "".obs;

File diff suppressed because it is too large Load Diff

View File

@ -72,11 +72,16 @@ class MeetingMainVoiceComponent extends StatelessWidget {
shapePath: ViewSvgPath.getMicrpphonePath() shapePath: ViewSvgPath.getMicrpphonePath()
), ),
), ),
Text( SizedBox(
users[index].userName, width: 70,
style: TextStyle( child: Text(
fontSize: 12.sp, users[index].userName,
color: ColorUtil.Color_255_255_255), maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_255_255_255),
),
) )
], ],
) )
@ -89,11 +94,16 @@ class MeetingMainVoiceComponent extends StatelessWidget {
width: 20.w, width: 20.w,
height: 20.h, height: 20.h,
), ),
Text( SizedBox(
users[index].userName, width: 70,
style: TextStyle( child: Text(
fontSize: 12.sp, users[index].userName,
color: ColorUtil.Color_255_255_255), maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_255_255_255),
),
) )
], ],
), ),

View File

@ -11,6 +11,6 @@ class UserLogic extends GetxController with RequestToolMixin {
/// 退 /// 退
void logout(){ void logout(){
UserStore.to.erase(); UserStore.to.erase();
Get.offAllNamed(Routes.loginPage); Get.toNamed(Routes.loginPage);
} }
} }

View File

@ -77,7 +77,7 @@ class UserPageState extends State<UserPage> {
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
UserStore.to.userInfoEntity.value!.userName.length >= 3 UserStore.to.userInfoEntity.value!.userName.length >= 3
? UserStore.to.userInfoEntity.value!.userName.substring(1,UserStore.to.userInfoEntity.value!.userName.length) ? UserStore.to.userInfoEntity.value!.userName.substring(UserStore.to.userInfoEntity.value!.userName.length - 2,UserStore.to.userInfoEntity.value!.userName.length)
: UserStore.to.userInfoEntity.value!.userName, : UserStore.to.userInfoEntity.value!.userName,
style: TextStyle( style: TextStyle(
fontSize: 30.sp, fontSize: 30.sp,

View File

@ -0,0 +1,110 @@
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
/// SDK相关工具类
class AgoraUtil{
///
static String getConnectionStateChangedType(ConnectionStateType type){
var returnTypeStr = "";
switch(type){
case ConnectionStateType.connectionStateDisconnected:
returnTypeStr = "网络连接断开";
break;
case ConnectionStateType.connectionStateConnecting:
returnTypeStr = "网络连接中";
break;
case ConnectionStateType.connectionStateConnected:
returnTypeStr = "网络已连接";
break;
case ConnectionStateType.connectionStateReconnecting:
returnTypeStr = "网络重新连接中";
break;
case ConnectionStateType.connectionStateFailed:
returnTypeStr = "网络连接失败";
break;
}
return returnTypeStr;
}
///
static String getConnectionChangedReasonType(ConnectionChangedReasonType type){
var returnTypeStr = "";
switch(type){
case ConnectionChangedReasonType.connectionChangedConnecting:
returnTypeStr = "建立网络连接中";
break;
case ConnectionChangedReasonType.connectionChangedJoinSuccess:
returnTypeStr = "成功加入频道";
break;
case ConnectionChangedReasonType.connectionChangedInterrupted:
returnTypeStr = "网络连接中断";
break;
case ConnectionChangedReasonType.connectionChangedBannedByServer:
returnTypeStr = "网络连接被服务器禁止";
break;
case ConnectionChangedReasonType.connectionChangedJoinFailed:
returnTypeStr = "加入频道失败";
break;
case ConnectionChangedReasonType.connectionChangedLeaveChannel:
returnTypeStr = "离开频道";
break;
case ConnectionChangedReasonType.connectionChangedInvalidAppId:
returnTypeStr = "App ID 无效";
break;
case ConnectionChangedReasonType.connectionChangedInvalidChannelName:
returnTypeStr = "频道名无效";
break;
case ConnectionChangedReasonType.connectionChangedInvalidToken:
returnTypeStr = "Token 无效";
break;
case ConnectionChangedReasonType.connectionChangedTokenExpired:
returnTypeStr = "当前使用的 Token 已过期";
break;
case ConnectionChangedReasonType.connectionChangedRejectedByServer:
returnTypeStr = "此用户被服务器禁止";
break;
case ConnectionChangedReasonType.connectionChangedSettingProxyServer:
returnTypeStr = "设置了代理服务器";
break;
case ConnectionChangedReasonType.connectionChangedRenewToken:
returnTypeStr = "更新 Token 引起网络连接状态改变";
break;
case ConnectionChangedReasonType.connectionChangedClientIpAddressChanged:
returnTypeStr = "客户端 IP 地址变更";
break;
case ConnectionChangedReasonType.connectionChangedKeepAliveTimeout:
returnTypeStr = "SDK 和服务器连接保活超时";
break;
case ConnectionChangedReasonType.connectionChangedRejoinSuccess:
returnTypeStr = "重新加入频道成功";
break;
case ConnectionChangedReasonType.connectionChangedLost:
returnTypeStr = "SDK 和服务器失去连接";
break;
case ConnectionChangedReasonType.connectionChangedEchoTest:
returnTypeStr = "连接状态变化由回声测试引起";
break;
case ConnectionChangedReasonType.connectionChangedClientIpAddressChangedByUser:
returnTypeStr = "本地 IP 地址被用户更改";
break;
case ConnectionChangedReasonType.connectionChangedSameUidLogin:
returnTypeStr = "使用相同的 UID 从不同的设备加入同一频道";
break;
case ConnectionChangedReasonType.connectionChangedTooManyBroadcasters:
returnTypeStr = "频道内主播人数已达上限";
break;
case ConnectionChangedReasonType.connectionChangedLicenseValidationFailure:
returnTypeStr = "连接已更改许可证验证失败";
break;
case ConnectionChangedReasonType.connectionChangedCertificationVeryfyFailure:
returnTypeStr = "连接已更改认证版本失败";
break;
case ConnectionChangedReasonType.connectionChangedStreamChannelNotAvailable:
returnTypeStr = "连接已更改流通道不可用";
break;
case ConnectionChangedReasonType.connectionChangedInconsistentAppid:
returnTypeStr = "连接已更改不一致Appid";
break;
}
return returnTypeStr;
}
}

View File

@ -71,6 +71,8 @@ class ColorUtil {
static const Color_16_19_13 = Color.fromRGBO(16, 19, 13, 1); static const Color_16_19_13 = Color.fromRGBO(16, 19, 13, 1);
static const Color_255_69_69 = Color.fromRGBO(255, 69, 69, 1);
/// ///
/// hex, 0xffffff, /// hex, 0xffffff,
/// alpha, [0.0,1.0] /// alpha, [0.0,1.0]

View File

@ -51,6 +51,10 @@ class ToastUtils {
EasyLoading.showError(showMsg, duration: duration); EasyLoading.showError(showMsg, duration: duration);
} }
static showLoadingToMask(String str, EasyLoadingMaskType maskType) {
EasyLoading.show(status: str, maskType: maskType);
}
static showLoading() { static showLoading() {
EasyLoading.show(status: 'loading...'); EasyLoading.show(status: 'loading...');
} }
@ -63,6 +67,10 @@ class ToastUtils {
EasyLoading.showInfo(showMsg, duration: Duration(microseconds: microseconds)); EasyLoading.showInfo(showMsg, duration: Duration(microseconds: microseconds));
} }
static showSuccessToMask(String showMsg, EasyLoadingMaskType maskType, {Duration? duration}) {
EasyLoading.showSuccess(showMsg, maskType: maskType, duration: duration);
}
static showSuccess(String showMsg, {Duration? duration}) { static showSuccess(String showMsg, {Duration? duration}) {
EasyLoading.showSuccess(showMsg, duration: duration); EasyLoading.showSuccess(showMsg, duration: duration);
} }

View File

@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <dynamic_color/dynamic_color_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
} }

View File

@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
dynamic_color
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST

View File

@ -6,20 +6,28 @@ import FlutterMacOS
import Foundation import Foundation
import agora_rtc_engine import agora_rtc_engine
import appkit_ui_element_colors
import device_info_plus import device_info_plus
import dynamic_color
import flutter_inappwebview_macos import flutter_inappwebview_macos
import geolocator_apple import geolocator_apple
import iris_method_channel import iris_method_channel
import macos_ui
import macos_window_utils
import package_info_plus import package_info_plus
import path_provider_foundation import path_provider_foundation
import sqflite_darwin import sqflite_darwin
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AgoraRtcNgPlugin.register(with: registry.registrar(forPlugin: "AgoraRtcNgPlugin")) AgoraRtcNgPlugin.register(with: registry.registrar(forPlugin: "AgoraRtcNgPlugin"))
AppkitUiElementColorsPlugin.register(with: registry.registrar(forPlugin: "AppkitUiElementColorsPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
IrisMethodChannelPlugin.register(with: registry.registrar(forPlugin: "IrisMethodChannelPlugin")) IrisMethodChannelPlugin.register(with: registry.registrar(forPlugin: "IrisMethodChannelPlugin"))
MacOSUiPlugin.register(with: registry.registrar(forPlugin: "MacOSUiPlugin"))
MacOSWindowUtilsPlugin.register(with: registry.registrar(forPlugin: "MacOSWindowUtilsPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))

View File

@ -14,6 +14,14 @@ packages:
description: dart description: dart
source: sdk source: sdk
version: "0.3.2" version: "0.3.2"
adaptive_dialog:
dependency: "direct main"
description:
name: adaptive_dialog
sha256: a87f9e13fdbe0b11d353733a90796129ee79fc0654a27855fa2c9c0a3633a362
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.0"
agora_rtc_engine: agora_rtc_engine:
dependency: "direct main" dependency: "direct main"
description: description:
@ -30,6 +38,22 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "6.7.0" version: "6.7.0"
animations:
dependency: transitive
description:
name: animations
sha256: d3d6dcfb218225bbe68e87ccf6378bbb2e32a94900722c5f81611dad089911cb
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.11"
appkit_ui_element_colors:
dependency: transitive
description:
name: appkit_ui_element_colors
sha256: c3e50f900aae314d339de489535736238627071457c4a4a2dbbb1545b4f04f22
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
args: args:
dependency: transitive dependency: transitive
description: description:
@ -214,6 +238,14 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.3.7" version: "2.3.7"
date_format:
dependency: "direct main"
description:
name: date_format
sha256: a48254e60bdb7f1d5a15cac7f86e37491808056c0a99dbdc850841def4754ddc
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.9"
device_info_plus: device_info_plus:
dependency: "direct main" dependency: "direct main"
description: description:
@ -246,6 +278,14 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
dynamic_color:
dependency: transitive
description:
name: dynamic_color
sha256: eae98052fa6e2826bdac3dd2e921c6ce2903be15c6b7f8b6d8a5d49b5086298d
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.0"
easy_debounce: easy_debounce:
dependency: "direct main" dependency: "direct main"
description: description:
@ -546,6 +586,14 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.2" version: "2.1.2"
gradient_borders:
dependency: transitive
description:
name: gradient_borders
sha256: b1cd969552c83f458ff755aa68e13a0327d09f06c3f42f471b423b01427f21f8
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:
@ -586,6 +634,14 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.2" version: "4.0.2"
intersperse:
dependency: transitive
description:
name: intersperse
sha256: "2f8a905c96f6cbba978644a3d5b31b8d86ddc44917662df7d27a61f3df66a576"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
intl: intl:
dependency: transitive dependency: transitive
description: description:
@ -690,6 +746,22 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
macos_ui:
dependency: transitive
description:
name: macos_ui
sha256: "80f6539aba5a3a1182d5225a6c27969a780bcb1d2d8135b4ffb708570cf0c854"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.9"
macos_window_utils:
dependency: transitive
description:
name: macos_window_utils
sha256: "3534f2af024f2f24112ca28789a44e6750083f8c0065414546c6593ee48a5009"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.1"
macros: macros:
dependency: transitive dependency: transitive
description: description:

View File

@ -33,8 +33,6 @@ dependencies:
flutter_localizations: flutter_localizations:
sdk: flutter sdk: flutter
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8 cupertino_icons: ^1.0.8
@ -86,9 +84,14 @@ dependencies:
preload_page_view: ^0.2.0 preload_page_view: ^0.2.0
# webview # webview
#webview_flutter: ^3.0.4
flutter_inappwebview: ^6.1.5 flutter_inappwebview: ^6.1.5
# 时间组件
date_format: ^2.0.9
# 弹窗
adaptive_dialog: ^2.3.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter

View File

@ -7,6 +7,7 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <agora_rtc_engine/agora_rtc_engine_plugin.h> #include <agora_rtc_engine/agora_rtc_engine_plugin.h>
#include <dynamic_color/dynamic_color_plugin_c_api.h>
#include <flutter_inappwebview_windows/flutter_inappwebview_windows_plugin_c_api.h> #include <flutter_inappwebview_windows/flutter_inappwebview_windows_plugin_c_api.h>
#include <geolocator_windows/geolocator_windows.h> #include <geolocator_windows/geolocator_windows.h>
#include <iris_method_channel/iris_method_channel_plugin_c_api.h> #include <iris_method_channel/iris_method_channel_plugin_c_api.h>
@ -15,6 +16,8 @@
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
AgoraRtcEnginePluginRegisterWithRegistrar( AgoraRtcEnginePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AgoraRtcEnginePlugin")); registry->GetRegistrarForPlugin("AgoraRtcEnginePlugin"));
DynamicColorPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar( FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterInappwebviewWindowsPluginCApi")); registry->GetRegistrarForPlugin("FlutterInappwebviewWindowsPluginCApi"));
GeolocatorWindowsRegisterWithRegistrar( GeolocatorWindowsRegisterWithRegistrar(

View File

@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
agora_rtc_engine agora_rtc_engine
dynamic_color
flutter_inappwebview_windows flutter_inappwebview_windows
geolocator_windows geolocator_windows
iris_method_channel iris_method_channel