mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
flutter_desktop: fix peer page bugs
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -1278,11 +1278,11 @@ impl LoginConfigHandler {
|
||||
///
|
||||
/// * `username` - The name of the peer.
|
||||
/// * `pi` - The peer info.
|
||||
pub fn handle_peer_info(&mut self, pi: PeerInfo) {
|
||||
pub fn handle_peer_info(&mut self, pi: &PeerInfo) {
|
||||
if !pi.version.is_empty() {
|
||||
self.version = hbb_common::get_version_number(&pi.version);
|
||||
}
|
||||
self.features = pi.features.into_option();
|
||||
self.features = pi.features.clone().into_option();
|
||||
let serde = PeerInfoSerde {
|
||||
username: pi.username.clone(),
|
||||
hostname: pi.hostname.clone(),
|
||||
|
||||
@@ -205,8 +205,8 @@ pub fn session_get_custom_image_quality(id: String) -> Option<Vec<i32>> {
|
||||
}
|
||||
|
||||
pub fn session_set_custom_image_quality(id: String, value: i32) {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
|
||||
session.set_custom_image_quality(value);
|
||||
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
|
||||
session.save_custom_image_quality(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,11 @@ impl<T: InvokeUi> Session<T> {
|
||||
self.lc.read().unwrap().image_quality.clone()
|
||||
}
|
||||
|
||||
/// Get custom image quality.
|
||||
pub fn get_custom_image_quality(&self) -> Vec<i32> {
|
||||
self.lc.read().unwrap().custom_image_quality.clone()
|
||||
}
|
||||
|
||||
pub fn save_view_style(&mut self, value: String) {
|
||||
self.lc.write().unwrap().save_view_style(value);
|
||||
}
|
||||
@@ -634,7 +639,7 @@ impl<T: InvokeUi> Interface for Session<T> {
|
||||
}
|
||||
} else if !self.is_port_forward() {
|
||||
if pi.displays.is_empty() {
|
||||
self.lc.write().unwrap().handle_peer_info(pi);
|
||||
self.lc.write().unwrap().handle_peer_info(&pi);
|
||||
self.update_privacy_mode();
|
||||
self.msgbox("error", "Remote Error", "No Display");
|
||||
return;
|
||||
@@ -647,9 +652,9 @@ impl<T: InvokeUi> Interface for Session<T> {
|
||||
self.set_display(current.x, current.y, current.width, current.height);
|
||||
}
|
||||
self.update_privacy_mode();
|
||||
// Save recent peers, then push event to flutter. So flutter can refresh peer page.
|
||||
self.lc.write().unwrap().handle_peer_info(&pi);
|
||||
self.set_peer_info(&pi);
|
||||
self.lc.write().unwrap().handle_peer_info(pi);
|
||||
|
||||
if self.is_file_transfer() {
|
||||
self.close_success();
|
||||
} else if !self.is_port_forward() {
|
||||
|
||||
Reference in New Issue
Block a user