Compare commits
No commits in common. "363fd0b77cafee9e14823ceb5a12c6f1d6ad4dce" and "045c730899d12ec12bbb5bd524cc1838579e6495" have entirely different histories.
363fd0b77c
...
045c730899
|
|
@ -103,10 +103,4 @@ abstract class RetrofitClient {
|
||||||
@Query("enableCamera") bool enableCamera,
|
@Query("enableCamera") bool enableCamera,
|
||||||
@Query("uid") String uid,
|
@Query("uid") String uid,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// 刷新登录Token
|
|
||||||
@POST("/auth/refresh")
|
|
||||||
Future<BaseStructureResult<UserInfoEntity>> refreshToken(
|
|
||||||
@Query("refreshToken") String refreshToken,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,8 @@ import 'package:wgshare/utils/toast_utils.dart';
|
||||||
import 'package:wgshare/routes/app_routes.dart';
|
import 'package:wgshare/routes/app_routes.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
|
|
||||||
import '../mixins/request_tool_mixin.dart';
|
|
||||||
import '../models/common/base_structure_result.dart';
|
|
||||||
import '../models/user_info_entity.dart';
|
|
||||||
|
|
||||||
class RequestTool {
|
class RequestTool {
|
||||||
static late Dio _dio;
|
static late Dio _dio;
|
||||||
|
|
||||||
// 初始化请求配置
|
// 初始化请求配置
|
||||||
static _init() {
|
static _init() {
|
||||||
// 自定义 HttpClient
|
// 自定义 HttpClient
|
||||||
|
|
@ -25,21 +20,16 @@ class RequestTool {
|
||||||
|
|
||||||
BaseOptions options = BaseOptions(
|
BaseOptions options = BaseOptions(
|
||||||
baseUrl: RequestConfig().baseUrl,
|
baseUrl: RequestConfig().baseUrl,
|
||||||
connectTimeout:
|
connectTimeout: const Duration(milliseconds: RequestConfig.connectTimeout),
|
||||||
const Duration(milliseconds: RequestConfig.connectTimeout),
|
receiveTimeout: const Duration(milliseconds: RequestConfig.receiveTimeout),
|
||||||
receiveTimeout:
|
|
||||||
const Duration(milliseconds: RequestConfig.receiveTimeout),
|
|
||||||
);
|
);
|
||||||
_dio = Dio(options)
|
_dio = Dio(options)..httpClientAdapter = IOHttpClientAdapter(createHttpClient: () => httpClient);
|
||||||
..httpClientAdapter =
|
|
||||||
IOHttpClientAdapter(createHttpClient: () => httpClient);
|
|
||||||
_dio.interceptors.add(AuthInterceptor()); // 添加 token
|
_dio.interceptors.add(AuthInterceptor()); // 添加 token
|
||||||
_dio.interceptors.add(ResponseHandle()); // 添加 数据返回拦截
|
_dio.interceptors.add(ResponseHandle()); // 添加 数据返回拦截
|
||||||
_dio.interceptors.add(TheError()); // 添加 数据返回拦截
|
_dio.interceptors.add(TheError()); // 添加 数据返回拦截
|
||||||
const isProd = bool.fromEnvironment('dart.vm.product');
|
const isProd = bool.fromEnvironment('dart.vm.product');
|
||||||
if (!isProd && RequestConfig.requestDataPrinting) {
|
if (!isProd && RequestConfig.requestDataPrinting) {
|
||||||
_dio.interceptors
|
_dio.interceptors.add(LogInterceptor(responseBody: true, requestBody: true)); //添加日志
|
||||||
.add(LogInterceptor(responseBody: true, requestBody: true)); //添加日志
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return RetrofitClient(_dio, baseUrl: RequestConfig().baseUrl);
|
return RetrofitClient(_dio, baseUrl: RequestConfig().baseUrl);
|
||||||
|
|
@ -118,10 +108,8 @@ class ResponseHandle extends Interceptor {
|
||||||
var data = response.data;
|
var data = response.data;
|
||||||
|
|
||||||
var flag = data != null &&
|
var flag = data != null &&
|
||||||
((data['code'] != null &&
|
((data['code'] != null && (data['code'] == 401 || data['code'] == '401')) ||
|
||||||
(data['code'] == 401 || data['code'] == '401')) ||
|
(data['Code'] != null && (data['Code'] == 401 || data['Code'] == '401')));
|
||||||
(data['Code'] != null &&
|
|
||||||
(data['Code'] == 401 || data['Code'] == '401')));
|
|
||||||
|
|
||||||
if (statusCode == 401 || flag) {
|
if (statusCode == 401 || flag) {
|
||||||
Future.delayed(const Duration(seconds: 2), () {
|
Future.delayed(const Duration(seconds: 2), () {
|
||||||
|
|
@ -138,14 +126,12 @@ class ResponseHandle extends Interceptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TheError extends Interceptor with RequestToolMixin {
|
class TheError extends Interceptor {
|
||||||
// late getx.Rx<UserInfoDetail?> userInfo = UserStore.to.userDetailInfo;
|
// late getx.Rx<UserInfoDetail?> userInfo = UserStore.to.userDetailInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onError(
|
void onError(DioException err, ErrorInterceptorHandler handler) {
|
||||||
DioException err, ErrorInterceptorHandler handler) async {
|
|
||||||
var message = '请求错误,请重试';
|
var message = '请求错误,请重试';
|
||||||
int? statusCode;
|
|
||||||
|
|
||||||
switch (err.type) {
|
switch (err.type) {
|
||||||
case DioExceptionType.connectionTimeout:
|
case DioExceptionType.connectionTimeout:
|
||||||
|
|
@ -166,7 +152,7 @@ class TheError extends Interceptor with RequestToolMixin {
|
||||||
} else {
|
} else {
|
||||||
Response? response = err.response;
|
Response? response = err.response;
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
statusCode = response.statusCode;
|
int? statusCode = response.statusCode;
|
||||||
|
|
||||||
var errorMap = response.data;
|
var errorMap = response.data;
|
||||||
// var runtimeType = errorMap.runtimeType;
|
// var runtimeType = errorMap.runtimeType;
|
||||||
|
|
@ -177,11 +163,12 @@ class TheError extends Interceptor with RequestToolMixin {
|
||||||
switch (statusCode) {
|
switch (statusCode) {
|
||||||
case 401:
|
case 401:
|
||||||
message = '用户登录失效,请重新登录';
|
message = '用户登录失效,请重新登录';
|
||||||
/*Future.delayed(const Duration(seconds: 2), () {
|
|
||||||
|
Future.delayed(const Duration(seconds: 2), () {
|
||||||
// UserStore.to.erase();
|
// UserStore.to.erase();
|
||||||
StorageService.to.erase();
|
StorageService.to.erase();
|
||||||
getx.Get.offAllNamed(Routes.loginPage);
|
getx.Get.offAllNamed(Routes.loginPage);
|
||||||
});*/
|
});
|
||||||
break;
|
break;
|
||||||
case 404:
|
case 404:
|
||||||
message = '无效地址';
|
message = '无效地址';
|
||||||
|
|
@ -203,17 +190,11 @@ class TheError extends Interceptor with RequestToolMixin {
|
||||||
default:
|
default:
|
||||||
message = '请求错误';
|
message = '请求错误';
|
||||||
}
|
}
|
||||||
if (statusCode == 401) {
|
/* if (message == '用户登录失效,请重新登录' && userInfo.value?.id == null) {
|
||||||
BaseStructureResult<UserInfoEntity> res = await getClient()
|
return handler.next(error);
|
||||||
.refreshToken(UserStore.to.userInfoEntity.value!.refreshToken);
|
}*/
|
||||||
if (null != res.data) {
|
|
||||||
UserStore.to.setToken(res.data!.token);
|
|
||||||
UserStore.to.setRefreshToken(res.data!.refreshToken);
|
|
||||||
UserStore.to.setUserDetailInfo(res.data!);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ToastUtils.showError(message);
|
ToastUtils.showError(message);
|
||||||
}
|
|
||||||
return handler.next(err);
|
return handler.next(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
enum AppStorageKey {
|
enum AppStorageKey {
|
||||||
token(value: 'TOKEN', label: "登录用户的token"),
|
token(value: 'TOKEN', label: "登录用户的token"),
|
||||||
refreshToken(value: 'REFRESHTOKEN', 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: "密码"),
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,6 @@ class UserStore extends GetxController with RequestToolMixin {
|
||||||
/// 是否登录
|
/// 是否登录
|
||||||
String? token;
|
String? token;
|
||||||
|
|
||||||
/// 刷新用的token
|
|
||||||
String? refreshToken;
|
|
||||||
|
|
||||||
/// 登录类型
|
/// 登录类型
|
||||||
String? loginType;
|
String? loginType;
|
||||||
|
|
||||||
|
|
@ -26,7 +23,6 @@ class UserStore extends GetxController with RequestToolMixin {
|
||||||
UserStore init() {
|
UserStore init() {
|
||||||
loginType = StorageService.to.read(AppStorageKey.loginType.value);
|
loginType = StorageService.to.read(AppStorageKey.loginType.value);
|
||||||
token = StorageService.to.read(AppStorageKey.token.value);
|
token = StorageService.to.read(AppStorageKey.token.value);
|
||||||
refreshToken = StorageService.to.read(AppStorageKey.refreshToken.value);
|
|
||||||
try {
|
try {
|
||||||
var userDetail = StorageService.to.read(AppStorageKey.userInfo.value);
|
var userDetail = StorageService.to.read(AppStorageKey.userInfo.value);
|
||||||
if (userDetail != null) {
|
if (userDetail != null) {
|
||||||
|
|
@ -49,12 +45,6 @@ class UserStore extends GetxController with RequestToolMixin {
|
||||||
StorageService.to.write(AppStorageKey.token.value, token);
|
StorageService.to.write(AppStorageKey.token.value, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 保存refreshToken
|
|
||||||
void setRefreshToken(String refreshToken) {
|
|
||||||
this.refreshToken = refreshToken;
|
|
||||||
StorageService.to.write(AppStorageKey.refreshToken.value, refreshToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 保存登录类型
|
/// 保存登录类型
|
||||||
void setLoginType(String loginType) {
|
void setLoginType(String loginType) {
|
||||||
this.loginType = loginType;
|
this.loginType = loginType;
|
||||||
|
|
@ -71,12 +61,10 @@ class UserStore extends GetxController with RequestToolMixin {
|
||||||
void erase() {
|
void erase() {
|
||||||
userInfoEntity.value = null;
|
userInfoEntity.value = null;
|
||||||
token = null;
|
token = null;
|
||||||
refreshToken = null;
|
|
||||||
loginType = null;
|
loginType = null;
|
||||||
|
|
||||||
StorageService.to.write(AppStorageKey.userInfo.value, null);
|
StorageService.to.write(AppStorageKey.userInfo.value, null);
|
||||||
StorageService.to.write(AppStorageKey.token.value, null);
|
StorageService.to.write(AppStorageKey.token.value, null);
|
||||||
StorageService.to.write(AppStorageKey.refreshToken.value, null);
|
|
||||||
StorageService.to.write(AppStorageKey.loginType.value, null);
|
StorageService.to.write(AppStorageKey.loginType.value, null);
|
||||||
// StorageService.to.erase();
|
// StorageService.to.erase();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@ class LoginLogic extends GetxController with RequestToolMixin {
|
||||||
BaseStructureResult<UserInfoEntity> res = await getClient().login(state.userNameController.text, md5.convert(utf8.encode(state.passwordController.text)).toString());
|
BaseStructureResult<UserInfoEntity> res = await getClient().login(state.userNameController.text, md5.convert(utf8.encode(state.passwordController.text)).toString());
|
||||||
if (null != res.data) {
|
if (null != res.data) {
|
||||||
UserStore.to.setToken(res.data!.token);
|
UserStore.to.setToken(res.data!.token);
|
||||||
UserStore.to.setRefreshToken(res.data!.refreshToken);
|
|
||||||
UserStore.to.setUserDetailInfo(res.data!);
|
UserStore.to.setUserDetailInfo(res.data!);
|
||||||
UserStore.to.setLoginType(AppConfig.NORMAL_LOGIN);
|
UserStore.to.setLoginType(AppConfig.NORMAL_LOGIN);
|
||||||
Get.offAllNamed(Routes.startPage);
|
Get.offAllNamed(Routes.startPage);
|
||||||
|
|
@ -87,7 +86,6 @@ class LoginLogic extends GetxController with RequestToolMixin {
|
||||||
BaseStructureResult<UserInfoEntity> res = await getClient().anonLogin(await DeviceInfo.getDeviceId(),state.nickNameCodeController.text, state.meetingCodeController.text);
|
BaseStructureResult<UserInfoEntity> res = await getClient().anonLogin(await DeviceInfo.getDeviceId(),state.nickNameCodeController.text, state.meetingCodeController.text);
|
||||||
if (null != res.data) {
|
if (null != res.data) {
|
||||||
UserStore.to.setToken(res.data!.token);
|
UserStore.to.setToken(res.data!.token);
|
||||||
UserStore.to.setRefreshToken(res.data!.refreshToken);
|
|
||||||
UserStore.to.setUserDetailInfo(res.data!);
|
UserStore.to.setUserDetailInfo(res.data!);
|
||||||
UserStore.to.setLoginType(AppConfig.ANONYMOUS_LOGIN);
|
UserStore.to.setLoginType(AppConfig.ANONYMOUS_LOGIN);
|
||||||
Get.toNamed(Routes.meetingMainPage, arguments: {"roomNumber": state.meetingCodeController.text});
|
Get.toNamed(Routes.meetingMainPage, arguments: {"roomNumber": state.meetingCodeController.text});
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:signalr_core/signalr_core.dart';
|
import 'package:signalr_core/signalr_core.dart';
|
||||||
import 'package:wakelock_plus/wakelock_plus.dart';
|
|
||||||
import 'package:wgshare/common/store/user_store.dart';
|
import 'package:wgshare/common/store/user_store.dart';
|
||||||
import 'package:wgshare/utils/count_microphone_volume.dart';
|
import 'package:wgshare/utils/count_microphone_volume.dart';
|
||||||
import '../../common/config/request_config.dart';
|
import '../../common/config/request_config.dart';
|
||||||
|
|
@ -19,7 +18,6 @@ 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 '../../common/store/business_store.dart';
|
import '../../common/store/business_store.dart';
|
||||||
import '../../routes/app_routes.dart';
|
|
||||||
import '../../utils/agora/AgoraUtil.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';
|
||||||
|
|
@ -36,9 +34,6 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
var data = Get.arguments;
|
var data = Get.arguments;
|
||||||
state.roomNumber.value = data["roomNumber"];
|
state.roomNumber.value = data["roomNumber"];
|
||||||
|
|
||||||
// 开启屏幕常亮
|
|
||||||
WakelockPlus.enable();
|
|
||||||
|
|
||||||
doHttpGetMeetingToken(true);
|
doHttpGetMeetingToken(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,10 +45,6 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
state.sendMsgController.dispose();
|
state.sendMsgController.dispose();
|
||||||
state.pageController.dispose();
|
state.pageController.dispose();
|
||||||
stopTime();
|
stopTime();
|
||||||
|
|
||||||
// 关闭屏幕常亮
|
|
||||||
WakelockPlus.disable();
|
|
||||||
|
|
||||||
leaveMeetingToRtc();
|
leaveMeetingToRtc();
|
||||||
leaveMeetingToSocket();
|
leaveMeetingToSocket();
|
||||||
}
|
}
|
||||||
|
|
@ -161,24 +152,6 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 点击grid切换大屏
|
|
||||||
void checkLargeScreen(String uid){
|
|
||||||
ToastUtils.showSuccess("切换用户成功");
|
|
||||||
if(uid == UserStore.to.userInfoEntity.value!.uid) {
|
|
||||||
state.remoteUid.value = "0";
|
|
||||||
}else{
|
|
||||||
if(state.isSpeak.value == true && state.isOpenCamera.value == true){
|
|
||||||
state.floating.value?.open(Get.context!);
|
|
||||||
}
|
|
||||||
state.remoteUid.value = uid;
|
|
||||||
}
|
|
||||||
changePageState(0);
|
|
||||||
Future.delayed(const Duration(milliseconds: 200), () {
|
|
||||||
changePageState(1);
|
|
||||||
});
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// ------------------------------------------------------------------------------发言权限
|
/// ------------------------------------------------------------------------------发言权限
|
||||||
/// 申请发言权限
|
/// 申请发言权限
|
||||||
Future<void> doHttpApplySpeak() async {
|
Future<void> doHttpApplySpeak() async {
|
||||||
|
|
@ -208,10 +181,6 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
/// ------------------------------------------------------------------------------麦克风相关(操作)
|
/// ------------------------------------------------------------------------------麦克风相关(操作)
|
||||||
/// 用户开闭麦
|
/// 用户开闭麦
|
||||||
Future<void> doHttpSetMicr(bool isOpenMicrophone) async {
|
Future<void> doHttpSetMicr(bool isOpenMicrophone) async {
|
||||||
if(isOpenMicrophone == false){
|
|
||||||
state.spokesman.value = "";
|
|
||||||
state.spokesmanVolume.value = 0;
|
|
||||||
}
|
|
||||||
await getClient().setMicr(state.roomNumber.value, isOpenMicrophone,
|
await getClient().setMicr(state.roomNumber.value, isOpenMicrophone,
|
||||||
UserStore.to.userInfoEntity.value!.uid);
|
UserStore.to.userInfoEntity.value!.uid);
|
||||||
}
|
}
|
||||||
|
|
@ -233,7 +202,6 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
BaseStructureResult res =
|
BaseStructureResult res =
|
||||||
await getClient().getTvAnchor(state.roomNumber.value);
|
await getClient().getTvAnchor(state.roomNumber.value);
|
||||||
state.remoteUid.value = res.data!.toString();
|
state.remoteUid.value = res.data!.toString();
|
||||||
state.remoteAssistantUid.value = res.data!.toString();
|
|
||||||
debugPrint("wgs输出===:获取当前全员观看主播${res.data}");
|
debugPrint("wgs输出===:获取当前全员观看主播${res.data}");
|
||||||
|
|
||||||
if (res.data!.toString().length != 9) {
|
if (res.data!.toString().length != 9) {
|
||||||
|
|
@ -270,7 +238,8 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
// 判断当前会议室是否存在全员观看主播
|
// 判断当前会议室是否存在全员观看主播
|
||||||
var isCurrentUserIsCamera = false;
|
var isCurrentUserIsCamera = false;
|
||||||
for (var i = 0; i < state.cacheUsers.value.length; i++) {
|
for (var i = 0; i < state.cacheUsers.value.length; i++) {
|
||||||
if (state.remoteUid.value == state.cacheUsers.value[i].uid && state.cacheUsers.value[i].enableCamera == true) {
|
if (state.remoteUid.value == state.cacheUsers.value[i].uid &&
|
||||||
|
state.cacheUsers.value[i].enableCamera == true) {
|
||||||
isCurrentUserIsCamera = true;
|
isCurrentUserIsCamera = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -285,13 +254,11 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
} else {
|
} else {
|
||||||
// 当前会议室不存在全员观看主播时,设置主播ID为空并切换页面到视频状态
|
// 当前会议室不存在全员观看主播时,设置主播ID为空并切换页面到视频状态
|
||||||
debugPrint("wgs输出===:当前会议室不存在全员观看主播时,设置主播ID为空并切换页面到视频状态");
|
debugPrint("wgs输出===:当前会议室不存在全员观看主播时,设置主播ID为空并切换页面到视频状态");
|
||||||
// state.remoteUid.value = "";
|
state.remoteUid.value = "";
|
||||||
state.remoteAssistantUid.value = "";
|
|
||||||
changePageState(1);
|
changePageState(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debugPrint("wgs输出===:当前全员观看是共享类型");
|
|
||||||
if (state.remoteUid.value ==
|
if (state.remoteUid.value ==
|
||||||
UserStore.to.userInfoEntity.value!.screenShareId) {
|
UserStore.to.userInfoEntity.value!.screenShareId) {
|
||||||
// 如果是自己在共享
|
// 如果是自己在共享
|
||||||
|
|
@ -303,7 +270,6 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
state.cacheUsers.value[i].enableShare = true;
|
state.cacheUsers.value[i].enableShare = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
changePageState(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
|
|
@ -572,9 +538,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
}
|
}
|
||||||
state.users.value = state.cacheUsers.value;
|
state.users.value = state.cacheUsers.value;
|
||||||
update();
|
update();
|
||||||
if(listDynamic[0] != UserStore.to.userInfoEntity.value!.uid){
|
|
||||||
doHttpGetTvAnchor();
|
doHttpGetTvAnchor();
|
||||||
}
|
|
||||||
debugPrint("wgs输出===:Socket-远端用户或主播离开会议室:$jsonStr");
|
debugPrint("wgs输出===:Socket-远端用户或主播离开会议室:$jsonStr");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -600,20 +564,6 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/// 强制退出
|
|
||||||
state.hubConnection.value?.on("ForceLogout", (e) {
|
|
||||||
// var jsonStr = const Utf8Decoder().convert(json.encode(uid).runes.toList());
|
|
||||||
var jsonStr = json.encode(e);
|
|
||||||
List listDynamic = jsonDecode(jsonStr);
|
|
||||||
debugPrint("wgs输出===:Socket-强制退出:${listDynamic[0]}");
|
|
||||||
state.isNormaExit.value = true;
|
|
||||||
ToastUtils.showSuccess("${listDynamic[0]}");
|
|
||||||
Future.delayed(const Duration(seconds: 1), () {
|
|
||||||
UserStore.to.erase();
|
|
||||||
Get.offAllNamed(Routes.loginPage);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
/// ------------------------------------------------------------------------------会议室聊天相关回调
|
/// ------------------------------------------------------------------------------会议室聊天相关回调
|
||||||
/// 会议室接收消息回调
|
/// 会议室接收消息回调
|
||||||
state.hubConnection.value?.on("ReceiveMessage", (e) {
|
state.hubConnection.value?.on("ReceiveMessage", (e) {
|
||||||
|
|
@ -624,12 +574,10 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
MeetingRoomMsg meetingRoomMsg = MeetingRoomMsg(list[0], list[1], list[2],
|
MeetingRoomMsg meetingRoomMsg = MeetingRoomMsg(list[0], list[1], list[2],
|
||||||
0, formatDate(dateTime, [HH, ':', nn, ':', ss]));
|
0, formatDate(dateTime, [HH, ':', nn, ':', ss]));
|
||||||
state.meetingRoomMsgs.value.add(meetingRoomMsg);
|
state.meetingRoomMsgs.value.add(meetingRoomMsg);
|
||||||
state.msgNum.value = state.msgNum.value += 1;
|
|
||||||
update();
|
update();
|
||||||
Future.delayed(const Duration(milliseconds: 100), () {
|
Future.delayed(const Duration(milliseconds: 100), () {
|
||||||
state.chatController
|
state.chatController
|
||||||
.jumpTo(state.chatController.position.maxScrollExtent);
|
.jumpTo(state.chatController.position.maxScrollExtent);
|
||||||
state.msgNum.value = 0;
|
|
||||||
});
|
});
|
||||||
debugPrint("wgs输出===:Socket-会议室接收消息:$jsonStr");
|
debugPrint("wgs输出===:Socket-会议室接收消息:$jsonStr");
|
||||||
});
|
});
|
||||||
|
|
@ -642,17 +590,13 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
var listDynamic = jsonDecode(jsonStr);
|
var listDynamic = jsonDecode(jsonStr);
|
||||||
MeetingRoomUser meetingRoomUser = MeetingRoomUser.fromJson(listDynamic);
|
MeetingRoomUser meetingRoomUser = MeetingRoomUser.fromJson(listDynamic);
|
||||||
if (meetingRoomUser.enableCamera == true) {
|
if (meetingRoomUser.enableCamera == true) {
|
||||||
debugPrint("wgs输出===:Socket-用户单独开摄像头${jsonStr}");
|
debugPrint("wgs输出===:Socket-用户单独开摄像头");
|
||||||
|
|
||||||
// 遍历会议室用户列表,更改摄像头状态
|
// 遍历会议室用户列表,更改摄像头状态
|
||||||
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.enableCamera = true;
|
mru.enableCamera = true;
|
||||||
}
|
}
|
||||||
debugPrint("wgs输出===:Socket-用户单独开摄像头---${state.remoteUid.value}--${meetingRoomUser.uid}");
|
|
||||||
if(state.remoteUid.value == meetingRoomUser.uid){
|
|
||||||
doHttpGetTvAnchor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) {
|
if (meetingRoomUser.uid == UserStore.to.userInfoEntity.value!.uid) {
|
||||||
|
|
@ -715,7 +659,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
/// isAgain:是否重新加入
|
/// isAgain:是否重新加入
|
||||||
Future<void> joinMeetingToSocket(bool isAgain) async {
|
Future<void> joinMeetingToSocket(bool isAgain) async {
|
||||||
await state.hubConnection.value?.invoke("joinChannel",
|
await state.hubConnection.value?.invoke("joinChannel",
|
||||||
args: [state.roomNumber.value, state.isOpenMicrophone.value, state.isOpenCamera.value, state.isSpeak.value]);
|
args: [state.roomNumber.value, false, false, false]);
|
||||||
mergeFetch(isAgain);
|
mergeFetch(isAgain);
|
||||||
/*if(isAgain == false){
|
/*if(isAgain == false){
|
||||||
mergeFetch(isAgain);
|
mergeFetch(isAgain);
|
||||||
|
|
@ -870,9 +814,8 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
||||||
state.microphoneVolume.value =
|
state.microphoneVolume.value =
|
||||||
CountMicrophoneVolume.getVolume(avi.volume!);
|
CountMicrophoneVolume.getVolume(avi.volume!);
|
||||||
} else {
|
} else {
|
||||||
debugPrint("wgs输出===:RTC-用户音量提示:${avi.uid}--${mru.uid}");
|
|
||||||
if (avi.uid.toString() == mru.uid) {
|
if (avi.uid.toString() == mru.uid) {
|
||||||
debugPrint("wgs输出===:RTC-用户音量提示(远端用户):${speakers[0].uid}--${speakers[0].volume}");
|
//debugPrint("wgs输出===:RTC-用户音量提示(远端用户):${speakers[0].uid}--${speakers[0].volume}");
|
||||||
mru.volume = CountMicrophoneVolume.getVolume(avi.volume!);
|
mru.volume = CountMicrophoneVolume.getVolume(avi.volume!);
|
||||||
|
|
||||||
if (avi.volume != 0) {
|
if (avi.volume != 0) {
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,6 @@ class MeetingMainState {
|
||||||
late RxBool isOpenShare = false.obs;
|
late RxBool isOpenShare = false.obs;
|
||||||
/// 当前视频主播ID
|
/// 当前视频主播ID
|
||||||
late RxString remoteUid = "".obs;
|
late RxString remoteUid = "".obs;
|
||||||
/// 当前视频主播ID-辅助判断用
|
|
||||||
late RxString remoteAssistantUid = "".obs;
|
|
||||||
/// 是否成功加入会议室
|
/// 是否成功加入会议室
|
||||||
late RxBool isJoinSuccess = false.obs;
|
late RxBool isJoinSuccess = false.obs;
|
||||||
|
|
||||||
|
|
@ -92,9 +90,6 @@ class MeetingMainState {
|
||||||
/// 聊天数据
|
/// 聊天数据
|
||||||
late RxList<MeetingRoomMsg> meetingRoomMsgs = RxList([]);
|
late RxList<MeetingRoomMsg> meetingRoomMsgs = RxList([]);
|
||||||
|
|
||||||
/// 聊天消息未读数量
|
|
||||||
late RxInt msgNum = 0.obs;
|
|
||||||
|
|
||||||
/// signalR 长连接相关
|
/// signalR 长连接相关
|
||||||
late RxString serviceUrl = "http://192.168.2.9:5192/session-manage".obs;
|
late RxString serviceUrl = "http://192.168.2.9:5192/session-manage".obs;
|
||||||
late Rx<HubConnection?> hubConnection = Rx(null);
|
late Rx<HubConnection?> hubConnection = Rx(null);
|
||||||
|
|
|
||||||
|
|
@ -325,9 +325,7 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.center,
|
CrossAxisAlignment.center,
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.spaceBetween,
|
MainAxisAlignment.start,
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/images/meeting_main_chat.png',
|
'assets/images/meeting_main_chat.png',
|
||||||
|
|
@ -344,36 +342,11 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Visibility(
|
|
||||||
visible: state.msgNum.value > 0 ? true : false,
|
|
||||||
child: Container(
|
|
||||||
width: 18.w,
|
|
||||||
height: 18.h,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
margin: const EdgeInsets.only(right: 12),
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
||||||
color: ColorUtil.Color_255_69_69,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
"${state.msgNum.value}",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12.sp,
|
|
||||||
color: ColorUtil
|
|
||||||
.Color_255_255_255),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.bottomSheet(
|
Get.bottomSheet(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
chatBottomSheet(context));
|
chatBottomSheet(context));
|
||||||
|
|
||||||
state.msgNum.value = 0;
|
|
||||||
|
|
||||||
Future.delayed(
|
Future.delayed(
|
||||||
const Duration(milliseconds: 100),
|
const Duration(milliseconds: 100),
|
||||||
() {
|
() {
|
||||||
|
|
@ -427,9 +400,6 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
children: [
|
children: [
|
||||||
/// 音频
|
/// 音频
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.only(left: 6,right: 6),
|
|
||||||
color: ColorUtil.Color_0_0_0_0,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -482,7 +452,6 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (state.isSpeak.value == false) {
|
if (state.isSpeak.value == false) {
|
||||||
Get.bottomSheet(
|
Get.bottomSheet(
|
||||||
|
|
@ -502,9 +471,6 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
|
|
||||||
/// 视频
|
/// 视频
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.only(left: 6,right: 6),
|
|
||||||
color: ColorUtil.Color_0_0_0_0,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -531,7 +497,6 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (state.isSpeak.value == false) {
|
if (state.isSpeak.value == false) {
|
||||||
Get.bottomSheet(
|
Get.bottomSheet(
|
||||||
|
|
@ -584,9 +549,6 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
|
|
||||||
/// 成员
|
/// 成员
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.only(left: 6,right: 6),
|
|
||||||
color: ColorUtil.Color_0_0_0_0,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -604,7 +566,6 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.bottomSheet(
|
Get.bottomSheet(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
|
|
@ -1665,7 +1626,7 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
return Stack(
|
return Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
state.remoteAssistantUid.value != ""
|
state.remoteUid.value != ""
|
||||||
? AgoraVideoView(
|
? AgoraVideoView(
|
||||||
controller: VideoViewController(
|
controller: VideoViewController(
|
||||||
rtcEngine: state.rctEngine.value!,
|
rtcEngine: state.rctEngine.value!,
|
||||||
|
|
@ -1747,8 +1708,7 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
crossAxisCount: 2, childAspectRatio: 0.8, crossAxisSpacing: 0),
|
crossAxisCount: 2, childAspectRatio: 0.8, crossAxisSpacing: 0),
|
||||||
itemCount: state.cacheUsers.value.length,
|
itemCount: state.cacheUsers.value.length,
|
||||||
itemBuilder: (BuildContext ctx, index) {
|
itemBuilder: (BuildContext ctx, index) {
|
||||||
return GestureDetector(
|
return Stack(
|
||||||
child: Stack(
|
|
||||||
children: [
|
children: [
|
||||||
state.cacheUsers.value[index].enableCamera == true
|
state.cacheUsers.value[index].enableCamera == true
|
||||||
? state.cacheUsers.value[index].uid ==
|
? state.cacheUsers.value[index].uid ==
|
||||||
|
|
@ -1881,14 +1841,6 @@ class MeetingMainPageState extends State<MeetingMainPage> {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
|
||||||
onTap: (){
|
|
||||||
if(state.cacheUsers.value[index].enableCamera == true){
|
|
||||||
logic.checkLargeScreen(state.cacheUsers.value[index].uid);
|
|
||||||
}else{
|
|
||||||
ToastUtils.showError("该用户暂未开启摄像头");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,10 @@ import 'user_state.dart';
|
||||||
|
|
||||||
class UserLogic extends GetxController with RequestToolMixin {
|
class UserLogic extends GetxController with RequestToolMixin {
|
||||||
final UserState state = UserState();
|
final UserState state = UserState();
|
||||||
|
|
||||||
|
/// 退出登录
|
||||||
|
void logout(){
|
||||||
|
UserStore.to.erase();
|
||||||
|
Get.toNamed(Routes.loginPage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ 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
|
||||||
import wakelock_plus
|
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
AgoraRtcNgPlugin.register(with: registry.registrar(forPlugin: "AgoraRtcNgPlugin"))
|
AgoraRtcNgPlugin.register(with: registry.registrar(forPlugin: "AgoraRtcNgPlugin"))
|
||||||
|
|
@ -32,5 +31,4 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
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"))
|
||||||
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -101,9 +101,6 @@ dependencies:
|
||||||
# 后台下载
|
# 后台下载
|
||||||
al_downloader: ^1.8.2
|
al_downloader: ^1.8.2
|
||||||
|
|
||||||
# 屏幕常亮
|
|
||||||
wakelock_plus: ^1.2.10
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue