mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-21 09:55:23 -04:00
Complete the information parser for stage card.
Signed-off-by: zhangyu <zhangyu578@huawei.com>
This commit is contained in:
@@ -20,11 +20,6 @@ namespace OHOS::Ace {
|
||||
StageCardParser::StageCardParser() : manifestWindow_(Referenced::MakeRefPtr<Framework::ManifestWindow>())
|
||||
{}
|
||||
|
||||
WindowConfig& StageCardParser::GetWindowConfig()
|
||||
{
|
||||
return manifestWindow_->GetWindowConfig();
|
||||
}
|
||||
|
||||
void StageCardParser::Parse(const std::string& contents, const std::string& selectUrl)
|
||||
{
|
||||
auto rootJson = JsonUtil::ParseJsonString(contents);
|
||||
@@ -47,10 +42,88 @@ void StageCardParser::Parse(const std::string& contents, const std::string& sele
|
||||
LOGE("The configuration information for the url %{public}s does not exist", selectUrl.c_str());
|
||||
return;
|
||||
}
|
||||
colorMode_ = formConfig->GetString("colorMode");
|
||||
|
||||
auto supportDimensions = formConfig->GetValue("supportDimensions");
|
||||
if (supportDimensions && supportDimensions->IsArray()) {
|
||||
for (index = 0; index < supportDimensions->GetArraySize(); ++index) {
|
||||
auto supportDimension = supportDimensions->GetArrayItem(index);
|
||||
if (supportDimension && supportDimension->IsString()) {
|
||||
supportDimensions_.push_back(supportDimension->GetString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
colorMode_ = formConfig->GetString("colorMode", "auto");
|
||||
defaultDimension_ = formConfig->GetString("defaultDimension");
|
||||
description_ = formConfig->GetString("description");
|
||||
formConfigAbility_ = formConfig->GetString("formConfigAbility");
|
||||
isDefault_ = formConfig->GetBool("updateEnabled", true);
|
||||
name_ = formConfig->GetString("name");
|
||||
scheduledUpdateTime_ = formConfig->GetString("scheduledUpdateTime");
|
||||
src_ = formConfig->GetString("src");
|
||||
updateDuration_ = formConfig->GetUInt("updateDuration", 1);
|
||||
updateEnabled_ = formConfig->GetBool("updateEnabled", true);
|
||||
manifestWindow_->WindowParse(formConfig);
|
||||
}
|
||||
|
||||
const std::string& StageCardParser::GetColorMode() const
|
||||
{
|
||||
return colorMode_;
|
||||
}
|
||||
|
||||
const std::string& StageCardParser::GetDefaultDimension() const
|
||||
{
|
||||
return defaultDimension_;
|
||||
}
|
||||
|
||||
const std::string& StageCardParser::GetDescription() const
|
||||
{
|
||||
return description_;
|
||||
}
|
||||
|
||||
const std::string& StageCardParser::GetFormConfigAbility() const
|
||||
{
|
||||
return formConfigAbility_;
|
||||
}
|
||||
|
||||
bool StageCardParser::GetIsDefault() const
|
||||
{
|
||||
return isDefault_;
|
||||
}
|
||||
|
||||
const std::string& StageCardParser::GetName() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
const std::string& StageCardParser::GetScheduledUpdateTime() const
|
||||
{
|
||||
return scheduledUpdateTime_;
|
||||
}
|
||||
|
||||
const std::string& StageCardParser::GetSrc() const
|
||||
{
|
||||
return src_;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& StageCardParser::GetSupportDimensions() const
|
||||
{
|
||||
return supportDimensions_;
|
||||
}
|
||||
|
||||
uint32_t StageCardParser::GetUpdateDuration() const
|
||||
{
|
||||
return updateDuration_;
|
||||
}
|
||||
|
||||
bool StageCardParser::GetUpdateEnabled() const
|
||||
{
|
||||
return updateEnabled_;
|
||||
}
|
||||
|
||||
WindowConfig& StageCardParser::GetWindowConfig() const
|
||||
{
|
||||
return manifestWindow_->GetWindowConfig();
|
||||
}
|
||||
|
||||
} // namespace OHOS::Ace::Framework
|
||||
|
||||
@@ -31,12 +31,31 @@ public:
|
||||
StageCardParser();
|
||||
~StageCardParser() override = default;
|
||||
void Parse(const std::string& contents, const std::string& selectUrl);
|
||||
WindowConfig& GetWindowConfig();
|
||||
const std::string& GetColorMode() const;
|
||||
const std::string& GetDefaultDimension() const;
|
||||
const std::string& GetDescription() const;
|
||||
const std::string& GetFormConfigAbility() const;
|
||||
bool GetIsDefault() const;
|
||||
const std::string& GetName() const;
|
||||
const std::string& GetScheduledUpdateTime() const;
|
||||
const std::string& GetSrc() const;
|
||||
const std::vector<std::string>& GetSupportDimensions() const;
|
||||
uint32_t GetUpdateDuration() const;
|
||||
bool GetUpdateEnabled() const;
|
||||
WindowConfig& GetWindowConfig() const;
|
||||
|
||||
private:
|
||||
std::string colorMode_;
|
||||
std::string defaultDimension_;
|
||||
std::string description_;
|
||||
std::string formConfigAbility_;
|
||||
bool isDefault_;
|
||||
std::string name_;
|
||||
std::string scheduledUpdateTime_;
|
||||
std::string src_;
|
||||
std::vector<std::string> supportDimensions_;
|
||||
uint32_t updateDuration_;
|
||||
bool updateEnabled_;
|
||||
RefPtr<Framework::ManifestWindow> manifestWindow_;
|
||||
ACE_DISALLOW_COPY_AND_MOVE(StageCardParser);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user