Skip to content

Commit

Permalink
reimplement version check to dev builds
Browse files Browse the repository at this point in the history
  • Loading branch information
kodewdle committed Mar 30, 2024
1 parent aeb6751 commit 67d3908
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
13 changes: 8 additions & 5 deletions ElvUI/Core/General/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ local LSM = E.Libs.LSM
E.noop = function() end
E.title = format('%s%s|r', E.InfoColor, 'ElvUI')
E.toc = tonumber(GetAddOnMetadata('ElvUI', 'X-Interface'))
E.version, E.versionString = E:ParseVersionString('ElvUI')
E.version, E.versionString, E.versionDev, E.versionGit = E:ParseVersionString('ElvUI')
E.myfaction, E.myLocalizedFaction = UnitFactionGroup('player')
E.myLocalizedClass, E.myclass, E.myClassID = UnitClass('player')
E.myLocalizedRace, E.myrace, E.myRaceID = UnitRace('player')
Expand Down Expand Up @@ -900,7 +900,7 @@ end
do
local SendMessageWaiting -- only allow 1 delay at a time regardless of eventing
function E:SendMessage()
if E.version < 99999 then
if not E.versionGit then
if IsInRaid() then
C_ChatInfo_SendAddonMessage('ELVUI_VERSIONCHK', E.version, (not IsInRaid(LE_PARTY_CATEGORY_HOME) and IsInRaid(LE_PARTY_CATEGORY_INSTANCE)) and 'INSTANCE_CHAT' or 'RAID')
elseif IsInGroup() then
Expand Down Expand Up @@ -957,10 +957,13 @@ do
_G.C_ChatInfo.RegisterAddonMessagePrefix('ELVUI_VERSIONCHK')

local f = CreateFrame('Frame')
f:RegisterEvent('CHAT_MSG_ADDON')
f:RegisterEvent('GROUP_ROSTER_UPDATE')
f:RegisterEvent('PLAYER_ENTERING_WORLD')
f:SetScript('OnEvent', SendRecieve)
f:RegisterEvent('CHAT_MSG_ADDON')

if not E.versionGit then
f:RegisterEvent('GROUP_ROSTER_UPDATE')
f:RegisterEvent('PLAYER_ENTERING_WORLD')
end
end

function E:UpdateStart(skipCallback, skipUpdateDB)
Expand Down
3 changes: 2 additions & 1 deletion ElvUI/Core/General/Tags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ do
end

do
local highestVersion = E.version
local highestVersion = E.versionGit and 0 or E.version
E:AddTag('ElvUI-Users', 20, function(unit)
if E.UserList and next(E.UserList) then
local name, realm = UnitName(unit)
Expand All @@ -1212,6 +1212,7 @@ do
if highestVersion < userVersion then
highestVersion = userVersion
end

return (userVersion < highestVersion) and '|cffFF3333E|r' or '|cff3366ffE|r'
end
end
Expand Down
2 changes: 1 addition & 1 deletion ElvUI/Core/Modules/Tooltip/Tooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ function TT:SetUnitText(tt, unit, isPlayerUnit)
local addonUser = E.UserList[nameRealm]
if addonUser then
local same = addonUser == E.version
tt:AddDoubleLine(L["ElvUI Version:"], format('%.2f', addonUser), nil, nil, nil, same and 0.2 or 1, same and 1 or 0.2, 0.2)
tt:AddDoubleLine(L["ElvUI Version:"], format('%.2f', addonUser), nil, nil, nil, E.versionGit and 1 or same and 0.2 or 1, E.versionGit and 1 or same and 1 or 0.2, E.versionGit and 1 or 0.2)
end
end

Expand Down
17 changes: 8 additions & 9 deletions ElvUI/Core/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
]]

local _G = _G
local gsub, tinsert, next = gsub, tinsert, next
local tostring, strfind, type, strsub = tostring, strfind, type, strsub
local gsub, tinsert, next, type = gsub, tinsert, next, type
local tostring, tonumber, strfind, strmatch = tostring, tonumber, strfind, strmatch

local CreateFrame = CreateFrame
local GetBuildInfo = GetBuildInfo
Expand Down Expand Up @@ -114,13 +114,12 @@ do -- this is different from E.locale because we need to convert for ace locale
end

function E:ParseVersionString(addon)
local version = strsub(GetAddOnMetadata(addon, 'Version'), 2)
if not strfind(version, '%-') then
return tonumber(version), version
elseif strfind(version, 'project%-version') then
return 99999, 'Development'
local version = GetAddOnMetadata(addon, 'Version')
if strfind(version, 'project%-version') then
return 99999, 'Development', nil, true
else
return 99999, version
local release, extra = strmatch(version, '^v?([%d.]+)(.*)')
return tonumber(release), release..extra, extra ~= ''
end
end

Expand Down Expand Up @@ -351,4 +350,4 @@ function E:OnInitialize()
elseif GetAddOnEnableState(E.myname, 'Tukui') == 2 then
E:StaticPopup_Show('TUKUI_ELVUI_INCOMPATIBLE')
end
end
end

0 comments on commit 67d3908

Please sign in to comment.