load android custom client for jvm startServer
This commit is contained in:
parent
b9792fc17d
commit
01ec539065
@ -207,7 +207,7 @@ class MainService : Service() {
|
||||
// keep the config dir same with flutter
|
||||
val prefs = applicationContext.getSharedPreferences(KEY_SHARED_PREFERENCES, FlutterActivity.MODE_PRIVATE)
|
||||
val configPath = prefs.getString(KEY_APP_DIR_CONFIG_PATH, "") ?: ""
|
||||
FFI.startServer(configPath)
|
||||
FFI.startServer(configPath, "")
|
||||
|
||||
createForegroundNotification()
|
||||
}
|
||||
|
@ -198,9 +198,7 @@ class PlatformFFI {
|
||||
await _ffiBind.mainDeviceId(id: id);
|
||||
await _ffiBind.mainDeviceName(name: name);
|
||||
await _ffiBind.mainSetHomeDir(home: _homeDir);
|
||||
final customClientConfig = '';
|
||||
await _ffiBind.mainInit(
|
||||
appDir: _dir, customClientConfig: customClientConfig);
|
||||
await _ffiBind.mainInit(appDir: _dir, customClientConfig: '');
|
||||
} catch (e) {
|
||||
debugPrintStack(label: 'initialize failed: $e');
|
||||
}
|
||||
|
@ -2116,12 +2116,16 @@ pub mod server_side {
|
||||
env: JNIEnv,
|
||||
_class: JClass,
|
||||
app_dir: JString,
|
||||
custom_client_config: JString,
|
||||
) {
|
||||
log::debug!("startServer from jvm");
|
||||
let mut env = env;
|
||||
if let Ok(app_dir) = env.get_string(&app_dir) {
|
||||
*config::APP_DIR.write().unwrap() = app_dir.into();
|
||||
}
|
||||
if let Ok(custom_client_config) = env.get_string(&custom_client_config) {
|
||||
crate::read_custom_client(custom_client_config);
|
||||
}
|
||||
std::thread::spawn(move || start_server(true));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user