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( FFButtonWidget(
onPressed: () async { onPressed: () async {
PhpGroup.resopndeVinculo try {
await PhpGroup.resopndeVinculo
.call( .call(
userUUID: FFAppState().userUUID, userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID, devUUID: FFAppState().devUUID,
@ -283,6 +284,37 @@ class PreferencesPageModel with ChangeNotifier {
// ignore: body_might_complete_normally_catch_error // ignore: body_might_complete_normally_catch_error
.catchError((err, stack) { .catchError((err, stack) {
log(err.toString()); 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( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( 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( text: FFLocalizations.of(context).getVariableText(
enText: 'Unlink', enText: 'Unlink',
@ -381,8 +404,9 @@ class PreferencesPageModel with ChangeNotifier {
), ),
), ),
FFButtonWidget( FFButtonWidget(
onPressed: () { onPressed: () async {
PhpGroup.deleteAccount try {
await PhpGroup.deleteAccount
.call( .call(
devUUID: FFAppState().devUUID, devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID, userUUID: FFAppState().userUUID,
@ -410,8 +434,10 @@ class PreferencesPageModel with ChangeNotifier {
ptText: 'Erro ao deletar conta', ptText: 'Erro ao deletar conta',
), ),
style: TextStyle( style: TextStyle(
color: FlutterFlowTheme.of(context).info)), color:
backgroundColor: FlutterFlowTheme.of(context).error, FlutterFlowTheme.of(context).info)),
backgroundColor:
FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3), duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating, behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -421,6 +447,26 @@ class PreferencesPageModel with ChangeNotifier {
); );
}); });
notifyListeners(); 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( options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3, width: MediaQuery.of(context).size.width * 0.3,