plugin, tmp commit

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-04-18 23:02:37 +08:00
parent f8a292cc56
commit ecf8c2664c
14 changed files with 547 additions and 118 deletions

View File

@@ -72,21 +72,17 @@ fn handle_client_message(builder: &mut IfaceBuilder<()>) {
#[cfg(feature = "flutter")]
{
use crate::flutter::{self, APP_TYPE_MAIN};
if let Some(stream) = flutter::GLOBAL_EVENT_STREAM
.write()
.unwrap()
.get(APP_TYPE_MAIN)
{
let data = HashMap::from([
("name", "new_connection"),
("uni_links", _uni_links.as_str()),
]);
if !stream.add(serde_json::ser::to_string(&data).unwrap_or("".to_string())) {
log::error!("failed to add dbus message to flutter global dbus stream.");
let data = HashMap::from([
("name", "new_connection"),
("uni_links", _uni_links.as_str()),
]);
let event = serde_json::ser::to_string(&data).unwrap_or("".to_string());
match crate::flutter::push_global_event(flutter::APP_TYPE_MAIN, event) {
None => log::error!("failed to find main event stream"),
Some(false) => {
log::error!("failed to add dbus message to flutter global dbus stream.")
}
} else {
log::error!("failed to find main event stream");
Some(true) => {}
}
}
return Ok((DBUS_METHOD_RETURN_SUCCESS.to_string(),));