mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Minor fixes
This commit is contained in:
@@ -45,13 +45,13 @@ struct ChapterView: View {
|
||||
ProgressView()
|
||||
}
|
||||
.indicator(.activity)
|
||||
#if os(tvOS)
|
||||
#if os(tvOS)
|
||||
.frame(width: thumbnailWidth, height: 140)
|
||||
.mask(RoundedRectangle(cornerRadius: 12))
|
||||
#else
|
||||
#else
|
||||
.frame(width: thumbnailWidth, height: 60)
|
||||
.mask(RoundedRectangle(cornerRadius: 6))
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -64,22 +64,18 @@ struct Seek: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(minWidth: 250, minHeight: 100)
|
||||
.padding(30)
|
||||
#endif
|
||||
.frame(maxWidth: playerControlsLayout.seekOSDWidth)
|
||||
.padding(2)
|
||||
.modifier(ControlBackgroundModifier())
|
||||
.clipShape(RoundedRectangle(cornerRadius: 3))
|
||||
.foregroundColor(.primary)
|
||||
#if os(tvOS)
|
||||
.padding(30)
|
||||
#else
|
||||
.padding(2)
|
||||
.modifier(ControlBackgroundModifier())
|
||||
.clipShape(RoundedRectangle(cornerRadius: 3))
|
||||
#endif
|
||||
|
||||
.foregroundColor(.primary)
|
||||
}
|
||||
#if os(tvOS)
|
||||
.fixedSize()
|
||||
.buttonStyle(.card)
|
||||
#else
|
||||
.buttonStyle(.plain)
|
||||
#endif
|
||||
.opacity(visible || YatteeApp.isForPreviews ? 1 : 0)
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,6 @@ struct PlayerControls: View {
|
||||
.transition(.opacity)
|
||||
.frame(maxWidth: .infinity, alignment: .topLeading)
|
||||
#if os(tvOS)
|
||||
.offset(x: 10, y: 10)
|
||||
.focused($focusedField, equals: .seekOSD)
|
||||
.onChange(of: player.seek.lastSeekTime) { _ in
|
||||
if !model.presentingControls {
|
||||
@@ -161,7 +160,6 @@ struct PlayerControls: View {
|
||||
#endif
|
||||
}
|
||||
}.opacity(model.presentingControls && !model.presentingOverlays ? 1 : 0)
|
||||
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
@@ -313,7 +311,7 @@ struct PlayerControls: View {
|
||||
}
|
||||
|
||||
private var settingsButton: some View {
|
||||
button("settings", systemImage: "gearshape", active: model.presentingControlsOverlay) {
|
||||
button("settings", systemImage: "gearshape") {
|
||||
withAnimation(Self.animation) {
|
||||
model.presentingControlsOverlay.toggle()
|
||||
}
|
||||
|
@@ -32,8 +32,11 @@ struct TVControls: UIViewRepresentable {
|
||||
|
||||
let controls = UIHostingController(rootView: PlayerControls(player: player, thumbnails: thumbnails))
|
||||
controls.view.frame = .init(
|
||||
origin: .zero,
|
||||
size: .init(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
|
||||
origin: .init(x: SafeArea.insets.left, y: SafeArea.insets.top),
|
||||
size: .init(
|
||||
width: UIScreen.main.bounds.width - SafeArea.horizontalInsets,
|
||||
height: UIScreen.main.bounds.height - SafeArea.verticalInset
|
||||
)
|
||||
)
|
||||
|
||||
controlsArea.addSubview(controls.view)
|
||||
|
@@ -461,6 +461,7 @@ struct VideoPlayerView: View {
|
||||
struct VideoPlayerView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
VideoPlayerView()
|
||||
.environmentObject(SeekModel())
|
||||
.injectFixtureEnvironmentObjects()
|
||||
}
|
||||
}
|
||||
|
25
Shared/SafeArea.swift
Normal file
25
Shared/SafeArea.swift
Normal file
@@ -0,0 +1,25 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
struct SafeArea {
|
||||
static var insets: UIEdgeInsets {
|
||||
let keyWindow = scene?.windows.first { $0.isKeyWindow }
|
||||
|
||||
return keyWindow?.safeAreaInsets ?? .init()
|
||||
}
|
||||
|
||||
static var verticalInset: Double {
|
||||
insets.top + insets.bottom
|
||||
}
|
||||
|
||||
static var horizontalInsets: Double {
|
||||
insets.left + insets.right
|
||||
}
|
||||
|
||||
static var scene: UIWindowScene? {
|
||||
UIApplication.shared.connectedScenes
|
||||
.filter { $0.activationState == .foregroundActive }
|
||||
.compactMap { $0 as? UIWindowScene }
|
||||
.first
|
||||
}
|
||||
}
|
@@ -79,13 +79,13 @@ struct VideoBanner: View {
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(width: thumbnailWidth, height: 140)
|
||||
.mask(RoundedRectangle(cornerRadius: 12))
|
||||
#else
|
||||
.frame(width: thumbnailWidth, height: 60)
|
||||
.mask(RoundedRectangle(cornerRadius: 6))
|
||||
#endif
|
||||
#if os(tvOS)
|
||||
.frame(width: thumbnailWidth, height: 140)
|
||||
.mask(RoundedRectangle(cornerRadius: 12))
|
||||
#else
|
||||
.frame(width: thumbnailWidth, height: 60)
|
||||
.mask(RoundedRectangle(cornerRadius: 6))
|
||||
#endif
|
||||
} else {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
@@ -93,13 +93,13 @@ struct VideoBanner: View {
|
||||
ProgressView()
|
||||
}
|
||||
.indicator(.activity)
|
||||
#if os(tvOS)
|
||||
#if os(tvOS)
|
||||
.frame(width: thumbnailWidth, height: 140)
|
||||
.mask(RoundedRectangle(cornerRadius: 12))
|
||||
#else
|
||||
#else
|
||||
.frame(width: thumbnailWidth, height: 60)
|
||||
.mask(RoundedRectangle(cornerRadius: 6))
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -428,9 +428,9 @@ struct VideoCell: View {
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: 320)
|
||||
#endif
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: 320)
|
||||
#endif
|
||||
} else {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
@@ -443,9 +443,9 @@ struct VideoCell: View {
|
||||
thumbnails.insertUnloadable(url)
|
||||
}
|
||||
|
||||
#if os(tvOS)
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: 320)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
||||
|
@@ -38,7 +38,7 @@ struct ChannelCell: View {
|
||||
}
|
||||
.foregroundColor(.secondary)
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: channel.thumbnailURL) { image in
|
||||
AsyncImage(url: channel.thumbnailURL) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
|
@@ -38,7 +38,7 @@ struct ChannelPlaylistCell: View {
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: playlist.thumbnailURL) { image in
|
||||
AsyncImage(url: playlist.thumbnailURL) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
|
Reference in New Issue
Block a user