Home screen fix
This commit is contained in:
1 parent
17753169fb
commit
2cb3f41814
4 files changed
+44
-3
No files matched your search
@@ -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" />
|
||||
|
||||
Reference in new issue
Block a user