refactor: rename AccountsManager to Accounts

plz stop with the managers
This commit is contained in:
William Casarin
2024-11-18 18:03:27 -08:00
parent 6545e1ddee
commit 22e67c95cc
11 changed files with 59 additions and 53 deletions

View File

@@ -1,7 +1,7 @@
use crate::colors::PINK;
use crate::imgcache::ImageCache;
use crate::{
account_manager::AccountManager,
accounts::Accounts,
route::{Route, Router},
ui::{Preview, PreviewConfig, View},
Damus,
@@ -13,7 +13,7 @@ use super::profile::preview::SimpleProfilePreview;
pub struct AccountsView<'a> {
ndb: &'a Ndb,
accounts: &'a AccountManager,
accounts: &'a Accounts,
img_cache: &'a mut ImageCache,
}
@@ -31,7 +31,7 @@ enum ProfilePreviewOp {
}
impl<'a> AccountsView<'a> {
pub fn new(ndb: &'a Ndb, accounts: &'a AccountManager, img_cache: &'a mut ImageCache) -> Self {
pub fn new(ndb: &'a Ndb, accounts: &'a Accounts, img_cache: &'a mut ImageCache) -> Self {
AccountsView {
ndb,
accounts,
@@ -56,7 +56,7 @@ impl<'a> AccountsView<'a> {
fn show_accounts(
ui: &mut Ui,
account_manager: &AccountManager,
accounts: &Accounts,
ndb: &Ndb,
img_cache: &mut ImageCache,
) -> Option<AccountsViewResponse> {
@@ -71,8 +71,8 @@ impl<'a> AccountsView<'a> {
return;
};
for i in 0..account_manager.num_accounts() {
let account_pubkey = account_manager
for i in 0..accounts.num_accounts() {
let account_pubkey = accounts
.get_account(i)
.map(|account| account.pubkey.bytes());
@@ -83,12 +83,12 @@ impl<'a> AccountsView<'a> {
};
let profile = ndb.get_profile_by_pubkey(&txn, account_pubkey).ok();
let is_selected =
if let Some(selected) = account_manager.get_selected_account_index() {
i == selected
} else {
false
};
let is_selected = if let Some(selected) = accounts.get_selected_account_index()
{
i == selected
} else {
false
};
let profile_peview_view = {
let width = ui.available_width();
@@ -217,7 +217,7 @@ fn selected_widget() -> impl egui::Widget {
mod preview {
use super::*;
use crate::{account_manager::process_accounts_view_response, test_data};
use crate::{accounts::process_accounts_view_response, test_data};
pub struct AccountsPreview {
app: Damus,

View File

@@ -1,5 +1,5 @@
pub mod account_login_view;
pub mod account_management;
pub mod accounts;
pub mod add_column;
pub mod anim;
pub mod mention;
@@ -13,7 +13,7 @@ pub mod thread;
pub mod timeline;
pub mod username;
pub use account_management::AccountsView;
pub use accounts::AccountsView;
pub use mention::Mention;
pub use note::{NoteResponse, NoteView, PostReplyView, PostView};
pub use preview::{Preview, PreviewApp, PreviewConfig};

View File

@@ -2,7 +2,7 @@ use egui::{vec2, Color32, InnerResponse, Layout, Margin, Separator, Stroke, Widg
use tracing::info;
use crate::{
account_manager::AccountsRoute,
accounts::AccountsRoute,
colors,
column::{Column, Columns},
imgcache::ImageCache,