Channel view and other small improvements

This commit is contained in:
Arkadiusz Fal
2022-12-11 17:06:02 +01:00
parent 006423682b
commit 899e66b204
7 changed files with 96 additions and 73 deletions

View File

@@ -144,22 +144,11 @@ struct ControlsBar: View {
)
}
} label: {
ZStack(alignment: .bottomTrailing) {
authorAvatar
if accounts.app.supportsSubscriptions,
accounts.signedIn,
let video = model.currentVideo,
subscriptions.isSubscribing(video.channel.id)
{
Image(systemName: "star.circle.fill")
#if !os(tvOS)
.background(Color.background)
#endif
.clipShape(Circle())
.foregroundColor(.secondary)
}
}
ChannelAvatarView(
channel: model.currentVideo?.channel,
video: model.currentVideo
)
.frame(width: barHeight - 10, height: barHeight - 10)
}
.contextMenu {
if let video = model.currentVideo {
@@ -207,7 +196,7 @@ struct ControlsBar: View {
navigation.presentUnsubscribeAlert(video.channel, subscriptions: subscriptions)
#endif
} label: {
Label("Unsubscribe", systemImage: "xmark.circle")
Label("Unsubscribe", systemImage: "star.circle")
}
} else {
Button {
@@ -275,38 +264,6 @@ struct ControlsBar: View {
Spacer()
}
}
private var authorAvatar: some View {
Group {
if let url = model.currentItem?.video?.channel.thumbnailURL {
WebImage(url: url, options: [.lowPriority])
.resizable()
.placeholder {
Rectangle().fill(Color("PlaceholderColor"))
}
.retryOnAppear(true)
.indicator(.activity)
} else {
ZStack {
Color(white: 0.6)
.opacity(0.5)
Group {
if let video = model.currentItem?.video, video.isLocal {
Image(systemName: video.localStreamImageSystemName)
} else {
Image(systemName: "play.rectangle")
}
}
.foregroundColor(.accentColor)
.font(.system(size: 20))
.contentShape(Rectangle())
}
}
}
.frame(width: 44, height: 44, alignment: .leading)
.clipShape(Circle())
}
}
struct ControlsBar_Previews: PreviewProvider {