customClientConfig in dart

This commit is contained in:
rustdesk 2024-04-16 18:42:35 +08:00
parent 44bce59777
commit a6c1d2d486
2 changed files with 13 additions and 13 deletions

View File

@ -198,7 +198,9 @@ class PlatformFFI {
await _ffiBind.mainDeviceId(id: id);
await _ffiBind.mainDeviceName(name: name);
await _ffiBind.mainSetHomeDir(home: _homeDir);
await _ffiBind.mainInit(appDir: _dir);
final customClientConfig = '';
await _ffiBind.mainInit(
appDir: _dir, customClientConfig: customClientConfig);
} catch (e) {
debugPrintStack(label: 'initialize failed: $e');
}

View File

@ -39,11 +39,15 @@ lazy_static::lazy_static! {
static ref TEXTURE_RENDER_KEY: Arc<AtomicI32> = Arc::new(AtomicI32::new(0));
}
fn initialize(app_dir: &str) {
fn initialize(app_dir: &str, custom_client_config: &str) {
flutter::async_tasks::start_flutter_async_runner();
*config::APP_DIR.write().unwrap() = app_dir.to_owned();
// core_main's load_custom_client does not work for flutter since it is only applied to its load_library in main.c
crate::load_custom_client();
if custom_client_config.is_empty() {
crate::load_custom_client();
} else {
crate::read_custom_client(custom_client_config);
}
#[cfg(target_os = "android")]
{
// flexi_logger can't work when android_logger initialized.
@ -1275,8 +1279,8 @@ pub fn cm_get_clients_length() -> usize {
crate::ui_cm_interface::get_clients_length()
}
pub fn main_init(app_dir: String) {
initialize(&app_dir);
pub fn main_init(app_dir: String, custom_client_config: String) {
initialize(&app_dir, &custom_client_config);
}
pub fn main_device_id(id: String) {
@ -2122,10 +2126,7 @@ pub mod server_side {
}
#[no_mangle]
pub unsafe extern "system" fn Java_ffi_FFI_startService(
_env: JNIEnv,
_class: JClass,
) {
pub unsafe extern "system" fn Java_ffi_FFI_startService(_env: JNIEnv, _class: JClass) {
log::debug!("startService from jvm");
config::Config::set_option("stop-service".into(), "".into());
crate::rendezvous_mediator::RendezvousMediator::restart();
@ -2151,10 +2152,7 @@ pub mod server_side {
}
#[no_mangle]
pub unsafe extern "system" fn Java_ffi_FFI_refreshScreen(
_env: JNIEnv,
_class: JClass,
) {
pub unsafe extern "system" fn Java_ffi_FFI_refreshScreen(_env: JNIEnv, _class: JClass) {
crate::server::video_service::refresh()
}
}