New video details

This commit is contained in:
Arkadiusz Fal
2022-11-13 18:52:15 +01:00
parent 9bea3b623d
commit 4ee1383f3a
26 changed files with 718 additions and 443 deletions

View File

@@ -137,20 +137,32 @@ struct ControlsBar: View {
var details: some View {
HStack {
HStack(spacing: 8) {
ZStack(alignment: .bottomTrailing) {
authorAvatar
Button {
if let video = model.currentVideo, !video.isLocal {
NavigationModel.openChannel(
video.channel,
player: model,
recents: recents,
navigation: navigation,
navigationStyle: navigationStyle
)
}
} 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)
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)
}
}
}
.contextMenu {

View File

@@ -1,14 +1,22 @@
import SwiftUI
struct ShareButton: View {
struct ShareButton<LabelView: View>: View {
let contentItem: ContentItem
@EnvironmentObject<AccountsModel> private var accounts
@EnvironmentObject<NavigationModel> private var navigation
@EnvironmentObject<PlayerModel> private var player
init(contentItem: ContentItem) {
let label: LabelView?
init(
contentItem: ContentItem,
@ViewBuilder label: @escaping () -> LabelView? = {
Label("Share...", systemImage: "square.and.arrow.up")
}
) {
self.contentItem = contentItem
self.label = label()
}
@ViewBuilder var body: some View {
@@ -24,11 +32,11 @@ struct ShareButton: View {
}
}
} label: {
Label("Share...", systemImage: "square.and.arrow.up")
label
}
.menuStyle(.borderlessButton)
#if os(macOS)
.frame(maxWidth: 35)
.frame(maxWidth: 60)
#endif
}
}

View File

@@ -90,7 +90,10 @@ struct VideoContextMenuView: View {
}
#if os(iOS)
if video.isLocal, let url = video.localStream?.localURL, DocumentsModel.shared.isDocument(url) {
if video.isLocal,
let url = video.localStream?.localURL,
DocumentsModel.shared.isDocument(url)
{
Section {
removeDocumentButton
}