fix: fallback to supported locale if easy_localization doesn't support device locale

This commit is contained in:
appflowy
2022-02-05 21:50:49 +08:00
parent 0d47397851
commit e9ba1e1886
2 changed files with 14 additions and 1 deletions

View File

@ -59,7 +59,13 @@ pub async fn get_appearance_setting() -> DataResult<AppearanceSettings, FlowyErr
match KV::get_str(APPEARANCE_SETTING_CACHE_KEY) {
None => data_result(AppearanceSettings::default()),
Some(s) => {
let setting: AppearanceSettings = serde_json::from_str(&s)?;
let setting = match serde_json::from_str(&s) {
Ok(setting) => setting,
Err(e) => {
tracing::error!("Deserialize AppearanceSettings failed: {:?}, fallback to default", e);
AppearanceSettings::default()
}
};
data_result(setting)
}
}