Skip to content

Commit

Permalink
chore(ui): move RelativePosition in timeline/controller
Browse files Browse the repository at this point in the history
  • Loading branch information
bnjbvr committed Jan 9, 2025
1 parent f853e75 commit 17c6bb2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
13 changes: 12 additions & 1 deletion crates/matrix-sdk-ui/src/timeline/controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ use super::{
event_item::{ReactionStatus, RemoteEventOrigin},
item::TimelineUniqueId,
traits::{Decryptor, RoomDataProvider},
util::{rfind_event_by_id, rfind_event_item, RelativePosition},
util::{rfind_event_by_id, rfind_event_item},
DateDividerMode, Error, EventSendState, EventTimelineItem, InReplyToDetails, Message,
PaginationError, Profile, ReactionInfo, RepliedToEvent, TimelineDetails, TimelineEventItemId,
TimelineFocus, TimelineItem, TimelineItemContent, TimelineItemKind,
Expand Down Expand Up @@ -1649,3 +1649,14 @@ async fn fetch_replied_to_event(
};
Ok(res)
}

/// Result of comparing events position in the timeline.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(in crate::timeline) enum RelativePosition {
/// Event B is after (more recent than) event A.
After,
/// They are the same event.
Same,
/// Event B is before (older than) event A.
Before,
}
4 changes: 2 additions & 2 deletions crates/matrix-sdk-ui/src/timeline/controller/read_receipts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ use tracing::{debug, error, warn};

use super::{
rfind_event_by_id, AllRemoteEvents, FullEventMeta, ObservableItemsTransaction,
RoomDataProvider, TimelineMetadata, TimelineState,
RelativePosition, RoomDataProvider, TimelineMetadata, TimelineState,
};
use crate::timeline::{controller::TimelineStateTransaction, util::RelativePosition, TimelineItem};
use crate::timeline::{controller::TimelineStateTransaction, TimelineItem};

/// In-memory caches for read receipts.
#[derive(Clone, Debug, Default)]
Expand Down
6 changes: 3 additions & 3 deletions crates/matrix-sdk-ui/src/timeline/controller/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use super::{
ObservableItemsTransactionEntry,
},
read_receipts::ReadReceipts,
DateDividerMode, HandleManyEventsResult, TimelineFocusKind, TimelineSettings,
DateDividerMode, HandleManyEventsResult, RelativePosition, TimelineFocusKind, TimelineSettings,
};
use crate::{
events::SyncTimelineEventWithoutContent,
Expand All @@ -64,7 +64,7 @@ use crate::{
item::TimelineUniqueId,
reactions::Reactions,
traits::RoomDataProvider,
util::{rfind_event_by_id, RelativePosition},
util::rfind_event_by_id,
Profile, TimelineItem, TimelineItemKind,
},
unable_to_decrypt_hook::UtdHookManager,
Expand Down Expand Up @@ -1110,7 +1110,7 @@ impl TimelineMetadata {
/// known.
///
/// Returns `None` if none of the two events could be found in the timeline.
pub fn compare_events_positions(
pub(in crate::timeline) fn compare_events_positions(
&self,
event_a: &EventId,
event_b: &EventId,
Expand Down
11 changes: 0 additions & 11 deletions crates/matrix-sdk-ui/src/timeline/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,3 @@ pub(super) fn rfind_event_by_item_id<'a>(
TimelineEventItemId::EventId(event_id) => rfind_event_by_id(items, event_id),
}
}

/// Result of comparing events position in the timeline.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(super) enum RelativePosition {
/// Event B is after (more recent than) event A.
After,
/// They are the same event.
Same,
/// Event B is before (older than) event A.
Before,
}

0 comments on commit 17c6bb2

Please sign in to comment.