Skip to content

Commit

Permalink
try to improve the update alerter
Browse files Browse the repository at this point in the history
  • Loading branch information
PrincessRTFM committed Sep 5, 2023
1 parent 38fe687 commit 6e8523e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
19 changes: 3 additions & 16 deletions XIVComboVX/Config/UpdateAlerter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ internal class UpdateAlerter: IDisposable {
private CancellationTokenSource? realAborter;
private CancellationTokenSource? aborter {
get {
CancellationTokenSource? src;
lock (this) {
src = this.realAborter;
return this.realAborter;
}
return src;
}
set {
lock (this) {
Expand Down Expand Up @@ -58,17 +56,6 @@ internal void checkMessage() {
PluginLog.Information("Message already displayed, unregistering");
return;
}
try {
if (!Service.GameState.isChatVisible) {
PluginLog.Information("Chat is not visible, cannot display message yet");
return;
}
}
catch (Exception e) {
PluginLog.Error(e, "Failed to check chat visibility state");
this.unregister();
return;
}

PluginLog.Information($"Checks passed, delaying message by {messageDelayMs}ms - may be reset if message is triggered again within that time");

Expand Down Expand Up @@ -127,9 +114,9 @@ private void onChatMessage(XivChatType type, uint senderId, ref SeString sender,
this.checkMessage();
}
private async void onLogin(object? sender, EventArgs e) {
await Task.Delay(messageDelayMs + 1000);
while (!Service.Client.IsLoggedIn)
do {
await Task.Delay(loginDelayMs);
} while (!Service.Client.IsLoggedIn || Service.Client.LocalContentId == 0 || Service.Client.LocalPlayer is null);
this.checkMessage();
}

Expand Down
2 changes: 1 addition & 1 deletion XIVComboVX/XIVComboVX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Product>XIVComboVX</Product>
<Authors>attick, daemitus, VariableVixen</Authors>
<Version>9.6.0</Version>
<Version>9.6.1</Version>
<Description>This plugin condenses various abilities onto single buttons.</Description>
<PackageProjectUrl>https://github.com/PrincessRTFM/XIVComboPlugin</PackageProjectUrl>
<Copyright>Copyleft attick 2020 baybeeee</Copyright>
Expand Down

0 comments on commit 6e8523e

Please sign in to comment.