refact, split window, debug

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow 2023-08-06 10:56:57 +08:00
parent e2228cc448
commit 2692c29519
2 changed files with 16 additions and 1 deletions

View File

@ -125,7 +125,18 @@ impl<T: InvokeUiSession> Remote<T> {
.await .await
{ {
Ok((mut peer, direct, pk)) => { Ok((mut peer, direct, pk)) => {
self.handler.set_connection_type(peer.is_secured(), direct); // flutter -> connection_ready let is_secured = peer.is_secured();
#[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
{
self.handler
.cache_flutter
.write()
.unwrap()
.is_secured_direct
.replace((is_secured, direct));
}
self.handler.set_connection_type(is_secured, direct); // flutter -> connection_ready
self.handler.update_direct(Some(direct)); self.handler.update_direct(Some(direct));
if conn_type == ConnType::DEFAULT_CONN { if conn_type == ConnType::DEFAULT_CONN {
self.handler self.handler

View File

@ -56,6 +56,7 @@ pub struct CacheFlutter {
pub sp: Option<SwitchDisplay>, pub sp: Option<SwitchDisplay>,
pub cursor_data: HashMap<u64, CursorData>, pub cursor_data: HashMap<u64, CursorData>,
pub cursor_id: u64, pub cursor_id: u64,
pub is_secured_direct: Option<(bool, bool)>,
} }
#[derive(Clone, Default)] #[derive(Clone, Default)]
@ -1198,6 +1199,9 @@ impl<T: InvokeUiSession> Session<T> {
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn restore_flutter_cache(&mut self) { pub fn restore_flutter_cache(&mut self) {
if let Some((is_secured, direct)) = self.cache_flutter.read().unwrap().is_secured_direct {
self.set_connection_type(is_secured, direct);
}
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);
if let Some(sp) = self.cache_flutter.read().unwrap().sp.as_ref() { if let Some(sp) = self.cache_flutter.read().unwrap().sp.as_ref() {