mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-11 18:47:47 +00:00
Refact. Flutter web, mid commit (#7482)
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -18,7 +18,7 @@ typedef HandleEvent = Future<void> Function(Map<String, dynamic> evt);
|
||||
|
||||
class PlatformFFI {
|
||||
final _eventHandlers = <String, Map<String, HandleEvent>>{};
|
||||
late RustdeskImpl _ffiBind;
|
||||
final RustdeskImpl _ffiBind = RustdeskImpl();
|
||||
|
||||
static String getByName(String name, [String arg = '']) {
|
||||
return context.callMethod('getByName', [name, arg]);
|
||||
@@ -101,6 +101,15 @@ class PlatformFFI {
|
||||
isWebDesktop = !context.callMethod('isMobile');
|
||||
context.callMethod('init');
|
||||
version = getByName('version');
|
||||
|
||||
context['onRegisteredEvent'] = (String message) {
|
||||
try {
|
||||
Map<String, dynamic> event = json.decode(message);
|
||||
tryHandle(event);
|
||||
} catch (e) {
|
||||
print('json.decode fail(): $e');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void setEventCallback(void Function(Map<String, dynamic>) fun) {
|
||||
@@ -145,7 +154,5 @@ class PlatformFFI {
|
||||
}
|
||||
|
||||
// just for compilation
|
||||
void syncAndroidServiceAppDirConfigPath() {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
void syncAndroidServiceAppDirConfigPath() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user