mirror of
https://github.com/yattee/yattee.git
synced 2024-12-13 13:50:32 +05:30
tvOS buttons hint
This commit is contained in:
parent
dcfd24e376
commit
c5738ee14a
@ -21,6 +21,7 @@ struct ControlsOverlay: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@FocusState private var focusedField: Field?
|
@FocusState private var focusedField: Field?
|
||||||
|
@State private var presentingButtonHintAlert = false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@ -57,7 +58,13 @@ struct ControlsOverlay: View {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Section(header: controlsHeader("Stream & Player")) {
|
#if os(tvOS)
|
||||||
|
let streamAndPlayerHeaderText = "Stream"
|
||||||
|
#else
|
||||||
|
let streamAndPlayerHeaderText = "Stream & Player"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Section(header: controlsHeader(streamAndPlayerHeaderText)) {
|
||||||
qualityButton
|
qualityButton
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.focused($focusedField, equals: .stream)
|
.focused($focusedField, equals: .stream)
|
||||||
@ -96,6 +103,9 @@ struct ControlsOverlay: View {
|
|||||||
}
|
}
|
||||||
.frame(maxHeight: overlayHeight)
|
.frame(maxHeight: overlayHeight)
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
|
.alert(isPresented: $presentingButtonHintAlert) {
|
||||||
|
Alert(title: Text("Press and hold to open this menu"))
|
||||||
|
}
|
||||||
.onAppear {
|
.onAppear {
|
||||||
focusedField = .qualityProfile
|
focusedField = .qualityProfile
|
||||||
}
|
}
|
||||||
@ -255,14 +265,17 @@ struct ControlsOverlay: View {
|
|||||||
.modifier(ControlBackgroundModifier())
|
.modifier(ControlBackgroundModifier())
|
||||||
.mask(RoundedRectangle(cornerRadius: 3))
|
.mask(RoundedRectangle(cornerRadius: 3))
|
||||||
#else
|
#else
|
||||||
Button {} label: {
|
Button {
|
||||||
|
presentingButtonHintAlert = true
|
||||||
|
} label: {
|
||||||
Text(player.qualityProfileSelection?.description ?? "Auto")
|
Text(player.qualityProfileSelection?.description ?? "Auto")
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.frame(maxWidth: 320)
|
.frame(maxWidth: 320)
|
||||||
}
|
}
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
|
Button("Automatic") { player.qualityProfileSelection = nil }
|
||||||
|
|
||||||
ForEach(qualityProfiles) { qualityProfile in
|
ForEach(qualityProfiles) { qualityProfile in
|
||||||
Button("Default") { player.qualityProfileSelection = nil }
|
|
||||||
Button {
|
Button {
|
||||||
player.qualityProfileSelection = qualityProfile
|
player.qualityProfileSelection = qualityProfile
|
||||||
} label: {
|
} label: {
|
||||||
@ -306,7 +319,7 @@ struct ControlsOverlay: View {
|
|||||||
.modifier(ControlBackgroundModifier())
|
.modifier(ControlBackgroundModifier())
|
||||||
.mask(RoundedRectangle(cornerRadius: 3))
|
.mask(RoundedRectangle(cornerRadius: 3))
|
||||||
#else
|
#else
|
||||||
StreamControl()
|
StreamControl(presentingButtonHintAlert: $presentingButtonHintAlert)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +349,9 @@ struct ControlsOverlay: View {
|
|||||||
.modifier(ControlBackgroundModifier())
|
.modifier(ControlBackgroundModifier())
|
||||||
.mask(RoundedRectangle(cornerRadius: 3))
|
.mask(RoundedRectangle(cornerRadius: 3))
|
||||||
#else
|
#else
|
||||||
Button {} label: {
|
Button {
|
||||||
|
presentingButtonHintAlert = true
|
||||||
|
} label: {
|
||||||
HStack(spacing: 8) {
|
HStack(spacing: 8) {
|
||||||
Image(systemName: "text.bubble")
|
Image(systemName: "text.bubble")
|
||||||
if let captions = captionsBinding.wrappedValue {
|
if let captions = captionsBinding.wrappedValue {
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct StreamControl: View {
|
struct StreamControl: View {
|
||||||
|
@Binding var presentingButtonHintAlert: Bool
|
||||||
|
|
||||||
@EnvironmentObject<PlayerModel> private var player
|
@EnvironmentObject<PlayerModel> private var player
|
||||||
|
|
||||||
|
init(presentingButtonHintAlert: Binding<Bool> = .constant(false)) {
|
||||||
|
_presentingButtonHintAlert = presentingButtonHintAlert
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Group {
|
Group {
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
@ -47,7 +53,9 @@ struct StreamControl: View {
|
|||||||
.fixedSize(horizontal: true, vertical: true)
|
.fixedSize(horizontal: true, vertical: true)
|
||||||
.disabled(player.isLoadingAvailableStreams)
|
.disabled(player.isLoadingAvailableStreams)
|
||||||
#else
|
#else
|
||||||
Button {} label: {
|
Button {
|
||||||
|
presentingButtonHintAlert = true
|
||||||
|
} label: {
|
||||||
Text(player.streamSelection?.shortQuality ?? "loading")
|
Text(player.streamSelection?.shortQuality ?? "loading")
|
||||||
.frame(maxWidth: 320)
|
.frame(maxWidth: 320)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user