FIX: internet connection exception in settings

This commit is contained in:
jantunesmesias 2024-08-06 17:36:29 -03:00
parent 87e092a070
commit cf79bff8e4
1 changed files with 86 additions and 40 deletions

View File

@ -273,7 +273,8 @@ class PreferencesPageModel with ChangeNotifier {
),
FFButtonWidget(
onPressed: () async {
PhpGroup.resopndeVinculo
try {
await PhpGroup.resopndeVinculo
.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
@ -283,6 +284,37 @@ class PreferencesPageModel with ChangeNotifier {
// ignore: body_might_complete_normally_catch_error
.catchError((err, stack) {
log(err.toString());
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Error unlinking device',
ptText: 'Erro ao desvincular dispositivo',
),
style: TextStyle(
color:
FlutterFlowTheme.of(context).info)),
backgroundColor:
FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
}).then(
(value) {
FFAppState().deleteCliUUID();
FFAppState().deleteLocal();
FFAppState().deleteOwnerUUID();
Navigator.pop(context);
Navigator.pop(context);
},
);
notifyListeners();
} catch (err, stack) {
log(err.toString());
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
@ -300,16 +332,7 @@ class PreferencesPageModel with ChangeNotifier {
),
),
);
}).then(
(value) {
FFAppState().deleteCliUUID();
FFAppState().deleteLocal();
FFAppState().deleteOwnerUUID();
Navigator.pop(context);
Navigator.pop(context);
},
);
notifyListeners();
}
},
text: FFLocalizations.of(context).getVariableText(
enText: 'Unlink',
@ -381,8 +404,9 @@ class PreferencesPageModel with ChangeNotifier {
),
),
FFButtonWidget(
onPressed: () {
PhpGroup.deleteAccount
onPressed: () async {
try {
await PhpGroup.deleteAccount
.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
@ -410,8 +434,10 @@ class PreferencesPageModel with ChangeNotifier {
ptText: 'Erro ao deletar conta',
),
style: TextStyle(
color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).error,
color:
FlutterFlowTheme.of(context).info)),
backgroundColor:
FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
@ -421,6 +447,26 @@ class PreferencesPageModel with ChangeNotifier {
);
});
notifyListeners();
} catch (err, stack) {
log(err.toString());
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Error deleting account',
ptText: 'Erro ao deletar conta',
),
style: TextStyle(
color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
}
},
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,