diff --git a/Daybreak.Core/Services/Guildwars/GuildWarsVersionChecker.cs b/Daybreak.Core/Services/Guildwars/GuildWarsVersionChecker.cs index c42601ca..e3b1361d 100644 --- a/Daybreak.Core/Services/Guildwars/GuildWarsVersionChecker.cs +++ b/Daybreak.Core/Services/Guildwars/GuildWarsVersionChecker.cs @@ -1,5 +1,6 @@ using Daybreak.Configuration.Options; using Daybreak.Services.Guildwars; +using Daybreak.Shared; using Daybreak.Shared.Models.Async; using Daybreak.Shared.Models.Mods; using Daybreak.Shared.Services.ExecutableManagement; @@ -153,7 +154,7 @@ internal sealed class GuildWarsVersionChecker( this.notificationService.NotifyInformation( title: "Guild Wars needs an update", description: "One or more Guild Wars executables are out of date and require an update. Click here to start the update", - expirationTime: DateTime.UtcNow + TimeSpan.FromSeconds(15)); + expirationTime: Global.NotificationNeverExpire); return; } } diff --git a/Daybreak.Core/Services/ReShade/ReShadeService.cs b/Daybreak.Core/Services/ReShade/ReShadeService.cs index 495cc8f4..e0935185 100644 --- a/Daybreak.Core/Services/ReShade/ReShadeService.cs +++ b/Daybreak.Core/Services/ReShade/ReShadeService.cs @@ -23,6 +23,7 @@ using System.Extensions; using System.Extensions.Core; using System.IO.Compression; using TrailBlazr.Services; +using Daybreak.Shared; namespace Daybreak.Services.ReShade; internal sealed class ReShadeService( @@ -421,7 +422,8 @@ internal sealed class ReShadeService( scopedLogger.LogDebug($"ReShade updated to version {version}"); this.notificationService.NotifyInformation( "ReShade updated", - $"ReShade has been updated to version {version}"); + $"ReShade has been updated to version {version}", + expirationTime: Global.NotificationLongExpiration); return; } @@ -429,7 +431,8 @@ internal sealed class ReShadeService( scopedLogger.LogError("Failed to update ReShade"); this.notificationService.NotifyInformation( "Failed to update ReShade", - $"Could not update ReShade to version {version}. Check logs for details"); + $"Could not update ReShade to version {version}. Check logs for details", + expirationTime: Global.NotificationLongExpiration); } private async Task InstallPackageInternal( diff --git a/Daybreak.Core/Services/Startup/Actions/VerifyNativeComponentsAction.cs b/Daybreak.Core/Services/Startup/Actions/VerifyNativeComponentsAction.cs index 75ddedfd..d7ca57dc 100644 --- a/Daybreak.Core/Services/Startup/Actions/VerifyNativeComponentsAction.cs +++ b/Daybreak.Core/Services/Startup/Actions/VerifyNativeComponentsAction.cs @@ -1,4 +1,5 @@ using System.Extensions.Core; +using Daybreak.Shared; using Daybreak.Shared.Models; using Daybreak.Shared.Services.Notifications; using Daybreak.Shared.Utils; @@ -64,7 +65,7 @@ public sealed class VerifyNativeComponentsAction( this.notificationService.NotifyError( title: "Missing native components", description: "Daybreak detected missing native components and some features may not work.", - expirationTime: DateTime.UtcNow + TimeSpan.FromSeconds(15) + expirationTime: Global.NotificationLongExpiration ); } else diff --git a/Daybreak.Core/Services/Toolbox/ToolboxService.cs b/Daybreak.Core/Services/Toolbox/ToolboxService.cs index 0b006a16..cd50fbf2 100644 --- a/Daybreak.Core/Services/Toolbox/ToolboxService.cs +++ b/Daybreak.Core/Services/Toolbox/ToolboxService.cs @@ -20,6 +20,7 @@ using System.Extensions; using System.Extensions.Core; using System.Runtime.CompilerServices; using System.Text; +using Daybreak.Shared; namespace Daybreak.Services.Toolbox; @@ -141,7 +142,7 @@ internal sealed class ToolboxService( { if (await this.IsUpdateAvailableInternal(cancellationToken)) { - this.notificationService.NotifyInformation("GWToolboxpp update available", "Click on this notification to update GWToolboxpp", expirationTime: DateTime.UtcNow + TimeSpan.FromSeconds(15)); + this.notificationService.NotifyInformation("GWToolboxpp update available", "Click on this notification to update GWToolboxpp", expirationTime: Global.NotificationNeverExpire); } } diff --git a/Daybreak.Core/Services/UMod/UModService.cs b/Daybreak.Core/Services/UMod/UModService.cs index 4b1bbe3e..dc30160e 100644 --- a/Daybreak.Core/Services/UMod/UModService.cs +++ b/Daybreak.Core/Services/UMod/UModService.cs @@ -20,6 +20,7 @@ using System.Diagnostics; using System.Extensions; using System.Extensions.Core; using TrailBlazr.Services; +using Daybreak.Shared; namespace Daybreak.Services.UMod; @@ -293,7 +294,8 @@ internal sealed class UModService( await this.DownloadLatestDll(progress, cancellationToken); this.notificationService.NotifyInformation( title: "UMod updated", - description: $"UMod has been updated to version {latestVersion}"); + description: $"UMod has been updated to version {latestVersion}", + expirationTime: Global.NotificationLongExpiration); } private async Task SetupUModDll(IProgress progress, CancellationToken cancellationToken) diff --git a/Daybreak.Linux/Services/Startup/Actions/SetupWinePrefixAction.cs b/Daybreak.Linux/Services/Startup/Actions/SetupWinePrefixAction.cs index 8725b1d9..75e47eda 100644 --- a/Daybreak.Linux/Services/Startup/Actions/SetupWinePrefixAction.cs +++ b/Daybreak.Linux/Services/Startup/Actions/SetupWinePrefixAction.cs @@ -1,6 +1,7 @@ using System.Extensions.Core; using Daybreak.Linux.Services.Startup.Notifications; using Daybreak.Linux.Services.Wine; +using Daybreak.Shared; using Daybreak.Shared.Models; using Daybreak.Shared.Services.Notifications; using Microsoft.Extensions.Logging; @@ -49,7 +50,7 @@ public sealed class SetupWinePrefixAction( this.notificationService.NotifyInformation( title: "Wine prefix setup required", description: "Click here to initialize the Wine prefix for Guild Wars launching.", - expirationTime: DateTime.UtcNow + TimeSpan.FromSeconds(15) + expirationTime: Global.NotificationLongExpiration ); } } diff --git a/Daybreak.Linux/Services/Startup/Notifications/WinePrefixSetupHandler.cs b/Daybreak.Linux/Services/Startup/Notifications/WinePrefixSetupHandler.cs index f83d3d23..5e1e83b3 100644 --- a/Daybreak.Linux/Services/Startup/Notifications/WinePrefixSetupHandler.cs +++ b/Daybreak.Linux/Services/Startup/Notifications/WinePrefixSetupHandler.cs @@ -1,5 +1,6 @@ using System.Extensions.Core; using Daybreak.Linux.Services.Wine; +using Daybreak.Shared; using Daybreak.Shared.Models.Notifications; using Daybreak.Shared.Models.Notifications.Handling; using Daybreak.Shared.Services.Notifications; @@ -53,7 +54,7 @@ public sealed class WinePrefixSetupHandler( this.notificationService.NotifyInformation( title: "Wine prefix ready", description: "Wine prefix has been initialized successfully. You can now launch Guild Wars.", - expirationTime: DateTime.UtcNow + TimeSpan.FromSeconds(5) + expirationTime: Global.NotificationLongExpiration ); } else @@ -62,7 +63,7 @@ public sealed class WinePrefixSetupHandler( this.notificationService.NotifyError( title: "Wine prefix setup failed", description: "Failed to initialize the Wine prefix. Check the logs for more details.", - expirationTime: DateTime.UtcNow + TimeSpan.FromSeconds(5) + expirationTime: Global.NotificationLongExpiration ); } } diff --git a/Daybreak.Shared/Global.cs b/Daybreak.Shared/Global.cs index cdec703e..6f6dbd9f 100644 --- a/Daybreak.Shared/Global.cs +++ b/Daybreak.Shared/Global.cs @@ -8,6 +8,9 @@ namespace Daybreak.Shared; public static class Global { - //Will get set by Daybreak on application startup public static IServiceProvider GlobalServiceProvider { get; internal set; } = default!; + + public static DateTime NotificationShortExpiration => DateTime.UtcNow + TimeSpan.FromSeconds(15); + public static DateTime NotificationLongExpiration => DateTime.UtcNow + TimeSpan.FromMinutes(1); + public static DateTime NotificationNeverExpire => DateTime.MaxValue; }