resolving review comments
This commit is contained in:
parent
2851e8a9a4
commit
a526e645a8
@ -1 +1 @@
|
|||||||
{"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}}
|
{"acknowledgedUpgradeVersions":[],"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}}
|
||||||
|
@ -43,7 +43,7 @@ local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
|
|||||||
local MOD_VERSION = "3.1.0"
|
local MOD_VERSION = "3.1.0"
|
||||||
local SOURCE_REPO = 'https://raw.githubusercontent.com/chr1z93/loadable-objects/main'
|
local SOURCE_REPO = 'https://raw.githubusercontent.com/chr1z93/loadable-objects/main'
|
||||||
local library, requestObj, modMeta, notificationVisible
|
local library, requestObj, modMeta, notificationVisible
|
||||||
local dontNotify = {}
|
local acknowledgedUpgradeVersions = {}
|
||||||
|
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
-- data for tokens
|
-- data for tokens
|
||||||
@ -104,13 +104,13 @@ local tokenDrawingStats = {
|
|||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
|
|
||||||
-- saving state of optionPanel to restore later
|
-- saving state of optionPanel to restore later
|
||||||
function onSave() return JSON.encode({ optionPanel = optionPanel, dontNotify = dontNotify }) end
|
function onSave() return JSON.encode({ optionPanel = optionPanel, acknowledgedUpgradeVersions = acknowledgedUpgradeVersions }) end
|
||||||
|
|
||||||
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
|
acknowledgedUpgradeVersions = loadedData.acknowledgedUpgradeVersions
|
||||||
updateOptionPanelState()
|
updateOptionPanelState()
|
||||||
else
|
else
|
||||||
print("Saved state could not be found!")
|
print("Saved state could not be found!")
|
||||||
@ -1059,10 +1059,11 @@ function compareVersion(request)
|
|||||||
-- global variable to make it accessible for other functions
|
-- global variable to make it accessible for other functions
|
||||||
modMeta = JSON.decode(request.text)
|
modMeta = JSON.decode(request.text)
|
||||||
|
|
||||||
-- stop here if on latest version or "don't show again" was clicked
|
-- stop here if on latest version
|
||||||
if MOD_VERSION == modMeta["latestVersion"] then return end
|
if MOD_VERSION == modMeta["latestVersion"] then return end
|
||||||
|
|
||||||
if dontNotify[modMeta["latestVersion"]] then return end
|
-- stop here if "don't show again" was clicked for this version before
|
||||||
|
if acknowledgedUpgradeVersions[modMeta["latestVersion"]] then return end
|
||||||
|
|
||||||
-- end here if no release notes are found
|
-- end here if no release notes are found
|
||||||
if modMeta["releaseNotes"][modMeta["latestVersion"]] == nil then
|
if modMeta["releaseNotes"][modMeta["latestVersion"]] == nil then
|
||||||
@ -1078,34 +1079,21 @@ end
|
|||||||
-- updates the XML update notification based on the mod metadata
|
-- updates the XML update notification based on the mod metadata
|
||||||
function updateNotificationLoading()
|
function updateNotificationLoading()
|
||||||
-- grab data
|
-- grab data
|
||||||
local highlights = modMeta["releaseNotes"][modMeta["latestVersion"]]["Highlights"]
|
local highlights = modMeta["releaseNotes"][modMeta["latestVersion"]]["highlights"]
|
||||||
local ui = UI.getXmlTable()
|
|
||||||
|
|
||||||
-- update the header
|
-- concatenate the release highlights
|
||||||
local header = find_tag_with_id(ui, 'notificationHeader')
|
|
||||||
header.value = header.value .. modMeta["latestVersion"]
|
|
||||||
|
|
||||||
-- update the release highlights
|
|
||||||
local highlightText = "• " .. highlights[1]
|
local highlightText = "• " .. highlights[1]
|
||||||
|
|
||||||
for i, entry in pairs(highlights) do
|
for i, entry in pairs(highlights) do
|
||||||
if i ~= 1 then
|
if i ~= 1 then
|
||||||
highlightText = highlightText .. "\n• " .. entry
|
highlightText = highlightText .. "\n• " .. entry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local releaseHighlightText = find_tag_with_id(ui, 'releaseHighlightText')
|
|
||||||
releaseHighlightText.value = highlightText
|
|
||||||
|
|
||||||
-- set height for amount of highlights
|
|
||||||
local highlightRow = find_tag_with_id(ui, 'highlightRow')
|
|
||||||
highlightRow.attributes.preferredHeight = 20*#highlights
|
|
||||||
|
|
||||||
local window = find_tag_with_id(ui, 'updateNotification')
|
|
||||||
window.attributes.height = highlightRow.attributes.preferredHeight + 125
|
|
||||||
|
|
||||||
-- update the XML UI
|
-- update the XML UI
|
||||||
UI.setXmlTable(ui)
|
UI.setValue("notificationHeader", "New version available: ".. modMeta["latestVersion"])
|
||||||
|
UI.setValue("releaseHighlightText", highlightText)
|
||||||
|
UI.setAttribute("highlightRow", "preferredHeight", 20*#highlights)
|
||||||
|
UI.setAttribute("updateNotification", "height", 20*#highlights + 125)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- triggered by clicking on the Finn Icon
|
-- triggered by clicking on the Finn Icon
|
||||||
@ -1121,9 +1109,9 @@ end
|
|||||||
|
|
||||||
-- close / don't show again buttons on the update notification
|
-- close / don't show again buttons on the update notification
|
||||||
function onClick_notification(_, parameter)
|
function onClick_notification(_, parameter)
|
||||||
if parameter == "dontNotify" then
|
if parameter == "dontShowAgain" then
|
||||||
-- this variable tracks if "don't show again" was pressed for a version
|
-- this variable tracks if "don't show again" was pressed for a version
|
||||||
dontNotify[modMeta["latestVersion"]] = true
|
acknowledgedUpgradeVersions[modMeta["latestVersion"]] = true
|
||||||
end
|
end
|
||||||
UI.hide("FinnIcon")
|
UI.hide("FinnIcon")
|
||||||
UI.hide("updateNotification")
|
UI.hide("updateNotification")
|
||||||
|
@ -33,10 +33,11 @@
|
|||||||
<Row preferredHeight="50">
|
<Row preferredHeight="50">
|
||||||
<Cell>
|
<Cell>
|
||||||
<Panel padding="10 10 0 0">
|
<Panel padding="10 10 0 0">
|
||||||
|
<!-- this part will be updated via script -->
|
||||||
<Text id="notificationHeader"
|
<Text id="notificationHeader"
|
||||||
font="font_teutonic-arkham"
|
font="font_teutonic-arkham"
|
||||||
fontSize="30"
|
fontSize="30"
|
||||||
alignment="MiddleCenter">New version available: </Text>
|
alignment="MiddleCenter">Placeholder</Text>
|
||||||
</Panel>
|
</Panel>
|
||||||
</Cell>
|
</Cell>
|
||||||
</Row>
|
</Row>
|
||||||
@ -70,7 +71,7 @@
|
|||||||
padding="10 10 5 10"
|
padding="10 10 5 10"
|
||||||
spacing="10">
|
spacing="10">
|
||||||
<Button class="bottomButtons"
|
<Button class="bottomButtons"
|
||||||
onClick="onClick_notification(dontNotify)">Don't show again</Button>
|
onClick="onClick_notification(dontShowAgain)">Don't show again</Button>
|
||||||
<Button class="bottomButtons"
|
<Button class="bottomButtons"
|
||||||
onClick="onClick_notification(close)">Close</Button>
|
onClick="onClick_notification(close)">Close</Button>
|
||||||
</HorizontalLayout>
|
</HorizontalLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user