decouple RelayView UI from state mutation
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -315,25 +315,21 @@ impl Accounts {
|
||||
self.cache.get(pubkey).and_then(|r| r.key.to_full())
|
||||
}
|
||||
|
||||
pub fn add_advertised_relay(&mut self, relay_to_add: &str, pool: &mut RelayPool) {
|
||||
pub fn process_relay_action(
|
||||
&mut self,
|
||||
ctx: &egui::Context,
|
||||
pool: &mut RelayPool,
|
||||
action: RelayAction,
|
||||
) {
|
||||
let acc = self.cache.selected_mut();
|
||||
modify_advertised_relays(
|
||||
&acc.key,
|
||||
RelayAction::Add(relay_to_add.to_owned()),
|
||||
pool,
|
||||
&self.relay_defaults,
|
||||
&mut acc.data,
|
||||
);
|
||||
}
|
||||
modify_advertised_relays(&acc.key, action, pool, &self.relay_defaults, &mut acc.data);
|
||||
|
||||
pub fn remove_advertised_relay(&mut self, relay_to_remove: &str, pool: &mut RelayPool) {
|
||||
let acc = self.cache.selected_mut();
|
||||
modify_advertised_relays(
|
||||
&acc.key,
|
||||
RelayAction::Remove(relay_to_remove.to_owned()),
|
||||
update_relay_configuration(
|
||||
pool,
|
||||
&self.relay_defaults,
|
||||
&mut acc.data,
|
||||
&acc.key.pubkey,
|
||||
&acc.data,
|
||||
create_wakeup(ctx),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ mod wallet;
|
||||
mod zaps;
|
||||
|
||||
pub use account::accounts::{AccountData, Accounts};
|
||||
pub use account::relay::RelayAction;
|
||||
pub use account::FALLBACK_PUBKEY;
|
||||
pub use app::{App, AppAction, Notedeck};
|
||||
pub use args::Args;
|
||||
|
||||
Reference in New Issue
Block a user