Merge pull request #2803 from krille-chan/krille/persist-active-filter
feat: Persist chat filters
This commit is contained in:
commit
b38d111264
2 changed files with 9 additions and 2 deletions
|
|
@ -69,7 +69,8 @@ enum AppSettings<T> {
|
|||
sendTimelineEventTimeout<int>('chat.fluffy.send_timeline_event_timeout', 15),
|
||||
lastSeenSupportBanner<int>('chat.fluffy.last_seen_support_banner', 0),
|
||||
supportBannerOptOut<bool>('chat.fluffy.support_banner_opt_out', false),
|
||||
webNotificationSound<bool>('chat.fluffy.web_notification_sound', true);
|
||||
webNotificationSound<bool>('chat.fluffy.web_notification_sound', true),
|
||||
chatFilter<String>('chat.fluffy.chat_filter', 'allChats');
|
||||
|
||||
final String key;
|
||||
final T defaultValue;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:cross_file/cross_file.dart';
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
|
|
@ -359,7 +360,11 @@ class ChatListController extends State<ChatList>
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
activeFilter = ActiveFilter.allChats;
|
||||
activeFilter =
|
||||
ActiveFilter.values.singleWhereOrNull(
|
||||
(filter) => AppSettings.chatFilter.value == filter.name,
|
||||
) ??
|
||||
ActiveFilter.allChats;
|
||||
_initReceiveSharingIntent();
|
||||
_activeSpaceId = widget.activeSpace;
|
||||
|
||||
|
|
@ -857,6 +862,7 @@ class ChatListController extends State<ChatList>
|
|||
setState(() {
|
||||
activeFilter = filter;
|
||||
});
|
||||
AppSettings.chatFilter.setItem(filter.name);
|
||||
}
|
||||
|
||||
void setActiveClient(Client client) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue