mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 01:05:17 +00:00
chore: Bring back separate chat types
This commit is contained in:
parent
e178ab4416
commit
0760acaa40
6 changed files with 23 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue