Compare commits

..

1 Commits

Author SHA1 Message Date
Ian Chua
dedd878af1 fix: tombstone resolution for 409 status code with error code -3 2026-06-09 16:41:58 +08:00
2 changed files with 24 additions and 9 deletions

View File

@@ -4953,16 +4953,25 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
auto* plater = wxGetApp().plater();
if (plater != nullptr && wxGetApp().imgui()->display_initialized()) {
std::string text;
if (conflict_code == -1) {
switch (conflict_code) {
case -1:
text = _u8L("Cloud sync conflict: this preset has a newer version in OrcaCloud.\n"
"Pull downloads the cloud copy. Force push overwrites it with your local preset.");
} else {
break;
case -2:
text = _u8L("Cloud sync conflict: a preset with this name already exists in OrcaCloud.\n"
"Pull downloads the cloud copy. Force push overwrites it with your local preset.");
}
break;
case -3:
text = _u8L("Cloud sync conflict: a preset with the same name was previously deleted from the cloud.\n"
"Do you want to push this new copy to the cloud?");
break;
};
plater->get_notification_manager()->push_orca_sync_conflict_notification(
text,
[this](wxEvtHandler*) {
conflict_code == -3 ? nullptr : std::function<bool(wxEvtHandler*)>{[this](wxEvtHandler*) {
// Runs on the GUI thread (on_http_error is a queued wx event); restart_sync_user_preset()
// already joins the old sync thread off the UI thread, so no extra thread is needed here.
if (is_closing() || !m_agent || !preset_bundle)
@@ -4970,7 +4979,7 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
BOOST_LOG_TRIVIAL(info) << "Pulling Orca Cloud settings to resolve sync conflict.";
restart_sync_user_preset();
return true;
},
}},
[this, conflict_setting_id](wxEvtHandler*) {
if (mainframe == nullptr)
return false;

View File

@@ -2416,12 +2416,18 @@ void NotificationManager::OrcaSyncConflictNotification::render_text(ImGuiWrapper
}
const float action_y = starting_y + m_endlines.size() * shift_y;
const std::string pull_text = _u8L("Pull");
render_hyperlink_action(imgui, x_offset, action_y, pull_text, "##orca_sync_pull",
[this] { if (m_pull_callback && m_pull_callback(m_evt_handler)) close(); });
std::string pull_text = "";
float padding = 0.f;
if (m_pull_callback) {
pull_text = _u8L("Pull");
padding = ImGui::CalcTextSize((pull_text + " ").c_str()).x;
render_hyperlink_action(imgui, x_offset, action_y, pull_text, "##orca_sync_pull",
[this] { if (m_pull_callback && m_pull_callback(m_evt_handler)) close(); });
}
if (m_force_push_callback) {
const std::string force_push_text = _u8L("Force push");
const float force_x = x_offset + ImGui::CalcTextSize((pull_text + " ").c_str()).x;
const float force_x = x_offset + padding;
render_hyperlink_action(imgui, force_x, action_y, force_push_text, "##orca_sync_force_push",
[this] { if (m_force_push_callback && m_force_push_callback(m_evt_handler)) close(); });
}