Skip to content

Commit

Permalink
add - Added support warning
Browse files Browse the repository at this point in the history
---

We've added a nonintrusive support warning message for release builds of
Nitrocid KS when a release series of Nitrocid is nearing end of support.

---

Type: add
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Feb 15, 2025
1 parent aa55839 commit 55a7732
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
3 changes: 3 additions & 0 deletions public/Nitrocid/Kernel/KernelEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ private static void MainLoop()
// Show a tip telling users to see license information
TextWriters.Write("* " + Translate.DoTranslation("Run 'license' to see the license information."), KernelColorType.Tip);

// Show another tip for release window
KernelReleaseInfo.NotifyReleaseSupportWindow();

// Start the shell
ShellManager.StartShellInternal(ShellType.Shell);
}
Expand Down
31 changes: 30 additions & 1 deletion public/Nitrocid/Kernel/KernelReleaseInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//

using Nitrocid.ConsoleBase.Colors;
using Nitrocid.ConsoleBase.Writers;
using Nitrocid.Kernel.Time;
using Nitrocid.Kernel.Time.Renderers;
using Nitrocid.Languages;
using System;

namespace Nitrocid.Kernel
{
internal static class KernelReleaseInfo
{

// Release specifiers (SPECIFIER: REL, DEV, ALPHA, BETA, or RC | None satisfied: Unsupported Release)
internal readonly static string ReleaseSpecifier = ""
#if !SPECIFIERREL
Expand All @@ -46,5 +52,28 @@ internal static class KernelReleaseInfo
#endif
;

// Release support window info
internal readonly static DateTime supportWindow = new(2025, 11, 27);
internal readonly static bool supportWindowPrimed =
#if SPECIFIERREL
true;
#else
false;
#endif

internal static void NotifyReleaseSupportWindow()
{
// Don't do anything if not primed yet
if (!supportWindowPrimed)
return;

// Check to see if we're close to end of support window
var currentDate = TimeDateTools.KernelDateTime.Date;
var supportWindowWarn = supportWindow.Subtract(new TimeSpan(30, 0, 0, 0));
if (currentDate >= supportWindowWarn && currentDate < supportWindow)
TextWriters.Write("* " + Translate.DoTranslation("We'll no longer support this version of Nitrocid KS after this date") + $": {TimeDateRenderers.RenderDate(supportWindow)}. " + Translate.DoTranslation("Make sure that you upgrade to the supported version soon if you want to continue receiving support."), KernelColorType.Warning);
else if (currentDate >= supportWindow)
TextWriters.Write("* " + Translate.DoTranslation("This version of Nitrocid KS is no longer supported.") + " " + Translate.DoTranslation("Make sure that you upgrade to the supported version soon if you want to continue receiving support."), KernelColorType.Warning);
}
}
}

0 comments on commit 55a7732

Please sign in to comment.