feat: get fully read marker
This commit is contained in:
parent
951db4c8d7
commit
f23abcd323
|
|
@ -1220,6 +1220,15 @@ class Room {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the user fully read marker
|
||||||
|
String? get userFullyReadMarker {
|
||||||
|
final readEvent = roomAccountData['m.fully_read'];
|
||||||
|
if (readEvent != null) {
|
||||||
|
return readEvent.content.tryGet<String>('event_id');
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// Sets the position of the read marker for a given room, and optionally the
|
/// Sets the position of the read marker for a given room, and optionally the
|
||||||
/// read receipt's location.
|
/// read receipt's location.
|
||||||
Future<void> setReadMarker(String eventId, {String? mRead}) async {
|
Future<void> setReadMarker(String eventId, {String? mRead}) async {
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,10 @@ void main() {
|
||||||
type: 'com.test.foo',
|
type: 'com.test.foo',
|
||||||
content: {'foo': 'bar'},
|
content: {'foo': 'bar'},
|
||||||
),
|
),
|
||||||
|
'm.fully_read': BasicRoomEvent(
|
||||||
|
type: 'm.fully_read',
|
||||||
|
content: {'event_id': '\$event_id:example.com'},
|
||||||
|
),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
room.setState(Event(
|
room.setState(Event(
|
||||||
|
|
@ -94,6 +98,7 @@ void main() {
|
||||||
expect(
|
expect(
|
||||||
room.getState('m.room.join_rules')?.content['join_rule'], 'public');
|
room.getState('m.room.join_rules')?.content['join_rule'], 'public');
|
||||||
expect(room.roomAccountData['com.test.foo']?.content['foo'], 'bar');
|
expect(room.roomAccountData['com.test.foo']?.content['foo'], 'bar');
|
||||||
|
expect(room.userFullyReadMarker, '\$event_id:example.com');
|
||||||
|
|
||||||
room.setState(
|
room.setState(
|
||||||
Event(
|
Event(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue