Fixes of AppUdpater

fix of bug (1) - order of dialogs
fix of bug (2) - show new version dialog when triggered by user
fix of bug (3) - refresh value in preferences combobox when opening preferences 
fix of bug (4) - Use fwrite instead of stream to speedup saving. 
Do not show checkbox when triggered by user.
This commit is contained in:
David Kocik 2023-01-19 13:01:41 +01:00
parent d681b99c10
commit 70879d2d8c
5 changed files with 33 additions and 19 deletions

View file

@ -811,13 +811,14 @@ void GUI_App::post_init()
// preset_updater->sync downloads profile updates on background so it must begin after config wizard finished.
bool cw_showed = this->config_wizard_startup();
this->preset_updater->sync(preset_bundle);
this->app_version_check(false);
if (! cw_showed) {
// The CallAfter is needed as well, without it, GL extensions did not show.
// Also, we only want to show this when the wizard does not, so the new user
// sees something else than "we want something" on the first start.
show_send_system_info_dialog_if_needed();
}
show_send_system_info_dialog_if_needed();
}
// app version check is asynchronous and triggers blocking dialog window, better call it last
this->app_version_check(false);
});
}
@ -1245,7 +1246,7 @@ bool GUI_App::on_init_inner()
preset_updater = new PresetUpdater();
Bind(EVT_SLIC3R_VERSION_ONLINE, &GUI_App::on_version_read, this);
Bind(EVT_SLIC3R_EXPERIMENTAL_VERSION_ONLINE, [this](const wxCommandEvent& evt) {
if (this->plater_ != nullptr && app_config->get("notify_release") == "all") {
if (this->plater_ != nullptr && (m_app_updater->get_triggered_by_user() || app_config->get("notify_release") == "all")) {
std::string evt_string = into_u8(evt.GetString());
if (*Semver::parse(SLIC3R_VERSION) < *Semver::parse(evt_string)) {
auto notif_type = (evt_string.find("beta") != std::string::npos ? NotificationType::NewBetaAvailable : NotificationType::NewAlphaAvailable);
@ -3305,7 +3306,8 @@ void GUI_App::on_version_read(wxCommandEvent& evt)
app_config->set("version_online", into_u8(evt.GetString()));
app_config->save();
std::string opt = app_config->get("notify_release");
if (this->plater_ == nullptr || (opt != "all" && opt != "release")) {
if (this->plater_ == nullptr || (!m_app_updater->get_triggered_by_user() && opt != "all" && opt != "release")) {
BOOST_LOG_TRIVIAL(info) << "Version online: " << evt.GetString() << ". User does not wish to be notified.";
return;
}
if (*Semver::parse(SLIC3R_VERSION) >= *Semver::parse(into_u8(evt.GetString()))) {
@ -3355,7 +3357,7 @@ void GUI_App::app_updater(bool from_user)
assert(!app_data.target_path.empty());
// dialog with new version info
AppUpdateAvailableDialog dialog(*Semver::parse(SLIC3R_VERSION), *app_data.version);
AppUpdateAvailableDialog dialog(*Semver::parse(SLIC3R_VERSION), *app_data.version, from_user);
auto dialog_result = dialog.ShowModal();
// checkbox "do not show again"
if (dialog.disable_version_check()) {