Merge pull request #669 from GetStream/fix/client-unread-count

fix(llc): Fix unread count not updating when the current user is set.
This commit is contained in:
Salvatore Giordano
2021-09-09 09:41:08 +02:00
committed by GitHub
5 changed files with 50 additions and 16 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() ??