mirror of
https://github.com/yattee/yattee.git
synced 2026-05-12 10:25:02 +00:00
Add tvOS setting for video click behavior
This commit is contained in:
@@ -506,6 +506,26 @@ extension SettingsManager {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// MARK: - Video Tap Action (tvOS only)
|
||||||
|
|
||||||
|
#if os(tvOS)
|
||||||
|
/// Action to perform when clicking a video cell on tvOS. Default is openInfo.
|
||||||
|
var tvOSVideoTapAction: VideoTapAction {
|
||||||
|
get {
|
||||||
|
if let cached = _tvOSVideoTapAction { return cached }
|
||||||
|
guard let rawValue = localDefaults.string(forKey: "tvOSVideoTapAction"),
|
||||||
|
let action = VideoTapAction(rawValue: rawValue) else {
|
||||||
|
return .openInfo
|
||||||
|
}
|
||||||
|
return action
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
_tvOSVideoTapAction = newValue
|
||||||
|
localDefaults.set(newValue.rawValue, forKey: "tvOSVideoTapAction")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// MARK: - Onboarding
|
// MARK: - Onboarding
|
||||||
|
|
||||||
/// Whether onboarding has been completed on this device.
|
/// Whether onboarding has been completed on this device.
|
||||||
|
|||||||
@@ -190,6 +190,11 @@ final class SettingsManager {
|
|||||||
var _textAreaTapAction: VideoTapAction?
|
var _textAreaTapAction: VideoTapAction?
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Video tap action (tvOS only)
|
||||||
|
#if os(tvOS)
|
||||||
|
var _tvOSVideoTapAction: VideoTapAction?
|
||||||
|
#endif
|
||||||
|
|
||||||
// Player Controls settings (controlsButtonSize moved to preset)
|
// Player Controls settings (controlsButtonSize moved to preset)
|
||||||
|
|
||||||
// Appearance settings
|
// Appearance settings
|
||||||
@@ -500,6 +505,9 @@ final class SettingsManager {
|
|||||||
_thumbnailTapAction = nil
|
_thumbnailTapAction = nil
|
||||||
_textAreaTapAction = nil
|
_textAreaTapAction = nil
|
||||||
#endif
|
#endif
|
||||||
|
#if os(tvOS)
|
||||||
|
_tvOSVideoTapAction = nil
|
||||||
|
#endif
|
||||||
_listStyle = nil
|
_listStyle = nil
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
_appIcon = nil
|
_appIcon = nil
|
||||||
|
|||||||
@@ -10256,6 +10256,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"settings.behavior.tvOSVideoTapAction" : {
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "On Click"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"settings.behavior.videoTap.none" : {
|
"settings.behavior.videoTap.none" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"en" : {
|
"en" : {
|
||||||
|
|||||||
@@ -58,7 +58,18 @@ struct TappableVideoModifier: ViewModifier {
|
|||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
Button {
|
Button {
|
||||||
dismissKeyboard()
|
dismissKeyboard()
|
||||||
|
#if os(tvOS)
|
||||||
|
let tapAction = appEnvironment?.settingsManager.tvOSVideoTapAction ?? .openInfo
|
||||||
|
if tapAction == .openInfo {
|
||||||
|
appEnvironment?.navigationCoordinator.navigate(
|
||||||
|
to: .video(.loaded(video), queueContext: queueContext)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
checkPasswordAndPlay()
|
checkPasswordAndPlay()
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
checkPasswordAndPlay()
|
||||||
|
#endif
|
||||||
} label: {
|
} label: {
|
||||||
content
|
content
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ struct LayoutNavigationSettingsView: View {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
HapticsSection(settings: settings)
|
HapticsSection(settings: settings)
|
||||||
#endif
|
#endif
|
||||||
#if !os(tvOS)
|
#if os(tvOS)
|
||||||
|
TVVideoActionsSection(settings: settings)
|
||||||
|
#else
|
||||||
VideoActionsSection(settings: settings)
|
VideoActionsSection(settings: settings)
|
||||||
LinkActionSection(settings: settings)
|
LinkActionSection(settings: settings)
|
||||||
ClipboardSection(settings: settings)
|
ClipboardSection(settings: settings)
|
||||||
@@ -190,6 +192,32 @@ private struct VideoActionsSection: View {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// MARK: - TV Video Actions Section
|
||||||
|
|
||||||
|
#if os(tvOS)
|
||||||
|
private struct TVVideoActionsSection: View {
|
||||||
|
@Bindable var settings: SettingsManager
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Section {
|
||||||
|
LabeledContent(String(localized: "settings.behavior.tvOSVideoTapAction")) {
|
||||||
|
Picker(
|
||||||
|
String(localized: "settings.behavior.tvOSVideoTapAction"),
|
||||||
|
selection: $settings.tvOSVideoTapAction
|
||||||
|
) {
|
||||||
|
Text(VideoTapAction.openInfo.displayName).tag(VideoTapAction.openInfo)
|
||||||
|
Text(VideoTapAction.playVideo.displayName).tag(VideoTapAction.playVideo)
|
||||||
|
}
|
||||||
|
.pickerStyle(.menu)
|
||||||
|
.labelsHidden()
|
||||||
|
}
|
||||||
|
} header: {
|
||||||
|
Text(String(localized: "settings.videoActions.header"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// MARK: - Mini Player Minimize Behavior Section (iOS 26+)
|
// MARK: - Mini Player Minimize Behavior Section (iOS 26+)
|
||||||
|
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
|
|||||||
Reference in New Issue
Block a user