-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78a77eb
commit 5a30107
Showing
3 changed files
with
52 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Dalamud.Interface.Internal.Notifications; | ||
using Dalamud.Plugin; | ||
using OtterGui.Classes; | ||
using OtterGui.Services; | ||
|
||
namespace Glamourer.Interop.PalettePlus; | ||
|
||
public sealed class PalettePlusChecker : IRequiredService, IDisposable | ||
{ | ||
private readonly Timer _paletteTimer; | ||
private readonly Configuration _config; | ||
private readonly DalamudPluginInterface _pluginInterface; | ||
|
||
public PalettePlusChecker(Configuration config, DalamudPluginInterface pluginInterface) | ||
{ | ||
_config = config; | ||
_pluginInterface = pluginInterface; | ||
_paletteTimer = new Timer(_ => PalettePlusCheck(), null, TimeSpan.FromSeconds(30), Timeout.InfiniteTimeSpan); | ||
} | ||
|
||
public void Dispose() | ||
=> _paletteTimer.Dispose(); | ||
|
||
public void SetAdvancedParameters(bool value) | ||
{ | ||
_config.UseAdvancedParameters = value; | ||
PalettePlusCheck(); | ||
} | ||
|
||
private void PalettePlusCheck() | ||
{ | ||
if (!_config.UseAdvancedParameters) | ||
return; | ||
|
||
try | ||
{ | ||
var subscriber = _pluginInterface.GetIpcSubscriber<string>("PalettePlus.ApiVersion"); | ||
subscriber.InvokeFunc(); | ||
Glamourer.Messager.AddMessage(new Notification( | ||
"You currently have Palette+ installed. This conflicts with Glamourers advanced options and will cause invalid state.\n\n" | ||
+ "Please uninstall Palette+ and restart your game. Palette+ is deprecated and no longer supported by Mare Synchronos.", | ||
NotificationType.Warning, 10000)); | ||
} | ||
catch | ||
{ | ||
// ignored | ||
} | ||
} | ||
} |