Skip to content

Commit

Permalink
refactor: remove checks for old ipc versions
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-is-cute committed May 31, 2024
1 parent d864c77 commit 2ce17c6
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 30 deletions.
1 change: 0 additions & 1 deletion Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ internal enum SpeedLimit {

[Serializable]
internal class PenumbraIntegration {
public bool IntegrateOnLowVersion;
public bool ShowImages = true;
public bool ShowButtons = true;
public float ImageSize = 0.375f;
Expand Down
20 changes: 2 additions & 18 deletions PenumbraIpc.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using Heliosphere.Ui;
using ImGuiNET;
using Penumbra.Api.Enums;
using Penumbra.Api.Helpers;
using Penumbra.Api.IpcSubscribers;
Expand Down Expand Up @@ -129,23 +128,8 @@ private void RegisterEvents() {
Task.Run(async () => await this.Plugin.State.UpdatePackages());
});

if (this.AtLeastVersion(PenumbraWindowIntegration.NeededVersion)) {
this.PostEnabledDrawEvent = PostEnabledDraw.Subscriber(this.Plugin.Interface, this.WindowIntegration.PostEnabledDraw);

this.PreSettingsTabBarDrawEvent = PreSettingsTabBarDraw.Subscriber(this.Plugin.Interface, this.WindowIntegration.PreSettingsTabBarDraw);
} else {
this.PreSettingsDrawEvent = PreSettingsDraw.Subscriber(this.Plugin.Interface, directory => {
if (!this.Plugin.Config.Penumbra.IntegrateOnLowVersion) {
return;
}

var width = ImGui.GetScrollMaxY() == 0
? ImGui.GetContentRegionAvail().X - ImGui.GetStyle().ScrollbarSize
: ImGui.GetContentRegionAvail().X;
this.WindowIntegration.PreSettingsTabBarDraw(directory, width, 0);
this.WindowIntegration.PostEnabledDraw(directory);
});
}
this.PostEnabledDrawEvent = PostEnabledDraw.Subscriber(this.Plugin.Interface, this.WindowIntegration.PostEnabledDraw);
this.PreSettingsTabBarDrawEvent = PreSettingsTabBarDraw.Subscriber(this.Plugin.Interface, this.WindowIntegration.PreSettingsTabBarDraw);
}

internal bool AtLeastVersion((int breaking, int features) tuple) {
Expand Down
2 changes: 0 additions & 2 deletions Ui/PenumbraWindowIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
namespace Heliosphere.Ui;

internal class PenumbraWindowIntegration {
internal static readonly (int, int) NeededVersion = (4, 24);

private Plugin Plugin { get; }

internal PenumbraWindowIntegration(Plugin plugin) {
Expand Down
9 changes: 0 additions & 9 deletions Ui/Tabs/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ internal Settings(Plugin plugin) {
internal static bool DrawPenumbraIntegrationSettings(Plugin plugin) {
var anyChanged = false;

var newEnough = plugin.Penumbra.AtLeastVersion(PenumbraWindowIntegration.NeededVersion);
if (!newEnough) {
anyChanged |= ImGui.Checkbox("Enable Penumbra UI integrations on old versions", ref plugin.Config.Penumbra.IntegrateOnLowVersion);
ImGui.SameLine();
ImGuiHelper.Help("Your version of Penumbra is older than the expected version for Penumbra UI integrations.\n\nYou can still enable them, but they won't look as good. This setting will disappear if you're on a new enough version.");
}

using var disabled = ImGuiHelper.DisabledUnless(newEnough || plugin.Config.Penumbra.IntegrateOnLowVersion);

anyChanged |= ImGui.Checkbox("Show mod image previews in Penumbra", ref plugin.Config.Penumbra.ShowImages);
anyChanged |= ImGui.Checkbox("Show Heliosphere buttons in Penumbra", ref plugin.Config.Penumbra.ShowButtons);

Expand Down

0 comments on commit 2ce17c6

Please sign in to comment.