Merge pull request #1434 from 1hitsong/fixHomeScetionNewUser

Fix home section for accounts with no section data
This commit is contained in:
1hitsong 2023-10-26 13:23:01 -04:00 committed by GitHub
commit 86b7996697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,11 +187,31 @@ namespace session
' Saves user's web client home sections as Roku user settings.
' Handles unsupported sections and ignores duplicates.
sub SaveUserHomeSections(customPrefs as object)
userPreferences = customPrefs
rowTypes = []
' If user has no section preferences, use default settings
if not userPreferences.doesExist("homesection0")
userPreferences = {
homesection0: "smalllibrarytiles",
homesection1: "resume",
homesection2: "nextup",
homesection3: "latestmedia",
homesection4: "livetv",
homesection5: "none",
homesection6: "none"
}
end if
for i = 0 to 6
homeSectionKey = "homesection" + i.toStr()
rowType = LCase(customPrefs[homeSectionKey])
' If home section doesn't exist, create it as a none row
if not userPreferences.DoesExist(homeSectionKey)
userPreferences.AddReplace(homeSectionKey, "none")
end if
rowType = LCase(userPreferences[homeSectionKey])
' Just in case we get invalid data
if not isValid(rowType) then rowType = "none"