Switch to unified timeline cache via TimelineKinds
This is a fairly large rewrite which unifies our threads, timelines and profiles. Now all timelines have a MultiSubscriber, and can be added and removed to columns just like Threads and Profiles. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -1,16 +1,13 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use enostr::{Filter, FullKeypair, Pubkey, PubkeyRef, RelayPool};
|
||||
use nostrdb::{FilterBuilder, Ndb, Note, NoteBuildOptions, NoteBuilder, ProfileRecord};
|
||||
use enostr::{FullKeypair, Pubkey, RelayPool};
|
||||
use nostrdb::{Ndb, Note, NoteBuildOptions, NoteBuilder, ProfileRecord};
|
||||
|
||||
use notedeck::{filter::default_limit, FilterState};
|
||||
use tracing::info;
|
||||
|
||||
use crate::{
|
||||
multi_subscriber::MultiSubscriber,
|
||||
profile_state::ProfileState,
|
||||
route::{Route, Router},
|
||||
timeline::{PubkeySource, Timeline, TimelineKind, TimelineTab},
|
||||
};
|
||||
|
||||
pub struct NostrName<'a> {
|
||||
@@ -75,33 +72,6 @@ pub fn get_display_name<'a>(record: Option<&ProfileRecord<'a>>) -> NostrName<'a>
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Profile {
|
||||
pub timeline: Timeline,
|
||||
pub subscription: Option<MultiSubscriber>,
|
||||
}
|
||||
|
||||
impl Profile {
|
||||
pub fn new(source: PubkeySource, filters: Vec<Filter>) -> Self {
|
||||
let timeline = Timeline::new(
|
||||
TimelineKind::profile(source),
|
||||
FilterState::ready(filters),
|
||||
TimelineTab::full_tabs(),
|
||||
);
|
||||
|
||||
Profile {
|
||||
timeline,
|
||||
subscription: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn filters_raw(pk: PubkeyRef<'_>) -> Vec<FilterBuilder> {
|
||||
vec![Filter::new()
|
||||
.authors([pk.bytes()])
|
||||
.kinds([1])
|
||||
.limit(default_limit())]
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SaveProfileChanges {
|
||||
pub kp: FullKeypair,
|
||||
pub state: ProfileState,
|
||||
|
||||
Reference in New Issue
Block a user