Bookmarks to feed refactor
This commit is contained in:
1 parent
45262c6394
commit
609c4622fd
4 files changed
+31
-41
No files matched your search
@@ -5,6 +5,10 @@ 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.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
- Nothing worth mentioning yet.
|
||||||
|
|
||||||
## [0.22.0] - 2024-03-24
|
## [0.22.0] - 2024-03-24
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
|
import "pkg:/components/Services/BookmarksService/BookmarksServiceUtils.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Locale.bs"
|
import "pkg:/source/utils/Locale.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
@@ -69,23 +70,7 @@ function OnBookmarksChange() as void
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function SetRowListContent(bookmarksContent as object)
|
function SetRowListContent(bookmarksContent as object)
|
||||||
bookmarkGroupNodes = bookmarksContent.getChildren(-1, 0)
|
m.rowList.feeds = BookmarksServiceUtils.BookmarksContentToFeed(bookmarksContent)
|
||||||
|
|
||||||
feeds = []
|
|
||||||
for each bookmarkGroupNode in bookmarkGroupNodes
|
|
||||||
bookmarkNodes = bookmarkGroupNode.getChildren(-1, 0)
|
|
||||||
feedSources = []
|
|
||||||
for each bookmarkNode in bookmarkNodes
|
|
||||||
feedSources.push(bookmarkNode.feedSource)
|
|
||||||
end for
|
|
||||||
|
|
||||||
feeds.push({
|
|
||||||
"title": bookmarkGroupNode.title
|
|
||||||
"feedSources": feedSources
|
|
||||||
})
|
|
||||||
end for
|
|
||||||
|
|
||||||
m.rowList.feeds = feeds
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
namespace BookmarksServiceUtils
|
||||||
|
|
||||||
|
function BookmarksContentToFeed(content as object) as object
|
||||||
|
bookmarkGroupNodes = content.getChildren(-1, 0)
|
||||||
|
|
||||||
|
feeds = []
|
||||||
|
for each bookmarkGroupNode in bookmarkGroupNodes
|
||||||
|
bookmarkNodes = bookmarkGroupNode.getChildren(-1, 0)
|
||||||
|
feedSources = []
|
||||||
|
for each bookmarkNode in bookmarkNodes
|
||||||
|
feedSources.push(bookmarkNode.feedSource)
|
||||||
|
end for
|
||||||
|
|
||||||
|
feeds.push({
|
||||||
|
"title": bookmarkGroupNode.title
|
||||||
|
"feedSources": feedSources
|
||||||
|
})
|
||||||
|
end for
|
||||||
|
|
||||||
|
return feeds
|
||||||
|
end function
|
||||||
|
|
||||||
|
end namespace
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import "pkg:/components/Services/BookmarksService/BookmarksServiceUtils.bs"
|
||||||
import "pkg:/source/utils/RegistryUtils.bs"
|
import "pkg:/source/utils/RegistryUtils.bs"
|
||||||
|
|
||||||
namespace Http
|
namespace Http
|
||||||
@@ -33,35 +34,12 @@ namespace Http
|
|||||||
function GetBookmarksFeeds(context as object) as boolean
|
function GetBookmarksFeeds(context as object) as boolean
|
||||||
response = context.response
|
response = context.response
|
||||||
|
|
||||||
feeds = m.BookmarksContentToFeeds(m.bookmarksService.content)
|
feeds = BookmarksServiceUtils.BookmarksContentToFeed(m.bookmarksService.content)
|
||||||
|
|
||||||
response.Json(feeds)
|
response.Json(feeds)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end function
|
end function
|
||||||
|
|
||||||
' TODO:P1 refactor to share code with Bookmarks screen
|
|
||||||
function BookmarksContentToFeeds(bookmarksContent as object) as object
|
|
||||||
bookmarkGroupNodes = bookmarksContent.getChildren(-1, 0)
|
|
||||||
|
|
||||||
feeds = []
|
|
||||||
for each bookmarkGroupNode in bookmarkGroupNodes
|
|
||||||
bookmarkNodes = bookmarkGroupNode.getChildren(-1, 0)
|
|
||||||
|
|
||||||
feedSources = []
|
|
||||||
for each bookmarkNode in bookmarkNodes
|
|
||||||
feedSources.push(bookmarkNode.feedSource)
|
|
||||||
end for
|
|
||||||
|
|
||||||
feeds.push({
|
|
||||||
"title": bookmarkGroupNode.title
|
|
||||||
"feedSources": feedSources
|
|
||||||
})
|
|
||||||
end for
|
|
||||||
|
|
||||||
return feeds
|
|
||||||
end function
|
|
||||||
|
|
||||||
end class
|
end class
|
||||||
|
|
||||||
end namespace
|
end namespace
|
||||||
Reference in new issue
Block a user