Fix bug where home screen editor is empty with a fresh install
This commit is contained in:
1 parent
1e121fdddd
commit
22f8031b91
3 files changed
+29
-8
No files matched your search
+3
-1
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- Nothing worth mentioning yet.
|
### Fixed
|
||||||
|
|
||||||
|
- Bug where home screen editor is empty with a fresh install
|
||||||
|
|
||||||
## [0.44.9] - 2026-04-25
|
## [0.44.9] - 2026-04-25
|
||||||
|
|
||||||
|
|||||||
+23
-6
@@ -7,10 +7,10 @@ import "pkg:/source/utils/StringUtils.bs"
|
|||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
m.homeLayout = {}
|
m.homeLayoutMap = {}
|
||||||
homeLayout = StringUtils.ParseJsonSafe(ReadAsciiFile("libpkg:/config/default_home_layout.yaml"))
|
homeLayoutMap = StringUtils.ParseJsonSafe(ReadAsciiFile("libpkg:/config/default_home_layout.yaml"))
|
||||||
for each item in homeLayout
|
for each item in homeLayoutMap
|
||||||
m.homeLayout[item.id] = item
|
m.homeLayoutMap[item.id] = item
|
||||||
end for
|
end for
|
||||||
|
|
||||||
m.checkList = m.top.findNode("checkList")
|
m.checkList = m.top.findNode("checkList")
|
||||||
@@ -81,17 +81,34 @@ function OnValueChange()
|
|||||||
|
|
||||||
nodes = []
|
nodes = []
|
||||||
checkedState = []
|
checkedState = []
|
||||||
|
homeLayoutMap = {}
|
||||||
|
homeLayoutMap.Append(m.homeLayoutMap)
|
||||||
|
|
||||||
for each item in value
|
for each item in value
|
||||||
feed = m.homeLayout[item.id]
|
feed = homeLayoutMap[item.id]
|
||||||
if feed = invalid
|
if feed = invalid
|
||||||
LogWarn("unknown feed id:", item.id)
|
LogWarn("unknown feed id:", item.id)
|
||||||
continue for
|
continue for
|
||||||
end if
|
end if
|
||||||
|
homeLayoutMap.Delete(item.id)
|
||||||
|
node = CreateObject("roSGNode", "ContentNode")
|
||||||
|
node.id = feed.id
|
||||||
|
node.title = Tr(feed.title)
|
||||||
|
nodes.push(node)
|
||||||
|
checkedState.push(item.enabled)
|
||||||
|
end for
|
||||||
|
|
||||||
|
for each id in homeLayoutMap
|
||||||
|
feed = homeLayoutMap[id]
|
||||||
|
if feed = invalid
|
||||||
|
LogWarn("unknown feed id:", id)
|
||||||
|
continue for
|
||||||
|
end if
|
||||||
node = CreateObject("roSGNode", "ContentNode")
|
node = CreateObject("roSGNode", "ContentNode")
|
||||||
node.id = feed.id
|
node.id = feed.id
|
||||||
node.title = Tr(feed.title)
|
node.title = Tr(feed.title)
|
||||||
nodes.push(node)
|
nodes.push(node)
|
||||||
checkedState.push(item.enabled)
|
checkedState.push(false)
|
||||||
end for
|
end for
|
||||||
|
|
||||||
labelCount = content.getChildCount()
|
labelCount = content.getChildCount()
|
||||||
|
|||||||
@@ -171,7 +171,9 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
|
|||||||
end if
|
end if
|
||||||
filteredLayout.Push(item)
|
filteredLayout.Push(item)
|
||||||
end for
|
end for
|
||||||
userPrefs["misc.home_screen_layout"] = filteredLayout
|
if filteredLayout.Count() > 0
|
||||||
|
userPrefs["misc.home_screen_layout"] = filteredLayout
|
||||||
|
end if
|
||||||
userPrefs.__version = 6
|
userPrefs.__version = 6
|
||||||
isDirty = true
|
isDirty = true
|
||||||
end if
|
end if
|
||||||
|
|||||||
Reference in new issue
Block a user