fix android build
This commit is contained in:
		
							parent
							
								
									d3bc0ca073
								
							
						
					
					
						commit
						07debe8363
					
				| @ -1267,7 +1267,7 @@ impl LoginConfigHandler { | ||||
|     /// Create a [`Message`] for login.
 | ||||
|     fn create_login_msg(&self, password: Vec<u8>) -> Message { | ||||
|         #[cfg(any(target_os = "android", target_os = "ios"))] | ||||
|         let my_id = Config::get_id_or(crate::common::MOBILE_INFO1.lock().unwrap().clone()); | ||||
|         let my_id = Config::get_id_or(crate::common::FLUTTER_INFO1.lock().unwrap().clone()); | ||||
|         #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
|         let my_id = Config::get_id(); | ||||
|         let mut lr = LoginRequest { | ||||
|  | ||||
| @ -441,7 +441,7 @@ pub fn username() -> String { | ||||
|     #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
|     return whoami::username().trim_end_matches('\0').to_owned(); | ||||
|     #[cfg(any(target_os = "android", target_os = "ios"))] | ||||
|     return MOBILE_INFO2.lock().unwrap().clone(); | ||||
|     return FLUTTER_INFO2.lock().unwrap().clone(); | ||||
| } | ||||
| 
 | ||||
| #[inline] | ||||
|  | ||||
| @ -19,12 +19,14 @@ use crate::flutter::connection_manager::{self, get_clients_length, get_clients_s | ||||
| use crate::flutter::{self, Session, SESSIONS}; | ||||
| use crate::start_server; | ||||
| use crate::ui_interface; | ||||
| #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
| use crate::ui_interface::{change_id, check_connect_status, is_ok_change_id}; | ||||
| use crate::ui_interface::{ | ||||
|     change_id, check_connect_status, discover, forget_password, get_api_server, get_app_name, | ||||
|     get_async_job_status, get_connect_status, get_fav, get_id, get_lan_peers, get_license, | ||||
|     get_local_option, get_options, get_peer, get_peer_option, get_socks, get_sound_inputs, | ||||
|     get_uuid, get_version, has_rendezvous_service, is_ok_change_id, post_request, set_local_option, | ||||
|     set_options, set_peer_option, set_socks, store_fav, test_if_valid_server, using_public_server, | ||||
|     discover, forget_password, get_api_server, get_app_name, get_async_job_status, | ||||
|     get_connect_status, get_fav, get_id, get_lan_peers, get_license, get_local_option, get_options, | ||||
|     get_peer, get_peer_option, get_socks, get_sound_inputs, get_uuid, get_version, | ||||
|     has_rendezvous_service, post_request, set_local_option, set_options, set_peer_option, | ||||
|     set_socks, store_fav, test_if_valid_server, using_public_server, | ||||
| }; | ||||
| 
 | ||||
| fn initialize(app_dir: &str) { | ||||
| @ -67,7 +69,10 @@ fn initialize(app_dir: &str) { | ||||
| /// Return true if the app should continue running with UI(possibly Flutter), false if the app should exit.
 | ||||
| #[no_mangle] | ||||
| pub extern "C" fn rustdesk_core_main() -> bool { | ||||
|     crate::core_main::core_main() | ||||
|     #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
|     return crate::core_main::core_main(); | ||||
|     #[cfg(any(target_os = "android", target_os = "ios"))] | ||||
|     false | ||||
| } | ||||
| 
 | ||||
| pub enum EventToUI { | ||||
| @ -390,6 +395,7 @@ pub fn main_get_sound_inputs() -> Vec<String> { | ||||
| } | ||||
| 
 | ||||
| pub fn main_change_id(new_id: String) { | ||||
|     #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
|     change_id(new_id) | ||||
| } | ||||
| 
 | ||||
| @ -461,6 +467,7 @@ pub fn main_get_connect_status() -> String { | ||||
| } | ||||
| 
 | ||||
| pub fn main_check_connect_status() { | ||||
|     #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
|     check_connect_status(true); | ||||
| } | ||||
| 
 | ||||
| @ -1042,8 +1049,13 @@ unsafe extern "C" fn set_by_name(name: *const c_char, value: *const c_char) { | ||||
|                     crate::rendezvous_mediator::RendezvousMediator::restart(); | ||||
|                 } | ||||
|                 "start_service" => { | ||||
|                     #[cfg(target_os = "android")] | ||||
|                     { | ||||
|                         Config::set_option("stop-service".into(), "".into()); | ||||
|                     start_server(false); | ||||
|                         crate::rendezvous_mediator::RendezvousMediator::restart(); | ||||
|                     } | ||||
|                     #[cfg(not(target_os = "android"))] | ||||
|                     std::thread::spawn(move || start_server(true)); | ||||
|                 } | ||||
|                 #[cfg(target_os = "android")] | ||||
|                 "close_conn" => { | ||||
|  | ||||
| @ -5,7 +5,7 @@ use crate::clipboard_file::*; | ||||
| use crate::common::update_clipboard; | ||||
| use crate::video_service; | ||||
| #[cfg(any(target_os = "android", target_os = "ios"))] | ||||
| use crate::{common::MOBILE_INFO2, flutter::connection_manager::start_channel}; | ||||
| use crate::{common::FLUTTER_INFO2, flutter::connection_manager::start_channel}; | ||||
| use crate::{ipc, VERSION}; | ||||
| use hbb_common::{ | ||||
|     config::Config, | ||||
| @ -643,7 +643,7 @@ impl Connection { | ||||
|         } | ||||
|         #[cfg(target_os = "android")] | ||||
|         { | ||||
|             pi.hostname = MOBILE_INFO2.lock().unwrap().clone(); | ||||
|             pi.hostname = FLUTTER_INFO2.lock().unwrap().clone(); | ||||
|             pi.platform = "Android".into(); | ||||
|         } | ||||
|         #[cfg(feature = "hwcodec")] | ||||
|  | ||||
| @ -32,10 +32,14 @@ lazy_static::lazy_static! { | ||||
|     pub static ref UI_STATUS : Arc<Mutex<Status>> = Arc::new(Mutex::new((0, false, 0, "".to_owned()))); | ||||
|     pub static ref OPTIONS : Arc<Mutex<HashMap<String, String>>> = Arc::new(Mutex::new(Config::get_options())); | ||||
|     pub static ref ASYNC_JOB_STATUS : Arc<Mutex<String>> = Default::default(); | ||||
|     pub static ref SENDER : Mutex<mpsc::UnboundedSender<ipc::Data>> = Mutex::new(check_connect_status(true)); | ||||
|     pub static ref TEMPORARY_PASSWD : Arc<Mutex<String>> = Arc::new(Mutex::new("".to_owned())); | ||||
| } | ||||
| 
 | ||||
| #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
| lazy_static::lazy_static! { | ||||
|     pub static ref SENDER : Mutex<mpsc::UnboundedSender<ipc::Data>> = Mutex::new(check_connect_status(true)); | ||||
| } | ||||
| 
 | ||||
| pub fn recent_sessions_updated() -> bool { | ||||
|     let mut childs = CHILDS.lock().unwrap(); | ||||
|     if childs.0 { | ||||
| @ -47,7 +51,10 @@ pub fn recent_sessions_updated() -> bool { | ||||
| } | ||||
| 
 | ||||
| pub fn get_id() -> String { | ||||
|     ipc::get_id() | ||||
|     #[cfg(any(target_os = "android", target_os = "ios"))] | ||||
|     return Config::get_id(); | ||||
|     #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
|     return ipc::get_id(); | ||||
| } | ||||
| 
 | ||||
| pub fn get_remote_id() -> String { | ||||
| @ -132,7 +139,7 @@ pub fn get_license() -> String { | ||||
| 
 | ||||
| pub fn get_option(key: String) -> String { | ||||
|     #[cfg(any(target_os = "android", target_os = "ios"))] | ||||
|     return Config::get_option(arg); | ||||
|     return Config::get_option(&key); | ||||
|     #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
|     return get_option_(&key); | ||||
| } | ||||
| @ -243,13 +250,16 @@ pub fn get_sound_inputs() -> Vec<String> { | ||||
| } | ||||
| 
 | ||||
| pub fn set_options(m: HashMap<String, String>) { | ||||
|     #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
|     { | ||||
|         *OPTIONS.lock().unwrap() = m.clone(); | ||||
|         ipc::set_options(m).ok(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| pub fn set_option(key: String, value: String) { | ||||
|     #[cfg(any(target_os = "android", target_os = "ios"))] | ||||
|     Config::set_option(name.to_owned(), value.to_owned()); | ||||
|     Config::set_option(key, value); | ||||
|     #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
|     { | ||||
|         let mut options = OPTIONS.lock().unwrap(); | ||||
| @ -277,6 +287,10 @@ pub fn install_path() -> String { | ||||
| } | ||||
| 
 | ||||
| pub fn get_socks() -> Vec<String> { | ||||
|     #[cfg(any(target_os = "android", target_os = "ios"))] | ||||
|     return Vec::new(); | ||||
|     #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
|     { | ||||
|         let s = ipc::get_socks(); | ||||
|         match s { | ||||
|             None => Vec::new(), | ||||
| @ -289,8 +303,10 @@ pub fn get_socks() -> Vec<String> { | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| pub fn set_socks(proxy: String, username: String, password: String) { | ||||
|     #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
|     ipc::set_socks(config::Socks5Server { | ||||
|         proxy, | ||||
|         username, | ||||
| @ -357,6 +373,7 @@ pub fn get_mouse_time() -> f64 { | ||||
|     return res; | ||||
| } | ||||
| 
 | ||||
| #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||
| pub fn check_mouse_time() { | ||||
|     let sender = SENDER.lock().unwrap(); | ||||
|     allow_err!(sender.send(ipc::Data::MouseMoveTime(0))); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user