mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 05:13:47 +00:00
Added config option for start page (#704)
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
This commit is contained in:
1 parent
df50fdb8b8
commit
a2bd67eda3
21 files changed
+436
-32
No files matched your search
@@ -36,6 +36,16 @@ public record ConfigMeta<TClass, TValue> : ConfigMetaBase
|
||||
/// The ID of the plugin that locked this configuration.
|
||||
/// </summary>
|
||||
public Guid LockedByConfigPluginId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// How this setting is managed by a configuration plugin, if at all.
|
||||
/// </summary>
|
||||
public ManagedConfigurationMode? ManagedMode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the plugin that currently provides an editable default value.
|
||||
/// </summary>
|
||||
public Guid EditableDefaultByConfigPluginId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The default value for the configuration property. This is used when resetting the property to its default state.
|
||||
@@ -65,6 +75,8 @@ public record ConfigMeta<TClass, TValue> : ConfigMetaBase
|
||||
{
|
||||
this.IsLocked = true;
|
||||
this.LockedByConfigPluginId = pluginId;
|
||||
this.ManagedMode = ManagedConfigurationMode.LOCKED;
|
||||
this.EditableDefaultByConfigPluginId = Guid.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -75,6 +87,9 @@ public record ConfigMeta<TClass, TValue> : ConfigMetaBase
|
||||
{
|
||||
this.IsLocked = false;
|
||||
this.LockedByConfigPluginId = Guid.Empty;
|
||||
if (this.ManagedMode is ManagedConfigurationMode.LOCKED)
|
||||
this.ManagedMode = null;
|
||||
|
||||
this.Reset();
|
||||
}
|
||||
|
||||
@@ -85,6 +100,30 @@ public record ConfigMeta<TClass, TValue> : ConfigMetaBase
|
||||
{
|
||||
this.IsLocked = false;
|
||||
this.LockedByConfigPluginId = Guid.Empty;
|
||||
if (this.ManagedMode is ManagedConfigurationMode.LOCKED)
|
||||
this.ManagedMode = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks the setting as having an editable default provided by a configuration plugin.
|
||||
/// </summary>
|
||||
public void SetEditableDefaultConfiguration(Guid pluginId)
|
||||
{
|
||||
this.IsLocked = false;
|
||||
this.LockedByConfigPluginId = Guid.Empty;
|
||||
this.ManagedMode = ManagedConfigurationMode.EDITABLE_DEFAULT;
|
||||
this.EditableDefaultByConfigPluginId = pluginId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the editable-default state without changing the current value.
|
||||
/// </summary>
|
||||
public void ClearEditableDefaultConfiguration()
|
||||
{
|
||||
if (this.ManagedMode is ManagedConfigurationMode.EDITABLE_DEFAULT)
|
||||
this.ManagedMode = null;
|
||||
|
||||
this.EditableDefaultByConfigPluginId = Guid.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -129,4 +168,17 @@ public record ConfigMeta<TClass, TValue> : ConfigMetaBase
|
||||
if (memberExpression.Member is System.Reflection.PropertyInfo propertyInfo)
|
||||
propertyInfo.SetValue(configInstance, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current value of the configuration property.
|
||||
/// </summary>
|
||||
public TValue GetValue()
|
||||
{
|
||||
var configInstance = this.ConfigSelection.Compile().Invoke(SETTINGS_MANAGER.ConfigurationData);
|
||||
var memberExpression = this.PropertyExpression.GetMemberExpression();
|
||||
if (memberExpression.Member is System.Reflection.PropertyInfo propertyInfo && propertyInfo.GetValue(configInstance) is TValue value)
|
||||
return value;
|
||||
|
||||
return default!;
|
||||
}
|
||||
}
|
||||
@@ -133,6 +133,17 @@ public static class ConfigurationSelectDataFactory
|
||||
yield return new(TB("Always expand navigation"), NavBehavior.ALWAYS_EXPAND);
|
||||
}
|
||||
|
||||
public static IEnumerable<ConfigurationSelectData<StartPage>> GetStartPageData()
|
||||
{
|
||||
yield return new(TB("Welcome"), StartPage.HOME);
|
||||
yield return new(TB("Chat"), StartPage.CHAT);
|
||||
yield return new(TB("Assistants"), StartPage.ASSISTANTS);
|
||||
yield return new(TB("Information"), StartPage.INFORMATION);
|
||||
yield return new(TB("Plugins"), StartPage.PLUGINS);
|
||||
yield return new(TB("Supporters"), StartPage.SUPPORTERS);
|
||||
yield return new(TB("Settings"), StartPage.SETTINGS);
|
||||
}
|
||||
|
||||
public static IEnumerable<ConfigurationSelectData<IconSources>> GetIconSourcesData()
|
||||
{
|
||||
foreach (var source in Enum.GetValues<IconSources>())
|
||||
|
||||
@@ -51,6 +51,11 @@ public sealed class Data
|
||||
/// </summary>
|
||||
public List<Guid> EnabledPlugins { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Metadata for managed settings that use a plugin-provided editable default.
|
||||
/// </summary>
|
||||
public Dictionary<string, ManagedEditableDefaultState> ManagedEditableDefaults { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// The next provider number to use.
|
||||
/// </summary>
|
||||
|
||||
@@ -52,6 +52,11 @@ public sealed class DataApp(Expression<Func<Data, DataApp>>? configSelection = n
|
||||
/// </summary>
|
||||
public NavBehavior NavigationBehavior { get; set; } = NavBehavior.NEVER_EXPAND_USE_TOOLTIPS;
|
||||
|
||||
/// <summary>
|
||||
/// Which page should be opened first when the app starts?
|
||||
/// </summary>
|
||||
public StartPage StartPage { get; set; } = ManagedConfiguration.Register(configSelection, n => n.StartPage, StartPage.HOME);
|
||||
|
||||
/// <summary>
|
||||
/// The visibility setting for previews features.
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public enum StartPage
|
||||
{
|
||||
HOME,
|
||||
CHAT,
|
||||
ASSISTANTS,
|
||||
INFORMATION,
|
||||
PLUGINS,
|
||||
SUPPORTERS,
|
||||
SETTINGS,
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public static class StartPageExtensions
|
||||
{
|
||||
public static string ToRoute(this StartPage startPage) => startPage switch
|
||||
{
|
||||
StartPage.HOME => string.Empty,
|
||||
StartPage.CHAT => Routes.CHAT,
|
||||
StartPage.ASSISTANTS => Routes.ASSISTANTS,
|
||||
StartPage.INFORMATION => Routes.ABOUT,
|
||||
StartPage.PLUGINS => Routes.PLUGINS,
|
||||
StartPage.SUPPORTERS => Routes.SUPPORTERS,
|
||||
StartPage.SETTINGS => Routes.SETTINGS,
|
||||
|
||||
_ => string.Empty,
|
||||
};
|
||||
}
|
||||
@@ -63,8 +63,10 @@ public static partial class ManagedConfiguration
|
||||
|
||||
if(dryRun)
|
||||
return successful;
|
||||
|
||||
return HandleParsedValue(configPluginId, dryRun, successful, configMeta, configuredValue);
|
||||
|
||||
var settingName = SettingName(propertyExpression);
|
||||
var managedMode = ReadManagedConfigurationMode(propertyExpression, settings);
|
||||
return HandleParsedScalarValue(configPluginId, dryRun, successful, configMeta, configuredValue, managedMode, settingName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -128,8 +130,10 @@ public static partial class ManagedConfiguration
|
||||
|
||||
if(dryRun)
|
||||
return successful;
|
||||
|
||||
return HandleParsedValue(configPluginId, dryRun, successful, configMeta, configuredValue);
|
||||
|
||||
var settingName = SettingName(propertyExpression);
|
||||
var managedMode = ReadManagedConfigurationMode(propertyExpression, settings);
|
||||
return HandleParsedScalarValue(configPluginId, dryRun, successful, configMeta, configuredValue, managedMode, settingName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -216,7 +220,9 @@ public static partial class ManagedConfiguration
|
||||
}
|
||||
}
|
||||
|
||||
return HandleParsedValue(configPluginId, dryRun, successful, configMeta, configuredValue);
|
||||
var settingName = SettingName(propertyExpression);
|
||||
var managedMode = ReadManagedConfigurationMode(propertyExpression, settings);
|
||||
return HandleParsedScalarValue(configPluginId, dryRun, successful, configMeta, configuredValue, managedMode, settingName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -857,4 +863,91 @@ public static partial class ManagedConfiguration
|
||||
|
||||
return successful;
|
||||
}
|
||||
|
||||
private static bool HandleParsedScalarValue<TClass, TValue>(
|
||||
Guid configPluginId,
|
||||
bool dryRun,
|
||||
bool successful,
|
||||
ConfigMeta<TClass, TValue> configMeta,
|
||||
TValue configuredValue,
|
||||
ManagedConfigurationMode managedMode,
|
||||
string settingName)
|
||||
{
|
||||
if (dryRun)
|
||||
return successful;
|
||||
|
||||
switch (successful)
|
||||
{
|
||||
case true when managedMode is ManagedConfigurationMode.LOCKED:
|
||||
ClearEditableDefaultState(settingName);
|
||||
configMeta.ClearEditableDefaultConfiguration();
|
||||
configMeta.SetValue(configuredValue);
|
||||
configMeta.LockConfiguration(configPluginId);
|
||||
break;
|
||||
|
||||
case true when managedMode is ManagedConfigurationMode.EDITABLE_DEFAULT:
|
||||
var currentValueSerialized = SerializeManagedScalarValue(configMeta.GetValue());
|
||||
var configuredValueSerialized = SerializeManagedScalarValue(configuredValue);
|
||||
|
||||
string lastAppliedValue;
|
||||
if (!TryGetEditableDefaultState(settingName, out var editableDefaultState))
|
||||
{
|
||||
configMeta.SetValue(configuredValue);
|
||||
lastAppliedValue = configuredValueSerialized;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastAppliedValue = editableDefaultState.LastAppliedValue;
|
||||
if (string.Equals(currentValueSerialized, lastAppliedValue, StringComparison.Ordinal))
|
||||
{
|
||||
configMeta.SetValue(configuredValue);
|
||||
lastAppliedValue = configuredValueSerialized;
|
||||
}
|
||||
}
|
||||
|
||||
SetEditableDefaultState(settingName, configPluginId, lastAppliedValue);
|
||||
configMeta.UnlockConfiguration();
|
||||
configMeta.SetEditableDefaultConfiguration(configPluginId);
|
||||
break;
|
||||
|
||||
case false when configMeta.IsLocked && configMeta.LockedByConfigPluginId == configPluginId:
|
||||
configMeta.ResetLockedConfiguration();
|
||||
break;
|
||||
|
||||
case false when configMeta.ManagedMode is ManagedConfigurationMode.EDITABLE_DEFAULT
|
||||
&& TryGetEditableDefaultState(settingName, out var editableDefaultStateToRemove)
|
||||
&& editableDefaultStateToRemove.ConfigPluginId == configPluginId:
|
||||
configMeta.ClearEditableDefaultConfiguration();
|
||||
ClearEditableDefaultState(settingName);
|
||||
break;
|
||||
}
|
||||
|
||||
return successful;
|
||||
}
|
||||
|
||||
private static ManagedConfigurationMode ReadManagedConfigurationMode<TClass, TValue>(
|
||||
Expression<Func<TClass, TValue>> propertyExpression,
|
||||
LuaTable settings)
|
||||
{
|
||||
var allowUserOverrideSettingName = $"{SettingsManager.ToSettingName(propertyExpression)}.AllowUserOverride";
|
||||
if (!settings.TryGetValue(allowUserOverrideSettingName, out var allowUserOverrideValue))
|
||||
return ManagedConfigurationMode.LOCKED;
|
||||
|
||||
if (allowUserOverrideValue.TryRead<bool>(out var allowUserOverride))
|
||||
return allowUserOverride ? ManagedConfigurationMode.EDITABLE_DEFAULT : ManagedConfigurationMode.LOCKED;
|
||||
|
||||
if (allowUserOverrideValue.TryRead<string>(out var allowUserOverrideText) && bool.TryParse(allowUserOverrideText, out allowUserOverride))
|
||||
return allowUserOverride ? ManagedConfigurationMode.EDITABLE_DEFAULT : ManagedConfigurationMode.LOCKED;
|
||||
|
||||
return ManagedConfigurationMode.LOCKED;
|
||||
}
|
||||
|
||||
private static string SerializeManagedScalarValue<TValue>(TValue value) => value switch
|
||||
{
|
||||
null => string.Empty,
|
||||
string text => text,
|
||||
IFormattable formattable => formattable.ToString(null, CultureInfo.InvariantCulture),
|
||||
|
||||
_ => value.ToString() ?? string.Empty,
|
||||
};
|
||||
}
|
||||
@@ -246,68 +246,68 @@ public static partial class ManagedConfiguration
|
||||
public static bool IsConfigurationLeftOver<TClass, TValue>(
|
||||
Expression<Func<Data, TClass>> configSelection,
|
||||
Expression<Func<TClass, TValue>> propertyExpression,
|
||||
IEnumerable<IAvailablePlugin> availablePlugins)
|
||||
IReadOnlyList<IAvailablePlugin> availablePlugins)
|
||||
where TValue : Enum
|
||||
{
|
||||
if (!TryGet(configSelection, propertyExpression, out var configMeta))
|
||||
return false;
|
||||
|
||||
if (configMeta.LockedByConfigPluginId == Guid.Empty || !configMeta.IsLocked)
|
||||
return false;
|
||||
|
||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
||||
if (plugin is null)
|
||||
if (configMeta.LockedByConfigPluginId != Guid.Empty && configMeta.IsLocked)
|
||||
{
|
||||
configMeta.ResetLockedConfiguration();
|
||||
return true;
|
||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
||||
if (plugin is null)
|
||||
{
|
||||
configMeta.ResetLockedConfiguration();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return CleanupEditableDefaultState(configMeta, SettingName(propertyExpression), availablePlugins);
|
||||
}
|
||||
|
||||
public static bool IsConfigurationLeftOver<TClass>(
|
||||
Expression<Func<Data, TClass>> configSelection,
|
||||
Expression<Func<TClass, string>> propertyExpression,
|
||||
IEnumerable<IAvailablePlugin> availablePlugins)
|
||||
IReadOnlyList<IAvailablePlugin> availablePlugins)
|
||||
{
|
||||
if (!TryGet(configSelection, propertyExpression, out var configMeta))
|
||||
return false;
|
||||
|
||||
if (configMeta.LockedByConfigPluginId == Guid.Empty || !configMeta.IsLocked)
|
||||
return false;
|
||||
|
||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
||||
if (plugin is null)
|
||||
if (configMeta.LockedByConfigPluginId != Guid.Empty && configMeta.IsLocked)
|
||||
{
|
||||
configMeta.ResetLockedConfiguration();
|
||||
return true;
|
||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
||||
if (plugin is null)
|
||||
{
|
||||
configMeta.ResetLockedConfiguration();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return CleanupEditableDefaultState(configMeta, SettingName(propertyExpression), availablePlugins);
|
||||
}
|
||||
|
||||
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||
public static bool IsConfigurationLeftOver<TClass, TValue>(
|
||||
Expression<Func<Data, TClass>> configSelection,
|
||||
Expression<Func<TClass, TValue>> propertyExpression,
|
||||
IEnumerable<IAvailablePlugin> availablePlugins,
|
||||
IReadOnlyList<IAvailablePlugin> availablePlugins,
|
||||
ISpanParsable<TValue>? _ = null)
|
||||
where TValue : struct, ISpanParsable<TValue>
|
||||
{
|
||||
if (!TryGet(configSelection, propertyExpression, out var configMeta))
|
||||
return false;
|
||||
|
||||
if (configMeta.LockedByConfigPluginId == Guid.Empty || !configMeta.IsLocked)
|
||||
return false;
|
||||
|
||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
||||
if (plugin is null)
|
||||
if (configMeta.LockedByConfigPluginId != Guid.Empty && configMeta.IsLocked)
|
||||
{
|
||||
configMeta.ResetLockedConfiguration();
|
||||
return true;
|
||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
||||
if (plugin is null)
|
||||
{
|
||||
configMeta.ResetLockedConfiguration();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return CleanupEditableDefaultState(configMeta, SettingName(propertyExpression), availablePlugins);
|
||||
}
|
||||
|
||||
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||
@@ -413,4 +413,44 @@ public static partial class ManagedConfiguration
|
||||
var configPath = $"{configName}.{className}.{propertyName}";
|
||||
return configPath;
|
||||
}
|
||||
|
||||
private static string SettingName<TClass, TValue>(Expression<Func<TClass, TValue>> propertyExpression) => SettingsManager.ToSettingName(propertyExpression);
|
||||
|
||||
private static bool TryGetEditableDefaultState(string settingName, out ManagedEditableDefaultState editableDefaultState)
|
||||
{
|
||||
return SETTINGS_MANAGER.ConfigurationData.ManagedEditableDefaults.TryGetValue(settingName, out editableDefaultState!);
|
||||
}
|
||||
|
||||
private static void SetEditableDefaultState(string settingName, Guid pluginId, string lastAppliedValue)
|
||||
{
|
||||
SETTINGS_MANAGER.ConfigurationData.ManagedEditableDefaults[settingName] = new()
|
||||
{
|
||||
ConfigPluginId = pluginId,
|
||||
LastAppliedValue = lastAppliedValue,
|
||||
};
|
||||
}
|
||||
|
||||
private static bool ClearEditableDefaultState(string settingName) => SETTINGS_MANAGER.ConfigurationData.ManagedEditableDefaults.Remove(settingName);
|
||||
|
||||
private static bool CleanupEditableDefaultState<TClass, TValue>(
|
||||
ConfigMeta<TClass, TValue> configMeta,
|
||||
string settingName,
|
||||
IReadOnlyList<IAvailablePlugin> availablePlugins)
|
||||
{
|
||||
if (!TryGetEditableDefaultState(settingName, out var editableDefaultState))
|
||||
{
|
||||
if (configMeta.ManagedMode is not ManagedConfigurationMode.EDITABLE_DEFAULT)
|
||||
return false;
|
||||
|
||||
configMeta.ClearEditableDefaultConfiguration();
|
||||
return true;
|
||||
}
|
||||
|
||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == editableDefaultState.ConfigPluginId);
|
||||
if (plugin is not null)
|
||||
return false;
|
||||
|
||||
configMeta.ClearEditableDefaultConfiguration();
|
||||
return ClearEditableDefaultState(settingName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace AIStudio.Settings;
|
||||
|
||||
public enum ManagedConfigurationMode
|
||||
{
|
||||
/// <summary>
|
||||
/// The configuration is locked by a configuration plugin. The user cannot change the value of this setting, and it will be overridden by the plugin on each update.
|
||||
/// </summary>
|
||||
LOCKED,
|
||||
|
||||
/// <summary>
|
||||
/// The configuration has an editable default provided by a configuration plugin. The user can change the value of this setting.
|
||||
/// </summary>
|
||||
EDITABLE_DEFAULT,
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AIStudio.Settings;
|
||||
|
||||
public sealed class ManagedEditableDefaultState
|
||||
{
|
||||
public Guid ConfigPluginId { get; init; } = Guid.Empty;
|
||||
|
||||
public string LastAppliedValue { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -52,6 +52,16 @@ public sealed class SettingsManager
|
||||
/// </summary>
|
||||
public bool IsDarkMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that the startup start-page redirect is evaluated at most once per app session.
|
||||
/// </summary>
|
||||
public bool StartupStartPageRedirectHandled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the initial settings load attempt has completed.
|
||||
/// </summary>
|
||||
public bool HasCompletedInitialSettingsLoad { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The configuration data.
|
||||
/// </summary>
|
||||
@@ -67,6 +77,8 @@ public sealed class SettingsManager
|
||||
var settingsSnapshot = await this.TryReadSettingsSnapshot();
|
||||
if (settingsSnapshot is not null)
|
||||
this.ConfigurationData = settingsSnapshot;
|
||||
|
||||
this.HasCompletedInitialSettingsLoad = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user