Files
yattee/Yattee/Views/Video/VideoInfoPlayThumbnailTip.swift
Arkadiusz Fal 5651f8d431 Add a toolbar layout for the video info actions with a configurable primary action
Layout & Navigation gains a Video Info section on iOS/macOS: the actions
(Play, Download, Share, Add to Playlist, Bookmark) can stay as inline
button rows or move to the navigation bar, where the chosen primary
action is pinned and the rest live in an ellipsis menu. The toolbar
layout with Download pinned is the new default, since the hero thumbnail
already plays the video on tap; a one-time TipKit popover on the
thumbnail points that out. tvOS keeps the existing button layout.
2026-09-20 23:52:20 +02:00

53 lines
1.2 KiB
Swift

//
// VideoInfoPlayThumbnailTip.swift
// Yattee
//
// TipKit hint that the hero thumbnail plays the video. Shown once, only while the
// toolbar action layout is active (the inline layout has an explicit Play button).
//
#if !os(tvOS)
import SwiftUI
import TipKit
struct VideoInfoPlayThumbnailTip: Tip {
/// Mirrors `SettingsManager.videoInfoActionsLayout == .toolbar`; updated by VideoInfoView.
@Parameter
static var isToolbarLayout: Bool = false
var title: Text {
Text(String(localized: "videoInfo.playTip.title"))
}
var message: Text? {
Text(String(localized: "videoInfo.playTip.message"))
}
var image: Image? {
Image(systemName: "play.circle")
}
var rules: [Rule] {
#Rule(Self.$isToolbarLayout) { $0 == true }
}
}
/// Attaches the play-thumbnail tip to the hero thumbnail when enabled.
struct VideoInfoPlayThumbnailTipModifier: ViewModifier {
let enabled: Bool
private let tip = VideoInfoPlayThumbnailTip()
init(enabled: Bool) {
self.enabled = enabled
}
func body(content: Content) -> some View {
if enabled {
content.popoverTip(tip, arrowEdge: .top)
} else {
content
}
}
}
#endif