format
This commit is contained in:
parent
9eadcd7ea0
commit
be6fc55ef9
|
@ -36,16 +36,15 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
|
||||||
_model = createModel(context, () => LocalProfileComponentModel());
|
_model = createModel(context, () => LocalProfileComponentModel());
|
||||||
_model.setOnUpdate(onUpdate: () => setState(() {}));
|
_model.setOnUpdate(onUpdate: () => setState(() {}));
|
||||||
_model.setStateCallback = () => safeSetState(() {});
|
_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
|
@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),
|
||||||
|
|
|
@ -278,11 +278,10 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -28,7 +28,7 @@ class LocalizationService {
|
||||||
if (isError == true) {
|
if (isError == true) {
|
||||||
_handleError(context, response.jsonBody['error_msg']);
|
_handleError(context, response.jsonBody['error_msg']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (response.jsonBody == null) {
|
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',
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue