remove fav peers from search
Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
This commit is contained in:
parent
5d95d61aef
commit
05c789ae50
@ -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);
|
||||
|
@ -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()),
|
||||
|
Loading…
Reference in New Issue
Block a user