feature add web version on bury point

This commit is contained in:
alves
2025-12-16 17:24:13 +08:00
parent 005e45bd0a
commit 6688f3c0ed
5 changed files with 47 additions and 2 deletions

View File

@@ -1008,6 +1008,39 @@ void MainFrame::show_option(bool show)
}
}
}
void MainFrame::get_local_webview_version()
{
std::string versionFilePath = "";
#ifdef _WIN32
wchar_t appDataPath[MAX_PATH] = {0};
auto hr = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath);
char* path = new char[MAX_PATH];
size_t pathLength;
wcstombs_s(&pathLength, path, MAX_PATH, appDataPath, MAX_PATH);
std::string filePath = path;
versionFilePath = filePath + "\\" + std::string("Snapmaker_Orca\\web\\flutter_web\\version.json");
#elif __APPLE__
const char* home_env = getenv("HOME");
versionFilePath = home_env;
versionFilePath = versionFilePath + "/Library/Application Support/Snapmaker_Orca/web/flutter_web/version.json";
#else
#endif
std::ifstream json_file(versionFilePath);
if (!json_file.is_open()) {
return;
}
nlohmann::json json_data;
json_file >> json_data;
std::string str_version = json_data["version"];
std::string str_build_number = json_data["build_number"];
std::string tag = std::string("flutter_version: ") + str_version + std::string(" ") + std::string("build_number: ") + str_build_number;
set_sentry_tags("flutter_version", tag);
}
void MainFrame::init_tabpanel() {
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on
@@ -1089,8 +1122,9 @@ void MainFrame::init_tabpanel() {
});
m_tabpanel->AddPage(m_webview, "", "tab_home_active", "tab_home_active", false);
m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
}
get_local_webview_version();
m_plater = new Plater(this, this);
m_plater->SetBackgroundColour(*wxWHITE);
m_plater->Hide();