Fix video context menu channel subscription button (fixes #41)

This commit is contained in:
Arkadiusz Fal
2021-12-19 23:27:20 +01:00
parent f132ba9683
commit 0a5cb5b542
8 changed files with 61 additions and 55 deletions

View File

@@ -39,6 +39,10 @@ struct ContentView: View {
#endif
}
.onAppear(perform: configure)
.onChange(of: accounts.signedIn) { _ in
subscriptions.load(force: true)
playlists.load(force: true)
}
.environmentObject(accounts)
.environmentObject(comments)
@@ -83,6 +87,17 @@ struct ContentView: View {
}
)
#endif
.alert(isPresented: $navigation.presentingUnsubscribeAlert) {
Alert(
title: Text(
"Are you sure you want to unsubscribe from \(navigation.channelToUnsubscribe.name)?"
),
primaryButton: .destructive(Text("Unsubscribe")) {
subscriptions.unsubscribe(navigation.channelToUnsubscribe.id)
},
secondaryButton: .cancel()
)
}
}
func configure() {
@@ -135,6 +150,9 @@ struct ContentView: View {
#endif
navigation.tabSelection = section ?? .search
subscriptions.load()
playlists.load()
}
func openWelcomeScreenIfAccountEmpty() {