fix build

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow 2023-08-05 19:20:20 +08:00
parent bf42d66171
commit 5817e48e17
3 changed files with 8 additions and 0 deletions

View File

@ -1009,6 +1009,7 @@ impl<T: InvokeUiSession> Remote<T> {
} }
Some(login_response::Union::PeerInfo(pi)) => { Some(login_response::Union::PeerInfo(pi)) => {
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
{ {
self.handler.cache_flutter.write().unwrap().pi = pi.clone(); self.handler.cache_flutter.write().unwrap().pi = pi.clone();
} }
@ -1060,6 +1061,7 @@ impl<T: InvokeUiSession> Remote<T> {
}, },
Some(message::Union::CursorData(cd)) => { Some(message::Union::CursorData(cd)) => {
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
{ {
let mut lock = self.handler.cache_flutter.write().unwrap(); let mut lock = self.handler.cache_flutter.write().unwrap();
if !lock.cursor_data.contains_key(&cd.id) { if !lock.cursor_data.contains_key(&cd.id) {
@ -1070,6 +1072,7 @@ impl<T: InvokeUiSession> Remote<T> {
} }
Some(message::Union::CursorId(id)) => { Some(message::Union::CursorId(id)) => {
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
{ {
self.handler.cache_flutter.write().unwrap().cursor_id = id; self.handler.cache_flutter.write().unwrap().cursor_id = id;
} }
@ -1290,6 +1293,7 @@ impl<T: InvokeUiSession> Remote<T> {
} }
Some(misc::Union::SwitchDisplay(s)) => { Some(misc::Union::SwitchDisplay(s)) => {
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
{ {
self.handler self.handler
.cache_flutter .cache_flutter

View File

@ -602,6 +602,7 @@ pub fn session_change_resolution(session_id: SessionID, display: i32, width: i32
} }
pub fn session_restore_cache(session_id: SessionID) { pub fn session_restore_cache(session_id: SessionID) {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if let Some(session) = SESSIONS.write().unwrap().get_mut(&session_id) { if let Some(session) = SESSIONS.write().unwrap().get_mut(&session_id) {
session.restore_flutter_cache(); session.restore_flutter_cache();
} }

View File

@ -49,6 +49,7 @@ pub static IS_IN: AtomicBool = AtomicBool::new(false);
const CHANGE_RESOLUTION_VALID_TIMEOUT_SECS: u64 = 15; const CHANGE_RESOLUTION_VALID_TIMEOUT_SECS: u64 = 15;
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
#[derive(Default)] #[derive(Default)]
pub struct CacheFlutter { pub struct CacheFlutter {
pub pi: PeerInfo, pub pi: PeerInfo,
@ -72,6 +73,7 @@ pub struct Session<T: InvokeUiSession> {
pub server_clipboard_enabled: Arc<RwLock<bool>>, pub server_clipboard_enabled: Arc<RwLock<bool>>,
pub last_change_display: Arc<Mutex<ChangeDisplayRecord>>, pub last_change_display: Arc<Mutex<ChangeDisplayRecord>>,
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub cache_flutter: Arc<RwLock<CacheFlutter>>, pub cache_flutter: Arc<RwLock<CacheFlutter>>,
} }
@ -1194,6 +1196,7 @@ impl<T: InvokeUiSession> Session<T> {
} }
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn restore_flutter_cache(&mut self) { pub fn restore_flutter_cache(&mut self) {
let pi = self.cache_flutter.read().unwrap().pi.clone(); let pi = self.cache_flutter.read().unwrap().pi.clone();
self.handle_peer_info(pi); self.handle_peer_info(pi);