Skip to content

Commit 14cc37d

Browse files
committed
Add 'New Update' notification flow
Introduce a small update-notification feature: add AppEvents.HasUpdateNotified event and have TaskManager publish it when update messages exist. Add localized resource key (menuNewUpdate) and expose it in the ResUI designer; update resource files for several languages. In the UI, add a New Update button in MainWindow.xaml, wire its click to the existing check-update handler, bind its visibility to a new BlNewUpdate property on MainWindowViewModel, and subscribe the viewmodel to the new event. Also reset the notification flag after showing the Check Update dialog.
1 parent c7519f8 commit 14cc37d

15 files changed

Lines changed: 66 additions & 0 deletions

v2rayN/ServiceLib/Events/AppEvents.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public static class AppEvents
77
public static readonly EventChannel<Unit> AddServerViaScanRequested = new();
88
public static readonly EventChannel<Unit> AddServerViaClipboardRequested = new();
99
public static readonly EventChannel<bool> SubscriptionsUpdateRequested = new();
10+
public static readonly EventChannel<bool> HasUpdateNotified = new();
1011

1112
public static readonly EventChannel<Unit> ProfilesRefreshRequested = new();
1213
public static readonly EventChannel<Unit> SubscriptionsRefreshRequested = new();

v2rayN/ServiceLib/Manager/TaskManager.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,10 @@ private async Task UpdateTaskRunCheckUpdate()
142142
await _updateFunc?.Invoke(false, msg);
143143
}
144144
NoticeManager.Instance.Enqueue(string.Join("\n", msgs));
145+
146+
if (msgs.Count > 0)
147+
{
148+
AppEvents.HasUpdateNotified.Publish(true);
149+
}
145150
}
146151
}

v2rayN/ServiceLib/Resx/ResUI.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,4 +1743,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
17431743
<data name="LvTestIpInfo" xml:space="preserve">
17441744
<value>IP Info</value>
17451745
</data>
1746+
<data name="menuNewUpdate" xml:space="preserve">
1747+
<value>New Update</value>
1748+
</data>
17461749
</root>

v2rayN/ServiceLib/Resx/ResUI.fr.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,4 +1740,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
17401740
<data name="LvTestIpInfo" xml:space="preserve">
17411741
<value>IP Info</value>
17421742
</data>
1743+
<data name="menuNewUpdate" xml:space="preserve">
1744+
<value>New Update</value>
1745+
</data>
17431746
</root>

v2rayN/ServiceLib/Resx/ResUI.hu.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,4 +1743,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
17431743
<data name="LvTestIpInfo" xml:space="preserve">
17441744
<value>IP Info</value>
17451745
</data>
1746+
<data name="menuNewUpdate" xml:space="preserve">
1747+
<value>New Update</value>
1748+
</data>
17461749
</root>

v2rayN/ServiceLib/Resx/ResUI.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,4 +1743,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
17431743
<data name="LvTestIpInfo" xml:space="preserve">
17441744
<value>IP Info</value>
17451745
</data>
1746+
<data name="menuNewUpdate" xml:space="preserve">
1747+
<value>New Update</value>
1748+
</data>
17461749
</root>

v2rayN/ServiceLib/Resx/ResUI.ru.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,4 +1743,7 @@
17431743
<data name="LvTestIpInfo" xml:space="preserve">
17441744
<value>IP Info</value>
17451745
</data>
1746+
<data name="menuNewUpdate" xml:space="preserve">
1747+
<value>New Update</value>
1748+
</data>
17461749
</root>

v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,4 +1740,7 @@
17401740
<data name="LvTestIpInfo" xml:space="preserve">
17411741
<value>IP 信息</value>
17421742
</data>
1743+
<data name="menuNewUpdate" xml:space="preserve">
1744+
<value>有更新</value>
1745+
</data>
17431746
</root>

v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,4 +1740,7 @@
17401740
<data name="LvTestIpInfo" xml:space="preserve">
17411741
<value>IP 資訊</value>
17421742
</data>
1743+
<data name="menuNewUpdate" xml:space="preserve">
1744+
<value>有更新</value>
1745+
</data>
17431746
</root>

0 commit comments

Comments
 (0)