added unread messages and unread chats counters

This commit is contained in:
Username1548
2025-02-20 16:41:07 +07:00
parent 120af45dd5
commit 93899e316f
45 changed files with 1784 additions and 1884 deletions

View File

@@ -26,8 +26,14 @@ mixin _$ChatMessageModel {
List<dynamic>? get mediaData => throw _privateConstructorUsedError;
@JsonKey(name: 'author_id')
int get authorId => throw _privateConstructorUsedError;
@JsonKey(name: 'updated_at')
String get updatedAt => throw _privateConstructorUsedError;
@JsonKey(name: 'updated_at', fromJson: parseDate)
DateTime get updatedAt => throw _privateConstructorUsedError;
@JsonKey(name: 'read_by_to_user', defaultValue: false)
bool get isRead => throw _privateConstructorUsedError;
@JsonKey(name: 'is_author_message_auth_user')
bool? get isCurrentUserAuthor => throw _privateConstructorUsedError;
@JsonKey(name: 'room_id')
String? get roomId => throw _privateConstructorUsedError;
/// Serializes this ChatMessageModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -50,7 +56,10 @@ abstract class $ChatMessageModelCopyWith<$Res> {
String data,
@JsonKey(name: 'media_data') List<dynamic>? mediaData,
@JsonKey(name: 'author_id') int authorId,
@JsonKey(name: 'updated_at') String updatedAt});
@JsonKey(name: 'updated_at', fromJson: parseDate) DateTime updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false) bool isRead,
@JsonKey(name: 'is_author_message_auth_user') bool? isCurrentUserAuthor,
@JsonKey(name: 'room_id') String? roomId});
}
/// @nodoc
@@ -73,6 +82,9 @@ class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel>
Object? mediaData = freezed,
Object? authorId = null,
Object? updatedAt = null,
Object? isRead = null,
Object? isCurrentUserAuthor = freezed,
Object? roomId = freezed,
}) {
return _then(_value.copyWith(
id: null == id
@@ -94,7 +106,19 @@ class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel>
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as String,
as DateTime,
isRead: null == isRead
? _value.isRead
: isRead // ignore: cast_nullable_to_non_nullable
as bool,
isCurrentUserAuthor: freezed == isCurrentUserAuthor
? _value.isCurrentUserAuthor
: isCurrentUserAuthor // ignore: cast_nullable_to_non_nullable
as bool?,
roomId: freezed == roomId
? _value.roomId
: roomId // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
@@ -112,7 +136,10 @@ abstract class _$$ChatMessageModelImplCopyWith<$Res>
String data,
@JsonKey(name: 'media_data') List<dynamic>? mediaData,
@JsonKey(name: 'author_id') int authorId,
@JsonKey(name: 'updated_at') String updatedAt});
@JsonKey(name: 'updated_at', fromJson: parseDate) DateTime updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false) bool isRead,
@JsonKey(name: 'is_author_message_auth_user') bool? isCurrentUserAuthor,
@JsonKey(name: 'room_id') String? roomId});
}
/// @nodoc
@@ -133,6 +160,9 @@ class __$$ChatMessageModelImplCopyWithImpl<$Res>
Object? mediaData = freezed,
Object? authorId = null,
Object? updatedAt = null,
Object? isRead = null,
Object? isCurrentUserAuthor = freezed,
Object? roomId = freezed,
}) {
return _then(_$ChatMessageModelImpl(
id: null == id
@@ -154,7 +184,19 @@ class __$$ChatMessageModelImplCopyWithImpl<$Res>
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as String,
as DateTime,
isRead: null == isRead
? _value.isRead
: isRead // ignore: cast_nullable_to_non_nullable
as bool,
isCurrentUserAuthor: freezed == isCurrentUserAuthor
? _value.isCurrentUserAuthor
: isCurrentUserAuthor // ignore: cast_nullable_to_non_nullable
as bool?,
roomId: freezed == roomId
? _value.roomId
: roomId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
@@ -167,7 +209,12 @@ class _$ChatMessageModelImpl implements _ChatMessageModel {
required this.data,
@JsonKey(name: 'media_data') required final List<dynamic>? mediaData,
@JsonKey(name: 'author_id') required this.authorId,
@JsonKey(name: 'updated_at') required this.updatedAt})
@JsonKey(name: 'updated_at', fromJson: parseDate) required this.updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false)
required this.isRead,
@JsonKey(name: 'is_author_message_auth_user')
required this.isCurrentUserAuthor,
@JsonKey(name: 'room_id') required this.roomId})
: _mediaData = mediaData;
factory _$ChatMessageModelImpl.fromJson(Map<String, dynamic> json) =>
@@ -192,12 +239,21 @@ class _$ChatMessageModelImpl implements _ChatMessageModel {
@JsonKey(name: 'author_id')
final int authorId;
@override
@JsonKey(name: 'updated_at')
final String updatedAt;
@JsonKey(name: 'updated_at', fromJson: parseDate)
final DateTime updatedAt;
@override
@JsonKey(name: 'read_by_to_user', defaultValue: false)
final bool isRead;
@override
@JsonKey(name: 'is_author_message_auth_user')
final bool? isCurrentUserAuthor;
@override
@JsonKey(name: 'room_id')
final String? roomId;
@override
String toString() {
return 'ChatMessageModel(id: $id, data: $data, mediaData: $mediaData, authorId: $authorId, updatedAt: $updatedAt)';
return 'ChatMessageModel(id: $id, data: $data, mediaData: $mediaData, authorId: $authorId, updatedAt: $updatedAt, isRead: $isRead, isCurrentUserAuthor: $isCurrentUserAuthor, roomId: $roomId)';
}
@override
@@ -212,13 +268,25 @@ class _$ChatMessageModelImpl implements _ChatMessageModel {
(identical(other.authorId, authorId) ||
other.authorId == authorId) &&
(identical(other.updatedAt, updatedAt) ||
other.updatedAt == updatedAt));
other.updatedAt == updatedAt) &&
(identical(other.isRead, isRead) || other.isRead == isRead) &&
(identical(other.isCurrentUserAuthor, isCurrentUserAuthor) ||
other.isCurrentUserAuthor == isCurrentUserAuthor) &&
(identical(other.roomId, roomId) || other.roomId == roomId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, data,
const DeepCollectionEquality().hash(_mediaData), authorId, updatedAt);
int get hashCode => Object.hash(
runtimeType,
id,
data,
const DeepCollectionEquality().hash(_mediaData),
authorId,
updatedAt,
isRead,
isCurrentUserAuthor,
roomId);
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@@ -243,7 +311,13 @@ abstract class _ChatMessageModel implements ChatMessageModel {
required final String data,
@JsonKey(name: 'media_data') required final List<dynamic>? mediaData,
@JsonKey(name: 'author_id') required final int authorId,
@JsonKey(name: 'updated_at') required final String updatedAt}) =
@JsonKey(name: 'updated_at', fromJson: parseDate)
required final DateTime updatedAt,
@JsonKey(name: 'read_by_to_user', defaultValue: false)
required final bool isRead,
@JsonKey(name: 'is_author_message_auth_user')
required final bool? isCurrentUserAuthor,
@JsonKey(name: 'room_id') required final String? roomId}) =
_$ChatMessageModelImpl;
factory _ChatMessageModel.fromJson(Map<String, dynamic> json) =
@@ -260,8 +334,17 @@ abstract class _ChatMessageModel implements ChatMessageModel {
@JsonKey(name: 'author_id')
int get authorId;
@override
@JsonKey(name: 'updated_at')
String get updatedAt;
@JsonKey(name: 'updated_at', fromJson: parseDate)
DateTime get updatedAt;
@override
@JsonKey(name: 'read_by_to_user', defaultValue: false)
bool get isRead;
@override
@JsonKey(name: 'is_author_message_auth_user')
bool? get isCurrentUserAuthor;
@override
@JsonKey(name: 'room_id')
String? get roomId;
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.