Switch to Columns
Also refactor damus app usage to only pass in things that we need in views. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::cmp::Ordering;
|
||||
|
||||
use enostr::Keypair;
|
||||
use enostr::{FilledKeypair, Keypair};
|
||||
|
||||
use crate::key_storage::{KeyStorage, KeyStorageResponse, KeyStorageType};
|
||||
pub use crate::user_account::UserAccount;
|
||||
@@ -88,6 +88,12 @@ impl AccountManager {
|
||||
self.currently_selected_account
|
||||
}
|
||||
|
||||
pub fn selected_or_first_nsec(&self) -> Option<FilledKeypair<'_>> {
|
||||
self.get_selected_account()
|
||||
.and_then(|kp| kp.to_full())
|
||||
.or_else(|| self.accounts.iter().find_map(|a| a.to_full()))
|
||||
}
|
||||
|
||||
pub fn get_selected_account(&self) -> Option<&UserAccount> {
|
||||
if let Some(account_index) = self.currently_selected_account {
|
||||
if let Some(account) = self.get_account(account_index) {
|
||||
|
||||
Reference in New Issue
Block a user