fluffychat merge
This commit is contained in:
commit
dc7019f113
2 changed files with 53 additions and 10 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:async/async.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:async/async.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:matrix/matrix_api_lite/utils/logs.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
|
@ -142,25 +142,69 @@ enum AppSettings<T> {
|
|||
}
|
||||
|
||||
extension AppSettingsBoolExtension on AppSettings<bool> {
|
||||
bool get value => AppSettings.store.getBool(key) ?? defaultValue;
|
||||
bool get value {
|
||||
final value = Result(() => AppSettings.store.getBool(key));
|
||||
final error = value.asError;
|
||||
if (error != null) {
|
||||
Logs().e(
|
||||
'Unable to fetch $key from storage. Removing entry...',
|
||||
error.error,
|
||||
error.stackTrace,
|
||||
);
|
||||
}
|
||||
return value.asValue?.value ?? defaultValue;
|
||||
}
|
||||
|
||||
Future<void> setItem(bool value) => AppSettings.store.setBool(key, value);
|
||||
}
|
||||
|
||||
extension AppSettingsStringExtension on AppSettings<String> {
|
||||
String get value => AppSettings.store.getString(key) ?? defaultValue;
|
||||
String get value {
|
||||
final value = Result(() => AppSettings.store.getString(key));
|
||||
final error = value.asError;
|
||||
if (error != null) {
|
||||
Logs().e(
|
||||
'Unable to fetch $key from storage. Removing entry...',
|
||||
error.error,
|
||||
error.stackTrace,
|
||||
);
|
||||
}
|
||||
return value.asValue?.value ?? defaultValue;
|
||||
}
|
||||
|
||||
Future<void> setItem(String value) => AppSettings.store.setString(key, value);
|
||||
}
|
||||
|
||||
extension AppSettingsIntExtension on AppSettings<int> {
|
||||
int get value => AppSettings.store.getInt(key) ?? defaultValue;
|
||||
int get value {
|
||||
final value = Result(() => AppSettings.store.getInt(key));
|
||||
final error = value.asError;
|
||||
if (error != null) {
|
||||
Logs().e(
|
||||
'Unable to fetch $key from storage. Removing entry...',
|
||||
error.error,
|
||||
error.stackTrace,
|
||||
);
|
||||
}
|
||||
return value.asValue?.value ?? defaultValue;
|
||||
}
|
||||
|
||||
Future<void> setItem(int value) => AppSettings.store.setInt(key, value);
|
||||
}
|
||||
|
||||
extension AppSettingsDoubleExtension on AppSettings<double> {
|
||||
double get value => AppSettings.store.getDouble(key) ?? defaultValue;
|
||||
double get value {
|
||||
final value = Result(() => AppSettings.store.getDouble(key));
|
||||
final error = value.asError;
|
||||
if (error != null) {
|
||||
Logs().e(
|
||||
'Unable to fetch $key from storage. Removing entry...',
|
||||
error.error,
|
||||
error.stackTrace,
|
||||
);
|
||||
}
|
||||
return value.asValue?.value ?? defaultValue;
|
||||
}
|
||||
|
||||
Future<void> setItem(double value) => AppSettings.store.setDouble(key, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3208,6 +3208,10 @@
|
|||
"@notificationRuleRoomOneToOneDescription": {},
|
||||
"notificationRuleJitsiDescription": "Varsler brukeren om hendelser i Jitsi-widgeten.",
|
||||
"@notificationRuleJitsiDescription": {},
|
||||
"customReaction": "Egendefinert reaksjon",
|
||||
"@customReaction": {},
|
||||
"pause": "Pause",
|
||||
"@pause": {},
|
||||
"alwaysUse24HourFormat": "falsk",
|
||||
"commandHint_googly": "Send noen googly-øyne",
|
||||
"commandHint_cuddle": "Send en kose",
|
||||
|
|
@ -3271,7 +3275,6 @@
|
|||
"notificationRuleServerAclDescription": "Undertrykker varsler for server-ACL hendelser.",
|
||||
"youHaveKnocked": "Du har ringt på",
|
||||
"displayNavigationRail": "Vis navigasjonsstang på mobil",
|
||||
"customReaction": "Egendefinert reaksjon",
|
||||
"writeAMessageLangCodes": "Skriv inn {l1} eller {l2}...",
|
||||
"requests": "Forespørsler",
|
||||
"holdForInfo": "Klikk og hold for ordinformasjon.",
|
||||
|
|
@ -4688,10 +4691,6 @@
|
|||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"@customReaction": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"@writeAMessageLangCodes": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue