feat: web v2 keyboard (#9175)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou 2024-08-26 12:13:11 +08:00 committed by GitHub
parent 5abe42f66c
commit 4b4fd94f3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 29 additions and 2 deletions

View File

@ -50,6 +50,9 @@ final isLinux = isLinux_;
final isDesktop = isDesktop_;
final isWeb = isWeb_;
final isWebDesktop = isWebDesktop_;
final isWebOnWindows = isWebOnWindows_;
final isWebOnLinux = isWebOnLinux_;
final isWebOnMacOs = isWebOnMacOS_;
var isMobile = isAndroid || isIOS;
var version = '';
int androidVersion = 0;

View File

@ -32,6 +32,7 @@ const String kPeerPlatformWindows = "Windows";
const String kPeerPlatformLinux = "Linux";
const String kPeerPlatformMacOS = "Mac OS";
const String kPeerPlatformAndroid = "Android";
const String kPeerPlatformWebDesktop = "WebDesktop";
const double kScrollbarThickness = 12.0;

View File

@ -178,8 +178,9 @@ String getLocalPlatformForKBLayoutType(String peerPlatform) {
localPlatform = kPeerPlatformWindows;
} else if (isLinux) {
localPlatform = kPeerPlatformLinux;
} else if (isWebOnWindows || isWebOnLinux) {
localPlatform = kPeerPlatformWebDesktop;
}
// to-do: web desktop support ?
return localPlatform;
}

View File

@ -11,3 +11,7 @@ final isWebDesktop_ = false;
final isDesktop_ = Platform.isWindows || Platform.isMacOS || Platform.isLinux;
String get screenInfo_ => '';
final isWebOnWindows_ = false;
final isWebOnLinux_ = false;
final isWebOnMacOS_ = false;

View File

@ -234,7 +234,7 @@ class RustdeskImpl {
}
String getLocalKbLayoutType({dynamic hint}) {
throw js.context.callMethod('getByName', ['option:local', 'kb_layout']);
return js.context.callMethod('getByName', ['option:local', 'kb_layout']);
}
Future<void> setLocalKbLayoutType(
@ -415,6 +415,17 @@ class RustdeskImpl {
]));
}
Future<void> sessionHandleFlutterRawKeyEvent(
{required UuidValue sessionId,
required String name,
required int platformCode,
required int positionCode,
required int lockModes,
required bool downOrUp,
dynamic hint}) {
throw UnimplementedError();
}
void sessionEnterOrLeave(
{required UuidValue sessionId, required bool enter, dynamic hint}) {
throw UnimplementedError();

View File

@ -1,4 +1,5 @@
import 'dart:js' as js;
import 'dart:html' as html;
final isAndroid_ = false;
final isIOS_ = false;
@ -11,3 +12,9 @@ final isWebDesktop_ = !js.context.callMethod('isMobile');
final isDesktop_ = false;
String get screenInfo_ => js.context.callMethod('getByName', ['screen_info']);
final _userAgent = html.window.navigator.userAgent.toLowerCase();
final isWebOnWindows_ = _userAgent.contains('win');
final isWebOnLinux_ = _userAgent.contains('linux');
final isWebOnMacOS_ = _userAgent.contains('mac');