2024-03-22 13:16:37 +08:00
import ' dart:async ' ;
2024-03-23 10:08:55 +08:00
import ' dart:js ' as js ;
import ' dart:convert ' ;
2024-03-22 13:16:37 +08:00
import ' dart:typed_data ' ;
2024-03-27 11:26:29 +08:00
import ' package:flutter/foundation.dart ' ;
2024-03-22 13:16:37 +08:00
import ' package:uuid/uuid.dart ' ;
2024-03-28 11:38:11 +08:00
import ' package:flutter_hbb/consts.dart ' ;
2024-03-22 13:16:37 +08:00
final _privateConstructorUsedError = UnsupportedError (
' It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it. \n Please check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models ' ) ;
mixin _ $EventToUI {
Object get field0 = > throw _privateConstructorUsedError ;
}
sealed class EventToUI {
const factory EventToUI . event (
String field0 ,
) = EventToUI_Event ;
const factory EventToUI . rgba (
int field0 ,
) = EventToUI_Rgba ;
const factory EventToUI . texture (
int field0 ,
) = EventToUI_Texture ;
}
class EventToUI_Event implements EventToUI {
const EventToUI_Event ( final String field0 ) : this . field = field0 ;
final String field ;
String get field0 = > field ;
}
class EventToUI_Rgba implements EventToUI {
const EventToUI_Rgba ( final int field0 ) : this . field = field0 ;
final int field ;
int get field0 = > field ;
}
class EventToUI_Texture implements EventToUI {
const EventToUI_Texture ( final int field0 ) : this . field = field0 ;
final int field ;
int get field0 = > field ;
}
class RustdeskImpl {
Future < void > stopGlobalEventStream ( { required String appType , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > hostStopSystemKeyPropagate (
{ required bool stopped , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
int peerGetDefaultSessionsCount ( { required String id , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return 0 ;
2024-03-22 13:16:37 +08:00
}
String sessionAddExistedSync (
2024-06-14 17:55:03 +08:00
{ required String id ,
required UuidValue sessionId ,
required Int32List displays ,
dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return ' ' ;
2024-03-22 13:16:37 +08:00
}
String sessionAddSync (
{ required UuidValue sessionId ,
required String id ,
required bool isFileTransfer ,
required bool isPortForward ,
required bool isRdp ,
required String switchUuid ,
required bool forceRelay ,
required String password ,
required bool isSharedPassword ,
dynamic hint } ) {
2024-03-24 11:23:06 +08:00
return js . context . callMethod ( ' setByName ' , [
' session_add_sync ' ,
jsonEncode ( { ' id ' : id , ' password ' : password } )
] ) ;
2024-03-22 13:16:37 +08:00
}
Stream < EventToUI > sessionStart (
{ required UuidValue sessionId , required String id , dynamic hint } ) {
2024-03-24 11:23:06 +08:00
js . context . callMethod ( ' setByName ' , [
' session_start ' ,
jsonEncode ( { ' id ' : id } )
] ) ;
return Stream . empty ( ) ;
2024-03-22 13:16:37 +08:00
}
2024-06-13 18:03:41 +08:00
Stream < EventToUI > sessionStartWithDisplays (
{ required UuidValue sessionId ,
required String id ,
required Int32List displays ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
2024-03-22 13:16:37 +08:00
Future < bool ? > sessionGetRemember (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future (
( ) = > js . context . callMethod ( ' getByName ' , [ ' remember ' ] ) = = ' true ' ) ;
2024-03-22 13:16:37 +08:00
}
Future < bool ? > sessionGetToggleOption (
{ required UuidValue sessionId , required String arg , dynamic hint } ) {
2024-03-24 11:23:06 +08:00
return Future (
( ) = > sessionGetToggleOptionSync ( sessionId: sessionId , arg: arg ) ) ;
2024-03-22 13:16:37 +08:00
}
bool sessionGetToggleOptionSync (
{ required UuidValue sessionId , required String arg , dynamic hint } ) {
2024-03-24 11:23:06 +08:00
return ' true ' = = js . context . callMethod ( ' getByName ' , [ ' option:toggle ' , arg ] ) ;
2024-03-22 13:16:37 +08:00
}
Future < String ? > sessionGetOption (
{ required UuidValue sessionId , required String arg , dynamic hint } ) {
2024-03-24 11:23:06 +08:00
return Future (
2024-03-27 11:26:29 +08:00
( ) = > js . context . callMethod ( ' getByName ' , [ ' option:session ' , arg ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionLogin (
{ required UuidValue sessionId ,
required String osUsername ,
required String osPassword ,
required String password ,
required bool remember ,
dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
' login ' ,
jsonEncode ( {
' os_username ' : osUsername ,
' os_password ' : osPassword ,
' password ' : password ,
' remember ' : remember
} )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSend2Fa (
{ required UuidValue sessionId , required String code , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [ ' send_2fa ' , code ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionClose ( { required UuidValue sessionId , dynamic hint } ) {
2024-03-24 11:23:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [ ' session_close ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionRefresh (
{ required UuidValue sessionId , required int display , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [ ' refresh ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionRecordScreen (
{ required UuidValue sessionId ,
required bool start ,
required int display ,
required int width ,
required int height ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionRecordStatus (
{ required UuidValue sessionId , required bool status , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionReconnect (
{ required UuidValue sessionId , required bool forceRelay , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [ ' reconnect ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionToggleOption (
{ required UuidValue sessionId , required String value , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future (
( ) = > js . context . callMethod ( ' setByName ' , [ ' toggle_option ' , value ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionTogglePrivacyMode (
{ required UuidValue sessionId ,
required String implKey ,
required bool on ,
dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
' toggle_option ' ,
jsonEncode ( { implKey , on } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < String ? > sessionGetFlutterOption (
{ required UuidValue sessionId , required String k , dynamic hint } ) {
2024-03-24 11:23:06 +08:00
return Future (
( ) = > js . context . callMethod ( ' getByName ' , [ ' option:flutter:peer ' , k ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSetFlutterOption (
{ required UuidValue sessionId ,
required String k ,
required String v ,
dynamic hint } ) {
2024-03-24 11:23:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
' option:flutter:peer ' ,
jsonEncode ( { ' name ' : k , ' value ' : v } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
int getNextTextureKey ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return 0 ;
2024-03-22 13:16:37 +08:00
}
String getLocalFlutterOption ( { required String k , dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return js . context . callMethod ( ' getByName ' , [ ' option:flutter:local ' , k ] ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > setLocalFlutterOption (
{ required String k , required String v , dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
' option:flutter:local ' ,
jsonEncode ( { ' name ' : k , ' value ' : v } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
String getLocalKbLayoutType ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
throw js . context . callMethod ( ' getByName ' , [ ' option:local ' , ' kb_layout ' ] ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > setLocalKbLayoutType (
{ required String kbLayoutType , dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
' option:local ' ,
jsonEncode ( { ' name ' : ' kb_layout ' , ' value ' : kbLayoutType } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < String ? > sessionGetViewStyle (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = >
2024-03-27 11:26:29 +08:00
js . context . callMethod ( ' getByName ' , [ ' option:session ' , ' view_style ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSetViewStyle (
{ required UuidValue sessionId , required String value , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
2024-03-27 11:26:29 +08:00
' option:session ' ,
2024-03-25 10:47:53 +08:00
jsonEncode ( { ' name ' : ' view_style ' , ' value ' : value } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < String ? > sessionGetScrollStyle (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = >
2024-03-27 11:26:29 +08:00
js . context . callMethod ( ' getByName ' , [ ' option:session ' , ' scroll_style ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSetScrollStyle (
{ required UuidValue sessionId , required String value , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
2024-03-27 11:26:29 +08:00
' option:session ' ,
2024-03-25 10:47:53 +08:00
jsonEncode ( { ' name ' : ' scroll_style ' , ' value ' : value } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < String ? > sessionGetImageQuality (
2024-03-28 11:38:11 +08:00
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return Future ( ( ) = > js . context
. callMethod ( ' getByName ' , [ ' option:session ' , ' image_quality ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSetImageQuality (
{ required UuidValue sessionId , required String value , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
2024-03-27 11:26:29 +08:00
' option:session ' ,
2024-03-25 10:47:53 +08:00
jsonEncode ( { ' name ' : ' image_quality ' , ' value ' : value } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < String ? > sessionGetKeyboardMode (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-28 11:38:11 +08:00
final mode =
js . context . callMethod ( ' getByName ' , [ ' option:session ' , ' keyboard_mode ' ] ) ;
return Future ( ( ) = > mode = = ' ' ? null : mode ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSetKeyboardMode (
{ required UuidValue sessionId , required String value , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
2024-03-27 11:26:29 +08:00
' option:session ' ,
2024-03-25 10:47:53 +08:00
jsonEncode ( { ' name ' : ' keyboard_mode ' , ' value ' : value } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
String ? sessionGetReverseMouseWheelSync (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return js . context
2024-03-27 11:26:29 +08:00
. callMethod ( ' getByName ' , [ ' option:session ' , ' reverse_mouse_wheel ' ] ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSetReverseMouseWheel (
{ required UuidValue sessionId , required String value , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
2024-03-27 11:26:29 +08:00
' option:session ' ,
2024-03-25 10:47:53 +08:00
jsonEncode ( { ' name ' : ' reverse_mouse_wheel ' , ' value ' : value } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
String ? sessionGetDisplaysAsIndividualWindows (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return js . context . callMethod (
2024-03-27 11:26:29 +08:00
' getByName ' , [ ' option:session ' , ' displays_as_individual_windows ' ] ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSetDisplaysAsIndividualWindows (
{ required UuidValue sessionId , required String value , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future . value ( ) ;
2024-03-22 13:16:37 +08:00
}
String ? sessionGetUseAllMyDisplaysForTheRemoteSession (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return ' ' ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSetUseAllMyDisplaysForTheRemoteSession (
{ required UuidValue sessionId , required String value , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future . value ( ) ;
2024-03-22 13:16:37 +08:00
}
Future < Int32List ? > sessionGetCustomImageQuality (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
try {
return Future ( ( ) = > Int32List . fromList ( [
int . parse ( js . context . callMethod (
2024-03-27 11:26:29 +08:00
' getByName ' , [ ' option:session ' , ' custom_image_quality ' ] ) )
2024-03-25 10:47:53 +08:00
] ) ) ;
} catch ( e ) {
return Future . value ( null ) ;
}
2024-03-22 13:16:37 +08:00
}
bool sessionIsKeyboardModeSupported (
{ required UuidValue sessionId , required String mode , dynamic hint } ) {
2024-03-28 11:38:11 +08:00
return mode = = kKeyLegacyMode ;
2024-03-22 13:16:37 +08:00
}
2024-04-25 13:26:02 +08:00
bool sessionIsMultiUiSession ( { required UuidValue sessionId , dynamic hint } ) {
return false ;
}
2024-03-22 13:16:37 +08:00
Future < void > sessionSetCustomImageQuality (
{ required UuidValue sessionId , required int value , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
2024-03-27 11:26:29 +08:00
' option:session ' ,
2024-03-25 10:47:53 +08:00
jsonEncode ( { ' name ' : ' custom_image_quality ' , ' value ' : value } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSetCustomFps (
{ required UuidValue sessionId , required int fps , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
2024-03-27 11:26:29 +08:00
' option:session ' ,
2024-03-25 10:47:53 +08:00
jsonEncode ( { ' name ' : ' custom_fps ' , ' value ' : fps } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionLockScreen ( { required UuidValue sessionId , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [ ' lock_screen ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionCtrlAltDel ( { required UuidValue sessionId , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [ ' ctrl_alt_del ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSwitchDisplay (
{ required bool isDesktop ,
required UuidValue sessionId ,
required Int32List value ,
dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
' switch_display ' ,
jsonEncode ( {
isDesktop: isDesktop ,
sessionId: sessionId . toString ( ) ,
value: value
} )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionHandleFlutterKeyEvent (
{ required UuidValue sessionId ,
required String name ,
required int platformCode ,
required int positionCode ,
required int lockModes ,
required bool downOrUp ,
dynamic hint } ) {
2024-03-26 10:45:06 +08:00
// TODO: map mode
2024-03-22 13:16:37 +08:00
throw UnimplementedError ( ) ;
}
void sessionEnterOrLeave (
{ required UuidValue sessionId , required bool enter , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionInputKey (
{ required UuidValue sessionId ,
required String name ,
required bool down ,
required bool press ,
required bool alt ,
required bool ctrl ,
required bool shift ,
required bool command ,
dynamic hint } ) {
2024-03-26 10:45:06 +08:00
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 '
} )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionInputString (
{ required UuidValue sessionId , required String value , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future (
( ) = > js . context . callMethod ( ' setByName ' , [ ' input_string ' , value ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSendChat (
{ required UuidValue sessionId , required String text , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionPeerOption (
{ required UuidValue sessionId ,
required String name ,
required String value ,
dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future ( ( ) = > js . context . callMethod ( ' SetByName ' , [
2024-03-27 11:26:29 +08:00
' option:session ' ,
2024-03-25 10:47:53 +08:00
jsonEncode ( { ' name ' : name , ' value ' : value } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < String > sessionGetPeerOption (
{ required UuidValue sessionId , required String name , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future (
2024-03-27 11:26:29 +08:00
( ) = > js . context . callMethod ( ' getByName ' , [ ' option:session ' , name ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionInputOsPassword (
{ required UuidValue sessionId , required String value , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future (
( ) = > js . context . callMethod ( ' setByName ' , [ ' input_os_password ' , value ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionReadRemoteDir (
{ required UuidValue sessionId ,
required String path ,
required bool includeHidden ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionSendFiles (
{ required UuidValue sessionId ,
required int actId ,
required String path ,
required String to ,
required int fileNum ,
required bool includeHidden ,
required bool isRemote ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionSetConfirmOverrideFile (
{ required UuidValue sessionId ,
required int actId ,
required int fileNum ,
required bool needOverride ,
required bool remember ,
required bool isUpload ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionRemoveFile (
{ required UuidValue sessionId ,
required int actId ,
required String path ,
required int fileNum ,
required bool isRemote ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionReadDirRecursive (
{ required UuidValue sessionId ,
required int actId ,
required String path ,
required bool isRemote ,
required bool showHidden ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionRemoveAllEmptyDirs (
{ required UuidValue sessionId ,
required int actId ,
required String path ,
required bool isRemote ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionCancelJob (
{ required UuidValue sessionId , required int actId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionCreateDir (
{ required UuidValue sessionId ,
required int actId ,
required String path ,
required bool isRemote ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > sessionReadLocalDirSync (
{ required UuidValue sessionId ,
required String path ,
required bool showHidden ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > sessionGetPlatform (
{ required UuidValue sessionId , required bool isRemote , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionLoadLastTransferJobs (
{ required UuidValue sessionId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionAddJob (
{ required UuidValue sessionId ,
required int actId ,
required String path ,
required String to ,
required int fileNum ,
required bool includeHidden ,
required bool isRemote ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionResumeJob (
{ required UuidValue sessionId ,
required int actId ,
required bool isRemote ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionElevateDirect (
{ required UuidValue sessionId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionElevateWithLogon (
{ required UuidValue sessionId ,
required String username ,
required String password ,
dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
' elevate_with_logon ' ,
jsonEncode ( { username , password } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSwitchSides (
{ required UuidValue sessionId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionChangeResolution (
{ required UuidValue sessionId ,
required int display ,
required int width ,
required int height ,
dynamic hint } ) {
2024-03-26 10:45:06 +08:00
// note: restore on disconnected
2024-03-22 13:16:37 +08:00
throw UnimplementedError ( ) ;
}
Future < void > sessionSetSize (
{ required UuidValue sessionId ,
required int display ,
required int width ,
required int height ,
dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future . value ( ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSendSelectedSessionId (
{ required UuidValue sessionId , required String sid , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < List < String > > mainGetSoundInputs ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String ? > mainGetDefaultSoundInput ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
String mainGetLoginDeviceInfo ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainChangeId ( { required String newId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetAsyncStatus ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetOption ( { required String key , dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future . value ( mainGetOptionSync ( key: key ) ) ;
2024-03-22 13:16:37 +08:00
}
String mainGetOptionSync ( { required String key , dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return js . context . callMethod ( ' getByName ' , [ ' option ' , key ] ) ;
2024-03-22 13:16:37 +08:00
}
Future < String > mainGetError ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainShowOption ( { required String key , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainSetOption (
{ required String key , required String value , dynamic hint } ) {
2024-03-24 11:23:06 +08:00
js . context . callMethod ( ' setByName ' , [
2024-03-23 10:08:55 +08:00
' option ' ,
jsonEncode ( { ' name ' : key , ' value ' : value } )
] ) ;
2024-03-24 11:23:06 +08:00
return Future . value ( ) ;
2024-03-22 13:16:37 +08:00
}
2024-03-24 11:23:06 +08:00
// get server settings
2024-03-22 13:16:37 +08:00
Future < String > mainGetOptions ( { dynamic hint } ) {
2024-03-24 11:23:06 +08:00
return Future ( ( ) = > mainGetOptionsSync ( ) ) ;
2024-03-22 13:16:37 +08:00
}
2024-03-24 11:23:06 +08:00
// get server settings
2024-03-22 13:16:37 +08:00
String mainGetOptionsSync ( { dynamic hint } ) {
2024-03-24 11:23:06 +08:00
return js . context . callMethod ( ' getByName ' , [ ' options ' ] ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainSetOptions ( { required String json , dynamic hint } ) {
2024-03-24 11:23:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [ ' options ' , json ] ) ) ;
2024-03-22 13:16:37 +08:00
}
2024-04-28 14:22:21 +08:00
Future < String > mainTestIfValidServer (
{ required String server , required bool testWithProxy , dynamic hint } ) {
2024-03-24 11:23:06 +08:00
// TODO: implement
return Future . value ( ' ' ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainSetSocks (
{ required String proxy ,
required String username ,
required String password ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < List < String > > mainGetSocks ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetAppName ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
String mainGetAppNameSync ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
String mainUriPrefixSync ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetLicense ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetVersion ( { dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' getByName ' , [ ' version ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < List < String > > mainGetFav ( { dynamic hint } ) {
2024-03-27 11:26:29 +08:00
List < String > favs = [ ] ;
try {
favs = ( jsonDecode ( js . context . callMethod ( ' getByName ' , [ ' fav ' ] ) )
as List < dynamic > )
. map ( ( e ) = > e . toString ( ) )
. toList ( ) ;
} catch ( e ) {
debugPrint ( ' Failed to load favs: $ e ' ) ;
}
return Future . value ( favs ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainStoreFav ( { required List < String > favs , dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return Future (
( ) = > js . context . callMethod ( ' setByName ' , [ ' fav ' , jsonEncode ( favs ) ] ) ) ;
2024-03-22 13:16:37 +08:00
}
String mainGetPeerSync ( { required String id , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
// TODO:
2024-03-22 13:16:37 +08:00
throw UnimplementedError ( ) ;
}
Future < String > mainGetLanPeers ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetConnectStatus ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future (
( ) = > js . context . callMethod ( ' getByName ' , [ " get_conn_status " ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainCheckConnectStatus ( { dynamic hint } ) {
2024-03-28 11:38:11 +08:00
throw UnimplementedError ( ) ;
2024-03-22 13:16:37 +08:00
}
Future < bool > mainIsUsingPublicServer ( { dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future (
( ) = > js . context . callMethod ( ' setByName ' , [ " is_using_public_server " ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainDiscover ( { dynamic hint } ) {
2024-03-27 11:26:29 +08:00
throw UnimplementedError ( ) ;
2024-03-22 13:16:37 +08:00
}
Future < String > mainGetApiServer ( { dynamic hint } ) {
2024-03-24 11:23:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' getByName ' , [ ' api_server ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainPostRequest (
{ required String url ,
required String body ,
required String header ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
2024-04-25 11:46:21 +08:00
Future < bool > mainGetProxyStatus ( { dynamic hint } ) {
return Future ( ( ) = > false ) ;
}
Future < void > mainHttpRequest ( {
required String url ,
required String method ,
String ? body ,
required String header ,
dynamic hint ,
} ) {
throw UnimplementedError ( ) ;
}
2024-04-28 14:22:21 +08:00
Future < String ? > mainGetHttpStatus ( { required String url , dynamic hint } ) {
2024-04-25 11:46:21 +08:00
throw UnimplementedError ( ) ;
}
2024-03-22 13:16:37 +08:00
String mainGetLocalOption ( { required String key , dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return js . context . callMethod ( ' getByName ' , [ ' option:local ' , key ] ) ;
2024-03-22 13:16:37 +08:00
}
String mainGetEnv ( { required String key , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainSetLocalOption (
{ required String key , required String value , dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [
' option:local ' ,
jsonEncode ( { ' name ' : key , ' value ' : value } )
] ) ) ;
2024-03-22 13:16:37 +08:00
}
String mainGetInputSource ( { dynamic hint } ) {
2024-03-26 10:45:06 +08:00
// // 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 ' ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainSetInputSource (
{ required UuidValue sessionId , required String value , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future . value ( ) ;
2024-03-22 13:16:37 +08:00
}
Future < String > mainGetMyId ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetUuid ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetPeerOption (
{ required String id , required String key , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > mainGetPeerOptionSync ( id: id , key: key , hint: hint ) ) ;
2024-03-22 13:16:37 +08:00
}
String mainGetPeerOptionSync (
{ required String id , required String key , dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return js . context . callMethod ( ' getByName ' , [
' option:peer ' ,
jsonEncode ( { ' id ' : id , ' name ' : key } )
] ) ;
2024-03-22 13:16:37 +08:00
}
String mainGetPeerFlutterOptionSync (
{ required String id , required String k , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return js . context . callMethod ( ' getByName ' , [ ' option:flutter:peer ' , k ] ) ;
2024-03-22 13:16:37 +08:00
}
void mainSetPeerFlutterOptionSync (
{ required String id ,
required String k ,
required String v ,
dynamic hint } ) {
2024-03-26 10:45:06 +08:00
js . context . callMethod ( ' setByName ' , [
' option:flutter:peer ' ,
jsonEncode ( { ' name ' : k , ' value ' : v } )
] ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainSetPeerOption (
{ required String id ,
required String key ,
required String value ,
dynamic hint } ) {
2024-03-26 10:45:06 +08:00
mainSetPeerOptionSync ( id: id , key: key , value: value , hint: hint ) ;
return Future . value ( ) ;
2024-03-22 13:16:37 +08:00
}
bool mainSetPeerOptionSync (
{ required String id ,
required String key ,
required String value ,
dynamic hint } ) {
2024-03-26 10:45:06 +08:00
js . context . callMethod ( ' setByName ' , [
' option:peer ' ,
2024-03-27 11:26:29 +08:00
jsonEncode ( { ' id ' : id , ' name ' : key , ' value ' : value } )
2024-03-26 10:45:06 +08:00
] ) ;
return true ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainSetPeerAlias (
{ required String id , required String alias , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
mainSetPeerOptionSync ( id: id , key: ' alias ' , value: alias , hint: hint ) ;
return Future . value ( ) ;
2024-03-22 13:16:37 +08:00
}
Future < String > mainGetNewStoredPeers ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainForgetPassword ( { required String id , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [ ' forget ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < bool > mainPeerHasPassword ( { required String id , dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return Future ( ( ) = >
js . context . callMethod ( ' getByName ' , [ ' peer_has_password ' , id ] ) = =
' true ' ) ;
2024-03-22 13:16:37 +08:00
}
Future < bool > mainPeerExists ( { required String id , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future (
( ) = > js . context . callMethod ( ' getByName ' , [ ' peer_exists ' , id ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainLoadRecentPeers ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future (
( ) = > js . context . callMethod ( ' getByName ' , [ ' load_recent_peers ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
String mainLoadRecentPeersSync ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return js . context . callMethod ( ' getByName ' , [ ' load_recent_peers_sync ' ] ) ;
2024-03-22 13:16:37 +08:00
}
String mainLoadLanPeersSync ( { dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return ' {} ' ;
2024-03-22 13:16:37 +08:00
}
Future < String > mainLoadRecentPeersForAb (
{ required String filter , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainLoadFavPeers ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future ( ( ) = > js . context . callMethod ( ' getByName ' , [ ' load_fav_peers ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainLoadLanPeers ( { dynamic hint } ) {
2024-03-27 11:26:29 +08:00
throw UnimplementedError ( ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainRemoveDiscovered ( { required String id , dynamic hint } ) {
2024-03-27 11:26:29 +08:00
throw UnimplementedError ( ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainChangeTheme ( { required String dark , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainChangeLanguage ( { required String lang , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
2024-06-18 08:43:19 +08:00
String mainVideoSaveDirectory ( { required bool root , dynamic hint } ) {
2024-03-22 13:16:37 +08:00
throw UnimplementedError ( ) ;
}
Future < void > mainSetUserDefaultOption (
{ required String key , required String value , dynamic hint } ) {
2024-03-28 11:38:11 +08:00
return js . context . callMethod ( ' getByName ' , [
' option:user:default ' ,
jsonEncode ( { ' name ' : key , ' value ' : value } )
] ) ;
2024-03-22 13:16:37 +08:00
}
String mainGetUserDefaultOption ( { required String key , dynamic hint } ) {
2024-03-28 11:38:11 +08:00
return js . context . callMethod ( ' getByName ' , [ ' option:user:default ' , key ] ) ;
2024-03-22 13:16:37 +08:00
}
Future < String > mainHandleRelayId ( { required String id , dynamic hint } ) {
2024-03-24 11:23:06 +08:00
var newId = id ;
if ( id . endsWith ( " \\ r " ) | | id . endsWith ( " /r " ) ) {
newId = id . substring ( 0 , id . length - 2 ) ;
}
return Future . value ( newId ) ;
2024-03-22 13:16:37 +08:00
}
String mainGetMainDisplay ( { dynamic hint } ) {
2024-03-28 11:38:11 +08:00
return js . context . callMethod ( ' getByName ' , [ ' main_display ' ] ) ;
2024-03-22 13:16:37 +08:00
}
String mainGetDisplays ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionAddPortForward (
{ required UuidValue sessionId ,
required int localPort ,
required String remoteHost ,
required int remotePort ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionRemovePortForward (
{ required UuidValue sessionId , required int localPort , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionNewRdp ( { required UuidValue sessionId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionRequestVoiceCall (
{ required UuidValue sessionId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionCloseVoiceCall (
{ required UuidValue sessionId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > cmHandleIncomingVoiceCall (
{ required int id , required bool accept , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > cmCloseVoiceCall ( { required int id , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetLastRemoteId ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future (
( ) = > js . context . callMethod ( ' getByName ' , [ ' option ' , ' last_remote_id ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < String > mainGetSoftwareUpdateUrl ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetHomeDir ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future . value ( ' ' ) ;
2024-03-22 13:16:37 +08:00
}
Future < String > mainGetLangs ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetTemporaryPassword ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future . value ( ' ' ) ;
2024-03-22 13:16:37 +08:00
}
Future < String > mainGetPermanentPassword ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future . value ( ' ' ) ;
2024-03-22 13:16:37 +08:00
}
Future < String > mainGetFingerprint ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > cmGetClientsState ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String ? > cmCheckClientsLength ( { required int length , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < int > cmGetClientsLength ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainInit ( { required String appDir , dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future . value ( ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > mainDeviceId ( { required String id , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
// TODO: ?
2024-03-22 13:16:37 +08:00
throw UnimplementedError ( ) ;
}
Future < void > mainDeviceName ( { required String name , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
// TODO: ?
2024-03-22 13:16:37 +08:00
throw UnimplementedError ( ) ;
}
Future < void > mainRemovePeer ( { required String id , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [ ' remove ' , id ] ) ) ;
2024-03-22 13:16:37 +08:00
}
bool mainHasHwcodec ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
2024-04-12 17:26:24 +08:00
bool mainHasVram ( { dynamic hint } ) {
2024-03-22 13:16:37 +08:00
throw UnimplementedError ( ) ;
}
String mainSupportedHwdecodings ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < bool > mainIsRoot ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
int getDoubleClickTime ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainStartDbusServer ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainSaveAb ( { required String json , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainClearAb ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainLoadAb ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainSaveGroup ( { required String json , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainClearGroup ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainLoadGroup ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionSendPointer (
{ required UuidValue sessionId , required String msg , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > sessionSendMouse (
{ required UuidValue sessionId , required String msg , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future (
( ) = > js . context . callMethod ( ' setByName ' , [ ' send_mouse ' , msg ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionRestartRemoteDevice (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return Future ( ( ) = > js . context . callMethod ( ' setByName ' , [ ' restart ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
String sessionGetAuditServerSync (
{ required UuidValue sessionId , required String typ , dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return js . context . callMethod ( ' getByName ' , [ ' audit_server ' , typ ] ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionSendNote (
{ required UuidValue sessionId , required String note , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > sessionAlternativeCodecs (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return Future (
( ) = > js . context . callMethod ( ' getByName ' , [ ' alternative_codecs ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionChangePreferCodec (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return Future (
( ) = > js . context . callMethod ( ' setByName ' , [ ' change_prefer_codec ' ] ) ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionOnWaitingForImageDialogShow (
{ required UuidValue sessionId , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return Future . value ( ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sessionToggleVirtualDisplay (
{ required UuidValue sessionId ,
required int index ,
required bool on ,
dynamic hint } ) {
2024-03-26 10:45:06 +08:00
// TODO
2024-03-22 13:16:37 +08:00
throw UnimplementedError ( ) ;
}
Future < void > mainSetHomeDir ( { required String home , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
String mainGetDataDirIos ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainStopService ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainStartService ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainUpdateTemporaryPassword ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainSetPermanentPassword (
{ required String password , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < bool > mainCheckSuperUserPermission ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainCheckMouseTime ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < double > mainGetMouseTime ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainWol ( { required String id , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainCreateShortcut ( { required String id , dynamic hint } ) {
2024-03-26 10:45:06 +08:00
// TODO:
2024-03-22 13:16:37 +08:00
throw UnimplementedError ( ) ;
}
Future < void > cmSendChat (
{ required int connId , required String msg , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > cmLoginRes (
{ required int connId , required bool res , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > cmCloseConnection ( { required int connId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > cmRemoveDisconnectedConnection (
{ required int connId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > cmCheckClickTime ( { required int connId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < double > cmGetClickTime ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > cmSwitchPermission (
{ required int connId ,
required String name ,
required bool enabled ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool cmCanElevate ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > cmElevatePortable ( { required int connId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > cmSwitchBack ( { required int connId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > cmGetConfig ( { required String name , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainGetBuildDate ( { dynamic hint } ) {
2024-03-26 10:45:06 +08:00
// TODO
2024-03-22 13:16:37 +08:00
throw UnimplementedError ( ) ;
}
String translate (
{ required String name , required String locale , dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return js . context . callMethod ( ' getByName ' , [
' translate ' ,
jsonEncode ( { ' locale ' : locale , ' text ' : name } )
] ) ;
2024-03-22 13:16:37 +08:00
}
int sessionGetRgbaSize (
{ required UuidValue sessionId , required int display , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return 0 ;
2024-03-22 13:16:37 +08:00
}
void sessionNextRgba (
2024-03-25 10:47:53 +08:00
{ required UuidValue sessionId , required int display , dynamic hint } ) { }
2024-03-22 13:16:37 +08:00
void sessionRegisterPixelbufferTexture (
{ required UuidValue sessionId ,
required int display ,
required int ptr ,
2024-03-25 10:47:53 +08:00
dynamic hint } ) { }
2024-03-22 13:16:37 +08:00
void sessionRegisterGpuTexture (
{ required UuidValue sessionId ,
required int display ,
required int ptr ,
2024-03-25 10:47:53 +08:00
dynamic hint } ) { }
2024-03-22 13:16:37 +08:00
Future < void > queryOnlines ( { required List < String > ids , dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return Future ( ( ) = >
js . context . callMethod ( ' setByName ' , [ ' query_onlines ' , jsonEncode ( ids ) ] ) ) ;
2024-03-22 13:16:37 +08:00
}
2024-03-25 10:47:53 +08:00
// Dup to the function in hbb_common, lib.rs
// Maybe we need to move this function to js part.
2024-03-22 13:16:37 +08:00
int versionToNumber ( { required String v , dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return int . tryParse (
js . context . callMethod ( ' getByName ' , [ ' get_version_number ' , v ] ) ) ? ?
0 ;
2024-03-22 13:16:37 +08:00
}
Future < bool > optionSynced ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future . value ( true ) ;
2024-03-22 13:16:37 +08:00
}
bool mainIsInstalled ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
void mainInitInputSource ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainIsInstalledLowerVersion ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainIsInstalledDaemon ( { required bool prompt , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainIsProcessTrusted ( { required bool prompt , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainIsCanScreenRecording ( { required bool prompt , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainIsCanInputMonitoring ( { required bool prompt , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainIsShareRdp ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainSetShareRdp ( { required bool enable , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainGotoInstall ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
String mainGetNewVersion ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainUpdateMe ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > setCurSessionId ( { required UuidValue sessionId , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool installShowRunWithoutInstall ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > installRunWithoutInstall ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > installInstallMe (
{ required String options , required String path , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
String installInstallPath ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainAccountAuth (
{ required String op , required bool rememberMe , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainAccountAuthCancel ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < String > mainAccountAuthResult ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainOnMainWindowClose ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainCurrentIsWayland ( { dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
bool mainIsLoginWayland ( { dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
bool mainHideDocker ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainHasFileClipboard ( { dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
bool mainHasGpuTextureRender ( { dynamic hint } ) {
2024-03-27 11:26:29 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
Future < void > cmInit ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainStartIpcUrlServer ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > mainTestWallpaper ( { required int second , dynamic hint } ) {
2024-03-23 10:08:55 +08:00
// TODO: implement mainTestWallpaper
return Future . value ( ) ;
2024-03-22 13:16:37 +08:00
}
Future < bool > mainSupportRemoveWallpaper ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
// TODO: implement mainSupportRemoveWallpaper
return Future . value ( false ) ;
2024-03-22 13:16:37 +08:00
}
bool isIncomingOnly ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
bool isOutgoingOnly ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
bool isCustomClient ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
bool isDisableSettings ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
bool isDisableAb ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
2024-05-28 20:10:12 +08:00
bool isDisableGroupPanel ( { dynamic hint } ) {
return false ;
}
2024-03-22 13:16:37 +08:00
bool isDisableAccount ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
bool isDisableInstallation ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
Future < bool > isPresetPassword ( { dynamic hint } ) {
2024-03-23 10:08:55 +08:00
return Future . value ( false ) ;
2024-03-22 13:16:37 +08:00
}
Future < void > sendUrlScheme ( { required String url , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > pluginEvent (
{ required String id ,
required String peer ,
required Uint8List event ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Stream < EventToUI > pluginRegisterEventStream (
{ required String id , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
String ? pluginGetSessionOption (
{ required String id ,
required String peer ,
required String key ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > pluginSetSessionOption (
{ required String id ,
required String peer ,
required String key ,
required String value ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
String ? pluginGetSharedOption (
{ required String id , required String key , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > pluginSetSharedOption (
{ required String id ,
required String key ,
required String value ,
dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > pluginReload ( { required String id , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
void pluginEnable ( { required String id , required bool v , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool pluginIsEnabled ( { required String id , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool pluginFeatureIsEnabled ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > pluginSyncUi ( { required String syncTo , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > pluginListReload ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < void > pluginInstall (
{ required String id , required bool b , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool isSupportMultiUiSession ( { required String version , dynamic hint } ) {
2024-03-25 10:47:53 +08:00
return versionToNumber ( v: version ) > versionToNumber ( v: ' 1.2.4 ' ) ;
2024-03-22 13:16:37 +08:00
}
bool isSelinuxEnforcing ( { dynamic hint } ) {
2024-03-26 10:45:06 +08:00
return false ;
2024-03-22 13:16:37 +08:00
}
String mainDefaultPrivacyModeImpl ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
String mainSupportedPrivacyModeImpls ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
String mainSupportedInputSource ( { dynamic hint } ) {
2024-03-28 11:38:11 +08:00
return jsonEncode ( [
[ ' Input source 2 ' , ' input_source_2_tip ' ]
] ) ;
2024-03-22 13:16:37 +08:00
}
Future < String > mainGenerate2Fa ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Future < bool > mainVerify2Fa ( { required String code , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
bool mainHasValid2FaSync ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
String mainGetHardOption ( { required String key , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
2024-04-18 13:12:45 +08:00
Future < void > mainCheckHwcodec ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
2024-04-20 14:54:23 +08:00
Future < void > sessionRequestNewDisplayInitMsgs (
{ required UuidValue sessionId , required int display , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
2024-05-09 11:03:59 +08:00
Future < String > mainHandleWaylandScreencastRestoreToken (
{ required String key , required String value , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
2024-05-17 14:19:11 +08:00
bool mainIsOptionFixed ( { required String key , dynamic hint } ) {
throw UnimplementedError ( ) ;
}
2024-05-28 16:42:30 +08:00
bool mainGetUseTextureRender ( { dynamic hint } ) {
throw UnimplementedError ( ) ;
}
2024-03-26 10:45:06 +08:00
void dispose ( ) { }
2024-03-22 13:16:37 +08:00
}