updated save function
This commit is contained in:
parent
647553558f
commit
eb447e4640
@ -1 +1 @@
|
|||||||
{"optionPanel":{"playAreaSnapTags":true,"showAttachmentHelper":false,"showChaosBagManager":false,"showCleanUpHelper":false,"showCustomPlaymatImages":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":[],"showNavigationOverlay":false,"showSearchAssistant":[],"showTitleSplash":true,"showTokenArranger":false,"useClueClickers":false,"useSnapTags":true}}
|
{"dontNotify":[],"optionPanel":{"playAreaSnapTags":true,"showAttachmentHelper":false,"showChaosBagManager":false,"showCleanUpHelper":false,"showCustomPlaymatImages":false,"showCYOA":false,"showDisplacementTool":false,"showDrawButton":false,"showHandHelper":[],"showNavigationOverlay":false,"showSearchAssistant":[],"showTitleSplash":true,"showTokenArranger":false,"useClueClickers":false,"useSnapTags":true}}
|
||||||
|
@ -108,8 +108,9 @@ function onSave() return JSON.encode({ optionPanel = optionPanel, dontNotify = d
|
|||||||
|
|
||||||
function onLoad(savedData)
|
function onLoad(savedData)
|
||||||
if savedData then
|
if savedData then
|
||||||
loadedData = JSON.decode(savedData)
|
loadedData = JSON.decode(savedData)
|
||||||
optionPanel = loadedData.optionPanel
|
optionPanel = loadedData.optionPanel
|
||||||
|
dontNotify = loadedData.dontNotify
|
||||||
updateOptionPanelState()
|
updateOptionPanelState()
|
||||||
else
|
else
|
||||||
print("Saved state could not be found!")
|
print("Saved state could not be found!")
|
||||||
@ -1056,16 +1057,25 @@ function compareVersion(request)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local metatable = JSON.decode(request.text)
|
-- global variable to make it accessible for other functions
|
||||||
local latestVersion = metatable["latestVersion"]
|
modMeta = JSON.decode(request.text)
|
||||||
--if MOD_VERSION == latestVersion then return end
|
|
||||||
if dontNotify[latestVersion] then return end
|
|
||||||
|
|
||||||
local releaseNotes = metatable["releaseNotes"][latestVersion]
|
-- stop here if on latest version or "don't show again" was clicked
|
||||||
|
--if MOD_VERSION == modMeta["latestVersion"] then return end
|
||||||
|
if dontNotify[modMeta["latestVersion"]] then return end
|
||||||
|
|
||||||
|
local releaseNotes = modMeta["releaseNotes"][modMeta["latestVersion"]]
|
||||||
if releaseNotes == nil then
|
if releaseNotes == nil then
|
||||||
log("Release notes for latest version not found!")
|
log("Release notes for latest version not found!")
|
||||||
else
|
else
|
||||||
|
-- updating the XML notification
|
||||||
local ui = UI.getXmlTable()
|
local ui = UI.getXmlTable()
|
||||||
|
|
||||||
|
-- update the header
|
||||||
|
local header = find_tag_with_id(ui, 'versionHeader')
|
||||||
|
header.value = "New Version available: " .. modMeta["latestVersion"] .. " (current: " .. MOD_VERSION .. ")"
|
||||||
|
|
||||||
|
-- update the release notes
|
||||||
local releaseNoteWrapper = find_tag_with_id(ui, 'releaseNoteWrapper')
|
local releaseNoteWrapper = find_tag_with_id(ui, 'releaseNoteWrapper')
|
||||||
releaseNoteWrapper.children = {}
|
releaseNoteWrapper.children = {}
|
||||||
|
|
||||||
@ -1076,21 +1086,17 @@ function compareVersion(request)
|
|||||||
attributes = { class="releaseNote" }
|
attributes = { class="releaseNote" }
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local header = find_tag_with_id(ui, 'versionHeader')
|
|
||||||
header.value = "New Version available: " .. latestVersion .. " (current: " .. MOD_VERSION .. ")"
|
|
||||||
UI.setXmlTable(ui)
|
UI.setXmlTable(ui)
|
||||||
end
|
|
||||||
|
|
||||||
-- small delay to avoid lagging
|
-- small delay to avoid lagging
|
||||||
Wait.time(function() UI.show("updateNotification") end, 1)
|
Wait.time(function() UI.show("updateNotification") end, 1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- close / don't show again buttons on the XML use this
|
-- close / don't show again buttons on the XML use this
|
||||||
function onClick_notification(_, parameter)
|
function onClick_notification(_, parameter)
|
||||||
if parameter == "dontNotify" then
|
if parameter == "dontNotify" then
|
||||||
dontNotify[latestVersion] = true
|
dontNotify[modMeta["latestVersion"]] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
UI.hide("updateNotification")
|
UI.hide("updateNotification")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user