parent
8e9e4b2812
commit
620f5067d6
|
|
@ -1,9 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:signalr_core/signalr_core.dart';
|
||||
import 'package:wgshare/common/models/common/base_structure_result.dart';
|
||||
import 'package:wgshare/common/mixins/request_tool_mixin.dart';
|
||||
|
||||
import '../../common/models/meeting_room_item.dart';
|
||||
import '../../utils/toast_utils.dart';
|
||||
import 'home_state.dart';
|
||||
|
||||
class HomeLogic extends GetxController with RequestToolMixin {
|
||||
|
|
@ -54,4 +56,20 @@ class HomeLogic extends GetxController with RequestToolMixin {
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,4 +25,7 @@ class HomeState {
|
|||
/// 总页数
|
||||
final RxInt totalPage = 0.obs;
|
||||
|
||||
/// 退出计时
|
||||
DateTime? currentBackPressTime;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,13 +37,15 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
|
|||
super.build(context);
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (bool didPop) async {
|
||||
if (didPop) {
|
||||
return;
|
||||
} else {
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
},
|
||||
onPopInvoked: (bool didPop) async {
|
||||
if (didPop) {
|
||||
return;
|
||||
}
|
||||
if (logic.closeOnConfirm(context)) {
|
||||
// 系统级别导航栈 退出程序
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
surfaceTintColor: Colors.white,
|
||||
|
|
|
|||
|
|
@ -236,25 +236,11 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
|
|||
// 如果是自己在共享
|
||||
}else{
|
||||
// 共享不是自己
|
||||
// 判断当前会议室是否存在共享成员
|
||||
var isCurrentUserIsCamera = false;
|
||||
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;
|
||||
isCurrentUserIsCamera = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isCurrentUserIsCamera == true) {
|
||||
// 当前会议室存在全员观看主播时,切换页面到视频状态
|
||||
debugPrint("wgs输出===:当前会议室存在全员观看主播时,切换页面到视频状态");
|
||||
changePageState(1);
|
||||
} else {
|
||||
// 当前会议室不存在全员观看主播时,设置主播ID为空并切换页面到视频状态
|
||||
debugPrint("wgs输出===:当前会议室不存在全员观看主播时,设置主播ID为空并切换页面到视频状态");
|
||||
state.remoteUid.value = "";
|
||||
changePageState(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue