Skip to content

Commit 5155484

Browse files
Merge pull request #7 from johnson-christopher/fix-reshowing-bug
Fix issue where button is shown automatically
2 parents 8fda3fe + 4e0ccb3 commit 5155484

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

HideExpansionButton.lua

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
local frame = CreateFrame("FRAME", "HideExpansionButtonFrame")
22
frame:RegisterEvent("ADDON_LOADED")
3-
frame:RegisterEvent("PLAYER_LOGIN")
3+
frame:RegisterEvent("COVENANT_CALLINGS_UPDATED")
4+
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
45

5-
frame:SetScript("OnEvent", function(self, event, addon, ...)
6-
if event == "ADDON_LOADED" and addon == "HideExpansionButton" then
7-
if ExpansionButtonVisible == nil then
6+
frame:SetScript("OnEvent", function(self, event, ...)
7+
if event == "ADDON_LOADED" then
8+
local addonName = ...
9+
if addonName == "HideExpansionButton" and ExpansionButtonVisible == nil then
810
ExpansionButtonVisible = false
11+
SetButtonState()
12+
frame:UnregisterEvent("ADDON_LOADED")
913
end
10-
elseif event == "PLAYER_LOGIN" then
14+
elseif event == "COVENANT_CALLINGS_UPDATED" then
15+
-- Something fires this event and then turns the button back on after.
16+
-- Since it doesn't seem to fire another event when it's done we just
17+
-- have to wait an arbitrary amount of time.
18+
C_Timer.After(5, SetButtonState)
19+
else
1120
SetButtonState()
1221
end
1322
end)

0 commit comments

Comments
 (0)