From 05c789ae5076484b11aad6dac26e68bff3926720 Mon Sep 17 00:00:00 2001 From: Sahil Yeole <sahilyeole93@gmail.com> Date: Wed, 18 Oct 2023 16:00:50 +0530 Subject: [PATCH] remove fav peers from search Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com> --- .../lib/desktop/pages/connection_page.dart | 2 - src/flutter_ffi.rs | 47 ------------------- 2 files changed, 49 deletions(-) diff --git a/flutter/lib/desktop/pages/connection_page.dart b/flutter/lib/desktop/pages/connection_page.dart index a19a70c99..40cb4100f 100644 --- a/flutter/lib/desktop/pages/connection_page.dart +++ b/flutter/lib/desktop/pages/connection_page.dart @@ -160,7 +160,6 @@ class _ConnectionPageState extends State<ConnectionPage> Future<void> _getAllPeers() async { Map<String, dynamic> recentPeers = jsonDecode(await bind.mainLoadRecentPeersSync()); - Map<String, dynamic> favPeers = jsonDecode(await bind.mainLoadFavPeersSync()); Map<String, dynamic> lanPeers = jsonDecode(await bind.mainLoadLanPeersSync()); Map<String, dynamic> abPeers = jsonDecode(await bind.mainLoadAbSync()); Map<String, dynamic> groupPeers = jsonDecode(await bind.mainLoadGroupSync()); @@ -194,7 +193,6 @@ class _ConnectionPageState extends State<ConnectionPage> } mergePeers(recentPeers); - mergePeers(favPeers); mergePeers(lanPeers); mergePeers(abPeers); mergePeers(groupPeers); diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index 2a714d949..4636bca08 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -886,53 +886,6 @@ pub fn main_load_recent_peers_sync() -> SyncReturn<String> { SyncReturn("".to_string()) } -pub fn main_load_fav_peers_sync() -> SyncReturn<String> { - if !config::APP_DIR.read().unwrap().is_empty() { - let favs = get_fav(); - let mut recent = PeerConfig::peers(None); - let mut lan = config::LanPeers::load() - .peers - .iter() - .filter(|d| recent.iter().all(|r| r.0 != d.id)) - .map(|d| { - ( - d.id.clone(), - SystemTime::UNIX_EPOCH, - PeerConfig { - info: PeerInfoSerde { - username: d.username.clone(), - hostname: d.hostname.clone(), - platform: d.platform.clone(), - }, - ..Default::default() - }, - ) - }) - .collect(); - recent.append(&mut lan); - let peers: Vec<HashMap<&str, String>> = recent - .into_iter() - .filter_map(|(id, _, p)| { - if favs.contains(&id) { - Some(peer_to_map(id, p)) - } else { - None - } - }) - .collect(); - - let data = HashMap::from([ - ("name", "load_fav_peers".to_owned()), - ( - "peers", - serde_json::ser::to_string(&peers).unwrap_or("".to_owned()), - ), - ]); - return SyncReturn(serde_json::ser::to_string(&data).unwrap_or("".to_owned())); - } - SyncReturn("".to_string()) -} - pub fn main_load_lan_peers_sync() -> SyncReturn<String> { let data = HashMap::from([ ("name", "load_lan_peers".to_owned()),