From ef5ab9ce048faf010dc0415a562d4c6354bdfbc9 Mon Sep 17 00:00:00 2001 From: RaulRodrigo06 Date: Thu, 16 Nov 2023 16:47:05 -0300 Subject: [PATCH] fix: removing unecessary reply content and fixing return --- lib/src/models/ds_message_item.model.dart | 5 ----- lib/src/widgets/chat/ds_reply_container.widget.dart | 8 ++------ lib/src/widgets/utils/ds_card.widget.dart | 2 +- lib/src/widgets/utils/ds_group_card.widget.dart | 1 - 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/src/models/ds_message_item.model.dart b/lib/src/models/ds_message_item.model.dart index aeaf1ebf..e4d01fcf 100644 --- a/lib/src/models/ds_message_item.model.dart +++ b/lib/src/models/ds_message_item.model.dart @@ -27,9 +27,6 @@ class DSMessageItemModel { /// Customer data Map? customer; - /// The message content - dynamic replyContent; - /// Used to define if a message detail (typicament a messages date and time) should be displayed or not bool? hideMessageDetail; @@ -44,7 +41,6 @@ class DSMessageItemModel { this.content, this.customer, this.hideMessageDetail, - this.replyContent, }); factory DSMessageItemModel.fromJson(Map json) { @@ -57,7 +53,6 @@ class DSMessageItemModel { content: json['content'], status: DSDeliveryReportStatus.unknown.getValue(json['status']), hideMessageDetail: json['hideMessageDetail'], - replyContent: json['replyContent'], ); if (json.containsKey('customer')) { diff --git a/lib/src/widgets/chat/ds_reply_container.widget.dart b/lib/src/widgets/chat/ds_reply_container.widget.dart index ff0fb12e..83199263 100644 --- a/lib/src/widgets/chat/ds_reply_container.widget.dart +++ b/lib/src/widgets/chat/ds_reply_container.widget.dart @@ -100,14 +100,10 @@ Widget _replyWidget( DSMessageBubbleStyle style, DSAlign align, ) { - final replyType = - replyContent != '' ? replyContent['content']['replied']['type'] : ''; - switch (replyType) { + switch (replyContent['type']) { case DSMessageContentType.textPlain: return DSBodyText( - replyContent['content']['replied']['value'] is String - ? replyContent['content']['replied']['value'] - : '**********', + replyContent['value'] is String ? replyContent['value'] : '**********', color: _color(align, style), overflow: TextOverflow.visible, ); diff --git a/lib/src/widgets/utils/ds_card.widget.dart b/lib/src/widgets/utils/ds_card.widget.dart index b0f996fb..c2120496 100644 --- a/lib/src/widgets/utils/ds_card.widget.dart +++ b/lib/src/widgets/utils/ds_card.widget.dart @@ -94,7 +94,7 @@ class DSCard extends StatelessWidget { onOpenLink: onOpenLink, messageId: messageId, customer: customer, - replyContent: replyContent, + replyContent: content['inReplyTo'], ); case DSMessageContentType.mediaLink: diff --git a/lib/src/widgets/utils/ds_group_card.widget.dart b/lib/src/widgets/utils/ds_group_card.widget.dart index b4f94dbb..c74dd0ed 100644 --- a/lib/src/widgets/utils/ds_group_card.widget.dart +++ b/lib/src/widgets/utils/ds_group_card.widget.dart @@ -261,7 +261,6 @@ class _DSGroupCardState extends State { onOpenLink: widget.onOpenLink, messageId: message.id, customer: message.customer, - replyContent: message.replyContent, ); final isLastMsg = msgCount == length;