From 6e69407224c75ff94a45db5b9e5346838c17e6df Mon Sep 17 00:00:00 2001 From: William Casarin Date: Fri, 31 May 2024 01:08:45 -0500 Subject: [PATCH] cleanups --- src/app.rs | 6 +++--- src/lib.rs | 1 - src/relay_generation.rs | 27 --------------------------- src/route.rs | 4 +++- src/ui/account_switcher.rs | 16 ++++++++-------- 5 files changed, 14 insertions(+), 40 deletions(-) delete mode 100644 src/relay_generation.rs diff --git a/src/app.rs b/src/app.rs index 951cfb99..5e7804eb 100644 --- a/src/app.rs +++ b/src/app.rs @@ -42,7 +42,7 @@ pub struct Damus { is_mobile: bool, /// global navigation for account management popups, etc. - nav: Vec, + _nav: Vec, pub textmode: bool, pub timelines: Vec, @@ -651,7 +651,7 @@ impl Damus { img_cache: ImageCache::new(imgcache_dir), note_cache: NoteCache::default(), selected_timeline: 0, - nav: Vec::with_capacity(6), + _nav: Vec::with_capacity(6), timelines, textmode: false, ndb: Ndb::new(data_path.as_ref().to_str().expect("db path ok"), &config).expect("ndb"), @@ -684,7 +684,7 @@ impl Damus { note_cache: NoteCache::default(), selected_timeline: 0, timelines, - nav: vec![], + _nav: vec![], textmode: false, ndb: Ndb::new(data_path.as_ref().to_str().expect("db path ok"), &config).expect("ndb"), account_manager: AccountManager::new(None, crate::key_storage::KeyStorage::None), diff --git a/src/lib.rs b/src/lib.rs index f10c945e..46d01506 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,7 +19,6 @@ pub mod login_manager; mod macos_key_storage; mod notecache; mod profile; -mod relay_generation; pub mod relay_pool_manager; mod result; mod route; diff --git a/src/relay_generation.rs b/src/relay_generation.rs deleted file mode 100644 index 7308abe2..00000000 --- a/src/relay_generation.rs +++ /dev/null @@ -1,27 +0,0 @@ -use enostr::RelayPool; -use tracing::error; - -fn test_relay_pool(wakeup: impl Fn() + Send + Sync + Clone + 'static) -> RelayPool { - let mut pool = RelayPool::new(); - - if let Err(e) = pool.add_url("ws://localhost:8080".to_string(), wakeup.clone()) { - error!("{:?}", e) - } - if let Err(e) = pool.add_url("wss://relay.damus.io".to_string(), wakeup.clone()) { - error!("{:?}", e) - } - if let Err(e) = pool.add_url("wss://pyramid.fiatjaf.com".to_string(), wakeup.clone()) { - error!("{:?}", e) - } - if let Err(e) = pool.add_url("wss://nos.lol".to_string(), wakeup.clone()) { - error!("{:?}", e) - } - if let Err(e) = pool.add_url("wss://nostr.wine".to_string(), wakeup.clone()) { - error!("{:?}", e) - } - if let Err(e) = pool.add_url("wss://purplepag.es".to_string(), wakeup) { - error!("{:?}", e) - } - - pool -} diff --git a/src/route.rs b/src/route.rs index 35006f65..d48f342d 100644 --- a/src/route.rs +++ b/src/route.rs @@ -1,7 +1,9 @@ -use nostrdb::NoteKey; +//use nostrdb::NoteKey; /// App routing. These describe different places you can go inside Notedeck. pub enum Route { + /* ManageAccount, Thread(NoteKey), + */ } diff --git a/src/ui/account_switcher.rs b/src/ui/account_switcher.rs index fba50311..680111e1 100644 --- a/src/ui/account_switcher.rs +++ b/src/ui/account_switcher.rs @@ -18,8 +18,8 @@ pub struct AccountSelectionWidget<'a> { } enum AccountSelectAction { - RemoveAccount { index: usize }, - SelectAccount { index: usize }, + RemoveAccount { _index: usize }, + SelectAccount { _index: usize }, OpenAccountManagement, } @@ -57,19 +57,19 @@ impl<'a> AccountSelectionWidget<'a> { res = top_section_widget(ui); scroll_area().show(ui, |ui| { - if let Some(index) = self.show_accounts(ui) { - selected_index = Some(index); - res.action = Some(AccountSelectAction::SelectAccount { index }); + if let Some(_index) = self.show_accounts(ui) { + selected_index = Some(_index); + res.action = Some(AccountSelectAction::SelectAccount { _index }); } }); ui.add_space(8.0); ui.add(add_account_button()); - if let Some(index) = selected_index { - if let Some(account) = self.account_manager.get_account(index) { + if let Some(_index) = selected_index { + if let Some(account) = self.account_manager.get_account(_index) { ui.add_space(8.0); if self.handle_sign_out(ui, account) { - res.action = Some(AccountSelectAction::RemoveAccount { index }) + res.action = Some(AccountSelectAction::RemoveAccount { _index }) } } }