wip: refactor

This commit is contained in:
2024-12-13 10:11:12 +07:00
parent 10f042acab
commit f82eaa4ac3
20 changed files with 431 additions and 231 deletions

View File

@@ -0,0 +1,28 @@
use gpui::*;
use nostr_sdk::prelude::*;
pub struct SignalRegistry {
public_keys: Vec<PublicKey>,
}
impl Global for SignalRegistry {}
impl SignalRegistry {
pub fn set_global(cx: &mut AppContext) {
cx.set_global(Self::new());
}
pub fn contains(&self, public_key: PublicKey) -> bool {
self.public_keys.contains(&public_key)
}
pub fn push(&mut self, public_key: PublicKey) {
self.public_keys.push(public_key);
}
fn new() -> Self {
Self {
public_keys: Vec::new(),
}
}
}