fix lastrunversion migration + make whats new show per user

This commit is contained in:
Charles Ewert 2023-12-06 10:39:05 -05:00
parent 6f70a06e3e
commit 81ef7e2531
3 changed files with 12 additions and 13 deletions

View File

@ -20,10 +20,8 @@ sub Main (args as dynamic) as void
m.wasMigrated = false
runGlobalMigrations()
runRegistryUserMigrations()
' update LastRunVersion now that migrations are finished
showWhatsNew = false
' update global LastRunVersion now that migrations are finished
if m.global.app.version <> m.global.app.lastRunVersion
showWhatsNew = true
set_setting("LastRunVersion", m.global.app.version)
end if
if m.wasMigrated then printRegistry()
@ -74,11 +72,15 @@ sub Main (args as dynamic) as void
end if
end if
' Show the Whats New popup
if showWhatsNew and m.global.session.user.settings["load.allowwhatsnew"]
dialog = createObject("roSGNode", "WhatsNewDialog")
m.scene.dialog = dialog
m.scene.dialog.observeField("buttonSelected", m.port)
' has the current user ran this version before?
if not versionChecker(m.global.session.user.settings.lastRunVersion, m.global.app.version)
set_user_setting("LastRunVersion", m.global.app.version)
' show what's new popup
if m.global.session.user.settings["load.allowwhatsnew"]
dialog = createObject("roSGNode", "WhatsNewDialog")
m.scene.dialog = dialog
m.scene.dialog.observeField("buttonSelected", m.port)
end if
end if
' Handle input messages

View File

@ -71,7 +71,7 @@ sub runRegistryUserMigrations()
' app versions < 2.0.0 didn't save LastRunVersion at the user level
' fall back to using the apps lastRunVersion
lastRunVersion = m.global.app.lastRunVersion
registry_write("LastRunVersion", m.global.app.version, section)
registry_write("LastRunVersion", lastRunVersion, section)
end if
' BASE_MIGRATION

View File

@ -156,11 +156,8 @@ namespace session
' grab lastRunVersion for this user
lastRunVersion = get_user_setting("LastRunVersion")
if isValid(lastRunVersion) and lastRunVersion = m.global.app.version
' Don't update the registry, only update the global session
if isValid(lastRunVersion)
session.user.Update("LastRunVersion", lastRunVersion)
else
set_user_setting("LastRunVersion", m.global.app.version)
end if
' update user session settings with values from registry