use new event channel for mobile and web

This commit is contained in:
csf
2022-05-17 19:59:37 +08:00
parent 85a2a7cd44
commit a7af7967f6
26 changed files with 1875 additions and 480 deletions

View File

@@ -1,9 +1,10 @@
use crate::client::file_trait::FileManager;
#[cfg(target_os = "android")]
use crate::mobile::connection_manager::{self, get_clients_length, get_clients_state};
use crate::mobile::{make_fd_to_json, Session};
use crate::mobile::{self, make_fd_to_json, Session};
use flutter_rust_bridge::StreamSink;
use hbb_common::ResultType;
use hbb_common::{
config::{self, Config, PeerConfig, ONLINE, LocalConfig},
config::{self, Config, LocalConfig, PeerConfig, ONLINE},
fs, log,
};
use serde_json::{Number, Value};
@@ -34,6 +35,11 @@ fn initialize(app_dir: &str) {
crate::common::check_software_update();
}
pub fn start_event_stream(s: StreamSink<String>) -> ResultType<()> {
let _ = mobile::EVENT_STREAM.write().unwrap().insert(s);
Ok(())
}
#[no_mangle]
unsafe extern "C" fn get_by_name(name: *const c_char, arg: *const c_char) -> *const c_char {
let mut res = "".to_owned();