Skip to content

Commit

Permalink
Merge pull request #1990 from famedly/karthi/latestEventReceivedTime
Browse files Browse the repository at this point in the history
chore: BREAKING rename timeCreated to latestEventReceivedTime in Room
  • Loading branch information
krille-chan authored Jan 2, 2025
2 parents 0caec7c + 05ee403 commit 5b37675
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2998,8 +2998,8 @@ class Client extends MatrixApi {
a.notificationCount != b.notificationCount) {
return b.notificationCount.compareTo(a.notificationCount);
} else {
return b.timeCreated.millisecondsSinceEpoch
.compareTo(a.timeCreated.millisecondsSinceEpoch);
return b.latestEventReceivedTime.millisecondsSinceEpoch
.compareTo(a.latestEventReceivedTime.millisecondsSinceEpoch);
}
};

Expand Down
5 changes: 3 additions & 2 deletions lib/src/room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,9 @@ class Room {
@Deprecated('Use `getLocalizedDisplayname()` instead')
String get displayname => getLocalizedDisplayname();

/// When the last message received.
DateTime get timeCreated => lastEvent?.originServerTs ?? DateTime.now();
/// When was the last event received.
DateTime get latestEventReceivedTime =>
lastEvent?.originServerTs ?? DateTime.now();

/// Call the Matrix API to change the name of this room. Returns the event ID of the
/// new m.room.name event.
Expand Down
2 changes: 1 addition & 1 deletion test/room_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void main() {
);
expect(room.lastEvent?.eventId, '12345');
expect(room.lastEvent?.body, 'abc');
expect(room.timeCreated, room.lastEvent?.originServerTs);
expect(room.latestEventReceivedTime, room.lastEvent?.originServerTs);
});

test('lastEvent is set properly', () async {
Expand Down

0 comments on commit 5b37675

Please sign in to comment.