Merge branch 'develop' into fix/fd-922
This commit is contained in:
commit
cb73a3564b
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||
import 'package:hub/components/templates_components/change_passs_qr_code_pass_key_template_component/change_pass_widget.dart';
|
||||
|
@ -45,23 +47,32 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
);
|
||||
onConfirm() async {
|
||||
String content;
|
||||
try {
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Notification changed successfully',
|
||||
ptText: 'Notificação alterada com sucesso',
|
||||
);
|
||||
context.pop();
|
||||
SnackBarUtil.showSnackBar(context, content);
|
||||
StorageUtil().notify = !StorageUtil().notify;
|
||||
notifyListeners();
|
||||
} catch (err) {
|
||||
String value = StorageUtil().notify ? 'N' : 'S';
|
||||
await PhpGroup.changeNotifica.call(notifica: value).then((value) async {
|
||||
if (value.jsonBody['error'] == false) {
|
||||
StorageUtil().notify = !StorageUtil().notify;
|
||||
notifyListeners();
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Notification changed successfully',
|
||||
ptText: 'Notificação alterada com sucesso',
|
||||
);
|
||||
SnackBarUtil.showSnackBar(context, content);
|
||||
} else {
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Error changing notification',
|
||||
ptText: 'Erro ao alterar notificação',
|
||||
);
|
||||
SnackBarUtil.showSnackBar(context, content, isError: true);
|
||||
}
|
||||
}).catchError((e, s) {
|
||||
log('toggleNotify', error: e, stackTrace: s);
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Error changing notification',
|
||||
ptText: 'Erro ao alterar notificação',
|
||||
);
|
||||
context.pop();
|
||||
SnackBarUtil.showSnackBar(context, content, isError: true);
|
||||
}
|
||||
}).whenComplete(() => notifyListeners());
|
||||
context.pop();
|
||||
}
|
||||
|
||||
showAlertDialog(context, title, content, onConfirm);
|
||||
|
|
Loading…
Reference in New Issue