add mobile switch language

This commit is contained in:
csf
2022-07-31 20:42:56 +08:00
parent 93e79b5234
commit 5658ce807e
6 changed files with 76 additions and 6 deletions

View File

@@ -113,6 +113,14 @@ unsafe extern "C" fn get_by_name(name: *const c_char, arg: *const c_char) -> *co
res = Session::get_option(arg);
}
}
"local_option" => {
if let Ok(arg) = arg.to_str() {
res = LocalConfig::get_option(arg);
}
}
"langs" => {
res = crate::lang::LANGS.to_string();
}
// File Action
"get_home_dir" => {
res = fs::get_home_as_string();
@@ -311,6 +319,15 @@ unsafe extern "C" fn set_by_name(name: *const c_char, value: *const c_char) {
}
}
}
"local_option" => {
if let Ok(m) = serde_json::from_str::<HashMap<String, String>>(value) {
if let Some(name) = m.get("name") {
if let Some(value) = m.get("value") {
LocalConfig::set_option(name.to_owned(), value.to_owned());
}
}
}
}
"input_os_password" => {
Session::input_os_password(value.to_owned(), true);
}