- Add chat notification back to AutoUpdate (#2146)

- ImRaii UI elements in AutoUpdate tab
- Fix scoping in IconButton
This commit is contained in:
Infi 2024-12-19 22:19:50 +01:00 committed by GitHub
parent f7ef68d65e
commit 2e6cb6ef00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 166 additions and 114 deletions

View file

@ -249,7 +249,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
/// Gets or sets a value indicating whether or not docking should be globally enabled in ImGui.
/// </summary>
public bool IsDocking { get; set; }
/// <summary>
/// Gets or sets a value indicating whether or not plugin user interfaces should trigger sound effects.
/// This setting is effected by the in-game "System Sounds" option and volume.
@ -484,10 +484,15 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
public AutoUpdateBehavior? AutoUpdateBehavior { get; set; } = null;
/// <summary>
/// Gets or sets a value indicating whether or not users should be notified regularly about pending updates.
/// Gets or sets a value indicating whether users should be notified regularly about pending updates.
/// </summary>
public bool CheckPeriodicallyForUpdates { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether users should be notified about updates in chat.
/// </summary>
public bool SendUpdateNotificationToChat { get; set; } = false;
/// <summary>
/// Load a configuration from the provided path.
/// </summary>
@ -504,7 +509,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
{
deserialized =
JsonConvert.DeserializeObject<DalamudConfiguration>(text, SerializerSettings);
// If this reads as null, the file was empty, that's no good
if (deserialized == null)
throw new Exception("Read config was null.");
@ -530,7 +535,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
{
Log.Error(e, "Failed to set defaults for DalamudConfiguration");
}
return deserialized;
}
@ -549,7 +554,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
{
this.Save();
}
/// <inheritdoc/>
void IInternalDisposableService.DisposeService()
{
@ -595,14 +600,14 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
this.ReduceMotions = winAnimEnabled == 0;
}
}
// Migrate old auto-update setting to new auto-update behavior
this.AutoUpdateBehavior ??= this.AutoUpdatePlugins
? Plugin.Internal.AutoUpdate.AutoUpdateBehavior.UpdateAll
: Plugin.Internal.AutoUpdate.AutoUpdateBehavior.OnlyNotify;
#pragma warning restore CS0618
}
private void Save()
{
ThreadSafety.AssertMainThread();