Skip to content

Commit

Permalink
Buttons: If the calendar button is set to show on hover (the default)…
Browse files Browse the repository at this point in the history
… it will now be force-shown when you receive a calendar invite until you respond to it.
  • Loading branch information
funkydude committed Dec 12, 2020
1 parent 0656a72 commit 69b0fda
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions Buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])
Expand All @@ -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
Expand Down

0 comments on commit 69b0fda

Please sign in to comment.