add set default if storage empty
This commit is contained in:
parent
9ccea7f635
commit
abfd27949f
2 changed files with 16 additions and 3 deletions
|
|
@ -16,9 +16,19 @@ export class AppComponent implements OnInit {
|
|||
// lang
|
||||
Lang.initLanguageSwitcher();
|
||||
|
||||
// set default country and filename
|
||||
await AsyncStorage.setItem('currentRecipeCountry', 'Thailand');
|
||||
await AsyncStorage.setItem('currentFile', 'default');
|
||||
// set default country and filename if empty
|
||||
|
||||
let currentCountry = await AsyncStorage.getItem('currentRecipeCountry');
|
||||
let currentFile = await AsyncStorage.getItem('currentRecipeFile');
|
||||
|
||||
if (!currentCountry) {
|
||||
await AsyncStorage.setItem('currentRecipeCountry', 'Thailand');
|
||||
}
|
||||
|
||||
if (!currentFile) {
|
||||
await AsyncStorage.setItem('currentRecipeFile', 'default');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ func NewData(taoLogger *logger.TaoLogger, redisClient *RedisCli) *Data {
|
|||
// read latest version
|
||||
latest_version, _ := strconv.Atoi(initVersion)
|
||||
defaultForEachCountry = append(defaultForEachCountry, DefaultByCountry{CountryShortName: elem.CountryID, CountryLongName: elem.CountryName, DefaultFileVersion: latest_version})
|
||||
|
||||
// emit out latest version
|
||||
taoLogger.Log.Info("Latest version", zap.Any("country", elem.CountryID), zap.Any("version", latest_version))
|
||||
}
|
||||
|
||||
currentFileMap := make(map[string]string)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue