mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-12 10:00:50 -04:00
task(ui): Add TimelineMetadata::subscriber_skip_count.
This patch adds the `subscriber_skip_count` field to `TimelineMetadata`. It's going to be used to define the `count` value of the `Skip` higher-order stream that is going to be applied to the `Timeline` subscriber.
This commit is contained in:
@@ -20,7 +20,8 @@ use tracing::trace;
|
||||
|
||||
use super::{
|
||||
super::{
|
||||
reactions::Reactions, rfind_event_by_id, TimelineItem, TimelineItemKind, TimelineUniqueId,
|
||||
reactions::Reactions, rfind_event_by_id, subscriber::skip::SkipCount, TimelineItem,
|
||||
TimelineItemKind, TimelineUniqueId,
|
||||
},
|
||||
read_receipts::ReadReceipts,
|
||||
state::PendingPollEvents,
|
||||
@@ -37,6 +38,8 @@ pub(in crate::timeline) struct TimelineMetadata {
|
||||
/// This value is constant over the lifetime of the metadata.
|
||||
internal_id_prefix: Option<String>,
|
||||
|
||||
pub(super) subscriber_skip_count: SkipCount,
|
||||
|
||||
/// The hook to call whenever we run into a unable-to-decrypt event.
|
||||
///
|
||||
/// This value is constant over the lifetime of the metadata.
|
||||
@@ -107,6 +110,7 @@ impl TimelineMetadata {
|
||||
is_room_encrypted: Option<bool>,
|
||||
) -> Self {
|
||||
Self {
|
||||
subscriber_skip_count: SkipCount::new(),
|
||||
own_user_id,
|
||||
next_internal_id: Default::default(),
|
||||
reactions: Default::default(),
|
||||
|
||||
@@ -59,7 +59,7 @@ pub mod skip {
|
||||
|
||||
const MAXIMUM_NUMBER_OF_INITIAL_ITEMS: usize = 20;
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SkipCount {
|
||||
count: SharedObservable<usize>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user