permisson block input

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-11-05 21:53:21 +08:00
parent 663d355a48
commit d528fd3762
49 changed files with 157 additions and 13 deletions

View File

@@ -191,6 +191,7 @@ List<TTextMenu> toolbarControls(BuildContext context, String id, FFI ffi) {
}
// blockUserInput
if (ffi.ffiModel.keyboard &&
ffi.ffiModel.permissions['block_input'] != false &&
pi.platform == kPeerPlatformWindows) // privacy-mode != true ??
{
v.add(TTextMenu(

View File

@@ -649,6 +649,10 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
_OptionCheckBox(
context, 'Enable Recording Session', 'enable-record-session',
enabled: enabled, fakeValue: fakeValue),
if (Platform.isWindows)
_OptionCheckBox(
context, 'Enable Block User Input', 'enable-block-input',
enabled: enabled, fakeValue: fakeValue),
_OptionCheckBox(context, 'Enable remote configuration modification',
'allow-remote-config-modification',
enabled: enabled, fakeValue: fakeValue),

View File

@@ -536,7 +536,6 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
child: Icon(
iconData,
color: Colors.white,
size: 32,
),
),
],
@@ -548,9 +547,11 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
@override
Widget build(BuildContext context) {
final crossAxisCount = 4;
final spacing = 10.0;
return Container(
width: double.infinity,
height: 200.0,
height: 160.0,
margin: EdgeInsets.all(5.0),
padding: EdgeInsets.all(5.0),
decoration: BoxDecoration(
@@ -575,10 +576,10 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
).marginOnly(left: 4.0, bottom: 8.0),
Expanded(
child: GridView.count(
crossAxisCount: 3,
padding: EdgeInsets.symmetric(horizontal: 20.0),
mainAxisSpacing: 20.0,
crossAxisSpacing: 20.0,
crossAxisCount: crossAxisCount,
padding: EdgeInsets.symmetric(horizontal: spacing),
mainAxisSpacing: spacing,
crossAxisSpacing: spacing,
children: [
buildPermissionIcon(
client.keyboard,
@@ -651,7 +652,23 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
});
},
translate('Allow recording session'),
)
),
// only windows support block input
if (Platform.isWindows)
buildPermissionIcon(
client.blockInput,
Icons.block,
(enabled) {
bind.cmSwitchPermission(
connId: client.id,
name: "block_input",
enabled: enabled);
setState(() {
client.blockInput = enabled;
});
},
translate('Allow block user input'),
)
],
),
),

View File

@@ -690,6 +690,7 @@ class Client {
bool file = false;
bool restart = false;
bool recording = false;
bool blockInput = false;
bool disconnected = false;
bool fromSwitch = false;
bool inVoiceCall = false;
@@ -713,6 +714,7 @@ class Client {
file = json['file'];
restart = json['restart'];
recording = json['recording'];
blockInput = json['block_input'];
disconnected = json['disconnected'];
fromSwitch = json['from_switch'];
inVoiceCall = json['in_voice_call'];
@@ -733,6 +735,7 @@ class Client {
data['file'] = file;
data['restart'] = restart;
data['recording'] = recording;
data['block_input'] = blockInput;
data['disconnected'] = disconnected;
data['from_switch'] = fromSwitch;
return data;