Channel layout improvements

This commit is contained in:
Arkadiusz Fal 2022-08-22 00:37:52 +02:00
parent 1f219b71d0
commit c43a6802da

View File

@ -96,10 +96,19 @@ struct ChannelVideosView: View {
HStack(spacing: 3) { HStack(spacing: 3) {
Text("\(store.item?.subscriptionsString ?? "")") Text("\(store.item?.subscriptionsString ?? "")")
.fontWeight(.bold) .fontWeight(.bold)
Text(" subscribers")
let subscribers = Text(" subscribers")
.allowsTightening(true) .allowsTightening(true)
.foregroundColor(.secondary) .foregroundColor(.secondary)
.opacity(store.item?.subscriptionsString != nil ? 1 : 0) .opacity(store.item?.subscriptionsString != nil ? 1 : 0)
#if os(iOS)
if navigationStyle == .sidebar {
subscribers
}
#else
subscribers
#endif
} }
ShareButton(contentItem: contentItem) ShareButton(contentItem: contentItem)
@ -157,21 +166,35 @@ struct ChannelVideosView: View {
Group { Group {
if accounts.app.supportsSubscriptions && accounts.signedIn { if accounts.app.supportsSubscriptions && accounts.signedIn {
if subscriptions.isSubscribing(channel.id) { if subscriptions.isSubscribing(channel.id) {
Button("Unsubscribe") { Button {
subscriptionToggleButtonDisabled = true subscriptionToggleButtonDisabled = true
subscriptions.unsubscribe(channel.id) { subscriptions.unsubscribe(channel.id) {
subscriptionToggleButtonDisabled = false subscriptionToggleButtonDisabled = false
} }
} label: {
Label("Unsubscribe", systemImage: "circle")
#if os(iOS)
.labelStyle(.automatic)
#else
.labelStyle(.titleOnly)
#endif
} }
} else { } else {
Button("Subscribe") { Button {
subscriptionToggleButtonDisabled = true subscriptionToggleButtonDisabled = true
subscriptions.subscribe(channel.id) { subscriptions.subscribe(channel.id) {
subscriptionToggleButtonDisabled = false subscriptionToggleButtonDisabled = false
navigation.sidebarSectionChanged.toggle() navigation.sidebarSectionChanged.toggle()
} }
} label: {
Label("Subscribe", systemImage: "star.circle")
#if os(iOS)
.labelStyle(.automatic)
#else
.labelStyle(.titleOnly)
#endif
} }
} }
} }