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