diff --git a/CHANGELOG.md b/CHANGELOG.md index 74a6fd86..56eda70b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Issue with deep linking not working due to session data race condition +- A bug where playlists will not load the second page when not logged in ### Changed diff --git a/playlet-lib/src/components/ContentNode/PlaylistContentNode.bs b/playlet-lib/src/components/ContentNode/PlaylistContentNode.bs index 880a9b57..79d11fa7 100644 --- a/playlet-lib/src/components/ContentNode/PlaylistContentNode.bs +++ b/playlet-lib/src/components/ContentNode/PlaylistContentNode.bs @@ -17,6 +17,8 @@ end function function LoadPlaylist(invidiousNode as object, singlePage as boolean) as void if m.contentTask <> invalid m.contentTask.cancel = true + m.contentTask = invalid + m.top.isLoading = false end if loadState = m.top.loadState @@ -30,10 +32,12 @@ function LoadPlaylist(invidiousNode as object, singlePage as boolean) as void invidious: invidiousNode singlePage: singlePage }, OnPlaylistContentTaskResult) + m.top.isLoading = true end function function OnPlaylistContentTaskResult(output as object) as void m.contentTask = invalid + m.top.isLoading = false if output.cancelled return diff --git a/playlet-lib/src/components/ContentNode/PlaylistContentNode.xml b/playlet-lib/src/components/ContentNode/PlaylistContentNode.xml index 34980de0..1e404bb7 100644 --- a/playlet-lib/src/components/ContentNode/PlaylistContentNode.xml +++ b/playlet-lib/src/components/ContentNode/PlaylistContentNode.xml @@ -5,6 +5,8 @@ + + diff --git a/playlet-lib/src/components/PlaylistView/PlaylistView.bs b/playlet-lib/src/components/PlaylistView/PlaylistView.bs index b7db1754..04122c46 100644 --- a/playlet-lib/src/components/PlaylistView/PlaylistView.bs +++ b/playlet-lib/src/components/PlaylistView/PlaylistView.bs @@ -13,6 +13,11 @@ import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/Types.bs" function Init() + m.busySpinner = m.top.findNode("busySpinner") + m.busyspinner.poster.width = 100 + m.busyspinner.poster.height = 100 + m.busySpinner.poster.uri = "pkg:/images/spinner.png" + m.background = m.top.findNode("background") m.backgroundSmall = m.top.findNode("backgroundSmall") m.titleLabel = m.top.findNode("titleLabel") @@ -69,6 +74,7 @@ function OnContentSet() as void if itemFocused > -1 and content.getChildCount() > itemFocused m.list.jumpToItem = itemFocused end if + m.top.isLoading = content.isLoading or content.loadState = FeedLoadState.Loading LoadPlaylistIfNeeded() end function @@ -249,3 +255,15 @@ function LoadPlaylistIfNeeded() as void ' TODO:P1 use a field instead of function call m.top.content@.LoadPlaylistPage(m.top.invidious) end function + +function OnLoadingChanged(event as object) + isLoading = event.GetData() + if isLoading + m.busyspinner.poster.rotation = 0 + m.busySpinner.visible = true + m.busySpinner.control = "start" + else + m.busySpinner.visible = false + m.busySpinner.control = "stop" + end if +end function diff --git a/playlet-lib/src/components/PlaylistView/PlaylistView.xml b/playlet-lib/src/components/PlaylistView/PlaylistView.xml index 7d0f30d7..3a0acfaa 100644 --- a/playlet-lib/src/components/PlaylistView/PlaylistView.xml +++ b/playlet-lib/src/components/PlaylistView/PlaylistView.xml @@ -1,6 +1,7 @@ + @@ -51,6 +52,12 @@ font="font:SmallestSystemFont" /> + +