SHOWING changelog everytime till the got it button is pressed, should reappear on version updates according to the current settings

This commit is contained in:
choco
2025-10-16 23:03:32 +02:00
parent 9170b5205c
commit 8fdff1eb18
2 changed files with 14 additions and 14 deletions

View File

@@ -159,22 +159,14 @@ public class LightlessPlugin : MediatorSubscriberBase, IHostedService
var currentVersion = ver == null ? string.Empty : $"{ver.Major}.{ver.Minor}.{ver.Build}";
var lastSeen = _lightlessConfigService.Current.LastSeenVersion ?? string.Empty;
Logger?.LogDebug("Last seen version: {lastSeen}, current version: {currentVersion}", lastSeen, currentVersion);
// for testing c:
// Mediator.Publish(new UiToggleMessage(typeof(UpdateNotesUi)));
if (string.IsNullOrEmpty(lastSeen))
// Show update notes if version has changed and user has valid setup
if (!string.IsNullOrEmpty(lastSeen) &&
!string.Equals(lastSeen, currentVersion, StringComparison.Ordinal) &&
_lightlessConfigService.Current.HasValidSetup() &&
_serverConfigurationManager.HasValidConfig())
{
_lightlessConfigService.Current.LastSeenVersion = currentVersion;
_lightlessConfigService.Save();
}
else if (!string.Equals(lastSeen, currentVersion, StringComparison.Ordinal))
{
if (_lightlessConfigService.Current.HasValidSetup() && _serverConfigurationManager.HasValidConfig())
{
Mediator.Publish(new UiToggleMessage(typeof(UpdateNotesUi)));
}
_lightlessConfigService.Current.LastSeenVersion = currentVersion;
_lightlessConfigService.Save();
Mediator.Publish(new UiToggleMessage(typeof(UpdateNotesUi)));
}
#if !DEBUG

View File

@@ -20,6 +20,7 @@ namespace LightlessSync.UI;
public class UpdateNotesUi : WindowMediatorSubscriberBase
{
private readonly UiSharedService _uiShared;
private readonly LightlessConfigService _configService;
private ChangelogFile _changelog = new();
private CreditsFile _credits = new();
@@ -65,6 +66,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
: base(logger, mediator, "Lightless Sync — Update Notes", performanceCollectorService)
{
_uiShared = uiShared;
_configService = configService;
AllowClickthrough = false;
AllowPinning = false;
@@ -576,6 +578,12 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
{
if (ImGui.Button("Got it!", new Vector2(closeWidth, closeHeight)))
{
// Update last seen version when user acknowledges the update notes
var ver = Assembly.GetExecutingAssembly().GetName().Version;
var currentVersion = ver == null ? string.Empty : $"{ver.Major}.{ver.Minor}.{ver.Build}";
_configService.Current.LastSeenVersion = currentVersion;
_configService.Save();
IsOpen = false;
}
}