RowCell bug fix

This commit is contained in:
Brahim Hadriche committed 2023-11-08 08:18:45 -05:00
1 parent c1bb059d66
commit 38a1d9a950
3 files changed
+46 -19

No files matched your search

+4
View File
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- An option to disable search history - An option to disable search history
### Fixed
- A rare bug that causes the app to crash when displaying video cells
## [0.15.0] - 2023-11-05 ## [0.15.0] - 2023-11-05
### Added ### Added
@@ -1,40 +1,49 @@
function Init() ' Note: we use aliases and not references to sub cells that we initialize on Init() because
m.videoRowCell = m.top.findNode("VideoRowCell") ' of a rare bug / race condition where the cells are not initialized
m.playlistRowCell = m.top.findNode("PlaylistRowCell")
m.channelRowCell = m.top.findNode("ChannelRowCell")
m.loadingRowCell = m.top.findNode("LoadingRowCell")
m.actionRowCell = m.top.findNode("ActionRowCell")
m.cells = [m.videoRowCell, m.playlistRowCell, m.channelRowCell, m.loadingRowCell, m.actionRowCell]
end function
function OnContentSet() as void function OnContentSet() as void
content = m.top.itemContent content = m.top.itemContent
visibleProperties = {
"video": "videoRowCellVisible",
"playlist": "playlistRowCellVisible",
"channel": "channelRowCellVisible",
"loading": "loadingRowCellVisible",
"action": "actionRowCellVisible"
}
contentProperties = {
"video": "videoRowCellItemContent",
"playlist": "playlistRowCellItemContent",
"channel": "channelRowCellItemContent",
"loading": "loadingRowCellItemContent",
"action": "actionRowCellItemContent"
}
if content = invalid if content = invalid
for each cell in m.cells for each key in visibleProperties
cell.visible = false m.top[visibleProperties[key]] = false
end for end for
m.loadingRowCell.visible = true m.top.loadingRowCellVisible = true
return return
end if end if
m.top.type = content.type m.top.type = content.type
visibleSet = false visibleSet = false
for each cell in m.cells for each key in visibleProperties
shouldBeVisible = content.type = cell.type shouldBeVisible = content.type = key
cell.visible = shouldBeVisible m.top[visibleProperties[key]] = shouldBeVisible
if shouldBeVisible if shouldBeVisible
cell.itemContent = content m.top[contentProperties[key]] = content
visibleSet = true visibleSet = true
end if end if
end for end for
if not visibleSet if not visibleSet
m.loadingRowCell.visible = true m.top.loadingRowCellVisible = true
end if end if
if m.loadingRowCell.visible if m.top.loadingRowCellVisible
m.loadingRowCell.index = m.top.index m.top.loadingRowCellIndex = m.top.index
end if end if
end function end function
@@ -3,6 +3,20 @@
<field id="type" type="string" /> <field id="type" type="string" />
<field id="itemContent" type="node" onChange="OnContentSet" /> <field id="itemContent" type="node" onChange="OnContentSet" />
<field id="index" type="integer" /> <field id="index" type="integer" />
<field id="videoRowCellVisible" type="boolean" alias="VideoRowCell.visible" />
<field id="playlistRowCellVisible" type="boolean" alias="PlaylistRowCell.visible" />
<field id="channelRowCellVisible" type="boolean" alias="ChannelRowCell.visible" />
<field id="loadingRowCellVisible" type="boolean" alias="LoadingRowCell.visible" />
<field id="actionRowCellVisible" type="boolean" alias="ActionRowCell.visible" />
<field id="videoRowCellItemContent" type="node" alias="VideoRowCell.itemContent" />
<field id="playlistRowCellItemContent" type="node" alias="PlaylistRowCell.itemContent" />
<field id="channelRowCellItemContent" type="node" alias="ChannelRowCell.itemContent" />
<field id="loadingRowCellItemContent" type="node" alias="LoadingRowCell.itemContent" />
<field id="actionRowCellItemContent" type="node" alias="ActionRowCell.itemContent" />
<field id="loadingRowCellIndex" type="integer" alias="LoadingRowCell.index" />
</interface> </interface>
<children> <children>
<VideoRowCell id="VideoRowCell" /> <VideoRowCell id="VideoRowCell" />