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:
Ivan Enderlin
2025-01-29 11:31:04 +01:00
parent 1d52073b45
commit e07212d356
2 changed files with 6 additions and 2 deletions

View File

@@ -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(),

View File

@@ -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>,
}