mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 11:43:43 +00:00
Move GLOBALS accessors into Globals impl
This commit is contained in:
parent
91b0c5bd6f
commit
2be8b12ffd
@ -69,6 +69,7 @@ lazy_static! {
|
||||
};
|
||||
}
|
||||
|
||||
impl Globals {
|
||||
#[allow(dead_code)]
|
||||
pub async fn get_feed(threaded: bool) -> Vec<Id> {
|
||||
let feed: Vec<FeedEvent> = GLOBALS
|
||||
@ -88,7 +89,7 @@ pub async fn get_feed(threaded: bool) -> Vec<Id> {
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
sort_feed(feed, threaded)
|
||||
Self::sort_feed(feed, threaded)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@ -109,7 +110,7 @@ pub fn blocking_get_feed(threaded: bool) -> Vec<Id> {
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
sort_feed(feed, threaded)
|
||||
Self::sort_feed(feed, threaded)
|
||||
}
|
||||
|
||||
fn sort_feed(mut feed: Vec<FeedEvent>, threaded: bool) -> Vec<Id> {
|
||||
@ -135,6 +136,7 @@ fn sort_feed(mut feed: Vec<FeedEvent>, threaded: bool) -> Vec<Id> {
|
||||
|
||||
feed.iter().map(|e| e.id).collect()
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn add_event(event: &Event) -> Result<(), Error> {
|
||||
// Insert the event
|
||||
|
@ -1,11 +1,12 @@
|
||||
use super::GossipUi;
|
||||
use crate::globals::Globals;
|
||||
use eframe::egui;
|
||||
use egui::{Align, Color32, Context, Layout, RichText, ScrollArea, TextStyle, Ui, Vec2};
|
||||
use nostr_types::{EventKind, Id, PublicKey};
|
||||
use tracing::info;
|
||||
|
||||
pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Frame, ui: &mut Ui) {
|
||||
let feed = crate::globals::blocking_get_feed(true);
|
||||
let feed = Globals::blocking_get_feed(true);
|
||||
|
||||
//let screen_rect = ctx.input().screen_rect; // Rect
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user