Home screen fix

This commit is contained in:
Brahim Hadriche committed 2026-07-04 11:30:39 -04:00
1 parent 17753169fb
commit 2cb3f41814
4 files changed
+44 -3

No files matched your search

+1
View File
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Signed-in accounts no longer get stuck sending failing requests after the login session expires
- Parser for channel video live indicator
- Home screen reduced to only the Trending sections after updating to 0.48.0
## [0.48.0] - 2026-07-01
@@ -23,10 +23,22 @@ namespace HomeScreenUtils
feedItems[item["id"]] = item
end for
' Sections missing from the saved layout (new sections, or layouts
' damaged by old bugs) render as enabled at the end of the feed.
filteredFeed = []
seenIds = {}
for each item in homeLayout
if item.enabled = true
filteredFeed.push(feedItems[item.id])
if IsAssociativeArray(item) and IsString(item.id)
seenIds[item.id] = true
if item.enabled = true and feedItems[item.id] <> invalid
filteredFeed.push(feedItems[item.id])
end if
end if
end for
for each item in feed
if not seenIds.DoesExist(item["id"])
filteredFeed.push(item)
end if
end for
@@ -198,6 +198,34 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
isDirty = true
end if
if userPrefs.__version = 8
' A pre-0.45.0 bug persisted an empty home screen layout on fresh installs,
' which the v7 -> v8 migration then turned into a trending-only layout.
' Heal layouts that lost sections: reset tiny ones to defaults, otherwise
' re-add missing sections as enabled so users notice they are back.
homeScreenLayout = userPrefs["misc.home_screen_layout"]
if IsArray(homeScreenLayout)
if homeScreenLayout.Count() < 3
userPrefs.Delete("misc.home_screen_layout")
else
defaultIds = ["subscriptions", "recommended", "popular", "playlists", "watch_history", "trending_livestreams", "trending_gaming"]
existingIds = {}
for each item in homeScreenLayout
if IsAssociativeArray(item) and IsString(item.id)
existingIds[item.id] = true
end if
end for
for each id in defaultIds
if not existingIds.DoesExist(id)
homeScreenLayout.Push({ id: id, enabled: true })
end if
end for
end if
end if
userPrefs.__version = 9
isDirty = true
end if
' TODO:P2 handle case where saved preferences version is higher than current version (e.g. user downgraded)
#if DEBUG
@@ -5,7 +5,7 @@
user prefs saved need to be migrated. If the version is less than the
current version, a migration is needed.
-->
<field id="__version" type="integer" value="8" />
<field id="__version" type="integer" value="9" />
<field id="prefsModel" type="array" />
<field id="preferenceFields" type="assocarray" />
<function name="GetUserPreferences" />