1313#include < libnick/app/datafilemanager.h>
1414#include < libnick/app/windowgeometry.h>
1515#include < libnick/events/event.h>
16+ #include < libnick/events/parameventargs.h>
1617#include < libnick/notifications/notificationsenteventargs.h>
1718#include < libnick/taskbar/taskbaritem.h>
1819#include < libnick/update/updater.h>
20+ #include < libnick/update/version.h>
1921#include " controllers/preferencesviewcontroller.h"
2022#include " models/startupinformation.h"
2123#include " models/theme.h"
@@ -43,6 +45,16 @@ namespace Nickvision::Application::Shared::Controllers
4345 * @return The notification sent event
4446 */
4547 Nickvision::Events::Event<Nickvision::Notifications::NotificationSentEventArgs>& notificationSent ();
48+ /* *
49+ * @brief Gets the event for when an application update is available.
50+ * @return The application update available event
51+ */
52+ Nickvision::Events::Event<Nickvision::Events::ParamEventArgs<Nickvision::Update::Version>>& appUpdateAvailable ();
53+ /* *
54+ * @brief Gets the event for when an application update's progress is changed.
55+ * @return The application update progress changed event
56+ */
57+ Nickvision::Events::Event<Nickvision::Events::ParamEventArgs<double >>& appUpdateProgressChanged ();
4658 /* *
4759 * @brief Gets the AppInfo object for the application
4860 * @return The current AppInfo object
@@ -53,6 +65,16 @@ namespace Nickvision::Application::Shared::Controllers
5365 * @return The preferred theme
5466 */
5567 Models::Theme getTheme ();
68+ /* *
69+ * @brief Gets the preferred update type for the application.
70+ * @return The preferred update type
71+ */
72+ Update::VersionType getPreferredUpdateType ();
73+ /* *
74+ * @brief Sets the preferred update type for the application.
75+ * @param type The preferred update type
76+ */
77+ void setPreferredUpdateType (Update::VersionType type);
5678 /* *
5779 * @brief Gets the debugging information for the application.
5880 * @param extraInformation Extra, ui-specific, information to include in the debug info statement
@@ -78,26 +100,19 @@ namespace Nickvision::Application::Shared::Controllers
78100 const Models::StartupInformation& startup (HWND hwnd);
79101#elif defined(__linux__)
80102 const Models::StartupInformation& startup (const std::string& desktopFile);
81- #else
103+ #else
82104 const Models::StartupInformation& startup ();
83105#endif
84106 /* *
85107 * @brief Shuts down the application.
86108 * @param geometry The window geometry to save
87109 */
88110 void shutdown (const Nickvision::App::WindowGeometry& geometry);
89- /* *
90- * @brief Checks for an application update and sends a notification if one is available.
91- * @param noUpdateNotification Send an app notification if no update is available.
92- */
93- void checkForUpdates (bool noUpdateNotification) const ;
94111#ifdef _WIN32
95112 /* *
96- * @brief Downloads and installs the latest application update in the background.
97- * @brief Will send a notification if the update fails.
98- * @brief MainWindowController::checkForUpdates() must be called before this method.
113+ * @brief Starts downloading and installing the latest application update for Windows in the background.
99114 */
100- void windowsUpdate ();
115+ void startWindowsUpdate ();
101116#endif
102117 /* *
103118 * @brief Gets the string for greeting on the home page.
@@ -138,6 +153,8 @@ namespace Nickvision::Application::Shared::Controllers
138153 private:
139154 bool m_started;
140155 std::vector<std::string> m_args;
156+ Nickvision::Events::Event<Nickvision::Events::ParamEventArgs<Nickvision::Update::Version>> m_appUpdateAvailable;
157+ Nickvision::Events::Event<Nickvision::Events::ParamEventArgs<double >> m_appUpdateProgressChanged;
141158 Nickvision::App::AppInfo m_appInfo;
142159 Nickvision::App::DataFileManager m_dataFileManager;
143160 std::shared_ptr<Nickvision::Update::Updater> m_updater;
0 commit comments