diff --git a/lib/src/room.dart b/lib/src/room.dart index 343f77a1..757dde11 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -1220,6 +1220,15 @@ class Room { return; } + /// Get the user fully read marker + String? get userFullyReadMarker { + final readEvent = roomAccountData['m.fully_read']; + if (readEvent != null) { + return readEvent.content.tryGet('event_id'); + } + return null; + } + /// Sets the position of the read marker for a given room, and optionally the /// read receipt's location. Future setReadMarker(String eventId, {String? mRead}) async { diff --git a/test/room_test.dart b/test/room_test.dart index b60c16e7..57d2b2bf 100644 --- a/test/room_test.dart +++ b/test/room_test.dart @@ -70,6 +70,10 @@ void main() { type: 'com.test.foo', content: {'foo': 'bar'}, ), + 'm.fully_read': BasicRoomEvent( + type: 'm.fully_read', + content: {'event_id': '\$event_id:example.com'}, + ), }, ); room.setState(Event( @@ -94,6 +98,7 @@ void main() { expect( room.getState('m.room.join_rules')?.content['join_rule'], 'public'); expect(room.roomAccountData['com.test.foo']?.content['foo'], 'bar'); + expect(room.userFullyReadMarker, '\$event_id:example.com'); room.setState( Event(