Commit 25c04e27 authored by Wilko Manger's avatar Wilko Manger

Add notification count properties to Room

parent 0eda5886
Pipeline #528 failed with stages
in 33 seconds
- Add notification count properties to `Room`
- Parse power levels even if they're strings
- Make sure duration milliseconds is an `int`
- Change `AudioInfo.duration` type to `Durration`
- Fix exceptions when total member count is unknown
- Add `Account` for the olm implementation
- Rename `Id` to `MatrixId` and let `Id` be genereic id
- Add `Device` class (now used in `Homeserver.login`)
- Handle no specific power level events properly
- Add unit tests
......@@ -95,6 +95,15 @@ class Room extends Identifiable<RoomId> {
List<User> get typingUsers => _typingUsers;
int _highlightedUnreadNotificationCount = 0;
int get highlightedUnreadNotificationCount =>
_highlightedUnreadNotificationCount;
int _totalUnreadNotificationCount = 0;
int get totalUnreadNotificationCount => _totalUnreadNotificationCount;
final LocalUser _me;
final Store _store;
......@@ -111,6 +120,8 @@ class Room extends Identifiable<RoomId> {
User creator,
RoomId replacementId,
RoomId replacesId,
int highlightedUnreadNotificationCount,
int totalUnreadNotificationCount,
}) : _scope = scope,
_name = name,
_avatarUrl = avatarUrl,
......@@ -120,6 +131,9 @@ class Room extends Identifiable<RoomId> {
_creator = creator,
_replacementId = replacementId,
_replacesId = replacesId,
_highlightedUnreadNotificationCount =
highlightedUnreadNotificationCount ?? 0,
_totalUnreadNotificationCount = totalUnreadNotificationCount ?? 0,
_me = Container().resolve(scope),
_store = Container().resolve(scope) {
_members = Members(this, memberCount, scope);
......@@ -199,6 +213,13 @@ class Room extends Identifiable<RoomId> {
members.count = summary['m.joined_member_count'] ?? members.count;
}
final notifications = response['unread_notifications'];
if (notifications != null) {
_highlightedUnreadNotificationCount =
notifications['highlight_count'] ?? 0;
_totalUnreadNotificationCount = notifications['notification_count'] ?? 0;
}
final context = ProcessContext();
await _processEvents(response['state']['events'], context);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment