feat: introduce hightlighted room getter
- adds `Room.isUnreadOrInvited` extending `Room.isUnread` to invited rooms This is some high-level abstraction simplifying computation of unread room badges / notifications. Related: https://gitlab.com/groups/famedly/company/-/epics/28 Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
parent
c436a86915
commit
ed7913e710
|
|
@ -530,6 +530,10 @@ class Room {
|
|||
/// in muted rooms, use [hasNewMessages].
|
||||
bool get isUnread => notificationCount > 0 || markedUnread;
|
||||
|
||||
/// Returns true if this room is to be marked as unread. This extends
|
||||
/// [isUnread] to rooms with [Membership.invite].
|
||||
bool get isUnreadOrInvited => isUnread || membership == Membership.invite;
|
||||
|
||||
@Deprecated('Use waitForRoomInSync() instead')
|
||||
Future<SyncUpdate> get waitForSync => waitForRoomInSync();
|
||||
|
||||
|
|
@ -1689,6 +1693,7 @@ class Room {
|
|||
|
||||
bool get canCreateGroupCall =>
|
||||
canChangeStateEvent('org.matrix.msc3401.call') && groupCallsEnabled;
|
||||
|
||||
bool get canJoinGroupCall =>
|
||||
canChangeStateEvent('org.matrix.msc3401.call.member') &&
|
||||
groupCallsEnabled;
|
||||
|
|
|
|||
|
|
@ -189,7 +189,8 @@ void main() {
|
|||
stateKey: '',
|
||||
),
|
||||
);
|
||||
expect(room.hasNewMessages, true);
|
||||
expect(room.hasNewMessages, isTrue);
|
||||
expect(room.isUnreadOrInvited, isTrue);
|
||||
expect(room.lastEvent?.body, 'cd');
|
||||
room.setState(
|
||||
Event(
|
||||
|
|
|
|||
Loading…
Reference in New Issue