Merge branch 'develop' into rfac/transform
This commit is contained in:
@@ -22,7 +22,7 @@ class Channel {
|
|||||||
this._client,
|
this._client,
|
||||||
this._type,
|
this._type,
|
||||||
this._id, {
|
this._id, {
|
||||||
Map<String, Object> extraData = const {},
|
Map<String, Object?> extraData = const {},
|
||||||
}) : _cid = _id != null ? '$_type:$_id' : null,
|
}) : _cid = _id != null ? '$_type:$_id' : null,
|
||||||
_extraData = extraData {
|
_extraData = extraData {
|
||||||
_client.logger.info('New Channel instance not initialized created');
|
_client.logger.info('New Channel instance not initialized created');
|
||||||
@@ -630,7 +630,7 @@ class Channel {
|
|||||||
Future<SendReactionResponse> sendReaction(
|
Future<SendReactionResponse> sendReaction(
|
||||||
Message message,
|
Message message,
|
||||||
String type, {
|
String type, {
|
||||||
Map<String, Object> extraData = const {},
|
Map<String, Object?> extraData = const {},
|
||||||
bool enforceUnique = false,
|
bool enforceUnique = false,
|
||||||
}) async {
|
}) async {
|
||||||
_checkInitialized();
|
_checkInitialized();
|
||||||
@@ -1099,7 +1099,7 @@ class Channel {
|
|||||||
}) async {
|
}) async {
|
||||||
final payload = <String, dynamic>{
|
final payload = <String, dynamic>{
|
||||||
'sort': sort,
|
'sort': sort,
|
||||||
'filter_conditions': filter,
|
'filter_conditions': filter ?? {},
|
||||||
'type': type,
|
'type': type,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1194,7 +1194,7 @@ class StreamChatClient {
|
|||||||
Channel channel(
|
Channel channel(
|
||||||
String type, {
|
String type, {
|
||||||
String? id,
|
String? id,
|
||||||
Map<String, Object> extraData = const {},
|
Map<String, Object?> extraData = const {},
|
||||||
}) {
|
}) {
|
||||||
if (id != null && state.channels.containsKey('$type:$id')) {
|
if (id != null && state.channels.containsKey('$type:$id')) {
|
||||||
return state.channels['$type:$id']!;
|
return state.channels['$type:$id']!;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class Attachment extends Equatable {
|
|||||||
includeIfNull: false,
|
includeIfNull: false,
|
||||||
defaultValue: {},
|
defaultValue: {},
|
||||||
)
|
)
|
||||||
final Map<String, Object> extraData;
|
final Map<String, Object?> extraData;
|
||||||
|
|
||||||
/// The attachment ID.
|
/// The attachment ID.
|
||||||
///
|
///
|
||||||
@@ -183,7 +183,7 @@ class Attachment extends Equatable {
|
|||||||
List<Action>? actions,
|
List<Action>? actions,
|
||||||
AttachmentFile? file,
|
AttachmentFile? file,
|
||||||
UploadState? uploadState,
|
UploadState? uploadState,
|
||||||
Map<String, Object>? extraData,
|
Map<String, Object?>? extraData,
|
||||||
}) =>
|
}) =>
|
||||||
Attachment(
|
Attachment(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
|
|||||||
@@ -30,10 +30,7 @@ Attachment _$AttachmentFromJson(Map<String, dynamic> json) {
|
|||||||
?.map((e) => Action.fromJson(e as Map<String, dynamic>))
|
?.map((e) => Action.fromJson(e as Map<String, dynamic>))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
[],
|
[],
|
||||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||||
(k, e) => MapEntry(k, e as Object),
|
|
||||||
) ??
|
|
||||||
{},
|
|
||||||
file: json['file'] == null
|
file: json['file'] == null
|
||||||
? null
|
? null
|
||||||
: AttachmentFile.fromJson(json['file'] as Map<String, dynamic>),
|
: AttachmentFile.fromJson(json['file'] as Map<String, dynamic>),
|
||||||
|
|||||||
@@ -132,9 +132,8 @@ class _$PreparingCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
|||||||
Preparing get _value => super._value as Preparing;
|
Preparing get _value => super._value as Preparing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
class _$Preparing implements Preparing {
|
class _$Preparing implements Preparing {
|
||||||
const _$Preparing();
|
const _$Preparing();
|
||||||
|
|
||||||
@@ -253,9 +252,8 @@ class _$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
class _$InProgress implements InProgress {
|
class _$InProgress implements InProgress {
|
||||||
const _$InProgress({required this.uploaded, required this.total});
|
const _$InProgress({required this.uploaded, required this.total});
|
||||||
|
|
||||||
@@ -382,9 +380,8 @@ class _$SuccessCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
|||||||
Success get _value => super._value as Success;
|
Success get _value => super._value as Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
class _$Success implements Success {
|
class _$Success implements Success {
|
||||||
const _$Success();
|
const _$Success();
|
||||||
|
|
||||||
@@ -497,9 +494,8 @@ class _$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
class _$Failed implements Failed {
|
class _$Failed implements Failed {
|
||||||
const _$Failed({required this.error});
|
const _$Failed({required this.error});
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ part of 'attachment_file.dart';
|
|||||||
|
|
||||||
AttachmentFile _$AttachmentFileFromJson(Map<String, dynamic> json) {
|
AttachmentFile _$AttachmentFileFromJson(Map<String, dynamic> json) {
|
||||||
return AttachmentFile(
|
return AttachmentFile(
|
||||||
|
size: json['size'] as int?,
|
||||||
path: json['path'] as String?,
|
path: json['path'] as String?,
|
||||||
name: json['name'] as String?,
|
name: json['name'] as String?,
|
||||||
bytes: _fromString(json['bytes'] as String?),
|
bytes: _fromString(json['bytes'] as String?),
|
||||||
size: json['size'] as int?,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class ChannelModel {
|
|||||||
includeIfNull: false,
|
includeIfNull: false,
|
||||||
defaultValue: {},
|
defaultValue: {},
|
||||||
)
|
)
|
||||||
final Map<String, Object> extraData;
|
final Map<String, Object?> extraData;
|
||||||
|
|
||||||
/// The team the channel belongs to
|
/// The team the channel belongs to
|
||||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||||
@@ -132,7 +132,7 @@ class ChannelModel {
|
|||||||
DateTime? updatedAt,
|
DateTime? updatedAt,
|
||||||
DateTime? deletedAt,
|
DateTime? deletedAt,
|
||||||
int? memberCount,
|
int? memberCount,
|
||||||
Map<String, Object>? extraData,
|
Map<String, Object?>? extraData,
|
||||||
String? team,
|
String? team,
|
||||||
}) =>
|
}) =>
|
||||||
ChannelModel(
|
ChannelModel(
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ ChannelModel _$ChannelModelFromJson(Map<String, dynamic> json) {
|
|||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
memberCount: json['member_count'] as int? ?? 0,
|
memberCount: json['member_count'] as int? ?? 0,
|
||||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||||
(k, e) => MapEntry(k, e as Object),
|
|
||||||
) ??
|
|
||||||
{},
|
|
||||||
team: json['team'] as String?,
|
team: json['team'] as String?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class Event {
|
|||||||
|
|
||||||
/// Map of custom channel extraData
|
/// Map of custom channel extraData
|
||||||
@JsonKey(defaultValue: {})
|
@JsonKey(defaultValue: {})
|
||||||
final Map<String, Object> extraData;
|
final Map<String, Object?> extraData;
|
||||||
|
|
||||||
/// Known top level fields.
|
/// Known top level fields.
|
||||||
/// Useful for [Serialization] methods.
|
/// Useful for [Serialization] methods.
|
||||||
@@ -140,7 +140,7 @@ class Event {
|
|||||||
int? unreadChannels,
|
int? unreadChannels,
|
||||||
bool? online,
|
bool? online,
|
||||||
String? parentId,
|
String? parentId,
|
||||||
Map<String, Object>? extraData,
|
Map<String, Object?>? extraData,
|
||||||
}) =>
|
}) =>
|
||||||
Event(
|
Event(
|
||||||
type: type ?? this.type,
|
type: type ?? this.type,
|
||||||
@@ -180,7 +180,7 @@ class EventChannel extends ChannelModel {
|
|||||||
required DateTime updatedAt,
|
required DateTime updatedAt,
|
||||||
DateTime? deletedAt,
|
DateTime? deletedAt,
|
||||||
required int memberCount,
|
required int memberCount,
|
||||||
Map<String, Object>? extraData,
|
Map<String, Object?>? extraData,
|
||||||
}) : super(
|
}) : super(
|
||||||
id: id,
|
id: id,
|
||||||
type: type,
|
type: type,
|
||||||
|
|||||||
@@ -38,10 +38,7 @@ Event _$EventFromJson(Map<String, dynamic> json) {
|
|||||||
channelId: json['channel_id'] as String?,
|
channelId: json['channel_id'] as String?,
|
||||||
channelType: json['channel_type'] as String?,
|
channelType: json['channel_type'] as String?,
|
||||||
parentId: json['parent_id'] as String?,
|
parentId: json['parent_id'] as String?,
|
||||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||||
(k, e) => MapEntry(k, e as Object),
|
|
||||||
) ??
|
|
||||||
{},
|
|
||||||
isLocal: json['is_local'] as bool? ?? false,
|
isLocal: json['is_local'] as bool? ?? false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -89,10 +86,7 @@ EventChannel _$EventChannelFromJson(Map<String, dynamic> json) {
|
|||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
memberCount: json['member_count'] as int? ?? 0,
|
memberCount: json['member_count'] as int? ?? 0,
|
||||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||||
(k, e) => MapEntry(k, e as Object),
|
|
||||||
) ??
|
|
||||||
{},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ extension FilterOperatorX on FilterOperator {
|
|||||||
/// See <a href="https://getstream.io/chat/docs/query_channels/?language=dart" target="_top">Query Channels Documentation</a>
|
/// See <a href="https://getstream.io/chat/docs/query_channels/?language=dart" target="_top">Query Channels Documentation</a>
|
||||||
class Filter extends Equatable {
|
class Filter extends Equatable {
|
||||||
const Filter.__({
|
const Filter.__({
|
||||||
required this.operator,
|
|
||||||
required this.value,
|
required this.value,
|
||||||
|
this.operator,
|
||||||
this.key,
|
this.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -159,13 +159,26 @@ class Filter extends Equatable {
|
|||||||
|
|
||||||
/// Creates a custom [Filter] if there isn't one already available.
|
/// Creates a custom [Filter] if there isn't one already available.
|
||||||
const factory Filter.custom({
|
const factory Filter.custom({
|
||||||
required String operator,
|
|
||||||
required Object value,
|
required Object value,
|
||||||
|
String? operator,
|
||||||
String? key,
|
String? key,
|
||||||
}) = Filter.__;
|
}) = Filter.__;
|
||||||
|
|
||||||
|
/// Creates a custom [Filter] from a raw map value
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// final filter = Filter.raw(
|
||||||
|
/// {
|
||||||
|
/// 'members': [user1.id, user2.id],
|
||||||
|
/// }
|
||||||
|
/// )
|
||||||
|
/// ```
|
||||||
|
const factory Filter.raw({
|
||||||
|
required Map<String, Object?> value,
|
||||||
|
}) = Filter.__;
|
||||||
|
|
||||||
/// An operator used for the filter. The operator string must start with `$`
|
/// An operator used for the filter. The operator string must start with `$`
|
||||||
final String operator;
|
final String? operator;
|
||||||
|
|
||||||
/// The "left-hand" side of the filter.
|
/// The "left-hand" side of the filter.
|
||||||
/// Specifies the name of the field the filter should match.
|
/// Specifies the name of the field the filter should match.
|
||||||
@@ -183,24 +196,22 @@ class Filter extends Equatable {
|
|||||||
List<Object?> get props => [operator, key, value];
|
List<Object?> get props => [operator, key, value];
|
||||||
|
|
||||||
/// Serializes to json object
|
/// Serializes to json object
|
||||||
Map<String, Object> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
final json = <String, Object>{};
|
final json = <String, Object?>{};
|
||||||
final groupOperators = _groupOperators.map((it) => it.rawValue);
|
final groupOperators = _groupOperators.map((it) => it.rawValue);
|
||||||
|
|
||||||
assert(
|
|
||||||
groupOperators.contains(operator) || key != null,
|
|
||||||
'Filter must contain the `key` when the operator is not a '
|
|
||||||
'group operator.',
|
|
||||||
);
|
|
||||||
|
|
||||||
if (groupOperators.contains(operator)) {
|
if (groupOperators.contains(operator)) {
|
||||||
// Filters with group operators are encoded in the following form:
|
// Filters with group operators are encoded in the following form:
|
||||||
// { $<operator>: [ <filter 1>, <filter 2> ] }
|
// { $<operator>: [ <filter 1>, <filter 2> ] }
|
||||||
json[operator] = value;
|
json[operator!] = value;
|
||||||
} else {
|
} else if (operator != null) {
|
||||||
// Normal filters are encoded in the following form:
|
// Normal filters are encoded in the following form:
|
||||||
// { key: { $<operator>: <value> } }
|
// { key: { $<operator>: <value> } }
|
||||||
json[key!] = {operator: value};
|
json[key!] = {operator: value};
|
||||||
|
} else if (key != null) {
|
||||||
|
json[key!] = value;
|
||||||
|
} else {
|
||||||
|
return value as Map<String, Object?>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ class Message extends Equatable {
|
|||||||
includeIfNull: false,
|
includeIfNull: false,
|
||||||
defaultValue: {},
|
defaultValue: {},
|
||||||
)
|
)
|
||||||
final Map<String, Object> extraData;
|
final Map<String, Object?> extraData;
|
||||||
|
|
||||||
/// True if the message is a system info
|
/// True if the message is a system info
|
||||||
bool get isSystem => type == 'system';
|
bool get isSystem => type == 'system';
|
||||||
@@ -289,7 +289,7 @@ class Message extends Equatable {
|
|||||||
DateTime? pinnedAt,
|
DateTime? pinnedAt,
|
||||||
Object? pinExpires = _pinExpires,
|
Object? pinExpires = _pinExpires,
|
||||||
User? pinnedBy,
|
User? pinnedBy,
|
||||||
Map<String, Object>? extraData,
|
Map<String, Object?>? extraData,
|
||||||
MessageSendingStatus? status,
|
MessageSendingStatus? status,
|
||||||
bool? skipPush,
|
bool? skipPush,
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -63,10 +63,7 @@ Message _$MessageFromJson(Map<String, dynamic> json) {
|
|||||||
pinnedBy: json['pinned_by'] == null
|
pinnedBy: json['pinned_by'] == null
|
||||||
? null
|
? null
|
||||||
: User.fromJson(json['pinned_by'] as Map<String, dynamic>),
|
: User.fromJson(json['pinned_by'] as Map<String, dynamic>),
|
||||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||||
(k, e) => MapEntry(k, e as Object),
|
|
||||||
) ??
|
|
||||||
{},
|
|
||||||
deletedAt: json['deleted_at'] == null
|
deletedAt: json['deleted_at'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class OwnUser extends User {
|
|||||||
DateTime? updatedAt,
|
DateTime? updatedAt,
|
||||||
DateTime? lastActive,
|
DateTime? lastActive,
|
||||||
bool online = false,
|
bool online = false,
|
||||||
Map<String, Object> extraData = const {},
|
Map<String, Object?> extraData = const {},
|
||||||
bool banned = false,
|
bool banned = false,
|
||||||
}) : super(
|
}) : super(
|
||||||
id: id,
|
id: id,
|
||||||
|
|||||||
@@ -34,9 +34,7 @@ OwnUser _$OwnUserFromJson(Map<String, dynamic> json) {
|
|||||||
? null
|
? null
|
||||||
: DateTime.parse(json['last_active'] as String),
|
: DateTime.parse(json['last_active'] as String),
|
||||||
online: json['online'] as bool? ?? false,
|
online: json['online'] as bool? ?? false,
|
||||||
extraData: (json['extra_data'] as Map<String, dynamic>).map(
|
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||||
(k, e) => MapEntry(k, e as Object),
|
|
||||||
),
|
|
||||||
banned: json['banned'] as bool? ?? false,
|
banned: json['banned'] as bool? ?? false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class Reaction {
|
|||||||
this.user,
|
this.user,
|
||||||
String? userId,
|
String? userId,
|
||||||
this.score = 0,
|
this.score = 0,
|
||||||
this.extraData,
|
this.extraData = const {},
|
||||||
}) : userId = userId ?? user?.id,
|
}) : userId = userId ?? user?.id,
|
||||||
createdAt = createdAt ?? DateTime.now();
|
createdAt = createdAt ?? DateTime.now();
|
||||||
|
|
||||||
@@ -49,8 +49,11 @@ class Reaction {
|
|||||||
final String? userId;
|
final String? userId;
|
||||||
|
|
||||||
/// Reaction custom extraData
|
/// Reaction custom extraData
|
||||||
@JsonKey(includeIfNull: false)
|
@JsonKey(
|
||||||
final Map<String, Object>? extraData;
|
includeIfNull: false,
|
||||||
|
defaultValue: {},
|
||||||
|
)
|
||||||
|
final Map<String, Object?> extraData;
|
||||||
|
|
||||||
/// Map of custom user extraData
|
/// Map of custom user extraData
|
||||||
static const topLevelFields = [
|
static const topLevelFields = [
|
||||||
@@ -75,7 +78,7 @@ class Reaction {
|
|||||||
User? user,
|
User? user,
|
||||||
String? userId,
|
String? userId,
|
||||||
int? score,
|
int? score,
|
||||||
Map<String, Object>? extraData,
|
Map<String, Object?>? extraData,
|
||||||
}) =>
|
}) =>
|
||||||
Reaction(
|
Reaction(
|
||||||
messageId: messageId ?? this.messageId,
|
messageId: messageId ?? this.messageId,
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ Reaction _$ReactionFromJson(Map<String, dynamic> json) {
|
|||||||
: User.fromJson(json['user'] as Map<String, dynamic>),
|
: User.fromJson(json['user'] as Map<String, dynamic>),
|
||||||
userId: json['user_id'] as String?,
|
userId: json['user_id'] as String?,
|
||||||
score: json['score'] as int? ?? 0,
|
score: json['score'] as int? ?? 0,
|
||||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||||
(k, e) => MapEntry(k, e as Object),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,6 +38,6 @@ Map<String, dynamic> _$ReactionToJson(Reaction instance) {
|
|||||||
writeNotNull('user', readonly(instance.user));
|
writeNotNull('user', readonly(instance.user));
|
||||||
val['score'] = instance.score;
|
val['score'] = instance.score;
|
||||||
writeNotNull('user_id', readonly(instance.userId));
|
writeNotNull('user_id', readonly(instance.userId));
|
||||||
writeNotNull('extra_data', instance.extraData);
|
val['extra_data'] = instance.extraData;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,8 +74,11 @@ class User {
|
|||||||
final bool banned;
|
final bool banned;
|
||||||
|
|
||||||
/// Map of custom user extraData
|
/// Map of custom user extraData
|
||||||
@JsonKey(includeIfNull: false)
|
@JsonKey(
|
||||||
final Map<String, Object> extraData;
|
includeIfNull: false,
|
||||||
|
defaultValue: {},
|
||||||
|
)
|
||||||
|
final Map<String, Object?> extraData;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => id.hashCode;
|
int get hashCode => id.hashCode;
|
||||||
@@ -107,7 +110,7 @@ class User {
|
|||||||
DateTime? updatedAt,
|
DateTime? updatedAt,
|
||||||
DateTime? lastActive,
|
DateTime? lastActive,
|
||||||
bool? online,
|
bool? online,
|
||||||
Map<String, Object>? extraData,
|
Map<String, Object?>? extraData,
|
||||||
bool? banned,
|
bool? banned,
|
||||||
List<String>? teams,
|
List<String>? teams,
|
||||||
}) =>
|
}) =>
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ User _$UserFromJson(Map<String, dynamic> json) {
|
|||||||
? null
|
? null
|
||||||
: DateTime.parse(json['last_active'] as String),
|
: DateTime.parse(json['last_active'] as String),
|
||||||
online: json['online'] as bool? ?? false,
|
online: json['online'] as bool? ?? false,
|
||||||
extraData: (json['extra_data'] as Map<String, dynamic>).map(
|
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||||
(k, e) => MapEntry(k, e as Object),
|
|
||||||
),
|
|
||||||
banned: json['banned'] as bool? ?? false,
|
banned: json['banned'] as bool? ?? false,
|
||||||
teams:
|
teams:
|
||||||
(json['teams'] as List<dynamic>?)?.map((e) => e as String).toList() ??
|
(json['teams'] as List<dynamic>?)?.map((e) => e as String).toList() ??
|
||||||
|
|||||||
@@ -130,6 +130,14 @@ void main() {
|
|||||||
expect(filter.operator, operator);
|
expect(filter.operator, operator);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('raw', () {
|
||||||
|
const value = {
|
||||||
|
'test': ['a', 'b'],
|
||||||
|
};
|
||||||
|
const filter = Filter.raw(value: value);
|
||||||
|
expect(filter.value, value);
|
||||||
|
});
|
||||||
|
|
||||||
group('groupedOperator', () {
|
group('groupedOperator', () {
|
||||||
final filter1 = Filter.equal('testKey', 'testValue');
|
final filter1 = Filter.equal('testKey', 'testValue');
|
||||||
final filter2 = Filter.in_('testKey', const ['testValue']);
|
final filter2 = Filter.in_('testKey', const ['testValue']);
|
||||||
@@ -180,6 +188,30 @@ void main() {
|
|||||||
'{"$key":{"${FilterOperator.in_.rawValue}":${json.encode(values)}}}',
|
'{"$key":{"${FilterOperator.in_.rawValue}":${json.encode(values)}}}',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('custom with no operator', () {
|
||||||
|
const key = 'testKey';
|
||||||
|
const values = ['testValue'];
|
||||||
|
final filter = Filter.custom(key: key, value: values);
|
||||||
|
final encoded = json.encode(filter);
|
||||||
|
expect(
|
||||||
|
encoded,
|
||||||
|
'{"$key":${json.encode(values)}}',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('raw', () {
|
||||||
|
const value = {
|
||||||
|
'test': ['a', 'b'],
|
||||||
|
};
|
||||||
|
const filter = Filter.raw(value: value);
|
||||||
|
|
||||||
|
final encoded = json.encode(filter);
|
||||||
|
expect(
|
||||||
|
encoded,
|
||||||
|
json.encode(value),
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('groupedFilter', () {
|
test('groupedFilter', () {
|
||||||
|
|||||||
@@ -12,12 +12,16 @@ class ImageGroup extends StatelessWidget {
|
|||||||
required this.message,
|
required this.message,
|
||||||
required this.messageTheme,
|
required this.messageTheme,
|
||||||
required this.size,
|
required this.size,
|
||||||
|
this.onReturnAction,
|
||||||
this.onShowMessage,
|
this.onShowMessage,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
/// List of attachments to show
|
/// List of attachments to show
|
||||||
final List<Attachment> images;
|
final List<Attachment> images;
|
||||||
|
|
||||||
|
/// Callback when attachment is returned to from other screens
|
||||||
|
final ValueChanged<ReturnActionType>? onReturnAction;
|
||||||
|
|
||||||
/// Message which images are attached to
|
/// Message which images are attached to
|
||||||
final Message message;
|
final Message message;
|
||||||
|
|
||||||
@@ -111,10 +115,10 @@ class ImageGroup extends StatelessWidget {
|
|||||||
void _onTap(
|
void _onTap(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
int index,
|
int index,
|
||||||
) {
|
) async {
|
||||||
final channel = StreamChannel.of(context).channel;
|
final channel = StreamChannel.of(context).channel;
|
||||||
|
|
||||||
Navigator.push(
|
final res = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => StreamChannel(
|
builder: (context) => StreamChannel(
|
||||||
@@ -129,6 +133,7 @@ class ImageGroup extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
if (res != null) onReturnAction?.call(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildImage(BuildContext context, int index) => ImageAttachment(
|
Widget _buildImage(BuildContext context, int index) => ImageAttachment(
|
||||||
|
|||||||
@@ -463,58 +463,57 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildExpandActionsButton() => Padding(
|
Widget _buildExpandActionsButton() {
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
final channel = StreamChannel.of(context).channel;
|
||||||
child: AnimatedCrossFade(
|
return Padding(
|
||||||
crossFadeState: _actionsShrunk
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
? CrossFadeState.showFirst
|
child: AnimatedCrossFade(
|
||||||
: CrossFadeState.showSecond,
|
crossFadeState: _actionsShrunk
|
||||||
firstChild: IconButton(
|
? CrossFadeState.showFirst
|
||||||
onPressed: () => setState(() => _actionsShrunk = false),
|
: CrossFadeState.showSecond,
|
||||||
icon: Transform.rotate(
|
firstChild: IconButton(
|
||||||
angle: (widget.actionsLocation == ActionsLocation.right ||
|
onPressed: () => setState(() => _actionsShrunk = false),
|
||||||
widget.actionsLocation == ActionsLocation.rightInside)
|
icon: Transform.rotate(
|
||||||
? pi
|
angle: (widget.actionsLocation == ActionsLocation.right ||
|
||||||
: 0,
|
widget.actionsLocation == ActionsLocation.rightInside)
|
||||||
child: StreamSvgIcon.emptyCircleLeft(
|
? pi
|
||||||
color: StreamChatTheme.of(context)
|
: 0,
|
||||||
.messageInputTheme
|
child: StreamSvgIcon.emptyCircleLeft(
|
||||||
.expandButtonColor,
|
color: StreamChatTheme.of(context)
|
||||||
),
|
.messageInputTheme
|
||||||
|
.expandButtonColor,
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
constraints: const BoxConstraints.tightFor(
|
|
||||||
height: 24,
|
|
||||||
width: 24,
|
|
||||||
),
|
|
||||||
splashRadius: 24,
|
|
||||||
),
|
),
|
||||||
secondChild: widget.disableAttachments &&
|
padding: const EdgeInsets.all(0),
|
||||||
!widget.showCommandsButton &&
|
constraints: const BoxConstraints.tightFor(
|
||||||
widget.actions?.isNotEmpty != true
|
height: 24,
|
||||||
? const Offstage()
|
width: 24,
|
||||||
: FittedBox(
|
),
|
||||||
child: Row(
|
splashRadius: 24,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: <Widget>[
|
|
||||||
if (!widget.disableAttachments) _buildAttachmentButton(),
|
|
||||||
if (widget.showCommandsButton &&
|
|
||||||
widget.editMessage == null &&
|
|
||||||
StreamChannel.of(context)
|
|
||||||
.channel
|
|
||||||
.config
|
|
||||||
?.commands
|
|
||||||
.isNotEmpty ==
|
|
||||||
true)
|
|
||||||
_buildCommandButton(),
|
|
||||||
...widget.actions ?? [],
|
|
||||||
].insertBetween(const SizedBox(width: 8)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
duration: const Duration(milliseconds: 300),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
),
|
),
|
||||||
);
|
secondChild: widget.disableAttachments &&
|
||||||
|
!widget.showCommandsButton &&
|
||||||
|
widget.actions?.isNotEmpty != true
|
||||||
|
? const Offstage()
|
||||||
|
: FittedBox(
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
if (!widget.disableAttachments) _buildAttachmentButton(),
|
||||||
|
if (widget.showCommandsButton &&
|
||||||
|
widget.editMessage == null &&
|
||||||
|
channel.state != null &&
|
||||||
|
channel.config?.commands.isNotEmpty == true)
|
||||||
|
_buildCommandButton(),
|
||||||
|
...widget.actions ?? [],
|
||||||
|
].insertBetween(const SizedBox(width: 8)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Expanded _buildTextInput(BuildContext context) {
|
Expanded _buildTextInput(BuildContext context) {
|
||||||
final theme = StreamChatTheme.of(context);
|
final theme = StreamChatTheme.of(context);
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ class MessageListView extends StatefulWidget {
|
|||||||
|
|
||||||
class _MessageListViewState extends State<MessageListView> {
|
class _MessageListViewState extends State<MessageListView> {
|
||||||
ItemScrollController? _scrollController;
|
ItemScrollController? _scrollController;
|
||||||
Function? _onThreadTap;
|
void Function(Message)? _onThreadTap;
|
||||||
bool _showScrollToBottom = false;
|
bool _showScrollToBottom = false;
|
||||||
late final ItemPositionsListener _itemPositionListener;
|
late final ItemPositionsListener _itemPositionListener;
|
||||||
int? _messageListLength;
|
int? _messageListLength;
|
||||||
@@ -814,7 +814,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
showUsername: !isMyMessage,
|
showUsername: !isMyMessage,
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
showSendingIndicator: false,
|
showSendingIndicator: false,
|
||||||
onThreadTap: _onThreadTap as void Function(Message)?,
|
onThreadTap: _onThreadTap,
|
||||||
borderRadiusGeometry: const BorderRadius.only(
|
borderRadiusGeometry: const BorderRadius.only(
|
||||||
topLeft: Radius.circular(16),
|
topLeft: Radius.circular(16),
|
||||||
bottomLeft: Radius.circular(2),
|
bottomLeft: Radius.circular(2),
|
||||||
@@ -976,7 +976,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
showThreadReplyMessage: !isThreadMessage,
|
showThreadReplyMessage: !isThreadMessage,
|
||||||
showFlagButton: !isMyMessage,
|
showFlagButton: !isMyMessage,
|
||||||
borderSide: borderSide,
|
borderSide: borderSide,
|
||||||
onThreadTap: _onThreadTap as void Function(Message)?,
|
onThreadTap: _onThreadTap,
|
||||||
onReplyTap: widget.onReplyTap,
|
onReplyTap: widget.onReplyTap,
|
||||||
attachmentBorderRadiusGeometry: BorderRadius.only(
|
attachmentBorderRadiusGeometry: BorderRadius.only(
|
||||||
topLeft: Radius.circular(attachmentBorderRadius),
|
topLeft: Radius.circular(attachmentBorderRadius),
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ class MessageWidget extends StatefulWidget {
|
|||||||
message: message,
|
message: message,
|
||||||
messageTheme: messageTheme,
|
messageTheme: messageTheme,
|
||||||
onShowMessage: onShowMessage,
|
onShowMessage: onShowMessage,
|
||||||
|
onReturnAction: onReturnAction,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
border,
|
border,
|
||||||
|
|||||||
@@ -159,11 +159,11 @@ class StreamChannelState extends State<StreamChannel> {
|
|||||||
bool preferOffline = false,
|
bool preferOffline = false,
|
||||||
}) async {
|
}) async {
|
||||||
if (_topPaginationEnded ||
|
if (_topPaginationEnded ||
|
||||||
_queryTopMessagesController.value! ||
|
_queryTopMessagesController.value == true ||
|
||||||
channel.state == null) return;
|
channel.state == null) return;
|
||||||
_queryTopMessagesController.add(true);
|
_queryTopMessagesController.add(true);
|
||||||
|
|
||||||
late Message message;
|
Message? message;
|
||||||
if (channel.state!.threads.containsKey(parentId)) {
|
if (channel.state!.threads.containsKey(parentId)) {
|
||||||
final thread = channel.state!.threads[parentId]!;
|
final thread = channel.state!.threads[parentId]!;
|
||||||
if (thread.isNotEmpty) {
|
if (thread.isNotEmpty) {
|
||||||
@@ -175,7 +175,7 @@ class StreamChannelState extends State<StreamChannel> {
|
|||||||
final response = await channel.getReplies(
|
final response = await channel.getReplies(
|
||||||
parentId,
|
parentId,
|
||||||
PaginationParams(
|
PaginationParams(
|
||||||
lessThan: message.id,
|
lessThan: message?.id,
|
||||||
limit: limit,
|
limit: limit,
|
||||||
),
|
),
|
||||||
preferOffline: preferOffline,
|
preferOffline: preferOffline,
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class MoorChatDatabase extends _$MoorChatDatabase {
|
|||||||
|
|
||||||
// you should bump this number whenever you change or add a table definition.
|
// you should bump this number whenever you change or add a table definition.
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 2;
|
int get schemaVersion => 3;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MigrationStrategy get migration => MigrationStrategy(
|
MigrationStrategy get migration => MigrationStrategy(
|
||||||
|
|||||||
@@ -42,22 +42,20 @@ class ChannelEntity extends DataClass implements Insertable<ChannelEntity> {
|
|||||||
final String? createdById;
|
final String? createdById;
|
||||||
|
|
||||||
/// Map of custom channel extraData
|
/// Map of custom channel extraData
|
||||||
final Map<String, Object>? extraData;
|
final Map<String, Object?>? extraData;
|
||||||
|
ChannelEntity(
|
||||||
ChannelEntity({
|
{required this.id,
|
||||||
required this.id,
|
required this.type,
|
||||||
required this.type,
|
required this.cid,
|
||||||
required this.cid,
|
required this.config,
|
||||||
required this.config,
|
required this.frozen,
|
||||||
required this.frozen,
|
this.lastMessageAt,
|
||||||
this.lastMessageAt,
|
required this.createdAt,
|
||||||
required this.createdAt,
|
required this.updatedAt,
|
||||||
required this.updatedAt,
|
this.deletedAt,
|
||||||
this.deletedAt,
|
required this.memberCount,
|
||||||
required this.memberCount,
|
this.createdById,
|
||||||
this.createdById,
|
this.extraData});
|
||||||
this.extraData,
|
|
||||||
});
|
|
||||||
factory ChannelEntity.fromData(
|
factory ChannelEntity.fromData(
|
||||||
Map<String, dynamic> data, GeneratedDatabase db,
|
Map<String, dynamic> data, GeneratedDatabase db,
|
||||||
{String? prefix}) {
|
{String? prefix}) {
|
||||||
@@ -135,7 +133,7 @@ class ChannelEntity extends DataClass implements Insertable<ChannelEntity> {
|
|||||||
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
||||||
memberCount: serializer.fromJson<int>(json['memberCount']),
|
memberCount: serializer.fromJson<int>(json['memberCount']),
|
||||||
createdById: serializer.fromJson<String?>(json['createdById']),
|
createdById: serializer.fromJson<String?>(json['createdById']),
|
||||||
extraData: serializer.fromJson<Map<String, Object>?>(json['extraData']),
|
extraData: serializer.fromJson<Map<String, Object?>?>(json['extraData']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
@@ -153,7 +151,7 @@ class ChannelEntity extends DataClass implements Insertable<ChannelEntity> {
|
|||||||
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
||||||
'memberCount': serializer.toJson<int>(memberCount),
|
'memberCount': serializer.toJson<int>(memberCount),
|
||||||
'createdById': serializer.toJson<String?>(createdById),
|
'createdById': serializer.toJson<String?>(createdById),
|
||||||
'extraData': serializer.toJson<Map<String, Object>?>(extraData),
|
'extraData': serializer.toJson<Map<String, Object?>?>(extraData),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +167,7 @@ class ChannelEntity extends DataClass implements Insertable<ChannelEntity> {
|
|||||||
Value<DateTime?> deletedAt = const Value.absent(),
|
Value<DateTime?> deletedAt = const Value.absent(),
|
||||||
int? memberCount,
|
int? memberCount,
|
||||||
Value<String?> createdById = const Value.absent(),
|
Value<String?> createdById = const Value.absent(),
|
||||||
Value<Map<String, Object>?> extraData = const Value.absent()}) =>
|
Value<Map<String, Object?>?> extraData = const Value.absent()}) =>
|
||||||
ChannelEntity(
|
ChannelEntity(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
type: type ?? this.type,
|
type: type ?? this.type,
|
||||||
@@ -257,7 +255,7 @@ class ChannelsCompanion extends UpdateCompanion<ChannelEntity> {
|
|||||||
final Value<DateTime?> deletedAt;
|
final Value<DateTime?> deletedAt;
|
||||||
final Value<int> memberCount;
|
final Value<int> memberCount;
|
||||||
final Value<String?> createdById;
|
final Value<String?> createdById;
|
||||||
final Value<Map<String, Object>?> extraData;
|
final Value<Map<String, Object?>?> extraData;
|
||||||
const ChannelsCompanion({
|
const ChannelsCompanion({
|
||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
this.type = const Value.absent(),
|
this.type = const Value.absent(),
|
||||||
@@ -301,7 +299,7 @@ class ChannelsCompanion extends UpdateCompanion<ChannelEntity> {
|
|||||||
Expression<DateTime?>? deletedAt,
|
Expression<DateTime?>? deletedAt,
|
||||||
Expression<int>? memberCount,
|
Expression<int>? memberCount,
|
||||||
Expression<String?>? createdById,
|
Expression<String?>? createdById,
|
||||||
Expression<Map<String, Object>?>? extraData,
|
Expression<Map<String, Object?>?>? extraData,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
@@ -331,7 +329,7 @@ class ChannelsCompanion extends UpdateCompanion<ChannelEntity> {
|
|||||||
Value<DateTime?>? deletedAt,
|
Value<DateTime?>? deletedAt,
|
||||||
Value<int>? memberCount,
|
Value<int>? memberCount,
|
||||||
Value<String?>? createdById,
|
Value<String?>? createdById,
|
||||||
Value<Map<String, Object>?>? extraData}) {
|
Value<Map<String, Object?>?>? extraData}) {
|
||||||
return ChannelsCompanion(
|
return ChannelsCompanion(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
type: type ?? this.type,
|
type: type ?? this.type,
|
||||||
@@ -638,8 +636,8 @@ class $ChannelsTable extends Channels
|
|||||||
|
|
||||||
static TypeConverter<Map<String, dynamic>, String> $converter0 =
|
static TypeConverter<Map<String, dynamic>, String> $converter0 =
|
||||||
MapConverter();
|
MapConverter();
|
||||||
static TypeConverter<Map<String, Object>, String> $converter1 =
|
static TypeConverter<Map<String, Object?>, String> $converter1 =
|
||||||
MapConverter<Object>();
|
MapConverter<Object?>();
|
||||||
}
|
}
|
||||||
|
|
||||||
class MessageEntity extends DataClass implements Insertable<MessageEntity> {
|
class MessageEntity extends DataClass implements Insertable<MessageEntity> {
|
||||||
@@ -714,7 +712,7 @@ class MessageEntity extends DataClass implements Insertable<MessageEntity> {
|
|||||||
final String? channelCid;
|
final String? channelCid;
|
||||||
|
|
||||||
/// Message custom extraData
|
/// Message custom extraData
|
||||||
final Map<String, Object>? extraData;
|
final Map<String, Object?>? extraData;
|
||||||
MessageEntity(
|
MessageEntity(
|
||||||
{required this.id,
|
{required this.id,
|
||||||
this.messageText,
|
this.messageText,
|
||||||
@@ -901,7 +899,7 @@ class MessageEntity extends DataClass implements Insertable<MessageEntity> {
|
|||||||
pinExpires: serializer.fromJson<DateTime?>(json['pinExpires']),
|
pinExpires: serializer.fromJson<DateTime?>(json['pinExpires']),
|
||||||
pinnedByUserId: serializer.fromJson<String?>(json['pinnedByUserId']),
|
pinnedByUserId: serializer.fromJson<String?>(json['pinnedByUserId']),
|
||||||
channelCid: serializer.fromJson<String?>(json['channelCid']),
|
channelCid: serializer.fromJson<String?>(json['channelCid']),
|
||||||
extraData: serializer.fromJson<Map<String, Object>?>(json['extraData']),
|
extraData: serializer.fromJson<Map<String, Object?>?>(json['extraData']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
@@ -931,7 +929,7 @@ class MessageEntity extends DataClass implements Insertable<MessageEntity> {
|
|||||||
'pinExpires': serializer.toJson<DateTime?>(pinExpires),
|
'pinExpires': serializer.toJson<DateTime?>(pinExpires),
|
||||||
'pinnedByUserId': serializer.toJson<String?>(pinnedByUserId),
|
'pinnedByUserId': serializer.toJson<String?>(pinnedByUserId),
|
||||||
'channelCid': serializer.toJson<String?>(channelCid),
|
'channelCid': serializer.toJson<String?>(channelCid),
|
||||||
'extraData': serializer.toJson<Map<String, Object>?>(extraData),
|
'extraData': serializer.toJson<Map<String, Object?>?>(extraData),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -959,7 +957,7 @@ class MessageEntity extends DataClass implements Insertable<MessageEntity> {
|
|||||||
Value<DateTime?> pinExpires = const Value.absent(),
|
Value<DateTime?> pinExpires = const Value.absent(),
|
||||||
Value<String?> pinnedByUserId = const Value.absent(),
|
Value<String?> pinnedByUserId = const Value.absent(),
|
||||||
Value<String?> channelCid = const Value.absent(),
|
Value<String?> channelCid = const Value.absent(),
|
||||||
Value<Map<String, Object>?> extraData = const Value.absent()}) =>
|
Value<Map<String, Object?>?> extraData = const Value.absent()}) =>
|
||||||
MessageEntity(
|
MessageEntity(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
messageText: messageText.present ? messageText.value : this.messageText,
|
messageText: messageText.present ? messageText.value : this.messageText,
|
||||||
@@ -1121,7 +1119,7 @@ class MessagesCompanion extends UpdateCompanion<MessageEntity> {
|
|||||||
final Value<DateTime?> pinExpires;
|
final Value<DateTime?> pinExpires;
|
||||||
final Value<String?> pinnedByUserId;
|
final Value<String?> pinnedByUserId;
|
||||||
final Value<String?> channelCid;
|
final Value<String?> channelCid;
|
||||||
final Value<Map<String, Object>?> extraData;
|
final Value<Map<String, Object?>?> extraData;
|
||||||
const MessagesCompanion({
|
const MessagesCompanion({
|
||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
this.messageText = const Value.absent(),
|
this.messageText = const Value.absent(),
|
||||||
@@ -1200,7 +1198,7 @@ class MessagesCompanion extends UpdateCompanion<MessageEntity> {
|
|||||||
Expression<DateTime?>? pinExpires,
|
Expression<DateTime?>? pinExpires,
|
||||||
Expression<String?>? pinnedByUserId,
|
Expression<String?>? pinnedByUserId,
|
||||||
Expression<String?>? channelCid,
|
Expression<String?>? channelCid,
|
||||||
Expression<Map<String, Object>?>? extraData,
|
Expression<Map<String, Object?>?>? extraData,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
@@ -1254,7 +1252,7 @@ class MessagesCompanion extends UpdateCompanion<MessageEntity> {
|
|||||||
Value<DateTime?>? pinExpires,
|
Value<DateTime?>? pinExpires,
|
||||||
Value<String?>? pinnedByUserId,
|
Value<String?>? pinnedByUserId,
|
||||||
Value<String?>? channelCid,
|
Value<String?>? channelCid,
|
||||||
Value<Map<String, Object>?>? extraData}) {
|
Value<Map<String, Object?>?>? extraData}) {
|
||||||
return MessagesCompanion(
|
return MessagesCompanion(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
messageText: messageText ?? this.messageText,
|
messageText: messageText ?? this.messageText,
|
||||||
@@ -1818,8 +1816,8 @@ class $MessagesTable extends Messages
|
|||||||
MapConverter<int>();
|
MapConverter<int>();
|
||||||
static TypeConverter<Map<String, int>, String> $converter4 =
|
static TypeConverter<Map<String, int>, String> $converter4 =
|
||||||
MapConverter<int>();
|
MapConverter<int>();
|
||||||
static TypeConverter<Map<String, Object>, String> $converter5 =
|
static TypeConverter<Map<String, Object?>, String> $converter5 =
|
||||||
MapConverter<Object>();
|
MapConverter<Object?>();
|
||||||
}
|
}
|
||||||
|
|
||||||
class PinnedMessageEntity extends DataClass
|
class PinnedMessageEntity extends DataClass
|
||||||
@@ -1895,7 +1893,7 @@ class PinnedMessageEntity extends DataClass
|
|||||||
final String? channelCid;
|
final String? channelCid;
|
||||||
|
|
||||||
/// Message custom extraData
|
/// Message custom extraData
|
||||||
final Map<String, Object>? extraData;
|
final Map<String, Object?>? extraData;
|
||||||
PinnedMessageEntity(
|
PinnedMessageEntity(
|
||||||
{required this.id,
|
{required this.id,
|
||||||
this.messageText,
|
this.messageText,
|
||||||
@@ -2082,7 +2080,7 @@ class PinnedMessageEntity extends DataClass
|
|||||||
pinExpires: serializer.fromJson<DateTime?>(json['pinExpires']),
|
pinExpires: serializer.fromJson<DateTime?>(json['pinExpires']),
|
||||||
pinnedByUserId: serializer.fromJson<String?>(json['pinnedByUserId']),
|
pinnedByUserId: serializer.fromJson<String?>(json['pinnedByUserId']),
|
||||||
channelCid: serializer.fromJson<String?>(json['channelCid']),
|
channelCid: serializer.fromJson<String?>(json['channelCid']),
|
||||||
extraData: serializer.fromJson<Map<String, Object>?>(json['extraData']),
|
extraData: serializer.fromJson<Map<String, Object?>?>(json['extraData']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
@@ -2112,7 +2110,7 @@ class PinnedMessageEntity extends DataClass
|
|||||||
'pinExpires': serializer.toJson<DateTime?>(pinExpires),
|
'pinExpires': serializer.toJson<DateTime?>(pinExpires),
|
||||||
'pinnedByUserId': serializer.toJson<String?>(pinnedByUserId),
|
'pinnedByUserId': serializer.toJson<String?>(pinnedByUserId),
|
||||||
'channelCid': serializer.toJson<String?>(channelCid),
|
'channelCid': serializer.toJson<String?>(channelCid),
|
||||||
'extraData': serializer.toJson<Map<String, Object>?>(extraData),
|
'extraData': serializer.toJson<Map<String, Object?>?>(extraData),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2140,7 +2138,7 @@ class PinnedMessageEntity extends DataClass
|
|||||||
Value<DateTime?> pinExpires = const Value.absent(),
|
Value<DateTime?> pinExpires = const Value.absent(),
|
||||||
Value<String?> pinnedByUserId = const Value.absent(),
|
Value<String?> pinnedByUserId = const Value.absent(),
|
||||||
Value<String?> channelCid = const Value.absent(),
|
Value<String?> channelCid = const Value.absent(),
|
||||||
Value<Map<String, Object>?> extraData = const Value.absent()}) =>
|
Value<Map<String, Object?>?> extraData = const Value.absent()}) =>
|
||||||
PinnedMessageEntity(
|
PinnedMessageEntity(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
messageText: messageText.present ? messageText.value : this.messageText,
|
messageText: messageText.present ? messageText.value : this.messageText,
|
||||||
@@ -2302,7 +2300,7 @@ class PinnedMessagesCompanion extends UpdateCompanion<PinnedMessageEntity> {
|
|||||||
final Value<DateTime?> pinExpires;
|
final Value<DateTime?> pinExpires;
|
||||||
final Value<String?> pinnedByUserId;
|
final Value<String?> pinnedByUserId;
|
||||||
final Value<String?> channelCid;
|
final Value<String?> channelCid;
|
||||||
final Value<Map<String, Object>?> extraData;
|
final Value<Map<String, Object?>?> extraData;
|
||||||
const PinnedMessagesCompanion({
|
const PinnedMessagesCompanion({
|
||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
this.messageText = const Value.absent(),
|
this.messageText = const Value.absent(),
|
||||||
@@ -2381,7 +2379,7 @@ class PinnedMessagesCompanion extends UpdateCompanion<PinnedMessageEntity> {
|
|||||||
Expression<DateTime?>? pinExpires,
|
Expression<DateTime?>? pinExpires,
|
||||||
Expression<String?>? pinnedByUserId,
|
Expression<String?>? pinnedByUserId,
|
||||||
Expression<String?>? channelCid,
|
Expression<String?>? channelCid,
|
||||||
Expression<Map<String, Object>?>? extraData,
|
Expression<Map<String, Object?>?>? extraData,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
@@ -2435,7 +2433,7 @@ class PinnedMessagesCompanion extends UpdateCompanion<PinnedMessageEntity> {
|
|||||||
Value<DateTime?>? pinExpires,
|
Value<DateTime?>? pinExpires,
|
||||||
Value<String?>? pinnedByUserId,
|
Value<String?>? pinnedByUserId,
|
||||||
Value<String?>? channelCid,
|
Value<String?>? channelCid,
|
||||||
Value<Map<String, Object>?>? extraData}) {
|
Value<Map<String, Object?>?>? extraData}) {
|
||||||
return PinnedMessagesCompanion(
|
return PinnedMessagesCompanion(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
messageText: messageText ?? this.messageText,
|
messageText: messageText ?? this.messageText,
|
||||||
@@ -3000,8 +2998,8 @@ class $PinnedMessagesTable extends PinnedMessages
|
|||||||
MapConverter<int>();
|
MapConverter<int>();
|
||||||
static TypeConverter<Map<String, int>, String> $converter4 =
|
static TypeConverter<Map<String, int>, String> $converter4 =
|
||||||
MapConverter<int>();
|
MapConverter<int>();
|
||||||
static TypeConverter<Map<String, Object>, String> $converter5 =
|
static TypeConverter<Map<String, Object?>, String> $converter5 =
|
||||||
MapConverter<Object>();
|
MapConverter<Object?>();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReactionEntity extends DataClass implements Insertable<ReactionEntity> {
|
class ReactionEntity extends DataClass implements Insertable<ReactionEntity> {
|
||||||
@@ -3021,7 +3019,7 @@ class ReactionEntity extends DataClass implements Insertable<ReactionEntity> {
|
|||||||
final int score;
|
final int score;
|
||||||
|
|
||||||
/// Reaction custom extraData
|
/// Reaction custom extraData
|
||||||
final Map<String, Object>? extraData;
|
final Map<String, Object?>? extraData;
|
||||||
ReactionEntity(
|
ReactionEntity(
|
||||||
{required this.userId,
|
{required this.userId,
|
||||||
required this.messageId,
|
required this.messageId,
|
||||||
@@ -3073,7 +3071,7 @@ class ReactionEntity extends DataClass implements Insertable<ReactionEntity> {
|
|||||||
type: serializer.fromJson<String>(json['type']),
|
type: serializer.fromJson<String>(json['type']),
|
||||||
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
||||||
score: serializer.fromJson<int>(json['score']),
|
score: serializer.fromJson<int>(json['score']),
|
||||||
extraData: serializer.fromJson<Map<String, Object>?>(json['extraData']),
|
extraData: serializer.fromJson<Map<String, Object?>?>(json['extraData']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
@@ -3085,7 +3083,7 @@ class ReactionEntity extends DataClass implements Insertable<ReactionEntity> {
|
|||||||
'type': serializer.toJson<String>(type),
|
'type': serializer.toJson<String>(type),
|
||||||
'createdAt': serializer.toJson<DateTime>(createdAt),
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
||||||
'score': serializer.toJson<int>(score),
|
'score': serializer.toJson<int>(score),
|
||||||
'extraData': serializer.toJson<Map<String, Object>?>(extraData),
|
'extraData': serializer.toJson<Map<String, Object?>?>(extraData),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3095,7 +3093,7 @@ class ReactionEntity extends DataClass implements Insertable<ReactionEntity> {
|
|||||||
String? type,
|
String? type,
|
||||||
DateTime? createdAt,
|
DateTime? createdAt,
|
||||||
int? score,
|
int? score,
|
||||||
Value<Map<String, Object>?> extraData = const Value.absent()}) =>
|
Value<Map<String, Object?>?> extraData = const Value.absent()}) =>
|
||||||
ReactionEntity(
|
ReactionEntity(
|
||||||
userId: userId ?? this.userId,
|
userId: userId ?? this.userId,
|
||||||
messageId: messageId ?? this.messageId,
|
messageId: messageId ?? this.messageId,
|
||||||
@@ -3144,7 +3142,7 @@ class ReactionsCompanion extends UpdateCompanion<ReactionEntity> {
|
|||||||
final Value<String> type;
|
final Value<String> type;
|
||||||
final Value<DateTime> createdAt;
|
final Value<DateTime> createdAt;
|
||||||
final Value<int> score;
|
final Value<int> score;
|
||||||
final Value<Map<String, Object>?> extraData;
|
final Value<Map<String, Object?>?> extraData;
|
||||||
const ReactionsCompanion({
|
const ReactionsCompanion({
|
||||||
this.userId = const Value.absent(),
|
this.userId = const Value.absent(),
|
||||||
this.messageId = const Value.absent(),
|
this.messageId = const Value.absent(),
|
||||||
@@ -3169,7 +3167,7 @@ class ReactionsCompanion extends UpdateCompanion<ReactionEntity> {
|
|||||||
Expression<String>? type,
|
Expression<String>? type,
|
||||||
Expression<DateTime>? createdAt,
|
Expression<DateTime>? createdAt,
|
||||||
Expression<int>? score,
|
Expression<int>? score,
|
||||||
Expression<Map<String, Object>?>? extraData,
|
Expression<Map<String, Object?>?>? extraData,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (userId != null) 'user_id': userId,
|
if (userId != null) 'user_id': userId,
|
||||||
@@ -3187,7 +3185,7 @@ class ReactionsCompanion extends UpdateCompanion<ReactionEntity> {
|
|||||||
Value<String>? type,
|
Value<String>? type,
|
||||||
Value<DateTime>? createdAt,
|
Value<DateTime>? createdAt,
|
||||||
Value<int>? score,
|
Value<int>? score,
|
||||||
Value<Map<String, Object>?>? extraData}) {
|
Value<Map<String, Object?>?>? extraData}) {
|
||||||
return ReactionsCompanion(
|
return ReactionsCompanion(
|
||||||
userId: userId ?? this.userId,
|
userId: userId ?? this.userId,
|
||||||
messageId: messageId ?? this.messageId,
|
messageId: messageId ?? this.messageId,
|
||||||
@@ -3357,8 +3355,8 @@ class $ReactionsTable extends Reactions
|
|||||||
return $ReactionsTable(_db, alias);
|
return $ReactionsTable(_db, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TypeConverter<Map<String, Object>, String> $converter0 =
|
static TypeConverter<Map<String, Object?>, String> $converter0 =
|
||||||
MapConverter<Object>();
|
MapConverter<Object?>();
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserEntity extends DataClass implements Insertable<UserEntity> {
|
class UserEntity extends DataClass implements Insertable<UserEntity> {
|
||||||
@@ -3384,7 +3382,7 @@ class UserEntity extends DataClass implements Insertable<UserEntity> {
|
|||||||
final bool banned;
|
final bool banned;
|
||||||
|
|
||||||
/// Map of custom user extraData
|
/// Map of custom user extraData
|
||||||
final Map<String, Object> extraData;
|
final Map<String, Object?> extraData;
|
||||||
UserEntity(
|
UserEntity(
|
||||||
{required this.id,
|
{required this.id,
|
||||||
this.role,
|
this.role,
|
||||||
@@ -3449,7 +3447,7 @@ class UserEntity extends DataClass implements Insertable<UserEntity> {
|
|||||||
lastActive: serializer.fromJson<DateTime?>(json['lastActive']),
|
lastActive: serializer.fromJson<DateTime?>(json['lastActive']),
|
||||||
online: serializer.fromJson<bool>(json['online']),
|
online: serializer.fromJson<bool>(json['online']),
|
||||||
banned: serializer.fromJson<bool>(json['banned']),
|
banned: serializer.fromJson<bool>(json['banned']),
|
||||||
extraData: serializer.fromJson<Map<String, Object>>(json['extraData']),
|
extraData: serializer.fromJson<Map<String, Object?>>(json['extraData']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
@@ -3463,7 +3461,7 @@ class UserEntity extends DataClass implements Insertable<UserEntity> {
|
|||||||
'lastActive': serializer.toJson<DateTime?>(lastActive),
|
'lastActive': serializer.toJson<DateTime?>(lastActive),
|
||||||
'online': serializer.toJson<bool>(online),
|
'online': serializer.toJson<bool>(online),
|
||||||
'banned': serializer.toJson<bool>(banned),
|
'banned': serializer.toJson<bool>(banned),
|
||||||
'extraData': serializer.toJson<Map<String, Object>>(extraData),
|
'extraData': serializer.toJson<Map<String, Object?>>(extraData),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3475,7 +3473,7 @@ class UserEntity extends DataClass implements Insertable<UserEntity> {
|
|||||||
Value<DateTime?> lastActive = const Value.absent(),
|
Value<DateTime?> lastActive = const Value.absent(),
|
||||||
bool? online,
|
bool? online,
|
||||||
bool? banned,
|
bool? banned,
|
||||||
Map<String, Object>? extraData}) =>
|
Map<String, Object?>? extraData}) =>
|
||||||
UserEntity(
|
UserEntity(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
role: role.present ? role.value : this.role,
|
role: role.present ? role.value : this.role,
|
||||||
@@ -3536,7 +3534,7 @@ class UsersCompanion extends UpdateCompanion<UserEntity> {
|
|||||||
final Value<DateTime?> lastActive;
|
final Value<DateTime?> lastActive;
|
||||||
final Value<bool> online;
|
final Value<bool> online;
|
||||||
final Value<bool> banned;
|
final Value<bool> banned;
|
||||||
final Value<Map<String, Object>> extraData;
|
final Value<Map<String, Object?>> extraData;
|
||||||
const UsersCompanion({
|
const UsersCompanion({
|
||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
this.role = const Value.absent(),
|
this.role = const Value.absent(),
|
||||||
@@ -3555,7 +3553,7 @@ class UsersCompanion extends UpdateCompanion<UserEntity> {
|
|||||||
this.lastActive = const Value.absent(),
|
this.lastActive = const Value.absent(),
|
||||||
this.online = const Value.absent(),
|
this.online = const Value.absent(),
|
||||||
this.banned = const Value.absent(),
|
this.banned = const Value.absent(),
|
||||||
required Map<String, Object> extraData,
|
required Map<String, Object?> extraData,
|
||||||
}) : id = Value(id),
|
}) : id = Value(id),
|
||||||
extraData = Value(extraData);
|
extraData = Value(extraData);
|
||||||
static Insertable<UserEntity> custom({
|
static Insertable<UserEntity> custom({
|
||||||
@@ -3566,7 +3564,7 @@ class UsersCompanion extends UpdateCompanion<UserEntity> {
|
|||||||
Expression<DateTime?>? lastActive,
|
Expression<DateTime?>? lastActive,
|
||||||
Expression<bool>? online,
|
Expression<bool>? online,
|
||||||
Expression<bool>? banned,
|
Expression<bool>? banned,
|
||||||
Expression<Map<String, Object>>? extraData,
|
Expression<Map<String, Object?>>? extraData,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
@@ -3588,7 +3586,7 @@ class UsersCompanion extends UpdateCompanion<UserEntity> {
|
|||||||
Value<DateTime?>? lastActive,
|
Value<DateTime?>? lastActive,
|
||||||
Value<bool>? online,
|
Value<bool>? online,
|
||||||
Value<bool>? banned,
|
Value<bool>? banned,
|
||||||
Value<Map<String, Object>>? extraData}) {
|
Value<Map<String, Object?>>? extraData}) {
|
||||||
return UsersCompanion(
|
return UsersCompanion(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
role: role ?? this.role,
|
role: role ?? this.role,
|
||||||
@@ -3791,8 +3789,8 @@ class $UsersTable extends Users with TableInfo<$UsersTable, UserEntity> {
|
|||||||
return $UsersTable(_db, alias);
|
return $UsersTable(_db, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TypeConverter<Map<String, Object>, String> $converter0 =
|
static TypeConverter<Map<String, Object?>, String> $converter0 =
|
||||||
MapConverter<Object>();
|
MapConverter<Object?>();
|
||||||
}
|
}
|
||||||
|
|
||||||
class MemberEntity extends DataClass implements Insertable<MemberEntity> {
|
class MemberEntity extends DataClass implements Insertable<MemberEntity> {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class Channels extends Table {
|
|||||||
TextColumn get createdById => text().nullable()();
|
TextColumn get createdById => text().nullable()();
|
||||||
|
|
||||||
/// Map of custom channel extraData
|
/// Map of custom channel extraData
|
||||||
TextColumn get extraData => text().nullable().map(MapConverter<Object>())();
|
TextColumn get extraData => text().nullable().map(MapConverter<Object?>())();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {cid};
|
Set<Column> get primaryKey => {cid};
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class Messages extends Table {
|
|||||||
'NULLABLE REFERENCES channels(cid) ON DELETE CASCADE')();
|
'NULLABLE REFERENCES channels(cid) ON DELETE CASCADE')();
|
||||||
|
|
||||||
/// Message custom extraData
|
/// Message custom extraData
|
||||||
TextColumn get extraData => text().nullable().map(MapConverter<Object>())();
|
TextColumn get extraData => text().nullable().map(MapConverter<Object?>())();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {id};
|
Set<Column> get primaryKey => {id};
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Reactions extends Table {
|
|||||||
IntColumn get score => integer().withDefault(const Constant(0))();
|
IntColumn get score => integer().withDefault(const Constant(0))();
|
||||||
|
|
||||||
/// Reaction custom extraData
|
/// Reaction custom extraData
|
||||||
TextColumn get extraData => text().nullable().map(MapConverter<Object>())();
|
TextColumn get extraData => text().nullable().map(MapConverter<Object?>())();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {
|
Set<Column> get primaryKey => {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Users extends Table {
|
|||||||
BoolColumn get banned => boolean().withDefault(const Constant(false))();
|
BoolColumn get banned => boolean().withDefault(const Constant(false))();
|
||||||
|
|
||||||
/// Map of custom user extraData
|
/// Map of custom user extraData
|
||||||
TextColumn get extraData => text().map(MapConverter<Object>())();
|
TextColumn get extraData => text().map(MapConverter<Object?>())();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {id};
|
Set<Column> get primaryKey => {id};
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ extension MessageEntityX on MessageEntity {
|
|||||||
pinnedAt: pinnedAt,
|
pinnedAt: pinnedAt,
|
||||||
pinExpires: pinExpires,
|
pinExpires: pinExpires,
|
||||||
pinnedBy: pinnedBy,
|
pinnedBy: pinnedBy,
|
||||||
|
mentionedUsers:
|
||||||
|
mentionedUsers.map((e) => User.fromJson(jsonDecode(e))).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'package:stream_chat_persistence/src/db/moor_chat_database.dart';
|
|||||||
extension ReactionEntityX on ReactionEntity {
|
extension ReactionEntityX on ReactionEntity {
|
||||||
/// Maps a [ReactionEntity] into [Reaction]
|
/// Maps a [ReactionEntity] into [Reaction]
|
||||||
Reaction toReaction({User? user}) => Reaction(
|
Reaction toReaction({User? user}) => Reaction(
|
||||||
extraData: extraData,
|
extraData: extraData ?? {},
|
||||||
type: type,
|
type: type,
|
||||||
createdAt: createdAt,
|
createdAt: createdAt,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ void main() {
|
|||||||
(prev, curr) =>
|
(prev, curr) =>
|
||||||
prev?..update(curr.type, (value) => value + 1, ifAbsent: () => 1),
|
prev?..update(curr.type, (value) => value + 1, ifAbsent: () => 1),
|
||||||
),
|
),
|
||||||
mentionedUsers: const [],
|
mentionedUsers: [
|
||||||
|
jsonEncode(User(id: 'testuser')),
|
||||||
|
],
|
||||||
status: MessageSendingStatus.sent,
|
status: MessageSendingStatus.sent,
|
||||||
updatedAt: DateTime.now(),
|
updatedAt: DateTime.now(),
|
||||||
extraData: {'extra_test_data': 'extraData'},
|
extraData: {'extra_test_data': 'extraData'},
|
||||||
@@ -77,6 +79,11 @@ void main() {
|
|||||||
expect(message.createdAt, isSameDateAs(entity.createdAt));
|
expect(message.createdAt, isSameDateAs(entity.createdAt));
|
||||||
expect(message.shadowed, entity.shadowed);
|
expect(message.shadowed, entity.shadowed);
|
||||||
expect(message.showInChannel, entity.showInChannel);
|
expect(message.showInChannel, entity.showInChannel);
|
||||||
|
for (var i = 0; i < message.mentionedUsers.length; i++) {
|
||||||
|
final entityMentionedUser =
|
||||||
|
User.fromJson(jsonDecode(entity.mentionedUsers[i]));
|
||||||
|
expect(message.mentionedUsers[i].id, entityMentionedUser.id);
|
||||||
|
}
|
||||||
expect(message.replyCount, entity.replyCount);
|
expect(message.replyCount, entity.replyCount);
|
||||||
expect(message.reactionScores, entity.reactionScores);
|
expect(message.reactionScores, entity.reactionScores);
|
||||||
expect(message.reactionCounts, entity.reactionCounts);
|
expect(message.reactionCounts, entity.reactionCounts);
|
||||||
@@ -135,6 +142,9 @@ void main() {
|
|||||||
shadowed: math.Random().nextBool(),
|
shadowed: math.Random().nextBool(),
|
||||||
showInChannel: math.Random().nextBool(),
|
showInChannel: math.Random().nextBool(),
|
||||||
replyCount: 33,
|
replyCount: 33,
|
||||||
|
mentionedUsers: [
|
||||||
|
User(id: 'testuser'),
|
||||||
|
],
|
||||||
reactionScores: {for (final r in reactions) r.type: r.score},
|
reactionScores: {for (final r in reactions) r.type: r.score},
|
||||||
reactionCounts: reactions.fold(
|
reactionCounts: reactions.fold(
|
||||||
{},
|
{},
|
||||||
@@ -163,6 +173,8 @@ void main() {
|
|||||||
expect(entity.shadowed, message.shadowed);
|
expect(entity.shadowed, message.shadowed);
|
||||||
expect(entity.showInChannel, message.showInChannel);
|
expect(entity.showInChannel, message.showInChannel);
|
||||||
expect(entity.replyCount, message.replyCount);
|
expect(entity.replyCount, message.replyCount);
|
||||||
|
expect(entity.mentionedUsers,
|
||||||
|
message.mentionedUsers.map((e) => jsonEncode(e)).toList());
|
||||||
expect(entity.reactionScores, message.reactionScores);
|
expect(entity.reactionScores, message.reactionScores);
|
||||||
expect(entity.reactionCounts, message.reactionCounts);
|
expect(entity.reactionCounts, message.reactionCounts);
|
||||||
expect(entity.status, message.status);
|
expect(entity.status, message.status);
|
||||||
|
|||||||
Reference in New Issue
Block a user