fix: preferences settings
This commit is contained in:
parent
d98227b5eb
commit
09c2d2018b
|
@ -59,15 +59,15 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
onConfirm() async {
|
||||
String content;
|
||||
isNotify = await StorageHelper.instance.get(SQLiteStorageKey.notify.value, Storage.SQLiteStorage) == 'true';
|
||||
String value = isNotify ? 'N' : 'S';
|
||||
String value = !isNotify ? 'N' : 'S';
|
||||
await PhpGroup.changeNotifica.call(notifica: value).then((value) async {
|
||||
if (value.jsonBody['error'] == false) {
|
||||
await StorageHelper.instance.set(SQLiteStorageKey.notify.value, isNotify ? 'false' : 'true',Storage.SQLiteStorage);
|
||||
notifyListeners();
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Notification changed successfully',
|
||||
ptText: 'Notificação alterada com sucesso',
|
||||
);
|
||||
notifyListeners();
|
||||
SnackBarUtil.showSnackBar(context, content);
|
||||
} else {
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
|
@ -98,9 +98,7 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
await PhpGroup.changePass.call(newSenha: key).then((value) async {
|
||||
final String content;
|
||||
if (jsonDecode(value.jsonBody['error'].toString()) == false) {
|
||||
if (!isAccess) {
|
||||
await StorageHelper.instance.set(SQLiteStorageKey.access.value, isAccess ? 'false' : 'true', Storage.SQLiteStorage);
|
||||
}
|
||||
notifyListeners();
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Access pass changed successfully',
|
||||
|
@ -135,9 +133,7 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
.then((value) async {
|
||||
final String content;
|
||||
if (jsonDecode(value.jsonBody['error'].toString()) == false) {
|
||||
if (!isPanic) {
|
||||
await StorageHelper.instance.set(SQLiteStorageKey.panic.value, isPanic ? 'false' : 'true', Storage.SQLiteStorage);
|
||||
}
|
||||
notifyListeners();
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Panic password changed successfully',
|
||||
|
@ -173,13 +169,9 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
|
||||
onChange(String? key) async {
|
||||
isFingerprint = !isFingerprint;
|
||||
|
||||
await StorageHelper.instance.set(SecureStorageKey.fingerprintPass.value, isFingerprint ? '' : key ?? '', Storage.SecureStorage);
|
||||
|
||||
isFingerprint = await StorageHelper.instance.get(SQLiteStorageKey.fingerprint.value, Storage.SQLiteStorage) == 'true';
|
||||
|
||||
await StorageHelper.instance.set(SecureStorageKey.fingerprintPass.value, key ?? '', Storage.SecureStorage);
|
||||
await StorageHelper.instance.set(SQLiteStorageKey.fingerprint.value, isFingerprint ? 'true' : 'false', Storage.SQLiteStorage);
|
||||
notifyListeners();
|
||||
|
||||
SnackBarUtil.showSnackBar(context, content);
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ class AuthenticationService {
|
|||
),
|
||||
};
|
||||
await StorageHelper.instance.clearAll(Storage.SecureStorage);
|
||||
await StorageHelper.instance.clearAll(Storage.SQLiteStorage);
|
||||
context.go('/welcomePage', extra: extra);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue