Skip to content

Commit 52204a5

Browse files
committed
feat: Show notification when no update available
1 parent b82d720 commit 52204a5

5 files changed

Lines changed: 49 additions & 33 deletions

File tree

libapplication/include/controllers/mainwindowcontroller.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ namespace Nickvision::Application::Shared::Controllers
8888
void shutdown(const Nickvision::App::WindowGeometry& geometry);
8989
/**
9090
* @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.
9192
*/
92-
void checkForUpdates();
93+
void checkForUpdates(bool noUpdateNotification) const;
9394
#ifdef _WIN32
9495
/**
9596
* @brief Downloads and installs the latest application update in the background.

libapplication/src/controllers/mainwindowcontroller.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ namespace Nickvision::Application::Shared::Controllers
110110
m_taskbar.connect(hwnd);
111111
if (m_dataFileManager.get<Configuration>("config").getAutomaticallyCheckForUpdates())
112112
{
113-
checkForUpdates();
113+
checkForUpdates(false);
114114
}
115115
#elif defined(__linux__)
116116
m_taskbar.connect(desktopFile);
@@ -126,13 +126,13 @@ namespace Nickvision::Application::Shared::Controllers
126126
config.save();
127127
}
128128

129-
void MainWindowController::checkForUpdates()
129+
void MainWindowController::checkForUpdates(bool noUpdateNotification) const
130130
{
131131
if(!m_updater)
132132
{
133133
return;
134134
}
135-
std::thread worker{ [this]()
135+
std::thread worker{ [this, noUpdateNotification]()
136136
{
137137
Version latest{ m_updater->fetchCurrentVersion(VersionType::Stable) };
138138
if(!latest.empty())
@@ -141,6 +141,14 @@ namespace Nickvision::Application::Shared::Controllers
141141
{
142142
AppNotification::send({ _("New update available"), NotificationSeverity::Success, "update" });
143143
}
144+
else if(noUpdateNotification)
145+
{
146+
AppNotification::send({ _("No update available"), NotificationSeverity::Warning });
147+
}
148+
}
149+
else if(noUpdateNotification)
150+
{
151+
AppNotification::send({ _("No update available"), NotificationSeverity::Warning });
144152
}
145153
} };
146154
worker.detach();

org.nickvision.application.winui/Views/MainWindow.xaml.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ namespace winrt::Nickvision::Application::WinUI::Views::implementation
201201

202202
void MainWindow::CheckForUpdates(const IInspectable& sender, const RoutedEventArgs& args)
203203
{
204-
m_controller->checkForUpdates();
204+
m_controller->checkForUpdates(true);
205205
}
206206

207207
Windows::Foundation::IAsyncAction MainWindow::GitHubRepo(const IInspectable& sender, const RoutedEventArgs& args)

resources/po/application.pot

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2025-06-19 11:32-0400\n"
11+
"POT-Creation-Date: 2025-06-21 09:56-0400\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -50,43 +50,47 @@ msgstr ""
5050
msgid "New update available"
5151
msgstr ""
5252

53-
#: libapplication/src/controllers/mainwindowcontroller.cpp:156
53+
#: libapplication/src/controllers/mainwindowcontroller.cpp:146
54+
#: libapplication/src/controllers/mainwindowcontroller.cpp:151
55+
msgid "No update available"
56+
msgstr ""
57+
58+
#: libapplication/src/controllers/mainwindowcontroller.cpp:164
5459
msgid ""
5560
"The update is downloading in the background and will start once it finishes"
5661
msgstr ""
5762

58-
#: libapplication/src/controllers/mainwindowcontroller.cpp:161
63+
#: libapplication/src/controllers/mainwindowcontroller.cpp:169
5964
msgid "Unable to download and install update"
6065
msgstr ""
6166

62-
#: libapplication/src/controllers/mainwindowcontroller.cpp:174
67+
#: libapplication/src/controllers/mainwindowcontroller.cpp:182
6368
msgctxt "Night"
6469
msgid "Good Morning!"
6570
msgstr ""
6671

67-
#: libapplication/src/controllers/mainwindowcontroller.cpp:178
72+
#: libapplication/src/controllers/mainwindowcontroller.cpp:186
6873
msgctxt "Morning"
6974
msgid "Good Morning!"
7075
msgstr ""
7176

72-
#: libapplication/src/controllers/mainwindowcontroller.cpp:182
77+
#: libapplication/src/controllers/mainwindowcontroller.cpp:190
7378
msgid "Good Afternoon!"
7479
msgstr ""
7580

76-
#: libapplication/src/controllers/mainwindowcontroller.cpp:186
81+
#: libapplication/src/controllers/mainwindowcontroller.cpp:194
7782
msgid "Good Evening!"
7883
msgstr ""
7984

80-
#: libapplication/src/controllers/mainwindowcontroller.cpp:188
85+
#: libapplication/src/controllers/mainwindowcontroller.cpp:196
8186
msgid "Good Day!"
8287
msgstr ""
8388

84-
#: libapplication/src/controllers/mainwindowcontroller.cpp:231
85-
#, c++-format
89+
#: libapplication/src/controllers/mainwindowcontroller.cpp:239
8690
msgid "Folder Opened: {}"
8791
msgstr ""
8892

89-
#: libapplication/src/controllers/mainwindowcontroller.cpp:246
93+
#: libapplication/src/controllers/mainwindowcontroller.cpp:254
9094
msgid "Folder closed"
9195
msgstr ""
9296

@@ -188,7 +192,6 @@ msgstr ""
188192

189193
#: org.nickvision.application.gnome/src/views/mainwindow.cpp:138
190194
#: org.nickvision.application.winui/Views/MainWindow.xaml.cpp:239
191-
#, c++-format
192195
msgid "There is {} file in the folder."
193196
msgid_plural "There are {} files in the folder."
194197
msgstr[0] ""
@@ -279,7 +282,6 @@ msgid "Update"
279282
msgstr ""
280283

281284
#: org.nickvision.application.winui/Views/MainWindow.xaml.cpp:238
282-
#, c++-format
283285
msgid "Folder: {}"
284286
msgstr ""
285287

resources/po/ru.po

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: PACKAGE VERSION\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2025-06-14 12:41-0400\n"
10+
"POT-Creation-Date: 2025-06-21 09:56-0400\n"
1111
"PO-Revision-Date: 2023-05-23 06:33+0300\n"
1212
"Last-Translator: Fyodor Sobolev\n"
1313
"Language-Team: Russian\n"
1414
"Language: ru\n"
1515
"MIME-Version: 1.0\n"
1616
"Content-Type: text/plain; charset=UTF-8\n"
1717
"Content-Transfer-Encoding: 8bit\n"
18-
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
19-
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
18+
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
19+
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
2020

2121
#: libapplication/src/controllers/mainwindowcontroller.cpp:29
2222
msgid "Application"
@@ -51,43 +51,48 @@ msgstr "Фёдор Соболев https://github.com/fsobolev"
5151
msgid "New update available"
5252
msgstr ""
5353

54-
#: libapplication/src/controllers/mainwindowcontroller.cpp:156
54+
#: libapplication/src/controllers/mainwindowcontroller.cpp:146
55+
#: libapplication/src/controllers/mainwindowcontroller.cpp:151
56+
msgid "No update available"
57+
msgstr ""
58+
59+
#: libapplication/src/controllers/mainwindowcontroller.cpp:164
5560
msgid ""
5661
"The update is downloading in the background and will start once it finishes"
5762
msgstr ""
5863

59-
#: libapplication/src/controllers/mainwindowcontroller.cpp:161
64+
#: libapplication/src/controllers/mainwindowcontroller.cpp:169
6065
msgid "Unable to download and install update"
6166
msgstr ""
6267

63-
#: libapplication/src/controllers/mainwindowcontroller.cpp:174
68+
#: libapplication/src/controllers/mainwindowcontroller.cpp:182
6469
msgctxt "Night"
6570
msgid "Good Morning!"
6671
msgstr "Доброй ночи!"
6772

68-
#: libapplication/src/controllers/mainwindowcontroller.cpp:178
73+
#: libapplication/src/controllers/mainwindowcontroller.cpp:186
6974
msgctxt "Morning"
7075
msgid "Good Morning!"
7176
msgstr "Доброе утро!"
7277

73-
#: libapplication/src/controllers/mainwindowcontroller.cpp:182
78+
#: libapplication/src/controllers/mainwindowcontroller.cpp:190
7479
msgid "Good Afternoon!"
7580
msgstr "Добрый день!"
7681

77-
#: libapplication/src/controllers/mainwindowcontroller.cpp:186
82+
#: libapplication/src/controllers/mainwindowcontroller.cpp:194
7883
msgid "Good Evening!"
7984
msgstr "Добрый вечер!"
8085

81-
#: libapplication/src/controllers/mainwindowcontroller.cpp:188
86+
#: libapplication/src/controllers/mainwindowcontroller.cpp:196
8287
msgid "Good Day!"
8388
msgstr "Здравствуйте!"
8489

85-
#: libapplication/src/controllers/mainwindowcontroller.cpp:231
86-
#, fuzzy, c++-format
90+
#: libapplication/src/controllers/mainwindowcontroller.cpp:239
91+
#, fuzzy
8792
msgid "Folder Opened: {}"
8893
msgstr "Папка открыта: {0}"
8994

90-
#: libapplication/src/controllers/mainwindowcontroller.cpp:246
95+
#: libapplication/src/controllers/mainwindowcontroller.cpp:254
9196
#, fuzzy
9297
msgid "Folder closed"
9398
msgstr "Папка закрыта."
@@ -192,7 +197,7 @@ msgstr "Закрыть"
192197

193198
#: org.nickvision.application.gnome/src/views/mainwindow.cpp:138
194199
#: org.nickvision.application.winui/Views/MainWindow.xaml.cpp:239
195-
#, fuzzy, c++-format
200+
#, fuzzy
196201
msgid "There is {} file in the folder."
197202
msgid_plural "There are {} files in the folder."
198203
msgstr[0] "В папке {0} файл."
@@ -284,7 +289,7 @@ msgid "Update"
284289
msgstr ""
285290

286291
#: org.nickvision.application.winui/Views/MainWindow.xaml.cpp:238
287-
#, fuzzy, c++-format
292+
#, fuzzy
288293
msgid "Folder: {}"
289294
msgstr "Папка"
290295

0 commit comments

Comments
 (0)