@@ -24,6 +24,8 @@ use bitflags::bitflags;
24
24
use eyeball:: { SharedObservable , Subscriber } ;
25
25
#[ cfg( all( feature = "e2e-encryption" , feature = "experimental-sliding-sync" ) ) ]
26
26
use matrix_sdk_common:: ring_buffer:: RingBuffer ;
27
+ #[ cfg( feature = "experimental-sliding-sync" ) ]
28
+ use ruma:: events:: AnySyncTimelineEvent ;
27
29
use ruma:: {
28
30
api:: client:: sync:: sync_events:: v3:: RoomSummary as RumaSummary ,
29
31
events:: {
@@ -49,8 +51,6 @@ use ruma::{
49
51
EventId , MxcUri , OwnedEventId , OwnedMxcUri , OwnedRoomAliasId , OwnedRoomId , OwnedUserId ,
50
52
RoomAliasId , RoomId , RoomVersionId , UserId ,
51
53
} ;
52
- #[ cfg( feature = "experimental-sliding-sync" ) ]
53
- use ruma:: { events:: AnySyncTimelineEvent , MilliSecondsSinceUnixEpoch } ;
54
54
use serde:: { Deserialize , Serialize } ;
55
55
use tokio:: sync:: broadcast;
56
56
use tracing:: { debug, field:: debug, info, instrument, warn} ;
@@ -91,8 +91,8 @@ bitflags! {
91
91
/// The reason why a [`RoomInfoNotableUpdate`] is emitted.
92
92
#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
93
93
pub struct RoomInfoNotableUpdateReasons : u8 {
94
- /// The recency timestamp of the `Room` has changed.
95
- const RECENCY_TIMESTAMP = 0b0000_0001 ;
94
+ /// The recency stamp of the `Room` has changed.
95
+ const RECENCY_STAMP = 0b0000_0001 ;
96
96
97
97
/// The latest event of the `Room` has changed.
98
98
const LATEST_EVENT = 0b0000_0010 ;
@@ -920,12 +920,12 @@ impl Room {
920
920
self . inner . read ( ) . base_info . is_marked_unread
921
921
}
922
922
923
- /// Returns the recency timestamp of the room.
923
+ /// Returns the recency stamp of the room.
924
924
///
925
- /// Please read `RoomInfo::recency_timestamp ` to learn more.
925
+ /// Please read `RoomInfo::recency_stamp ` to learn more.
926
926
#[ cfg( feature = "experimental-sliding-sync" ) ]
927
- pub fn recency_timestamp ( & self ) -> Option < MilliSecondsSinceUnixEpoch > {
928
- self . inner . read ( ) . recency_timestamp
927
+ pub fn recency_stamp ( & self ) -> Option < u64 > {
928
+ self . inner . read ( ) . recency_stamp
929
929
}
930
930
}
931
931
@@ -986,15 +986,15 @@ pub struct RoomInfo {
986
986
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
987
987
pub ( crate ) cached_display_name : Option < DisplayName > ,
988
988
989
- /// The recency timestamp of this room.
989
+ /// The recency stamp of this room.
990
990
///
991
991
/// It's not to be confused with `origin_server_ts` of the latest event.
992
992
/// Sliding Sync might "ignore” some events when computing the recency
993
- /// timestamp of the room. Thus, using this `recency_timestamp ` value is
993
+ /// stamp of the room. Thus, using this `recency_stamp ` value is
994
994
/// more accurate than relying on the latest event.
995
995
#[ cfg( feature = "experimental-sliding-sync" ) ]
996
996
#[ serde( default ) ]
997
- pub ( crate ) recency_timestamp : Option < MilliSecondsSinceUnixEpoch > ,
997
+ pub ( crate ) recency_stamp : Option < u64 > ,
998
998
}
999
999
1000
1000
#[ derive( Clone , Debug , Serialize , Deserialize , PartialEq , Eq ) ]
@@ -1033,7 +1033,7 @@ impl RoomInfo {
1033
1033
warned_about_unknown_room_version : Arc :: new ( false . into ( ) ) ,
1034
1034
cached_display_name : None ,
1035
1035
#[ cfg( feature = "experimental-sliding-sync" ) ]
1036
- recency_timestamp : None ,
1036
+ recency_stamp : None ,
1037
1037
}
1038
1038
}
1039
1039
@@ -1439,12 +1439,12 @@ impl RoomInfo {
1439
1439
self . latest_event . as_deref ( )
1440
1440
}
1441
1441
1442
- /// Updates the recency timestamp of this room.
1442
+ /// Updates the recency stamp of this room.
1443
1443
///
1444
- /// Please read [`Self::recency_timestamp `] to learn more.
1444
+ /// Please read [`Self::recency_stamp `] to learn more.
1445
1445
#[ cfg( feature = "experimental-sliding-sync" ) ]
1446
- pub ( crate ) fn update_recency_timestamp ( & mut self , timestamp : MilliSecondsSinceUnixEpoch ) {
1447
- self . recency_timestamp = Some ( timestamp ) ;
1446
+ pub ( crate ) fn update_recency_stamp ( & mut self , stamp : u64 ) {
1447
+ self . recency_stamp = Some ( stamp ) ;
1448
1448
}
1449
1449
}
1450
1450
@@ -1660,7 +1660,7 @@ mod tests {
1660
1660
read_receipts : Default :: default ( ) ,
1661
1661
warned_about_unknown_room_version : Arc :: new ( false . into ( ) ) ,
1662
1662
cached_display_name : None ,
1663
- recency_timestamp : Some ( MilliSecondsSinceUnixEpoch ( 42u32 . into ( ) ) ) ,
1663
+ recency_stamp : Some ( 42 ) ,
1664
1664
} ;
1665
1665
1666
1666
let info_json = json ! ( {
@@ -1713,7 +1713,7 @@ mod tests {
1713
1713
"latest_active" : null,
1714
1714
"pending" : [ ]
1715
1715
} ,
1716
- "recency_timestamp " : 42 ,
1716
+ "recency_stamp " : 42 ,
1717
1717
} ) ;
1718
1718
1719
1719
assert_eq ! ( serde_json:: to_value( info) . unwrap( ) , info_json) ;
0 commit comments