feat: Option to hide redacted and unknown events
This commit is contained in:
parent
29d6d7a793
commit
d500476fbc
16 changed files with 118 additions and 38 deletions
|
|
@ -34,6 +34,7 @@ import 'package:swipe_to_action/swipe_to_action.dart';
|
|||
import '../components/dialogs/send_file_dialog.dart';
|
||||
import '../components/input_bar.dart';
|
||||
import '../utils/matrix_file_extension.dart';
|
||||
import '../config/app_config.dart';
|
||||
import 'chat_details.dart';
|
||||
import 'chat_list.dart';
|
||||
|
||||
|
|
@ -411,9 +412,15 @@ class _ChatState extends State<_Chat> {
|
|||
|
||||
List<Event> getFilteredEvents() => timeline.events
|
||||
.where((e) =>
|
||||
![RelationshipTypes.Edit, RelationshipTypes.Reaction]
|
||||
// always filter out edit and reaction relationships
|
||||
!{RelationshipTypes.Edit, RelationshipTypes.Reaction}
|
||||
.contains(e.relationshipType) &&
|
||||
e.type != 'm.reaction')
|
||||
// if a reaction has been redacted we also want it to appear in the timeline
|
||||
e.type != EventTypes.Reaction &&
|
||||
// if we enabled to hide all redacted events, don't show those
|
||||
(!AppConfig.hideRedactedEvents || !e.redacted) &&
|
||||
// if we enabled to hide all unknown events, don't show those
|
||||
(!AppConfig.hideUnknownEvents || e.isEventTypeKnown))
|
||||
.toList();
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ import '../components/content_banner.dart';
|
|||
import '../components/dialogs/simple_dialogs.dart';
|
||||
import '../components/matrix.dart';
|
||||
import '../utils/app_route.dart';
|
||||
import '../config/app_config.dart';
|
||||
import '../config/setting_keys.dart';
|
||||
import 'app_info.dart';
|
||||
import 'chat_list.dart';
|
||||
import 'settings_emotes.dart';
|
||||
|
|
@ -115,7 +117,7 @@ class _SettingsState extends State<Settings> {
|
|||
jitsi += '/';
|
||||
}
|
||||
final matrix = Matrix.of(context);
|
||||
await matrix.store.setItem('chat.fluffy.jitsi_instance', jitsi);
|
||||
await matrix.store.setItem(SettingKeys.jitsiInstance, jitsi);
|
||||
matrix.jitsiInstance = jitsi;
|
||||
}
|
||||
|
||||
|
|
@ -179,13 +181,13 @@ class _SettingsState extends State<Settings> {
|
|||
Matrix.of(context).wallpaper = File(wallpaper.path);
|
||||
await Matrix.of(context)
|
||||
.store
|
||||
.setItem('chat.fluffy.wallpaper', wallpaper.path);
|
||||
.setItem(SettingKeys.wallpaper, wallpaper.path);
|
||||
setState(() => null);
|
||||
}
|
||||
|
||||
void deleteWallpaperAction(BuildContext context) async {
|
||||
Matrix.of(context).wallpaper = null;
|
||||
await Matrix.of(context).store.deleteItem('chat.fluffy.wallpaper');
|
||||
await Matrix.of(context).store.deleteItem(SettingKeys.wallpaper);
|
||||
setState(() => null);
|
||||
}
|
||||
|
||||
|
|
@ -340,13 +342,39 @@ class _SettingsState extends State<Settings> {
|
|||
ListTile(
|
||||
title: Text(L10n.of(context).renderRichContent),
|
||||
trailing: Switch(
|
||||
value: Matrix.of(context).renderHtml,
|
||||
value: AppConfig.renderHtml,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
onChanged: (bool newValue) async {
|
||||
Matrix.of(context).renderHtml = newValue;
|
||||
AppConfig.renderHtml = newValue;
|
||||
await Matrix.of(context)
|
||||
.store
|
||||
.setItem('chat.fluffy.renderHtml', newValue ? '1' : '0');
|
||||
.setItem(SettingKeys.renderHtml, newValue.toString());
|
||||
setState(() => null);
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10n.of(context).hideRedactedEvents),
|
||||
trailing: Switch(
|
||||
value: AppConfig.hideRedactedEvents,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
onChanged: (bool newValue) async {
|
||||
AppConfig.hideRedactedEvents = newValue;
|
||||
await Matrix.of(context).store.setItem(
|
||||
SettingKeys.hideRedactedEvents, newValue.toString());
|
||||
setState(() => null);
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10n.of(context).hideUnknownEvents),
|
||||
trailing: Switch(
|
||||
value: AppConfig.hideUnknownEvents,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
onChanged: (bool newValue) async {
|
||||
AppConfig.hideUnknownEvents = newValue;
|
||||
await Matrix.of(context).store.setItem(
|
||||
SettingKeys.hideUnknownEvents, newValue.toString());
|
||||
setState(() => null);
|
||||
},
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue