refactor: Use AppSettings enum based configuration everywhere and fix load from json on web
This commit is contained in:
parent
4f0ed3e93f
commit
4c357f6249
46 changed files with 357 additions and 402 deletions
|
|
@ -1,9 +1,12 @@
|
|||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import '../../config/app_config.dart';
|
||||
import 'package:fluffychat/config/setting_keys.dart';
|
||||
|
||||
extension VisibleInGuiExtension on List<Event> {
|
||||
List<Event> filterByVisibleInGui({String? exceptionEventId}) => where(
|
||||
List<Event> filterByVisibleInGui({
|
||||
String? exceptionEventId,
|
||||
}) =>
|
||||
where(
|
||||
(event) => event.isVisibleInGui || event.eventId == exceptionEventId,
|
||||
).toList();
|
||||
}
|
||||
|
|
@ -19,9 +22,9 @@ extension IsStateExtension on Event {
|
|||
// if a reaction has been redacted we also want it to be hidden in the timeline
|
||||
!{EventTypes.Reaction, EventTypes.Redaction}.contains(type) &&
|
||||
// if we enabled to hide all redacted events, don't show those
|
||||
(!AppConfig.hideRedactedEvents || !redacted) &&
|
||||
(!AppSettings.hideRedactedEvents.value || !redacted) &&
|
||||
// if we enabled to hide all unknown events, don't show those
|
||||
(!AppConfig.hideUnknownEvents || isEventTypeKnown);
|
||||
(!AppSettings.hideUnknownEvents.value || isEventTypeKnown);
|
||||
|
||||
bool get isState => !{
|
||||
EventTypes.Message,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import 'package:flutter/services.dart';
|
|||
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'package:fluffychat/config/setting_keys.dart';
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
|
|
@ -52,8 +51,7 @@ Future<String?> getDatabaseCipher() async {
|
|||
}
|
||||
|
||||
void _sendNoEncryptionWarning(Object exception) async {
|
||||
final store = await SharedPreferences.getInstance();
|
||||
final isStored = AppSettings.noEncryptionWarningShown.getItem(store);
|
||||
final isStored = AppSettings.noEncryptionWarningShown.value;
|
||||
|
||||
if (isStored == true) return;
|
||||
|
||||
|
|
@ -63,5 +61,5 @@ void _sendNoEncryptionWarning(Object exception) async {
|
|||
exception.toString(),
|
||||
);
|
||||
|
||||
await AppSettings.noEncryptionWarningShown.setItem(store, true);
|
||||
await AppSettings.noEncryptionWarningShown.setItem(true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue