Skip to content

Commit 0670ae3

Browse files
authored
Merge pull request #1556 from cewert/fix-whatsnew
Fix what's new popup and show it for each user if enabled
2 parents 6f70a06 + ed9356d commit 0670ae3

File tree

7 files changed

+202
-197
lines changed

7 files changed

+202
-197
lines changed

components/WhatsNewDialog.bs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sub init()
55

66
m.top.id = "OKDialog"
77
m.top.height = 900
8-
m.top.title = "What's New?"
8+
m.top.title = m.global.app.version + " - " + tr("What's New?")
99
m.top.buttons = [tr("OK")]
1010

1111
dialogStyles = {
@@ -21,7 +21,7 @@ sub init()
2121
}
2222
}
2323

24-
whatsNewList = ParseJSON(ReadAsciiFile("pkg:/source/static/whatsNew.json"))
24+
whatsNewList = ParseJSON(ReadAsciiFile("pkg:/source/static/whatsNew/" + m.global.app.version.ToStr().trim() + ".json"))
2525

2626
for each item in whatsNewList
2727
textLine = m.content.CreateChild("StdDlgMultiStyleTextItem")

locale/en_US/translations.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1241,5 +1241,10 @@
12411241
<translation>Make the arrangement of the Roku home view sections match the web client's home screen. Jellyfin will need to be closed and reopened for change to take effect.</translation>
12421242
<extracomment>User Setting - Setting description</extracomment>
12431243
</message>
1244+
<message>
1245+
<source>What's New?</source>
1246+
<translation>What's New?</translation>
1247+
<extracomment>Popup title - Popup displays all the major changes to the app since the last version</extracomment>
1248+
</message>
12441249
</context>
12451250
</TS>

source/Main.bs

+11-8
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ sub Main (args as dynamic) as void
2020
m.wasMigrated = false
2121
runGlobalMigrations()
2222
runRegistryUserMigrations()
23-
' update LastRunVersion now that migrations are finished
24-
showWhatsNew = false
23+
' update global LastRunVersion now that migrations are finished
2524
if m.global.app.version <> m.global.app.lastRunVersion
26-
showWhatsNew = true
2725
set_setting("LastRunVersion", m.global.app.version)
2826
end if
2927
if m.wasMigrated then printRegistry()
@@ -74,11 +72,16 @@ sub Main (args as dynamic) as void
7472
end if
7573
end if
7674

77-
' Show the Whats New popup
78-
if showWhatsNew and m.global.session.user.settings["load.allowwhatsnew"]
79-
dialog = createObject("roSGNode", "WhatsNewDialog")
80-
m.scene.dialog = dialog
81-
m.scene.dialog.observeField("buttonSelected", m.port)
75+
' has the current user ran this version before?
76+
usersLastRunVersion = m.global.session.user.settings.lastRunVersion
77+
if not isValid(usersLastRunVersion) or not versionChecker(m.global.session.user.settings.lastRunVersion, m.global.app.version)
78+
set_user_setting("LastRunVersion", m.global.app.version)
79+
' show what's new popup
80+
if m.global.session.user.settings["load.allowwhatsnew"]
81+
dialog = createObject("roSGNode", "WhatsNewDialog")
82+
m.scene.dialog = dialog
83+
m.scene.dialog.observeField("buttonSelected", m.port)
84+
end if
8285
end if
8386

8487
' Handle input messages

source/migrations.bs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ sub runRegistryUserMigrations()
7171
' app versions < 2.0.0 didn't save LastRunVersion at the user level
7272
' fall back to using the apps lastRunVersion
7373
lastRunVersion = m.global.app.lastRunVersion
74-
registry_write("LastRunVersion", m.global.app.version, section)
74+
registry_write("LastRunVersion", lastRunVersion, section)
7575
end if
7676

7777
' BASE_MIGRATION

source/static/whatsNew.json

-182
This file was deleted.

0 commit comments

Comments
 (0)