fix(llc): update member presence and add skip_push to message (#314)

* update member presence

* add skip_push to message

* fix tests
This commit is contained in:
Salvatore Giordano
2021-03-05 09:56:00 +01:00
committed by GitHub
parent a4ebd48272
commit cef1b56c58
6 changed files with 62 additions and 1 deletions
@@ -72,6 +72,7 @@ class Message {
this.extraData,
this.deletedAt,
this.status = MessageSendingStatus.sent,
this.skipPush,
}) : id = id ?? Uuid().v4(),
pinExpires = pinExpires?.toUtc();
@@ -143,6 +144,9 @@ class Message {
/// If true the message is silent
final bool silent;
/// If true the message will not send a push notification
final bool skipPush;
/// If true the message is shadowed
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
final bool shadowed;
@@ -226,6 +230,7 @@ class Message {
'pinned_at',
'pin_expires',
'pinned_by',
'skip_push',
];
/// Serialize to json
@@ -262,6 +267,7 @@ class Message {
User pinnedBy,
Map<String, dynamic> extraData,
MessageSendingStatus status,
bool skipPush,
}) {
assert(() {
if (pinExpires is! DateTime &&
@@ -300,6 +306,7 @@ class Message {
pinnedAt: pinnedAt ?? this.pinnedAt,
pinnedBy: pinnedBy ?? this.pinnedBy,
pinExpires: pinExpires == _pinExpires ? this.pinExpires : pinExpires,
skipPush: skipPush ?? this.skipPush,
);
}
@@ -93,6 +93,7 @@ Message _$MessageFromJson(Map json) {
deletedAt: json['deleted_at'] == null
? null
: DateTime.parse(json['deleted_at'] as String),
skipPush: json['skip_push'] as bool,
);
}
@@ -123,6 +124,7 @@ Map<String, dynamic> _$MessageToJson(Message instance) {
writeNotNull('thread_participants', readonly(instance.threadParticipants));
val['show_in_channel'] = instance.showInChannel;
val['silent'] = instance.silent;
val['skip_push'] = instance.skipPush;
writeNotNull('shadowed', readonly(instance.shadowed));
writeNotNull('command', readonly(instance.command));
writeNotNull('created_at', readonly(instance.createdAt));