MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / loadTreePruning

Method loadTreePruning

native/events/Preference.cpp:682–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

680 }
681
682 void Preference::loadTreePruning() {
683 std::string fileContent = fastbotx::Preference::loadFileContent(TreePruningFilePath);
684 if (fileContent.empty())
685 return;
686 try {
687 ::nlohmann::json actions = ::nlohmann::json::parse(fileContent);
688 for (const ::nlohmann::json &action: actions) {
689 CustomActionPtr act = std::make_shared<CustomAction>();
690 std::string xpathStr = getJsonValue<std::string>(action, "xpath", "");
691 act->xpath = std::make_shared<Xpath>(xpathStr);
692 act->activity = getJsonValue<std::string>(action, "activity", "");
693 act->resourceID = getJsonValue<std::string>(action, "resourceid", InvalidProperty);
694 act->text = getJsonValue<std::string>(action, "text", InvalidProperty);
695 act->contentDescription = getJsonValue<std::string>(action, "contentdesc",
696 InvalidProperty);
697 act->classname = getJsonValue<std::string>(action, "classname", InvalidProperty);
698 this->_treePrunings.push_back(act);
699 }
700 } catch (nlohmann::json::exception &ex) {
701 BLOGE("parse tree pruning error happened: id,%d: %s", ex.id, ex.what());
702 }
703 }
704
705
706 std::string Preference::loadFileContent(const std::string &fileAbsolutePath) {

Callers

nothing calls this directly

Calls 4

parseFunction · 0.85
emptyMethod · 0.80
push_backMethod · 0.80
whatMethod · 0.80

Tested by

no test coverage detected