load keys on init

This commit is contained in:
Jack Chakany 2024-08-22 12:20:13 -04:00
parent 0d4cdf851e
commit 695979aaaa
2 changed files with 13 additions and 5 deletions

View file

@ -21,6 +21,14 @@ impl std::fmt::Debug for Error {
}
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::IOError(err) => write!(f, "IO error: {}", err),
}
}
}
pub enum KeyStorageType {
None,
#[cfg(target_os = "linux")]

View file

@ -98,6 +98,10 @@ fn update_app(app: &mut Hoot, ctx: &egui::Context) {
let wake_up = move || {
ctx.request_repaint();
};
match app.account_manager.load_keys() {
Ok(..) => {},
Err(v) => error!("something went wrong trying to load keys: {}", v),
}
app.relays
.add_url("wss://relay.damus.io".to_string(), wake_up.clone());
app.relays
@ -273,16 +277,12 @@ fn render_app(app: &mut Hoot, ctx: &egui::Context) {
});
});
} else if app.page == Page::Settings {
ui.label("Settings");
ui.heading("Settings");
ui.label(format!(
"Connected Relays: {}",
&app.relays.get_number_of_relays()
));
if ui.button("fetch keys").clicked() {
let _ = app.account_manager.load_keys();
}
ui.vertical(|ui| {
use nostr::ToBech32;
for key in app.account_manager.loaded_keys.clone() {