ffi: Correct timestamp value and remove is_read flag

The timestamp value of the Notification was not reliable since it was the
timestamp in which it was generated internally, not the timestamp of when the
event was sent, now we instead expose the `origin_server_ts` of the
TimelineEvent.

`is_read` is also very unreliable, so it's just removed for now.
This commit is contained in:
Mauro
2023-05-02 17:00:05 +02:00
committed by GitHub
parent be41dcf300
commit 2f413af0a8
3 changed files with 4 additions and 7 deletions

View File

@@ -22,8 +22,6 @@ dictionary NotificationItem {
boolean is_noisy;
boolean is_direct;
boolean is_encrypted;
boolean is_read;
u64 timestamp;
};
interface TimelineEvent {};

View File

@@ -19,6 +19,10 @@ impl TimelineEvent {
self.0.sender().to_string()
}
pub fn timestamp(&self) -> u64 {
self.0.origin_server_ts().0.into()
}
pub fn event_type(&self) -> Result<TimelineEventType, ClientError> {
let event_type = match &self.0 {
AnySyncTimelineEvent::MessageLike(event) => {

View File

@@ -18,9 +18,6 @@ pub struct NotificationItem {
pub is_noisy: bool,
pub is_direct: bool,
pub is_encrypted: bool,
pub is_read: bool,
pub timestamp: u64,
}
impl NotificationItem {
@@ -48,8 +45,6 @@ impl NotificationItem {
is_noisy,
is_direct: room.is_direct().await?,
is_encrypted: room.is_encrypted().await?,
is_read: notification.read,
timestamp: notification.ts.0.into(),
};
Ok(item)
}