Add accounts to Sidebar
This commit is contained in:
parent
0886cffcff
commit
29b5f426fd
|
@ -30,6 +30,24 @@ class SidebarModel: ObservableObject {
|
||||||
}
|
}
|
||||||
items.append(smartFeedControllerItem)
|
items.append(smartFeedControllerItem)
|
||||||
|
|
||||||
|
for account in AccountManager.shared.sortedActiveAccounts {
|
||||||
|
var accountItem = SidebarItem(account)
|
||||||
|
|
||||||
|
for webFeed in account.topLevelWebFeeds {
|
||||||
|
accountItem.addChild(SidebarItem(webFeed, unreadCount: delegate.unreadCount(for: webFeed)))
|
||||||
|
}
|
||||||
|
|
||||||
|
for folder in account.folders ?? Set<Folder>() {
|
||||||
|
var folderItem = SidebarItem(folder, unreadCount: delegate.unreadCount(for: folder))
|
||||||
|
for webFeed in folder.topLevelWebFeeds {
|
||||||
|
folderItem.addChild(SidebarItem(webFeed, unreadCount: delegate.unreadCount(for: webFeed)))
|
||||||
|
}
|
||||||
|
accountItem.addChild(folderItem)
|
||||||
|
}
|
||||||
|
|
||||||
|
items.append(accountItem)
|
||||||
|
}
|
||||||
|
|
||||||
sidebarItems = items
|
sidebarItems = items
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,10 @@ struct SidebarView: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
ForEach(sidebarModel.sidebarItems) { section in
|
|
||||||
OutlineGroup(sidebarModel.sidebarItems, children: \.children) { sidebarItem in
|
OutlineGroup(sidebarModel.sidebarItems, children: \.children) { sidebarItem in
|
||||||
Text(sidebarItem.nameForDisplay)
|
Text(sidebarItem.nameForDisplay)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue