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.setStateCallback = () => safeSetState(() {});
WidgetsBinding.instance.addPostFrameCallback((_) async{
bool initialized = false;
bool isDevLinked = _model.cliUUID.isNotEmpty;
if(!isDevLinked && !initialized) {
initialized = true;
await LocalizationService.processLocals(context).then((value) => value == true ? onUpdate() : null);
}
});
WidgetsBinding.instance.addPostFrameCallback((_) async {
bool initialized = false;
bool isDevLinked = _model.cliUUID.isNotEmpty;
if (!isDevLinked && !initialized) {
initialized = true;
await LocalizationService.processLocals(context).then((value) => value == true ? onUpdate() : null);
}
});
}
@override
@ -99,7 +98,8 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
highlightColor: Colors.transparent,
onTap: () async {
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(
borderRadius: BorderRadius.circular(200.0),

View File

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

View File

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