mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-23 19:02:10 +00:00
feature privacy flags throw protocol to web.
This commit is contained in:
@@ -4045,18 +4045,14 @@ wxString GUI_App::get_international_url(const wxString& origin_url) {
|
||||
|
||||
string dark_mode = wxGetApp().app_config->get("dark_color_mode");
|
||||
|
||||
auto isAgree = wxGetApp().app_config->get("app", "privacy_policy_isagree");
|
||||
std::string useAgree = (isAgree == "true" ? "1" : "0");
|
||||
|
||||
if (baseUrl.find("?") != std::string::npos) {
|
||||
return baseUrl + wxString::FromUTF8("&locale=") + lang + wxString::FromUTF8("-") + region +
|
||||
wxString::FromUTF8("&dark_mode=" + dark_mode) + wxString::FromUTF8("&privacy_policy_isagree=" + useAgree);
|
||||
wxString::FromUTF8("&dark_mode=" + dark_mode);
|
||||
} else {
|
||||
return baseUrl + wxString::FromUTF8("?locale=") + lang + wxString::FromUTF8("-") + region +
|
||||
wxString::FromUTF8("&dark_mode=" + dark_mode) + wxString::FromUTF8("&privacy_policy_isagree=" + useAgree);
|
||||
wxString::FromUTF8("&dark_mode=" + dark_mode);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool GUI_App::is_user_login()
|
||||
@@ -6719,7 +6715,7 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
|
||||
mainframe->refresh_plugin_tips();
|
||||
// BBS: remove SLA related message
|
||||
}
|
||||
auto isAgree = wxGetApp().app_config->get("app", "privacy_policy_isagree");
|
||||
auto isAgree = wxGetApp().app_config->get("app", PRIVACY_POLICY_FLAGS);
|
||||
|
||||
user_update_privacy_notify(isAgree == "true");
|
||||
BOOST_LOG_TRIVIAL(warning) << "run_wizard changed the privacy policy with: " << (isAgree);
|
||||
@@ -6932,7 +6928,7 @@ void GUI_App::user_update_privacy_notify(const bool& res)
|
||||
|
||||
json data;
|
||||
|
||||
data["privacy_policy_isagree"] = res;
|
||||
data[PRIVACY_POLICY_FLAGS] = res;
|
||||
|
||||
for (const auto& instance : m_user_update_privacy_subscribers) {
|
||||
auto ptr = instance.second.lock();
|
||||
@@ -6957,7 +6953,7 @@ void GUI_App::user_login_notify(const json& res)
|
||||
|
||||
bool GUI_App::config_wizard_startup()
|
||||
{
|
||||
auto isAgree = wxGetApp().app_config->get("app", "privacy_policy_isagree");
|
||||
auto isAgree = wxGetApp().app_config->get("app", PRIVACY_POLICY_FLAGS);
|
||||
user_update_privacy_notify(isAgree == "true");
|
||||
BOOST_LOG_TRIVIAL(warning) << "config_wizard_startup changed the privacy policy with: " << (isAgree);
|
||||
if (!m_app_conf_exists || preset_bundle->printers.only_default_printers()) {
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
#define _MSW_DARK_MODE 1
|
||||
#endif // _MSW_DARK_MODE
|
||||
|
||||
#define PRIVACY_POLICY_FLAGS "privacy_policy_isagree"
|
||||
|
||||
class wxMenuItem;
|
||||
class wxMenuBar;
|
||||
class wxTopLevelWindow;
|
||||
|
||||
@@ -748,9 +748,9 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
|
||||
app_config->set_bool(param, checkbox->GetValue());
|
||||
app_config->save();
|
||||
|
||||
if (param == "privacy_policy_isagree")
|
||||
if (param == PRIVACY_POLICY_FLAGS)
|
||||
{
|
||||
app_config->set("app", "privacy_policy_isagree", checkbox->GetValue());
|
||||
app_config->set("app", PRIVACY_POLICY_FLAGS, checkbox->GetValue());
|
||||
BOOST_LOG_TRIVIAL(warning) <<"create_item_checkbox changed the privacy policy with: "<<(checkbox->GetValue()?"true" : "false");
|
||||
wxGetApp().user_update_privacy_notify(checkbox->GetValue());
|
||||
}
|
||||
@@ -1300,7 +1300,7 @@ wxWindow* PreferencesDialog::create_general_page()
|
||||
std::string region = app_config->get("language");
|
||||
|
||||
auto title_user_experience = create_item_title(_L("User Experience"), page, _L("User Experience"));
|
||||
auto item_priv_policy = create_item_checkbox(_L("Join Customer Experience Improvement Program."), page, _L(""), 50, "privacy_policy_isagree");
|
||||
auto item_priv_policy = create_item_checkbox(_L("Join Customer Experience Improvement Program."), page, _L(""), 50,PRIVACY_POLICY_FLAGS);
|
||||
wxHyperlinkCtrl* hyperlink = nullptr;
|
||||
if (region.empty() || region != "zh_CN")
|
||||
hyperlink = new wxHyperlinkCtrl(page, wxID_ANY, _L("What data would be collected?"), enUrl);
|
||||
|
||||
@@ -4273,9 +4273,10 @@ void SSWCP_UserLogin_Instance::process()
|
||||
} else if (m_cmd == "sw_SubscribeUserLoginState") {
|
||||
sw_SubscribeUserLoginState();
|
||||
}
|
||||
else if (m_cmd == UPDATE_PRIVACY_STATUS)
|
||||
{
|
||||
else if (m_cmd == UPDATE_PRIVACY_STATUS) {
|
||||
sw_SubUserUpdatePrivacy();
|
||||
} else if (m_cmd == GET_PRIVACY_STATUS) {
|
||||
sw_GetUserUpdatePrivacy();
|
||||
}
|
||||
else {
|
||||
handle_general_fail();
|
||||
@@ -4341,6 +4342,22 @@ void SSWCP_UserLogin_Instance::sw_GetUserLoginState()
|
||||
handle_general_fail();
|
||||
}
|
||||
}
|
||||
void SSWCP_UserLogin_Instance::sw_GetUserUpdatePrivacy()
|
||||
{
|
||||
json data;
|
||||
auto isAgree = wxGetApp().app_config->get("app", PRIVACY_POLICY_FLAGS);
|
||||
bool isUserAgree = false;
|
||||
|
||||
if (isAgree == "true")
|
||||
isUserAgree = true;
|
||||
|
||||
data[PRIVACY_POLICY_FLAGS] = isUserAgree;
|
||||
|
||||
m_res_data = data;
|
||||
send_to_js();
|
||||
finish_job();
|
||||
|
||||
}
|
||||
|
||||
void SSWCP_UserLogin_Instance::sw_SubUserUpdatePrivacy()
|
||||
{
|
||||
@@ -5844,8 +5861,8 @@ std::unordered_set<std::string> SSWCP::m_project_cmd_list = {
|
||||
"sw_NewProject", "sw_OpenProject", "sw_GetRecentProjects", "sw_OpenRecentFile", "sw_DeleteRecentFiles", "sw_SubscribeRecentFiles",
|
||||
};
|
||||
|
||||
std::unordered_set<std::string> SSWCP::m_login_cmd_list = {"sw_UserLogin", "sw_UserLogout", "sw_GetUserLoginState",
|
||||
"sw_SubscribeUserLoginState", UPDATE_PRIVACY_STATUS};
|
||||
std::unordered_set<std::string> SSWCP::m_login_cmd_list = {"sw_UserLogin", "sw_UserLogout", "sw_GetUserLoginState", "sw_SubscribeUserLoginState",
|
||||
UPDATE_PRIVACY_STATUS, GET_PRIVACY_STATUS};
|
||||
|
||||
std::unordered_set<std::string> SSWCP::m_machine_manage_cmd_list = {
|
||||
"sw_GetLocalDevices", "sw_AddDevice", "sw_SubscribeLocalDevices", "sw_RenameDevice", "sw_SwitchModel", "sw_DeleteDevices"
|
||||
|
||||
@@ -26,6 +26,7 @@ using tcp = asio::ip::tcp;
|
||||
|
||||
//WCP Interface definition
|
||||
#define UPDATE_PRIVACY_STATUS "sw_SubUserUpdatePrivacy"
|
||||
#define GET_PRIVACY_STATUS "sw_GetUserUpdatePrivacy"
|
||||
#define UPLOAD_CAMERA_TIMELAPSE "sw_UploadCameraTimelapse"
|
||||
#define DELETE_CAMERA_TIMELAPSE "sw_DeleteCameraTimelapse"
|
||||
#define GETCAMERA_TIMELAPSE_INSTANCE "sw_GetCameraTimelapseInstance"
|
||||
@@ -531,6 +532,8 @@ private:
|
||||
|
||||
void sw_SubscribeUserLoginState();
|
||||
|
||||
void sw_GetUserUpdatePrivacy();
|
||||
|
||||
void sw_SubUserUpdatePrivacy();
|
||||
};
|
||||
|
||||
|
||||
@@ -639,7 +639,7 @@ int GuideFrame::SaveProfile()
|
||||
// m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "1");
|
||||
// } else
|
||||
// m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "0");
|
||||
m_MainPtr->app_config->set("app", "privacy_policy_isagree", PrivacyUse);
|
||||
m_MainPtr->app_config->set("app", PRIVACY_POLICY_FLAGS, PrivacyUse);
|
||||
BOOST_LOG_TRIVIAL(warning) << "SaveProfile changed the privacy policy with: " << (PrivacyUse ? "true" : "false");
|
||||
wxGetApp().user_update_privacy_notify(PrivacyUse);
|
||||
m_MainPtr->app_config->set("region", m_Region);
|
||||
|
||||
Reference in New Issue
Block a user