Fix settings warning logic to ensure I18N & prevent redundant alerts

This commit is contained in:
Thorsten Sommer 2026-06-21 18:33:31 +02:00
parent 26172ce43a
commit a6cb8e03f4
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -58,6 +58,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
private MudThemeProvider themeProvider = null!; private MudThemeProvider themeProvider = null!;
private bool useDarkMode; private bool useDarkMode;
private bool startupCompleted; private bool startupCompleted;
private bool settingsWriteProtectionWarningShown;
private readonly SemaphoreSlim mandatoryInfoDialogSemaphore = new(1, 1); private readonly SemaphoreSlim mandatoryInfoDialogSemaphore = new(1, 1);
private IReadOnlyCollection<NavBarItem> navItems = []; private IReadOnlyCollection<NavBarItem> navItems = [];
@ -107,7 +108,6 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
// Set the snackbar for the update service: // Set the snackbar for the update service:
UpdateService.SetBlazorDependencies(this.Snackbar); UpdateService.SetBlazorDependencies(this.Snackbar);
TemporaryChatService.Initialize(); TemporaryChatService.Initialize();
this.ShowSettingsWriteProtectionWarning();
// Should the navigation bar be open by default? // Should the navigation bar be open by default?
if(this.SettingsManager.ConfigurationData.App.NavigationBehavior is NavBehavior.ALWAYS_EXPAND) if(this.SettingsManager.ConfigurationData.App.NavigationBehavior is NavBehavior.ALWAYS_EXPAND)
@ -130,9 +130,10 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
private void ShowSettingsWriteProtectionWarning() private void ShowSettingsWriteProtectionWarning()
{ {
if(!this.SettingsManager.SettingsWriteBlocked) if(!this.SettingsManager.SettingsWriteBlocked || this.settingsWriteProtectionWarningShown)
return; return;
this.settingsWriteProtectionWarningShown = true;
var reason = this.SettingsManager.SettingsWriteBlockReason; var reason = this.SettingsManager.SettingsWriteBlockReason;
var message = reason switch var message = reason switch
{ {
@ -309,6 +310,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
case Event.PLUGINS_RELOADED: case Event.PLUGINS_RELOADED:
this.Lang = await this.SettingsManager.GetActiveLanguagePlugin(); this.Lang = await this.SettingsManager.GetActiveLanguagePlugin();
I18N.Init(this.Lang); I18N.Init(this.Lang);
this.ShowSettingsWriteProtectionWarning();
this.LoadNavItems(); this.LoadNavItems();
await this.InvokeAsync(this.StateHasChanged); await this.InvokeAsync(this.StateHasChanged);