Merge pull request #4120 from fufesou/fix/build_android_ios

fix build
This commit is contained in:
RustDesk 2023-04-20 13:57:42 +08:00 committed by GitHub
commit edec424153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 11 deletions

View File

@ -165,6 +165,7 @@ impl OboePlayer {
}
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
fn is_null(&self) -> bool {
self.raw.is_null()
}

View File

@ -1,6 +1,3 @@
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::client::get_key_state;
use crate::common::GrabState;
#[cfg(feature = "flutter")]
use crate::flutter::{CUR_SESSION_ID, SESSIONS};
#[cfg(target_os = "windows")]
@ -8,6 +5,8 @@ use crate::platform::windows::{get_char_from_vk, get_unicode_from_vk};
#[cfg(not(any(feature = "flutter", feature = "cli")))]
use crate::ui::CUR_SESSION;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::{client::get_key_state, common::GrabState};
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use hbb_common::log;
use hbb_common::message_proto::*;
#[cfg(any(target_os = "windows", target_os = "macos"))]
@ -15,10 +14,11 @@ use rdev::KeyCode;
use rdev::{Event, EventType, Key};
#[cfg(any(target_os = "windows", target_os = "macos"))]
use std::sync::atomic::{AtomicBool, Ordering};
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use std::time::SystemTime;
use std::{
collections::{HashMap, HashSet},
sync::{Arc, Mutex},
time::SystemTime,
};
#[cfg(windows)]
@ -73,6 +73,7 @@ pub mod client {
super::start_grab_loop();
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn change_grab_status(state: GrabState) {
match state {
GrabState::Ready => {}
@ -320,6 +321,7 @@ pub fn is_long_press(event: &Event) -> bool {
return false;
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn release_remote_keys() {
// todo!: client quit suddenly, how to release keys?
let to_release = TO_RELEASE.lock().unwrap().clone();
@ -565,6 +567,7 @@ pub fn event_to_key_events(
key_events
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn event_type_to_event(event_type: EventType) -> Event {
Event {
event_type,

View File

@ -1,12 +1,14 @@
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use std::collections::HashMap;
use std::ops::{Deref, DerefMut};
use std::str::FromStr;
use std::sync::{
atomic::{AtomicBool, AtomicUsize, Ordering},
Arc, Mutex, RwLock,
use std::{collections::HashMap, sync::atomic::AtomicBool};
use std::{
ops::{Deref, DerefMut},
str::FromStr,
sync::{
atomic::{AtomicUsize, Ordering},
Arc, Mutex, RwLock,
},
time::{Duration, SystemTime},
};
use std::time::{Duration, SystemTime};
use async_trait::async_trait;
use bytes::Bytes;
@ -27,10 +29,12 @@ use crate::client::{
input_os_password, load_config, send_mouse, start_video_audio_threads, FileManager, Key,
LoginConfigHandler, QualityStatus, KEY_MAP,
};
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::common::GrabState;
use crate::keyboard;
use crate::{client::Data, client::Interface};
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub static IS_IN: AtomicBool = AtomicBool::new(false);
#[derive(Clone, Default)]
@ -55,6 +59,7 @@ pub struct SessionPermissionConfig {
pub server_clipboard_enabled: Arc<RwLock<bool>>,
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
impl SessionPermissionConfig {
pub fn is_text_clipboard_required(&self) -> bool {
*self.server_clipboard_enabled.read().unwrap()
@ -64,6 +69,7 @@ impl SessionPermissionConfig {
}
impl<T: InvokeUiSession> Session<T> {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn get_permission_config(&self) -> SessionPermissionConfig {
SessionPermissionConfig {
lc: self.lc.clone(),
@ -89,6 +95,7 @@ impl<T: InvokeUiSession> Session<T> {
.eq(&ConnType::PORT_FORWARD)
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn is_rdp(&self) -> bool {
self.lc.read().unwrap().conn_type.eq(&ConnType::RDP)
}
@ -162,6 +169,7 @@ impl<T: InvokeUiSession> Session<T> {
self.lc.read().unwrap().is_privacy_mode_supported()
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn is_text_clipboard_required(&self) -> bool {
*self.server_clipboard_enabled.read().unwrap()
&& *self.server_keyboard_enabled.read().unwrap()
@ -488,6 +496,7 @@ impl<T: InvokeUiSession> Session<T> {
self.send(Data::Message(msg_out));
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn enter(&self) {
#[cfg(target_os = "windows")]
{
@ -502,6 +511,7 @@ impl<T: InvokeUiSession> Session<T> {
keyboard::client::change_grab_status(GrabState::Run);
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn leave(&self) {
#[cfg(target_os = "windows")]
{