From 69b0fda0f72ca95eb4265877eef3bead30053f91 Mon Sep 17 00:00:00 2001 From: funkydude Date: Sat, 12 Dec 2020 12:59:07 +0000 Subject: [PATCH] Buttons: If the calendar button is set to show on hover (the default) it will now be force-shown when you receive a calendar invite until you respond to it. --- Buttons.lua | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Buttons.lua b/Buttons.lua index 2c755da..dc6697a 100644 --- a/Buttons.lua +++ b/Buttons.lua @@ -313,10 +313,13 @@ do for i = 1, #animFrames do local f = animFrames[i] local n = f:GetName() + if not mod.db.visibilitySettings[n] or mod.db.visibilitySettings[n] == "hover" then - f.sexyMapFadeOut:Play() + if n ~= "GameTimeFrame" or (n == "GameTimeFrame" and C_Calendar.GetNumPendingInvites() < 1) then + f.sexyMapFadeOut:Play() - KillAnimation(n, f) + KillAnimation(n, f) + end end end end @@ -543,6 +546,17 @@ do self:NewFrame(button) end + local function CheckCalendar() + local vis = mod.db.visibilitySettings.GameTimeFrame + if not vis or vis == "hover" then + if C_Calendar.GetNumPendingInvites() < 1 then + mod:ChangeFrameVisibility(GameTimeFrame, "hover") + else + mod:ChangeFrameVisibility(GameTimeFrame, "always") + end + end + end + function mod:StartFrameGrab() for i = 1, #tbl do mod:NewFrame(tbl[i]) @@ -554,6 +568,13 @@ do end ldbi.RegisterCallback(mod, "LibDBIcon_IconCreated", "AddButton") + -- If calendar is set to "hover" and we have pending invites, force show it + local frame = CreateFrame("Frame") + frame:SetScript("OnEvent", CheckCalendar) + frame:RegisterEvent("CALENDAR_UPDATE_PENDING_INVITES") + frame:RegisterEvent("CALENDAR_ACTION_PENDING") + CheckCalendar() + mod.StartFrameGrab = nil end end