Skip to content

Commit

Permalink
Merge pull request #1434 from 1hitsong/fixHomeScetionNewUser
Browse files Browse the repository at this point in the history
Fix home section for accounts with no section data
  • Loading branch information
1hitsong authored Oct 26, 2023
2 parents 4222882 + 7edcff8 commit 86b7996
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion source/utils/session.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 86b7996

Please sign in to comment.