Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookmark groups added to top of list #263

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Bookmarks are now added to the top of the list

## [0.19.0] - 2024-01-10

### Added
Expand Down
13 changes: 8 additions & 5 deletions playlet-lib/src/components/Services/Bookmarks/Bookmarks.bs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ function Load() as void
return
end if

for each bookmarkGroup in bookmarks.groups
groupCount = bookmarks.groups.Count()
' GetOrCreateBookmarkGroup inserts at the beginning of the list, so we need to iterate backwards
for i = groupCount - 1 to 0 step -1
bookmarkGroup = bookmarks.groups[i]
bookmarkGroupNode = GetOrCreateBookmarkGroup(bookmarkGroup.title)
bookmarksCount = bookmarkGroup.bookmarks.Count()
' AddFeedSourceBookmark inserts at the beginning of the list, so we need to iterate backwards
for i = bookmarksCount - 1 to 0 step -1
bookmark = bookmarkGroup.bookmarks[i]
' AddFeedSourceBookmark also inserts at the beginning of the list, so we need to iterate backwards
for j = bookmarksCount - 1 to 0 step -1
bookmark = bookmarkGroup.bookmarks[j]
AddFeedSourceBookmark(bookmark.feedSource, bookmark.id, bookmarkGroupNode)
end for
end for
Expand Down Expand Up @@ -85,7 +88,7 @@ function GetOrCreateBookmarkGroup(groupName as string) as object
node = CreateObject("roSGNode", "ContentNode")
node.id = id
node.title = groupName
m.top.content.appendChild(node)
m.top.content.insertChild(node, 0)
LogInfo("Added bookmark group:", groupName)
return node
end function
Expand Down