!29 资源引用问题修改

Merge pull request !29 from tusi_fly/fly
This commit is contained in:
openharmony_ci 2021-07-19 11:32:49 +00:00 committed by Gitee
commit 667381cd32
3 changed files with 22 additions and 5 deletions

View File

@ -84,6 +84,24 @@ std::vector<std::string> AceApplicationInfoImpl::GetLocaleFallback(const std::ve
return fileList;
}
std::vector<std::string> AceApplicationInfoImpl::GetResourceFallback(const std::vector<std::string>& resourceList) const
{
ACE_SCOPED_TRACE("GetResourceFallback");
std::vector<std::string> fileList;
std::string deviceConfigTag = GetCurrentDeviceResTag();
AceResConfig::MatchAndSortResConfigs(resourceList, deviceConfigTag, fileList);
return fileList;
}
std::string AceApplicationInfoImpl::GetCurrentDeviceResTag() const
{
ResolutionType resolutionType = AceResConfig::GetResolutionType(SystemProperties::GetResolution());
AceResConfig deviceResConfig = AceResConfig(SystemProperties::GetMcc(), SystemProperties::GetMnc(),
SystemProperties::GetDevcieOrientation(), SystemProperties::GetColorMode(), SystemProperties::GetDeviceType(),
resolutionType);
return AceResConfig::ConvertResConfigToTag(deviceResConfig);
}
void AceApplicationInfoImpl::SetLocale(
const std::string& language,
const std::string& countryOrRegion,

View File

@ -37,12 +37,9 @@ public:
const std::string& keywordsAndValues) override;
void ChangeLocale(const std::string& language, const std::string& countryOrRegion) override;
std::vector<std::string> GetLocaleFallback(const std::vector<std::string>& localeList) const override;
std::vector<std::string> GetResourceFallback(const std::vector<std::string>& resourceList) const override
{
return std::vector<std::string>();
}
std::vector<std::string> GetResourceFallback(const std::vector<std::string>& resourceList) const override;
double GetLifeTime() const override { return 0.0f; }
std::string GetCurrentDeviceResTag() const override { return std::string(); };
std::string GetCurrentDeviceResTag() const override;
bool GetFiles(const std::string& filePath, std::vector<std::string>& fileList) const override;
bool GetBundleInfo(const std::string& packageName, AceBundleInfo& bundleInfo) override;

View File

@ -154,6 +154,8 @@ void FrontendDelegateImpl::GetConfigurationCommon(const std::string& filePath, s
std::vector<std::string> priorityFileName;
if (filePath.compare(I18N_FOLDER) == 0) {
priorityFileName = AceApplicationInfo::GetInstance().GetLocaleFallback(fileNameList);
} else {
priorityFileName = AceApplicationInfo::GetInstance().GetResourceFallback(fileNameList);
}
for (const auto& fileName : priorityFileName) {