Questie

Questie

116M Downloads

Detecting if addon updated wihout game restart logic fails in Questie.lua

Laumesis opened this issue ยท 1 comments

commented

Questie/Questie.lua

Lines 69 to 116 in 60ef402

-- check if user has updated but not restarted the game (todo: add future new source files to this)
if --Libs
(not QuestieLib) or
(not QuestiePlayer) or
(not QuestieSerializer) or
--Comms
(not QuestieComms) or
(not QuestieComms.data) or
--Options
(not QuestieOptions) or
(not QuestieOptionsDefaults) or
(not MinimapIcon) or
(not QuestieOptionsUtils) or
(not QuestieOptions.tabs) or
(not QuestieOptions.tabs.advanced) or
(not QuestieOptions.tabs.dbm) or
(not QuestieOptions.tabs.general) or
(not QuestieOptions.tabs.map) or
(not QuestieOptions.tabs.minimap) or
(not QuestieOptions.tabs.nameplate) or
(not QuestieOptions.tabs.tracker) or
(not QuestieAuto) or
(not QuestieCoords) or
(not QuestieEventHandler) or
(not QuestieJourney) or
--Map
(not QuestieMap) or
(not QuestieMap.utils) or
(not QuestieNameplate) or
(not QuestieProfessions) or
(not QuestieQuest) or
(not QuestieReputation) or
--Search
(not QuestieSearch) or
(not QuestieSearchResults) or
(not QuestieStreamLib) or
(not QuestieTooltips) or
(not QuestieSearchResults) or
(not QuestieCombatQueue) or
(not QuestieTracker) then
--Delay the warning.
C_Timer.After(8, function()
print(Questie:Colorize(l10n("WARNING!"), "red") .. " " .. l10n("You have updated Questie without restarting the game, this will likely cause problems. Please restart the game before continuing"))
end)
end

Those all always evaluate to true as table reference is assigned to each few lines earlier by for example:

local QuestieLib = QuestieLoader:ImportModule("QuestieLib");

Both function QuestieLoader:ImportModule(name) and function QuestieLoader:CreateModule(name) are identical functions currently, so both initialize a module same way:

function QuestieLoader:CreateBlankModule()
local ret = {} -- todo: copy class template
ret.private = {} -- todo: copy class template
return ret
end

Note: versionCheck.lua should check version okey. But I am not sure if it will display error? Does StaticPopup_Show() work always okey at middle of addon loading process while game UI is not necessary available yet? Should it also or instead add timer and chat messages?

versionCheck.lua error message styles should be unified. Maybe add function to call with a message and it will handle passing it to UI / user.

v6.5.1

commented

Haha, great finding @Laumesis :D Yes, the ImportModule and CreateModule functions are the same, as we were not sure how to progress with the QuestieLoader (e.g. making it fail, when Import is called before Create).

I hate this way of determining if Questie has all the required modules and now that you point out it never worked, I am willing to simply remove all of it. It is also a very exhausting to maintain this if-block and I bet there are already multiple modules missing in the check.

From what I experienced StaticPopup_Show works even while Questie is still loading up. The game UI is ready when the files are processed. Drejjmit already stated that TOC version updates are loaded on /reload, but file changes are not, which sounded odd and should also be investigated.

We need to find a clever and solid solution to remind users that they didn't restart the game after an update.