Skip to content

Commit 357d77b

Browse files
committed
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.
1 parent 0ba2574 commit 357d77b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

crates/matrix-sdk-ui/src/timeline/controller/metadata.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ use tracing::trace;
2020

2121
use super::{
2222
super::{
23-
reactions::Reactions, rfind_event_by_id, TimelineItem, TimelineItemKind, TimelineUniqueId,
23+
reactions::Reactions, rfind_event_by_id, subscriber::skip::SkipCount, TimelineItem,
24+
TimelineItemKind, TimelineUniqueId,
2425
},
2526
read_receipts::ReadReceipts,
2627
state::PendingPollEvents,
@@ -37,6 +38,8 @@ pub(in crate::timeline) struct TimelineMetadata {
3738
/// This value is constant over the lifetime of the metadata.
3839
internal_id_prefix: Option<String>,
3940

41+
pub(super) subscriber_skip_count: SkipCount,
42+
4043
/// The hook to call whenever we run into a unable-to-decrypt event.
4144
///
4245
/// This value is constant over the lifetime of the metadata.
@@ -107,6 +110,7 @@ impl TimelineMetadata {
107110
is_room_encrypted: Option<bool>,
108111
) -> Self {
109112
Self {
113+
subscriber_skip_count: SkipCount::new(),
110114
own_user_id,
111115
next_internal_id: Default::default(),
112116
reactions: Default::default(),

crates/matrix-sdk-ui/src/timeline/subscriber.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub mod skip {
5656

5757
const MAXIMUM_NUMBER_OF_INITIAL_ITEMS: usize = 20;
5858

59-
#[derive(Clone)]
59+
#[derive(Clone, Debug)]
6060
pub struct SkipCount {
6161
count: SharedObservable<usize>,
6262
}

0 commit comments

Comments
 (0)