mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Add support for Piped accounts and subscriptions
This commit is contained in:
@@ -15,7 +15,7 @@ struct AccountsMenuView: View {
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
Label(model.current?.name ?? "Select Account", systemImage: "person.crop.circle")
|
||||
Label(model.current?.description ?? "Select Account", systemImage: "person.crop.circle")
|
||||
.labelStyle(.titleAndIcon)
|
||||
}
|
||||
.disabled(instances.isEmpty)
|
||||
|
@@ -30,9 +30,6 @@ struct AppSidebarPlaylists: View {
|
||||
newPlaylistButton
|
||||
.padding(.top, 8)
|
||||
}
|
||||
.onAppear {
|
||||
playlists.load()
|
||||
}
|
||||
}
|
||||
|
||||
var newPlaylistButton: some View {
|
||||
|
@@ -22,8 +22,5 @@ struct AppSidebarSubscriptions: View {
|
||||
.id("channel\(channel.id)")
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
subscriptions.load()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,8 @@ import SwiftUI
|
||||
struct Sidebar: View {
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
@EnvironmentObject<PlaylistsModel> private var playlists
|
||||
@EnvironmentObject<SubscriptionsModel> private var subscriptions
|
||||
|
||||
var body: some View {
|
||||
ScrollViewReader { scrollView in
|
||||
@@ -13,12 +15,25 @@ struct Sidebar: View {
|
||||
AppSidebarRecents()
|
||||
.id("recentlyOpened")
|
||||
|
||||
if accounts.signedIn {
|
||||
AppSidebarSubscriptions()
|
||||
AppSidebarPlaylists()
|
||||
if accounts.api.signedIn {
|
||||
if accounts.app.supportsSubscriptions {
|
||||
AppSidebarSubscriptions()
|
||||
}
|
||||
|
||||
if accounts.app.supportsUserPlaylists {
|
||||
AppSidebarPlaylists()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
subscriptions.load()
|
||||
playlists.load()
|
||||
}
|
||||
.onChange(of: accounts.signedIn) { _ in
|
||||
subscriptions.load(force: true)
|
||||
playlists.load(force: true)
|
||||
}
|
||||
.onChange(of: navigation.sidebarSectionChanged) { _ in
|
||||
scrollScrollViewToItem(scrollView: scrollView, for: navigation.tabSelection)
|
||||
}
|
||||
|
Reference in New Issue
Block a user