feat: implement dialog callback

This commit is contained in:
Kingtous
2023-05-08 12:34:19 +08:00
Unverified
parent 19f81ad317
commit 77fa807b57
55 changed files with 734 additions and 554 deletions

View File

@@ -751,6 +751,25 @@ pub fn main_load_recent_peers() {
}
}
pub fn main_load_recent_peers_sync() -> SyncReturn<String> {
if !config::APP_DIR.read().unwrap().is_empty() {
let peers: Vec<HashMap<&str, String>> = PeerConfig::peers()
.drain(..)
.map(|(id, _, p)| peer_to_map(id, p))
.collect();
let data = HashMap::from([
("name", "load_recent_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_fav_peers() {
if !config::APP_DIR.read().unwrap().is_empty() {
let favs = get_fav();

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", "指纹"),
("Copy Fingerprint", "复制指纹"),
("no fingerprints", "没有指纹"),
("Select a peer", "选择一个被控端"),
("Select peers", "选择被控端")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", "Fingerabdruck"),
("Copy Fingerprint", "Fingerabdruck kopieren"),
("no fingerprints", "Keine Fingerabdrücke"),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", "Huella digital"),
("Copy Fingerprint", "Copiar huella digital"),
("no fingerprints", "sin huellas digitales"),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", "اثر انگشت"),
("Copy Fingerprint", "کپی کردن اثر انگشت"),
("no fingerprints", "بدون اثر انگشت"),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", "Firma digitale"),
("Copy Fingerprint", "Copia firma digitale"),
("no fingerprints", "Nessuna firma digitale"),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

File diff suppressed because it is too large Load Diff

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", "Vingerafdruk"),
("Copy Fingerprint", "Kopieer Vingerafdruk"),
("no fingerprints", "geen vingerafdrukken"),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", "Sygnatura"),
("Copy Fingerprint", "Skopiuj sygnaturę"),
("no fingerprints", "brak sygnatur"),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", "Отпечаток"),
("Copy Fingerprint", "Копировать отпечаток"),
("no fingerprints", "отпечатки отсутствуют"),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", "指紋"),
("Copy Fingerprint", "複製指紋"),
("no fingerprints", "沒有指紋"),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}

View File

@@ -498,5 +498,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Fingerprint", ""),
("Copy Fingerprint", ""),
("no fingerprints", ""),
("Select a peer", ""),
("Select peers", "")
].iter().cloned().collect();
}