use a map to track ftue levels per-feature instead

This commit is contained in:
goat 2024-06-15 22:08:30 +02:00
parent ef72ebc72c
commit 08a411728c
2 changed files with 13 additions and 11 deletions

View file

@ -80,10 +80,9 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
public string? LastVersion { get; set; } = null; public string? LastVersion { get; set; } = null;
/// <summary> /// <summary>
/// Gets or sets a value indicating the last seen FTUE version. /// Gets or sets a dictionary of seen FTUE levels.
/// Unused for now, added to prevent existing users from seeing level 0 FTUE.
/// </summary> /// </summary>
public int SeenFtueLevel { get; set; } = 1; public Dictionary<string, int> SeenFtueLevels { get; set; } = new();
/// <summary> /// <summary>
/// Gets or sets the last loaded Dalamud version. /// Gets or sets the last loaded Dalamud version.

View file

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
@ -78,8 +79,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
private AutoUpdateBehavior? chosenAutoUpdateBehavior; private AutoUpdateBehavior? chosenAutoUpdateBehavior;
private int currentFtueLevel; private Dictionary<string, int> currentFtueLevels = new();
private int updatedFtueLevel;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ChangelogWindow"/> class. /// Initializes a new instance of the <see cref="ChangelogWindow"/> class.
@ -152,7 +152,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
this.chosenAutoUpdateBehavior = null; this.chosenAutoUpdateBehavior = null;
this.currentFtueLevel = Service<DalamudConfiguration>.Get().SeenFtueLevel; this.currentFtueLevels = Service<DalamudConfiguration>.Get().SeenFtueLevels;
base.OnOpen(); base.OnOpen();
} }
@ -172,7 +172,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
configuration.AutoUpdateBehavior = this.chosenAutoUpdateBehavior.Value; configuration.AutoUpdateBehavior = this.chosenAutoUpdateBehavior.Value;
} }
configuration.SeenFtueLevel = this.updatedFtueLevel; configuration.SeenFtueLevels = this.currentFtueLevels;
configuration.QueueSave(); configuration.QueueSave();
} }
@ -360,11 +360,11 @@ internal sealed class ChangelogWindow : Window, IDisposable
this.apiBumpExplainerTexture.Value.ImGuiHandle, this.apiBumpExplainerTexture.Value.ImGuiHandle,
this.apiBumpExplainerTexture.Value.Size); this.apiBumpExplainerTexture.Value.Size);
if (this.currentFtueLevel < FtueLevels.AutoUpdateBehavior) if (!this.currentFtueLevels.TryGetValue(FtueLevels.AutoUpdate.Name, out var autoUpdateLevel) || autoUpdateLevel < FtueLevels.AutoUpdate.AutoUpdateInitial)
{ {
if (DrawNextButton(State.AskAutoUpdate)) if (DrawNextButton(State.AskAutoUpdate))
{ {
this.updatedFtueLevel = this.currentFtueLevel = FtueLevels.AutoUpdateBehavior; this.currentFtueLevels[FtueLevels.AutoUpdate.Name] = FtueLevels.AutoUpdate.AutoUpdateInitial;
} }
} }
else else
@ -520,7 +520,10 @@ internal sealed class ChangelogWindow : Window, IDisposable
private static class FtueLevels private static class FtueLevels
{ {
public const int Default = 1; public static class AutoUpdate
public const int AutoUpdateBehavior = 2; {
public const string Name = "AutoUpdate";
public const int AutoUpdateInitial = 1;
}
} }
} }