fix(llc): Fix unread count not updating when the current user is set.

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2021-09-08 16:37:34 +05:30
committed by xsahil03x
parent 386df52048
commit f4e37e23d6
5 changed files with 44 additions and 14 deletions
@@ -17,7 +17,7 @@ class OwnUser extends User {
this.devices = const [],
this.mutes = const [],
this.totalUnreadCount = 0,
this.unreadChannels,
this.unreadChannels = 0,
this.channelMutes = const [],
required String id,
String? role,
@@ -151,8 +151,8 @@ class OwnUser extends User {
final int totalUnreadCount;
/// Total unread channels by the user.
@JsonKey(includeIfNull: false)
final int? unreadChannels;
@JsonKey(includeIfNull: false, defaultValue: 0)
final int unreadChannels;
/// Known top level fields.
///
@@ -17,7 +17,7 @@ OwnUser _$OwnUserFromJson(Map<String, dynamic> json) {
.toList() ??
[],
totalUnreadCount: json['total_unread_count'] as int? ?? 0,
unreadChannels: json['unread_channels'] as int?,
unreadChannels: json['unread_channels'] as int? ?? 0,
channelMutes: (json['channel_mutes'] as List<dynamic>?)
?.map((e) => Mute.fromJson(e as Map<String, dynamic>))
.toList() ??