Merge branch 'krille/fix-has-new-messages' into 'main'
fix: Has new messages compares ts See merge request famedly/company/frontend/famedlysdk!962
This commit is contained in:
commit
b96617ce9f
|
|
@ -1,3 +1,7 @@
|
||||||
|
## [0.8.8] - 14nd Feb 2022
|
||||||
|
- fix: Has new messages compares ts
|
||||||
|
- fix: handle dynamic content for pinned events
|
||||||
|
|
||||||
## [0.8.7] - 14nd Feb 2022
|
## [0.8.7] - 14nd Feb 2022
|
||||||
- fix: Show reactions as last events and refactor hasNewMessage
|
- fix: Show reactions as last events and refactor hasNewMessage
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -508,6 +508,8 @@ class Room {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if the last event has a read marker of the user.
|
/// Checks if the last event has a read marker of the user.
|
||||||
|
/// Warning: This compares the origin server timestamp which might not map
|
||||||
|
/// to the real sort order of the timeline.
|
||||||
bool get hasNewMessages {
|
bool get hasNewMessages {
|
||||||
final lastEvent = this.lastEvent;
|
final lastEvent = this.lastEvent;
|
||||||
|
|
||||||
|
|
@ -522,7 +524,13 @@ class Room {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
final readAtMilliseconds = roomAccountData['m.receipt']
|
||||||
|
?.content
|
||||||
|
.tryGetMap<String, dynamic>(client.userID!)
|
||||||
|
?.tryGet<int>('ts') ??
|
||||||
|
0;
|
||||||
|
|
||||||
|
return readAtMilliseconds < lastEvent.originServerTs.millisecondsSinceEpoch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if this room is unread. To check if there are new messages
|
/// Returns true if this room is unread. To check if there are new messages
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
name: matrix
|
name: matrix
|
||||||
description: Matrix Dart SDK
|
description: Matrix Dart SDK
|
||||||
version: 0.8.7
|
version: 0.8.8
|
||||||
homepage: https://famedly.com
|
homepage: https://famedly.com
|
||||||
repository: https://gitlab.com/famedly/company/frontend/famedlysdk.git
|
repository: https://gitlab.com/famedly/company/frontend/famedlysdk.git
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,7 @@ void main() {
|
||||||
stateKey: '',
|
stateKey: '',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
expect(room.hasNewMessages, true);
|
||||||
expect(room.lastEvent?.body, 'cd');
|
expect(room.lastEvent?.body, 'cd');
|
||||||
room.setState(
|
room.setState(
|
||||||
Event(
|
Event(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue