chore: Bring back separate chat types

This commit is contained in:
krille-chan 2024-07-22 19:42:27 +02:00
parent e178ab4416
commit 0760acaa40
No known key found for this signature in database
6 changed files with 23 additions and 3 deletions

View file

@ -44,6 +44,7 @@ abstract class AppConfig {
static bool hideRedactedEvents = false;
static bool hideUnknownEvents = true;
static bool hideUnimportantStateEvents = true;
static bool separateChatTypes = false;
static bool autoplayImages = true;
static bool sendTypingNotifications = true;
static bool sendPublicReadReceipts = true;

View file

@ -4,6 +4,7 @@ abstract class SettingKeys {
static const String hideUnknownEvents = 'chat.fluffy.hideUnknownEvents';
static const String hideUnimportantStateEvents =
'chat.fluffy.hideUnimportantStateEvents';
static const String separateChatTypes = 'chat.fluffy.separateChatTypes';
static const String sentry = 'sentry';
static const String theme = 'theme';
static const String amoledEnabled = 'amoled_enabled';

View file

@ -50,8 +50,9 @@ enum PopupMenuAction {
enum ActiveFilter {
allChats,
unread,
messages,
groups,
unread,
spaces,
}
@ -60,6 +61,8 @@ extension LocalizedActiveFilter on ActiveFilter {
switch (this) {
case ActiveFilter.allChats:
return L10n.of(context)!.all;
case ActiveFilter.messages:
return L10n.of(context)!.messages;
case ActiveFilter.unread:
return L10n.of(context)!.unread;
case ActiveFilter.groups:
@ -321,6 +324,8 @@ class ChatListController extends State<ChatList>
switch (activeFilter) {
case ActiveFilter.allChats:
return (room) => true;
case ActiveFilter.messages:
return (room) => !room.isSpace && room.isDirectChat;
case ActiveFilter.groups:
return (room) => !room.isSpace && !room.isDirectChat;
case ActiveFilter.unread:

View file

@ -165,9 +165,12 @@ class ChatListViewBody extends StatelessWidget {
shrinkWrap: true,
scrollDirection: Axis.horizontal,
children: [
ActiveFilter.allChats,
ActiveFilter.unread,
if (AppConfig.separateChatTypes)
ActiveFilter.messages
else
ActiveFilter.allChats,
ActiveFilter.groups,
ActiveFilter.unread,
if (spaceDelegateCandidates.isNotEmpty &&
!controller.widget.displayNavigationRail)
ActiveFilter.spaces,

View file

@ -185,6 +185,12 @@ class SettingsStyleView extends StatelessWidget {
storeKey: SettingKeys.showPresences,
defaultValue: AppConfig.showPresences,
),
SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.separateChatTypes,
onChanged: (b) => AppConfig.separateChatTypes = b,
storeKey: SettingKeys.separateChatTypes,
defaultValue: AppConfig.separateChatTypes,
),
Divider(
height: 1,
color: Theme.of(context).dividerColor,

View file

@ -433,6 +433,10 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
store.getBool(SettingKeys.hideUnimportantStateEvents) ??
AppConfig.hideUnimportantStateEvents;
AppConfig.separateChatTypes =
store.getBool(SettingKeys.separateChatTypes) ??
AppConfig.separateChatTypes;
AppConfig.autoplayImages =
store.getBool(SettingKeys.autoplayImages) ?? AppConfig.autoplayImages;