mirror of
https://github.com/yattee/yattee.git
synced 2025-10-23 15:58:18 +00:00
PiP and UI improvements
This commit is contained in:
@@ -48,9 +48,9 @@ struct ChannelPlaylistView: View {
|
||||
}
|
||||
#if os(iOS)
|
||||
.sheet(isPresented: $presentingShareSheet) {
|
||||
ShareSheet(activityItems: [
|
||||
accounts.api.shareURL(contentItem)
|
||||
])
|
||||
if let url = accounts.api.shareURL(contentItem) {
|
||||
ShareSheet(activityItems: [url])
|
||||
}
|
||||
}
|
||||
#endif
|
||||
.onAppear {
|
||||
|
@@ -67,6 +67,7 @@ struct ChannelVideosView: View {
|
||||
.prefersDefaultFocus(in: focusNamespace)
|
||||
#endif
|
||||
}
|
||||
.environment(\.inChannelView, true)
|
||||
#if !os(iOS)
|
||||
.focusScope(focusNamespace)
|
||||
#endif
|
||||
@@ -102,9 +103,9 @@ struct ChannelVideosView: View {
|
||||
#endif
|
||||
#if os(iOS)
|
||||
.sheet(isPresented: $presentingShareSheet) {
|
||||
ShareSheet(activityItems: [
|
||||
accounts.api.shareURL(contentItem)
|
||||
])
|
||||
if let url = accounts.api.shareURL(contentItem) {
|
||||
ShareSheet(activityItems: [url])
|
||||
}
|
||||
}
|
||||
#endif
|
||||
.modifier(UnsubscribeAlertModifier())
|
||||
|
@@ -7,28 +7,34 @@ struct ShareButton: View {
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
|
||||
var body: some View {
|
||||
Button {
|
||||
#if os(iOS)
|
||||
presentingShareSheet = true
|
||||
#else
|
||||
NSPasteboard.general.clearContents()
|
||||
NSPasteboard.general.setString(shareURL, forType: .string)
|
||||
#endif
|
||||
} label: {
|
||||
#if os(iOS)
|
||||
Label("Share", systemImage: "square.and.arrow.up")
|
||||
#else
|
||||
Group {
|
||||
if let url = shareURL {
|
||||
Button {
|
||||
#if os(iOS)
|
||||
presentingShareSheet = true
|
||||
#else
|
||||
NSPasteboard.general.clearContents()
|
||||
NSPasteboard.general.setString(url, forType: .string)
|
||||
#endif
|
||||
} label: {
|
||||
#if os(iOS)
|
||||
Label("Share", systemImage: "square.and.arrow.up")
|
||||
#else
|
||||
EmptyView()
|
||||
#endif
|
||||
}
|
||||
.keyboardShortcut("c")
|
||||
.foregroundColor(.blue)
|
||||
.buttonStyle(.plain)
|
||||
.labelStyle(.iconOnly)
|
||||
} else {
|
||||
EmptyView()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
.keyboardShortcut("c")
|
||||
.foregroundColor(.blue)
|
||||
.buttonStyle(.plain)
|
||||
.labelStyle(.iconOnly)
|
||||
}
|
||||
|
||||
private var shareURL: String {
|
||||
accounts.api.shareURL(contentItem).absoluteString
|
||||
private var shareURL: String? {
|
||||
accounts.api.shareURL(contentItem)?.absoluteString
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@ struct VideoContextMenuView: View {
|
||||
@Binding var playerNavigationLinkActive: Bool
|
||||
|
||||
@Environment(\.inNavigationView) private var inNavigationView
|
||||
@Environment(\.inChannelView) private var inChannelView
|
||||
@Environment(\.navigationStyle) private var navigationStyle
|
||||
@Environment(\.currentPlaylistID) private var playlistID
|
||||
|
||||
@@ -27,11 +28,13 @@ struct VideoContextMenuView: View {
|
||||
addToQueueButton
|
||||
}
|
||||
|
||||
Section {
|
||||
openChannelButton
|
||||
if !inChannelView {
|
||||
Section {
|
||||
openChannelButton
|
||||
|
||||
if accounts.app.supportsSubscriptions {
|
||||
subscriptionButton
|
||||
if accounts.app.supportsSubscriptions {
|
||||
subscriptionButton
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +57,10 @@ struct VideoContextMenuView: View {
|
||||
Button {
|
||||
player.playNow(video)
|
||||
|
||||
guard !player.playingInPictureInPicture else {
|
||||
return
|
||||
}
|
||||
|
||||
if inNavigationView {
|
||||
playerNavigationLinkActive = true
|
||||
} else {
|
||||
@@ -72,6 +79,14 @@ struct VideoContextMenuView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var isShowingChannelButton: Bool {
|
||||
if case .channel = navigation.tabSelection {
|
||||
return false
|
||||
}
|
||||
|
||||
return !inChannelView
|
||||
}
|
||||
|
||||
private var addToQueueButton: some View {
|
||||
Button {
|
||||
player.enqueueVideo(video)
|
||||
|
Reference in New Issue
Block a user