Исправлено переключение локали на экране сканера

This commit is contained in:
Ivan Murashov
2017-09-21 13:09:38 +03:00
parent eba8c9e642
commit afc9cde20d
12 changed files with 85 additions and 49 deletions

View File

@@ -38,24 +38,43 @@ class _SplashScreenState extends BaseState<SplashScreen> {
}
void onStart() {
helper.getSettings().then((info) {
if (info == null) {
platform.invokeMethod('getCurrency').then((currency) {
platform.invokeMethod('getLocale').then((locale) {
initLocale(locale, () {
helper.createAppInfo(locale, currency).then((_) {
showNext();
});
});
});
});
helper.getLocale().then((locale) {
if (locale == null) {
initWithSystemValue();
} else {
helper.getLocale().then((locale) {
initWithSavedValue();
}
});
}
void initWithSystemValue() {
platform.invokeMethod('getLocale').then((locale) {
helper.getSettings().then((settings) {
if (settings == null) {
createSettingsTable(locale);
} else {
initLocale(locale, () {
showNext();
});
});
}
}
});
});
}
void initWithSavedValue() {
helper.getLocale().then((locale) {
initLocale(locale, () {
showNext();
});
});
}
void createSettingsTable(String locale) {
platform.invokeMethod('getCurrency').then((currency) {
helper.createAppInfo(locale, currency);
initLocale(locale, () {
showNext();
});
});
}