From cf74c231bb2a28c73de4f03203cfc5252d8039a3 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Sun, 22 Aug 2021 17:51:58 +0200 Subject: [PATCH] feat: use the stripped body for notifications and room previews --- lib/utils/background_push.dart | 7 +------ lib/widgets/list_items/chat_list_item.dart | 6 +----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart index 0279fcee..b006926e 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart @@ -595,12 +595,7 @@ class BackgroundPush { final title = l10n.unreadMessages(room.notificationCount); // Calculate the body - final body = event?.getLocalizedBody( - MatrixLocals(l10n), - withSenderNamePrefix: true, - hideReply: true, - ) ?? - l10n.openAppToReadMessages; + final body = event?.plaintextBody ?? l10n.openAppToReadMessages; // The person object for the android message style notification final avatar = room.avatar == null diff --git a/lib/widgets/list_items/chat_list_item.dart b/lib/widgets/list_items/chat_list_item.dart index d34bf9ee..4e9ac5bb 100644 --- a/lib/widgets/list_items/chat_list_item.dart +++ b/lib/widgets/list_items/chat_list_item.dart @@ -268,11 +268,7 @@ class ChatListItem extends StatelessWidget { : Text( room.membership == Membership.invite ? L10n.of(context).youAreInvitedToThisChat - : room.lastEvent?.getLocalizedBody( - MatrixLocals(L10n.of(context)), - hideReply: true, - ) ?? - '', + : room.lastEvent?.plaintextBody, softWrap: false, maxLines: 1, overflow: TextOverflow.ellipsis,