fix: 409 conflicts resolution in notifications (#13900)

* fix: 409 conflicts resolution in notifications

* fix: silently log other http errors

* fix: pass force push flag to start_sync_user_preset

* remove formatting churn

* fix: propagate force push down put_setting

* refactor render_hyperlink_action to PopNotification for reuse

* fix an issue that hold status should be cleared before force pushing.

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Ian Chua
2026-05-31 16:23:10 +08:00
committed by GitHub
parent 6a26284ba6
commit 535911fcfe
11 changed files with 259 additions and 86 deletions

View File

@@ -15,6 +15,8 @@
#include <wx/time.h>
#include <string>
#include <functional>
#include <utility>
#include <vector>
#include <deque>
#include <unordered_set>
@@ -162,6 +164,8 @@ enum class NotificationType
BBLMixUsePLAAndPETG,
BBLNozzleFilamentIncompatible,
OrcaSharedProfilesAvailable,
OrcaCloudAPIError,
OrcaSyncConflict,
NotificationTypeCount
};
@@ -274,6 +278,9 @@ public:
// Shared profiles available for selected printer
void push_shared_profiles_notification(const std::string& explore_url);
void push_orca_sync_conflict_notification(const std::string& text,
std::function<bool(wxEvtHandler*)> pull_callback,
std::function<bool(wxEvtHandler*)> force_push_callback);
// Download URL progress notif
void push_download_URL_progress_notification(size_t id, const std::string& text, std::function<bool(DownloaderUserAction, int)> user_action_callback);
@@ -491,6 +498,11 @@ private:
const float text_x, const float text_y,
const std::string text,
bool more = false);
// Renders an underlined, hyperlink-style clickable label backed by an invisible button.
// on_click runs when pressed; the callback itself decides whether to close().
void render_hyperlink_action(ImGuiWrapper& imgui, float text_x, float text_y,
const std::string& text, const char* button_id,
const std::function<void()>& on_click);
virtual void bbl_render_block_notif_text(ImGuiWrapper& imgui,
const float win_size_x, const float win_size_y,
const float win_pos_x, const float win_pos_y);
@@ -887,6 +899,28 @@ private:
std::string m_explore_url;
bool m_dont_show_clicked{ false };
};
class OrcaSyncConflictNotification : public PopNotification
{
public:
OrcaSyncConflictNotification(const NotificationData& n, NotificationIDProvider& id_provider, wxEvtHandler* evt_handler,
std::function<bool(wxEvtHandler*)> pull_callback,
std::function<bool(wxEvtHandler*)> force_push_callback)
: PopNotification(n, id_provider, evt_handler)
, m_pull_callback(std::move(pull_callback))
, m_force_push_callback(std::move(force_push_callback))
{
m_multiline = true;
}
protected:
void init() override;
void render_text(ImGuiWrapper& imgui,
const float win_size_x, const float win_size_y,
const float win_pos_x, const float win_pos_y) override;
std::function<bool(wxEvtHandler*)> m_pull_callback;
std::function<bool(wxEvtHandler*)> m_force_push_callback;
};
class SlicingProgressNotification;
// in HintNotification.hpp