syncTextsData method
void
syncTextsData({
- required dynamic complete(),
同步文案数据 1.如果本地缓存不存在则从assets中读取; 2.本地版本小于请求版本时增量更新语言配置;
Implementation
void syncTextsData({required Function() complete}) async {
var assetsLangData = await _assetsData;
if (assetsLangData.isEmptyJson) {
var appKey = EyFlutter.instance.appConfig?.appKey ?? "";
var config = langConfig();
int version = (await config?.langVersion()) ?? 0;
if (await _hasLocalCache()) {
var isUpdateTexts = await _isUpdateTexts(appKey, version);
if (isUpdateTexts.isUpdate || (!isUpdateTexts.isUpdate && isUpdateTexts.isSilenceUpdate)) {
_getRemoteData(appKey, version, complete);
} else {
complete();
Map<String, dynamic> langMap = await langPackage;
incrementalUpdate(langMap);
}
} else {
_getRemoteData(appKey, version, complete);
}
} else {
_cacheFromData(assetsLangData, complete);
}
}