From e43a4ad65f1d4eadd5196e8fde4eb332b0010d64 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sun, 14 Apr 2024 12:00:43 +0200 Subject: [PATCH] design: Adjust chat settings design --- assets/l10n/intl_en.arb | 6 +++- .../settings_chat/settings_chat_view.dart | 28 ++++++++++++------- .../filtered_timeline_extension.dart | 12 -------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index acf07430..7b834444 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -929,7 +929,9 @@ "type": "text", "placeholders": {} }, - "hideUnknownEvents": "Hide unknown events", + "hideRedactedMessages": "Hide redacted messages", + "hideRedactedMessagesBody": "If someone redacts a message, this message won't be visible in the chat anymore.", + "hideInvalidOrUnknownMessageFormats": "Hide invalid or unknown message formats", "@hideUnknownEvents": { "type": "text", "placeholders": {} @@ -1384,6 +1386,8 @@ "type": "text", "placeholders": {} }, + "hideMemberChangesInPublicChats": "Hide member changes in public chats", + "hideMemberChangesInPublicChatsBody": "Do not show in the chat timeline if someone joins or leaves a public chat to improve readability.", "overview": "Overview", "notifyMeFor": "Notify me for", "passwordRecoverySettings": "Password recovery settings", diff --git a/lib/pages/settings_chat/settings_chat_view.dart b/lib/pages/settings_chat/settings_chat_view.dart index 70c7938f..17b0f270 100644 --- a/lib/pages/settings_chat/settings_chat_view.dart +++ b/lib/pages/settings_chat/settings_chat_view.dart @@ -31,7 +31,10 @@ class SettingsChatView extends StatelessWidget { trailing: const Icon(Icons.chevron_right_outlined), leading: const Icon(Icons.emoji_emotions_outlined), ), - const Divider(), + Divider( + height: 1, + color: Theme.of(context).dividerColor, + ), SettingsSwitchListTile.adaptive( title: L10n.of(context)!.formattedMessages, subtitle: L10n.of(context)!.formattedMessagesDescription, @@ -40,23 +43,25 @@ class SettingsChatView extends StatelessWidget { defaultValue: AppConfig.renderHtml, ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.hideRedactedEvents, + title: L10n.of(context)!.hideMemberChangesInPublicChats, + subtitle: L10n.of(context)!.hideMemberChangesInPublicChatsBody, + onChanged: (b) => AppConfig.hideUnimportantStateEvents = b, + storeKey: SettingKeys.hideUnimportantStateEvents, + defaultValue: AppConfig.hideUnimportantStateEvents, + ), + SettingsSwitchListTile.adaptive( + title: L10n.of(context)!.hideRedactedMessages, + subtitle: L10n.of(context)!.hideRedactedMessagesBody, onChanged: (b) => AppConfig.hideRedactedEvents = b, storeKey: SettingKeys.hideRedactedEvents, defaultValue: AppConfig.hideRedactedEvents, ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.hideUnknownEvents, + title: L10n.of(context)!.hideInvalidOrUnknownMessageFormats, onChanged: (b) => AppConfig.hideUnknownEvents = b, storeKey: SettingKeys.hideUnknownEvents, defaultValue: AppConfig.hideUnknownEvents, ), - SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.hideUnimportantStateEvents, - onChanged: (b) => AppConfig.hideUnimportantStateEvents = b, - storeKey: SettingKeys.hideUnimportantStateEvents, - defaultValue: AppConfig.hideUnimportantStateEvents, - ), if (PlatformInfos.isMobile) SettingsSwitchListTile.adaptive( title: L10n.of(context)!.autoplayImages, @@ -64,7 +69,10 @@ class SettingsChatView extends StatelessWidget { storeKey: SettingKeys.autoplayImages, defaultValue: AppConfig.autoplayImages, ), - const Divider(), + Divider( + height: 1, + color: Theme.of(context).dividerColor, + ), SettingsSwitchListTile.adaptive( title: L10n.of(context)!.sendOnEnter, onChanged: (b) => AppConfig.sendOnEnter = b, diff --git a/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart b/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart index 7ae2bf0c..bd1cd8e4 100644 --- a/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart +++ b/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart @@ -18,10 +18,6 @@ extension IsStateExtension on Event { (!AppConfig.hideUnknownEvents || isEventTypeKnown) && // remove state events that we don't want to render (isState || !AppConfig.hideAllStateEvents) && - // hide unimportant state events - (!AppConfig.hideUnimportantStateEvents || - !isState || - importantStateEvents.contains(type)) && // hide simple join/leave member events in public rooms (!AppConfig.hideUnimportantStateEvents || type != EventTypes.RoomMember || @@ -29,14 +25,6 @@ extension IsStateExtension on Event { content.tryGet('membership') == 'ban' || stateKey != senderId); - static const Set importantStateEvents = { - EventTypes.Encryption, - EventTypes.RoomCreate, - EventTypes.RoomMember, - EventTypes.RoomTombstone, - EventTypes.CallInvite, - }; - bool get isState => !{ EventTypes.Message, EventTypes.Sticker,