mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-11 02:16:00 +02:00
Refact. Flutter web, key input (#7511)
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
d36e33a7cf
commit
e86d4657da
6 changed files with 321 additions and 74 deletions
|
@ -134,7 +134,7 @@ class RustdeskImpl {
|
|||
|
||||
Future<void> sessionSend2Fa(
|
||||
{required UuidValue sessionId, required String code, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('setByName', ['send_2fa', code]));
|
||||
}
|
||||
|
||||
Future<void> sessionClose({required UuidValue sessionId, dynamic hint}) {
|
||||
|
@ -143,7 +143,7 @@ class RustdeskImpl {
|
|||
|
||||
Future<void> sessionRefresh(
|
||||
{required UuidValue sessionId, required int display, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('setByName', ['refresh']));
|
||||
}
|
||||
|
||||
Future<void> sessionRecordScreen(
|
||||
|
@ -168,7 +168,8 @@ class RustdeskImpl {
|
|||
|
||||
Future<void> sessionToggleOption(
|
||||
{required UuidValue sessionId, required String value, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(
|
||||
() => js.context.callMethod('setByName', ['toggle_option', value]));
|
||||
}
|
||||
|
||||
Future<void> sessionTogglePrivacyMode(
|
||||
|
@ -176,7 +177,10 @@ class RustdeskImpl {
|
|||
required String implKey,
|
||||
required bool on,
|
||||
dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('setByName', [
|
||||
'toggle_option',
|
||||
jsonEncode({implKey, on})
|
||||
]));
|
||||
}
|
||||
|
||||
Future<String?> sessionGetFlutterOption(
|
||||
|
@ -360,11 +364,11 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
Future<void> sessionLockScreen({required UuidValue sessionId, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('setByName', ['lock_screen']));
|
||||
}
|
||||
|
||||
Future<void> sessionCtrlAltDel({required UuidValue sessionId, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('setByName', ['ctrl_alt_del']));
|
||||
}
|
||||
|
||||
Future<void> sessionSwitchDisplay(
|
||||
|
@ -372,7 +376,14 @@ class RustdeskImpl {
|
|||
required UuidValue sessionId,
|
||||
required Int32List value,
|
||||
dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('setByName', [
|
||||
'switch_display',
|
||||
jsonEncode({
|
||||
isDesktop: isDesktop,
|
||||
sessionId: sessionId.toString(),
|
||||
value: value
|
||||
})
|
||||
]));
|
||||
}
|
||||
|
||||
Future<void> sessionHandleFlutterKeyEvent(
|
||||
|
@ -383,6 +394,7 @@ class RustdeskImpl {
|
|||
required int lockModes,
|
||||
required bool downOrUp,
|
||||
dynamic hint}) {
|
||||
// TODO: map mode
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
|
@ -401,12 +413,24 @@ class RustdeskImpl {
|
|||
required bool shift,
|
||||
required bool command,
|
||||
dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('setByName', [
|
||||
'input_key',
|
||||
jsonEncode({
|
||||
'name': name,
|
||||
if (down) 'down': 'true',
|
||||
if (press) 'press': 'true',
|
||||
if (alt) 'alt': 'true',
|
||||
if (ctrl) 'ctrl': 'true',
|
||||
if (shift) 'shift': 'true',
|
||||
if (command) 'command': 'true'
|
||||
})
|
||||
]));
|
||||
}
|
||||
|
||||
Future<void> sessionInputString(
|
||||
{required UuidValue sessionId, required String value, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(
|
||||
() => js.context.callMethod('setByName', ['input_string', value]));
|
||||
}
|
||||
|
||||
Future<void> sessionSendChat(
|
||||
|
@ -559,7 +583,10 @@ class RustdeskImpl {
|
|||
required String username,
|
||||
required String password,
|
||||
dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('setByName', [
|
||||
'elevate_with_logon',
|
||||
jsonEncode({username, password})
|
||||
]));
|
||||
}
|
||||
|
||||
Future<void> sessionSwitchSides(
|
||||
|
@ -573,6 +600,7 @@ class RustdeskImpl {
|
|||
required int width,
|
||||
required int height,
|
||||
dynamic hint}) {
|
||||
// note: restore on disconnected
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
|
@ -683,7 +711,7 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
Future<String> mainGetVersion({dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('getByName', ['version']));
|
||||
}
|
||||
|
||||
Future<List<String>> mainGetFav({dynamic hint}) {
|
||||
|
@ -691,10 +719,12 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
Future<void> mainStoreFav({required List<String> favs, dynamic hint}) {
|
||||
// TODO:
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
String mainGetPeerSync({required String id, dynamic hint}) {
|
||||
// TODO:
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
|
@ -713,7 +743,8 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
Future<bool> mainIsUsingPublicServer({dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(
|
||||
() => js.context.callMethod('setByName', ["is_using_public_server"]));
|
||||
}
|
||||
|
||||
Future<void> mainDiscover({dynamic hint}) {
|
||||
|
@ -749,12 +780,16 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
String mainGetInputSource({dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
// // rdev grab mode
|
||||
// const CONFIG_INPUT_SOURCE_1 = "Input source 1";
|
||||
// // flutter grab mode
|
||||
// const CONFIG_INPUT_SOURCE_2 = "Input source 2";
|
||||
return 'Input source 2';
|
||||
}
|
||||
|
||||
Future<void> mainSetInputSource(
|
||||
{required UuidValue sessionId, required String value, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future.value();
|
||||
}
|
||||
|
||||
Future<String> mainGetMyId({dynamic hint}) {
|
||||
|
@ -767,17 +802,17 @@ class RustdeskImpl {
|
|||
|
||||
Future<String> mainGetPeerOption(
|
||||
{required String id, required String key, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => mainGetPeerOptionSync(id: id, key: key, hint: hint));
|
||||
}
|
||||
|
||||
String mainGetPeerOptionSync(
|
||||
{required String id, required String key, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return js.context.callMethod('getByName', ['option:peer', key]);
|
||||
}
|
||||
|
||||
String mainGetPeerFlutterOptionSync(
|
||||
{required String id, required String k, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return js.context.callMethod('getByName', ['option:flutter:peer', k]);
|
||||
}
|
||||
|
||||
void mainSetPeerFlutterOptionSync(
|
||||
|
@ -785,7 +820,10 @@ class RustdeskImpl {
|
|||
required String k,
|
||||
required String v,
|
||||
dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
js.context.callMethod('setByName', [
|
||||
'option:flutter:peer',
|
||||
jsonEncode({'name': k, 'value': v})
|
||||
]);
|
||||
}
|
||||
|
||||
Future<void> mainSetPeerOption(
|
||||
|
@ -793,7 +831,8 @@ class RustdeskImpl {
|
|||
required String key,
|
||||
required String value,
|
||||
dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
mainSetPeerOptionSync(id: id, key: key, value: value, hint: hint);
|
||||
return Future.value();
|
||||
}
|
||||
|
||||
bool mainSetPeerOptionSync(
|
||||
|
@ -801,12 +840,17 @@ class RustdeskImpl {
|
|||
required String key,
|
||||
required String value,
|
||||
dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
js.context.callMethod('setByName', [
|
||||
'option:peer',
|
||||
jsonEncode({'name': key, 'value': value})
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<void> mainSetPeerAlias(
|
||||
{required String id, required String alias, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
mainSetPeerOptionSync(id: id, key: 'alias', value: alias, hint: hint);
|
||||
return Future.value();
|
||||
}
|
||||
|
||||
Future<String> mainGetNewStoredPeers({dynamic hint}) {
|
||||
|
@ -814,15 +858,17 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
Future<void> mainForgetPassword({required String id, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('setByName', ['forget']));
|
||||
}
|
||||
|
||||
Future<bool> mainPeerHasPassword({required String id, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(
|
||||
() => js.context.callMethod('getByName', ['peer_has_password', id]));
|
||||
}
|
||||
|
||||
Future<bool> mainPeerExists({required String id, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(
|
||||
() => js.context.callMethod('getByName', ['peer_exists', id]));
|
||||
}
|
||||
|
||||
Future<void> mainLoadRecentPeers({dynamic hint}) {
|
||||
|
@ -870,6 +916,7 @@ class RustdeskImpl {
|
|||
|
||||
Future<void> mainSetUserDefaultOption(
|
||||
{required String key, required String value, dynamic hint}) {
|
||||
// TODO: do we need the default option?
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
|
@ -976,15 +1023,17 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
Future<void> mainDeviceId({required String id, dynamic hint}) {
|
||||
// TODO: ?
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
Future<void> mainDeviceName({required String name, dynamic hint}) {
|
||||
// TODO: ?
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
Future<void> mainRemovePeer({required String id, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('setByName', ['remove', id]));
|
||||
}
|
||||
|
||||
bool mainHasHwcodec({dynamic hint}) {
|
||||
|
@ -1048,7 +1097,7 @@ class RustdeskImpl {
|
|||
|
||||
Future<void> sessionRestartRemoteDevice(
|
||||
{required UuidValue sessionId, dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return Future(() => js.context.callMethod('setByName', ['restart']));
|
||||
}
|
||||
|
||||
String sessionGetAuditServerSync(
|
||||
|
@ -1081,6 +1130,7 @@ class RustdeskImpl {
|
|||
required int index,
|
||||
required bool on,
|
||||
dynamic hint}) {
|
||||
// TODO
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
|
@ -1126,6 +1176,7 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
Future<void> mainCreateShortcut({required String id, dynamic hint}) {
|
||||
// TODO:
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
|
@ -1181,6 +1232,7 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
Future<String> mainGetBuildDate({dynamic hint}) {
|
||||
// TODO
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
|
@ -1213,6 +1265,7 @@ class RustdeskImpl {
|
|||
dynamic hint}) {}
|
||||
|
||||
Future<void> queryOnlines({required List<String> ids, dynamic hint}) {
|
||||
// TODO:
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
|
@ -1336,11 +1389,11 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
bool mainCurrentIsWayland({dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool mainIsLoginWayland({dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<void> mainStartPa({dynamic hint}) {
|
||||
|
@ -1494,7 +1547,7 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
bool isSelinuxEnforcing({dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return false;
|
||||
}
|
||||
|
||||
String mainDefaultPrivacyModeImpl({dynamic hint}) {
|
||||
|
@ -1506,7 +1559,7 @@ class RustdeskImpl {
|
|||
}
|
||||
|
||||
String mainSupportedInputSource({dynamic hint}) {
|
||||
throw UnimplementedError();
|
||||
return jsonEncode(['Input source 2', 'input_source_2_tip']);
|
||||
}
|
||||
|
||||
Future<String> mainGenerate2Fa({dynamic hint}) {
|
||||
|
@ -1525,7 +1578,5 @@ class RustdeskImpl {
|
|||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
void dispose() {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue