chore: Bring back separate chat types

pull/1320/head
krille-chan 12 months ago
parent e178ab4416
commit 0760acaa40
No known key found for this signature in database

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

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

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

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

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

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

Loading…
Cancel
Save