This commit is contained in:
J. A. Messias 2024-11-11 14:06:21 -03:00
parent 9eadcd7ea0
commit be6fc55ef9
3 changed files with 15 additions and 19 deletions

View File

@ -37,15 +37,14 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
_model.setOnUpdate(onUpdate: () => setState(() {})); _model.setOnUpdate(onUpdate: () => setState(() {}));
_model.setStateCallback = () => safeSetState(() {}); _model.setStateCallback = () => safeSetState(() {});
WidgetsBinding.instance.addPostFrameCallback((_) async{ WidgetsBinding.instance.addPostFrameCallback((_) async {
bool initialized = false; bool initialized = false;
bool isDevLinked = _model.cliUUID.isNotEmpty; bool isDevLinked = _model.cliUUID.isNotEmpty;
if(!isDevLinked && !initialized) { if (!isDevLinked && !initialized) {
initialized = true; initialized = true;
await LocalizationService.processLocals(context).then((value) => value == true ? onUpdate() : null); await LocalizationService.processLocals(context).then((value) => value == true ? onUpdate() : null);
} }
}); });
} }
@override @override
@ -99,7 +98,8 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
onTap: () async { onTap: () async {
await StorageHelper().set(SQLiteStorageKey.clientUUID.value, '', Storage.SQLiteStorage); await StorageHelper().set(SQLiteStorageKey.clientUUID.value, '', Storage.SQLiteStorage);
await LocalizationService.processLocals(context).then((value) => value == true ? onUpdate() : null); await LocalizationService.processLocals(context)
.then((value) => value == true ? onUpdate() : null);
}, },
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(200.0), borderRadius: BorderRadius.circular(200.0),

View File

@ -278,7 +278,6 @@ class _AppState extends State<App> with WidgetsBindingObserver {
@override @override
void didChangeAppLifecycleState(AppLifecycleState state) async { void didChangeAppLifecycleState(AppLifecycleState state) async {
if (state == AppLifecycleState.detached) { if (state == AppLifecycleState.detached) {
await LocalizationService.processLocals(context); await LocalizationService.processLocals(context);
FirebaseMessagingService().updateDeviceToken(); FirebaseMessagingService().updateDeviceToken();

View File

@ -76,7 +76,6 @@ class LocalizationService {
return false; return false;
} }
final List<dynamic> locals = response.jsonBody['locais'].toList() ?? []; final List<dynamic> locals = response.jsonBody['locais'].toList() ?? [];
_logLocalsStatus(locals); _logLocalsStatus(locals);
@ -139,16 +138,14 @@ class LocalizationService {
final String errorMsg = response.jsonBody['error_msg']; final String errorMsg = response.jsonBody['error_msg'];
DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response)); DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response));
return false; return false;
} } else if (response.jsonBody == null) {
else if (response.jsonBody == null) {
final String errorMsg = FFLocalizations.of(context).getVariableText( final String errorMsg = FFLocalizations.of(context).getVariableText(
enText: 'Verify your connection', enText: 'Verify your connection',
ptText: 'Verifique sua conexão', ptText: 'Verifique sua conexão',
); );
DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response)); DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response));
return false ; return false;
} } else {
else {
await _updateStorageUtil(response.jsonBody); await _updateStorageUtil(response.jsonBody);
return true; return true;
} }