diff --git a/src/Sidekick.Common.Blazor/Initialization/Initialization.razor.cs b/src/Sidekick.Common.Blazor/Initialization/Initialization.razor.cs index a8d854b2..603403ed 100644 --- a/src/Sidekick.Common.Blazor/Initialization/Initialization.razor.cs +++ b/src/Sidekick.Common.Blazor/Initialization/Initialization.razor.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Sidekick.Common.Browser; +using Sidekick.Common.Cache; using Sidekick.Common.Initialization; using Sidekick.Common.Keybinds; using Sidekick.Common.Platform; @@ -38,6 +39,9 @@ public partial class Initialization : SidekickView [Inject] private ISettingsService SettingsService { get; set; } = null!; + [Inject] + private ICacheProvider CacheProvider { get; set; } = null!; + private int Count { get; set; } private int Completed { get; set; } @@ -72,6 +76,13 @@ public async Task Handle() { Completed = 0; Count = Configuration.Value.InitializableServices.Count + 1; + var version = GetVersion(); + var perviousVersion = await SettingsService.GetString(SettingKeys.Version); + if (version != perviousVersion) + { + CacheProvider.Clear(); + await SettingsService.Set(SettingKeys.Version, version); + } // Report initial progress await ReportProgress(); @@ -158,6 +169,14 @@ private Task ReportProgress() }); } + private string? GetVersion() + { + return FileVersionInfo.GetVersionInfo( + GetType() + .Assembly.Location) + .ProductVersion; + } + private void InitializeTray() { var menuItems = new List(); @@ -165,12 +184,7 @@ private void InitializeTray() menuItems.AddRange( new List() { - new( - label: "Sidekick - " - + FileVersionInfo.GetVersionInfo( - GetType() - .Assembly.Location) - .ProductVersion), + new(label: "Sidekick - " + GetVersion()), new( label: "Open Website", onClick: () => diff --git a/src/Sidekick.Common/Settings/SettingKeys.cs b/src/Sidekick.Common/Settings/SettingKeys.cs index 0631bfd2..7b25b230 100644 --- a/src/Sidekick.Common/Settings/SettingKeys.cs +++ b/src/Sidekick.Common/Settings/SettingKeys.cs @@ -2,6 +2,8 @@ namespace Sidekick.Common.Settings; public static class SettingKeys { + public const string Version = nameof(Version); + public const string CurrentDirectory = nameof(CurrentDirectory); public const string BearerToken = nameof(BearerToken); diff --git a/src/Sidekick.Modules.Settings/General/LanguageParserEditor.razor b/src/Sidekick.Modules.Settings/General/LanguageParserEditor.razor index 4a4f2063..99a67339 100644 --- a/src/Sidekick.Modules.Settings/General/LanguageParserEditor.razor +++ b/src/Sidekick.Modules.Settings/General/LanguageParserEditor.razor @@ -9,6 +9,7 @@ @inject SettingsResources Resources @inject IGameLanguageProvider GameLanguageProvider @inject ISettingsService SettingsService +@inject NavigationManager NavigationManager @code { @@ -38,6 +39,9 @@ { Language = value; await SettingsService.Set(SettingKeys.LanguageParser, value); + NavigationManager.NavigateTo("/initialize"); } } + +