2021-09-25 13:48:22 +05:30
|
|
|
import Defaults
|
2021-08-30 03:06:18 +05:30
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct AppSidebarSubscriptions: View {
|
2021-09-25 13:48:22 +05:30
|
|
|
@EnvironmentObject<NavigationModel> private var navigation
|
|
|
|
@EnvironmentObject<SubscriptionsModel> private var subscriptions
|
2021-08-30 03:06:18 +05:30
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
Section(header: Text("Subscriptions")) {
|
|
|
|
ForEach(subscriptions.all) { channel in
|
2021-09-29 04:31:49 +05:30
|
|
|
NavigationLink(tag: TabSelection.channel(channel.id), selection: $navigation.tabSelection) {
|
2021-09-25 13:48:22 +05:30
|
|
|
LazyView(ChannelVideosView(channel: channel))
|
2021-08-30 03:06:18 +05:30
|
|
|
} label: {
|
|
|
|
Label(channel.name, systemImage: AppSidebarNavigation.symbolSystemImage(channel.name))
|
|
|
|
}
|
|
|
|
.contextMenu {
|
|
|
|
Button("Unsubscribe") {
|
2021-09-25 13:48:22 +05:30
|
|
|
navigation.presentUnsubscribeAlert(channel)
|
2021-08-30 03:06:18 +05:30
|
|
|
}
|
|
|
|
}
|
2021-09-01 02:47:50 +05:30
|
|
|
.modifier(UnsubscribeAlertModifier())
|
2021-09-29 04:31:49 +05:30
|
|
|
.id("channel\(channel.id)")
|
2021-08-30 03:06:18 +05:30
|
|
|
}
|
|
|
|
}
|
2021-09-25 13:48:22 +05:30
|
|
|
.onAppear {
|
|
|
|
subscriptions.load()
|
|
|
|
}
|
2021-08-30 03:06:18 +05:30
|
|
|
}
|
|
|
|
}
|