revert message.dart

This commit is contained in:
Salvatore Giordano
2021-12-13 11:44:33 +01:00
parent 527ac4563f
commit b372f7b3f8
2 changed files with 11 additions and 7 deletions
@@ -76,8 +76,8 @@ class Message extends Equatable {
this.i18n, this.i18n,
}) : id = id ?? const Uuid().v4(), }) : id = id ?? const Uuid().v4(),
pinExpires = pinExpires?.toUtc(), pinExpires = pinExpires?.toUtc(),
createdAt = createdAt ?? DateTime.now(), _createdAt = createdAt,
updatedAt = updatedAt ?? DateTime.now(), _updatedAt = updatedAt,
_quotedMessageId = quotedMessageId; _quotedMessageId = quotedMessageId;
/// Create a new instance from a json /// Create a new instance from a json
@@ -167,13 +167,17 @@ class Message extends Equatable {
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly) @JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
final String? command; final String? command;
final DateTime? _createdAt;
/// Reserved field indicating when the message was created. /// Reserved field indicating when the message was created.
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly) @JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
final DateTime createdAt; DateTime get createdAt => _createdAt ?? DateTime.now();
final DateTime? _updatedAt;
/// Reserved field indicating when the message was updated last time. /// Reserved field indicating when the message was updated last time.
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly) @JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
final DateTime updatedAt; DateTime get updatedAt => _updatedAt ?? DateTime.now();
/// User who sent the message /// User who sent the message
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly) @JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
@@ -311,12 +315,12 @@ class Message extends Equatable {
threadParticipants: threadParticipants ?? this.threadParticipants, threadParticipants: threadParticipants ?? this.threadParticipants,
showInChannel: showInChannel ?? this.showInChannel, showInChannel: showInChannel ?? this.showInChannel,
command: command ?? this.command, command: command ?? this.command,
createdAt: createdAt ?? this.createdAt, createdAt: createdAt ?? _createdAt,
silent: silent ?? this.silent, silent: silent ?? this.silent,
extraData: extraData ?? this.extraData, extraData: extraData ?? this.extraData,
user: user ?? this.user, user: user ?? this.user,
shadowed: shadowed ?? this.shadowed, shadowed: shadowed ?? this.shadowed,
updatedAt: updatedAt ?? this.updatedAt, updatedAt: updatedAt ?? _updatedAt,
deletedAt: deletedAt ?? this.deletedAt, deletedAt: deletedAt ?? this.deletedAt,
status: status ?? this.status, status: status ?? this.status,
pinned: pinned ?? this.pinned, pinned: pinned ?? this.pinned,
@@ -1526,7 +1526,7 @@ class MessageInputState extends State<MessageInput> {
Future<void> sendMessage() async { Future<void> sendMessage() async {
var message = messageInputController.value; var message = messageInputController.value;
if (messageInputController.isValid) { if (!messageInputController.isValid) {
return; return;
} }