Review Updates & Bug Fix

Fix Roku component reuse bug
Don't repeat loadingTimer
Move ImageSizes enum to source folder
Update setting text & translation
Check selectedRowItem is valid and not empty
This commit is contained in:
1hitsong 2023-11-25 08:25:31 -05:00
parent 867667f516
commit 40925199d4
7 changed files with 33 additions and 29 deletions

View File

@ -28,6 +28,7 @@ end sub
sub itemContentChanged()
m.unplayedCount.visible = false
itemData = m.top.itemContent
if itemData = invalid then return

View File

@ -1,5 +1,5 @@
import "pkg:/source/utils/misc.bs"
import "pkg:/components/ImageSizes.bs"
import "pkg:/source/constants/ImageSizes.bs"
' The maximum number of seconds we will show the loading spinner and delay the user from using the home view while the content loads
' We use this to wait for the rows to load so we can reset focus to the row/item once it loads
@ -21,7 +21,6 @@ sub init()
m.loadingTimer = createObject("roSGNode", "Timer")
m.loadingTimer.duration = MAX_TIME_HOME_LOADING_SPINNER_SHOWN
m.loadingTimer.repeat = true
m.loadingTimer.observeField("fire", "stopLoadingSpinner")
updateSize()
@ -308,6 +307,7 @@ end sub
' Update home row data
sub updateHomeRows()
startMediaLoadingSpinner()
m.loadingTimer.control = "start"
content = processUserSections()
setRowItemSizes()
m.top.content = content
@ -454,6 +454,7 @@ sub updateLatestItems(msg)
row = CreateObject("roSGNode", "HomeRow")
row.title = tr("Latest in") + " " + node.metadata.title + " >"
row.usePoster = true
' Handle specific types with different item widths
if node.metadata.contentType = "movies"
row.imageWidth = imageSizes.MOVIE_POSTER[0]
@ -524,21 +525,19 @@ end sub
' setFocusToPreviousFocusedItem: Sets the cursor focus to the row and item previously selected
'
sub setFocusToPreviousFocusedItem()
m.loadingTimer.control = "start"
if not isValidAndNotEmpty(m.selectedRowItem) then return
if isValid(m.selectedRowItem)
' Set focus to row if it exists
itemRow = m.top.content.getChild(m.top.rowItemSelected[0])
if isValid(itemRow)
m.top.jumpToItem = m.top.rowItemSelected[0]
' Set focus to row if it exists
itemRow = m.top.content.getChild(m.selectedRowItem[0])
if isValid(itemRow)
m.top.jumpToItem = m.selectedRowItem[0]
' Set focus to column if it exists
itemColumn = itemRow.getChild(m.top.rowItemSelected[1])
if isValid(itemColumn)
m.top.jumpToRowItem = [m.selectedRowItem[0], m.selectedRowItem[1]]
m.loadingTimer.control = "stop"
stopLoadingSpinner()
end if
' Set focus to column if it exists
itemColumn = itemRow.getChild(m.selectedRowItem[1])
if isValid(itemColumn)
m.top.jumpToRowItem = [m.selectedRowItem[0], m.selectedRowItem[1]]
m.loadingTimer.control = "stop"
stopLoadingSpinner()
end if
end if
end sub

View File

@ -1232,13 +1232,13 @@
<extracomment>Message shown in OSD when no chapter data is returned by the API</extracomment>
</message>
<message>
<source>Use Web's Home Section Arrangement</source>
<translation>Use Web's Home Section Arrangement</translation>
<source>Use Web Client's Home Section Arrangement</source>
<translation>Use Web Client's Home Section Arrangement</translation>
<extracomment>User Setting - Setting title</extracomment>
</message>
<message>
<source>Make the arrangement of the Roku home view sections match the web's home screen. Jellyfin will need to be closed and reopened for change to take effect.</source>
<translation>Make the arrangement of the Roku home view sections match the web's home screen. Jellyfin will need to be closed and reopened for change to take effect.</translation>
<source>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.</source>
<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>
<extracomment>User Setting - Setting description</extracomment>
</message>
</context>

View File

@ -233,11 +233,11 @@
"default": "false"
},
{
"title": "Use Web's Home Section Arrangement",
"description": "Make the arrangement of the Roku home view sections match the web's home screen. Jellyfin will need to be closed and reopened for change to take effect.",
"title": "Use Web Client's Home Section Arrangement",
"description": "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.",
"settingName": "ui.home.useWebSectionArrangement",
"type": "bool",
"default": "false"
"default": "true"
}
]
},

View File

@ -1,5 +1,7 @@
' @fileoverview Constants for various image sizes.
namespace imageSizes
const WIDE_POSTER = [464, 331]
const MOVIE_POSTER = [188, 331]
const MOVIE_POSTER = [180, 331]
const MUSIC_ALBUM = [261, 331]
end namespace

View File

@ -72,6 +72,14 @@ sub runRegistryUserMigrations()
m.wasMigrated = true
print `Running Registry Migration for ${CLIENT_VERSION_REQUIRING_BASE_MIGRATION} for userid: ${section}`
' If this is an existing user, set the useWebSectionArrangement setting to false
' This way the home view for upgrading users is not changed without them opting in
useWebSectionArrangement = registry_read("ui.home.useWebSectionArrangement", section)
if not isValid(useWebSectionArrangement)
registry_write("ui.home.useWebSectionArrangement", "false", section)
end if
' no longer saving password to registry
registry_delete("password", section)
' av1 playback no longer hidden behind user setting

View File

@ -226,12 +226,6 @@ namespace session
userPreferences = customPrefs
rowTypes = []
' If this is a first time user, set the useWebSectionArrangement setting to true
' This way the home view for upgrading users is not changed without them opting in
if not isValid(m.global.app.lastRunVersion)
set_user_setting("ui.home.useWebSectionArrangement", "true")
end if
useWebSectionArrangement = m.global.session.user.settings["ui.home.useWebSectionArrangement"]
if isValid(useWebSectionArrangement)