Skip to content

Commit

Permalink
Reflect CheckForBetaUpdates change w/o restart on Windows
Browse files Browse the repository at this point in the history
If the user changes their beta updates preference, reflect it
immediately so that subsequent manual check for updates works as
expected.

This already worked correctly on macOS.
  • Loading branch information
vslavik committed May 1, 2023
1 parent 3130a68 commit b05c33b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/edapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,11 @@ bool PoeditApp::OnInit()
#endif // USE_SPARKLE

#ifdef __WXMSW__
wxString appcast = "https://poedit.net/updates_v2/win/appcast";
if ( CheckForBetaUpdates() )
{
// Beta versions use unstable feed.
appcast = "https://poedit.net/updates_v2/win/appcast/beta";
}

win_sparkle_set_appcast_url(appcast.utf8_str());
if (CheckForBetaUpdates())
win_sparkle_set_appcast_url("https://poedit.net/updates_v2/win/appcast/beta");
else
win_sparkle_set_appcast_url("https://poedit.net/updates_v2/win/appcast");

win_sparkle_set_can_shutdown_callback(&PoeditApp::WinSparkle_CanShutdown);
win_sparkle_set_shutdown_request_callback(&PoeditApp::WinSparkle_Shutdown);
auto buildnum = GetAppBuildNumber();
Expand Down
7 changes: 6 additions & 1 deletion src/prefsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,10 +1135,15 @@ class UpdatesPageWindow : public PrefsPanel

void SaveValues(wxConfigBase& cfg) override
{
cfg.Write("check_for_beta_updates", m_beta->GetValue());
#ifdef __WXMSW__
win_sparkle_set_automatic_check_for_updates(m_updates->GetValue());
// FIXME: don't duplicate this code from PoeditApp::OnInit()
if (m_beta->GetValue())
win_sparkle_set_appcast_url("https://poedit.net/updates_v2/win/appcast/beta");
else
win_sparkle_set_appcast_url("https://poedit.net/updates_v2/win/appcast");
#endif
cfg.Write("check_for_beta_updates", m_beta->GetValue());
#ifdef USE_SPARKLE
UserDefaults_SetBoolValue("SUEnableAutomaticChecks", m_updates->GetValue());
#endif
Expand Down

0 comments on commit b05c33b

Please sign in to comment.