mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Code style change
This commit is contained in:
parent
661de78ab3
commit
c51b9dd8e8
@ -455,7 +455,8 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
switch playerItem.status {
|
||||
case .readyToPlay:
|
||||
if self.model.activeBackend == .appleAVPlayer,
|
||||
self.isAutoplaying(playerItem) {
|
||||
self.isAutoplaying(playerItem)
|
||||
{
|
||||
self.model.updateAspectRatio()
|
||||
self.model.play()
|
||||
}
|
||||
|
@ -9,9 +9,7 @@ extension PlayerModel {
|
||||
}
|
||||
|
||||
func play(_ videos: [Video]) {
|
||||
videos.forEach { video in
|
||||
enqueueVideo(video, loadDetails: false)
|
||||
}
|
||||
videos.forEach { enqueueVideo($0, loadDetails: false) }
|
||||
|
||||
#if os(iOS)
|
||||
onPresentPlayer = { [weak self] in self?.advanceToNextItem() }
|
||||
|
@ -67,8 +67,8 @@ struct OpenURLHandler {
|
||||
default:
|
||||
navigation.presentAlert(title: "Error", message: "This URL could not be opened")
|
||||
#if os(macOS)
|
||||
guard !Windows.main.isOpen else { return }
|
||||
navigation.presentingAlertInVideoPlayer = true
|
||||
guard !Windows.main.isOpen else { return }
|
||||
navigation.presentingAlertInVideoPlayer = true
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,7 @@ struct PlayerBackendView: View {
|
||||
}
|
||||
.overlay(GeometryReader { proxy in
|
||||
Color.clear
|
||||
.onAppear {
|
||||
player.playerSize = proxy.size
|
||||
}
|
||||
.onAppear { player.playerSize = proxy.size }
|
||||
.onChange(of: proxy.size) { _ in player.playerSize = proxy.size }
|
||||
.onChange(of: player.controls.presentingOverlays) { _ in player.playerSize = proxy.size }
|
||||
.onChange(of: player.aspectRatio) { _ in player.playerSize = proxy.size }
|
||||
|
@ -210,33 +210,33 @@ struct VideoPlayerView: View {
|
||||
)
|
||||
.overlay(playerPlaceholder)
|
||||
#endif
|
||||
.frame(maxWidth: fullScreenLayout ? .infinity : nil, maxHeight: fullScreenLayout ? .infinity : nil)
|
||||
.onHover { hovering in
|
||||
hoveringPlayer = hovering
|
||||
hovering ? playerControls.show() : playerControls.hide()
|
||||
}
|
||||
.frame(maxWidth: fullScreenLayout ? .infinity : nil, maxHeight: fullScreenLayout ? .infinity : nil)
|
||||
.onHover { hovering in
|
||||
hoveringPlayer = hovering
|
||||
hovering ? playerControls.show() : playerControls.hide()
|
||||
}
|
||||
#if os(iOS)
|
||||
.gesture(playerControls.presentingOverlays ? nil : playerDragGesture)
|
||||
.onChange(of: dragGestureState) { _ in
|
||||
if !dragGestureState {
|
||||
onPlayerDragGestureEnded()
|
||||
}
|
||||
}
|
||||
#elseif os(macOS)
|
||||
.onAppear(perform: {
|
||||
NSEvent.addLocalMonitorForEvents(matching: [.mouseMoved]) {
|
||||
hoverThrottle.execute {
|
||||
if !player.currentItem.isNil, hoveringPlayer {
|
||||
playerControls.resetTimer()
|
||||
}
|
||||
.gesture(playerControls.presentingOverlays ? nil : playerDragGesture)
|
||||
.onChange(of: dragGestureState) { _ in
|
||||
if !dragGestureState {
|
||||
onPlayerDragGestureEnded()
|
||||
}
|
||||
|
||||
return $0
|
||||
}
|
||||
})
|
||||
#elseif os(macOS)
|
||||
.onAppear(perform: {
|
||||
NSEvent.addLocalMonitorForEvents(matching: [.mouseMoved]) {
|
||||
hoverThrottle.execute {
|
||||
if !player.currentItem.isNil, hoveringPlayer {
|
||||
playerControls.resetTimer()
|
||||
}
|
||||
}
|
||||
|
||||
return $0
|
||||
}
|
||||
})
|
||||
#endif
|
||||
|
||||
.background(Color.black)
|
||||
.background(Color.black)
|
||||
|
||||
#if !os(tvOS)
|
||||
if !fullScreenLayout {
|
||||
|
@ -37,10 +37,8 @@ struct VideoCell: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
Button(action: playAction) {
|
||||
content
|
||||
}
|
||||
Button(action: playAction) {
|
||||
content
|
||||
}
|
||||
.opacity(contentOpacity)
|
||||
.buttonStyle(.plain)
|
||||
|
@ -7,12 +7,12 @@ struct ContentItemView: View {
|
||||
var body: some View {
|
||||
Group {
|
||||
switch item.contentType {
|
||||
case .video:
|
||||
VideoCell(video: item.video)
|
||||
case .playlist:
|
||||
ChannelPlaylistCell(playlist: item.playlist)
|
||||
case .channel:
|
||||
ChannelCell(channel: item.channel)
|
||||
case .video:
|
||||
VideoCell(video: item.video)
|
||||
default:
|
||||
PlaceholderCell()
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ struct SafeArea {
|
||||
|
||||
static var scene: UIWindowScene? {
|
||||
UIApplication.shared.connectedScenes
|
||||
.filter { $0.activationState == .foregroundActive }
|
||||
.compactMap { $0 as? UIWindowScene }
|
||||
.first
|
||||
.filter { $0.activationState == .foregroundActive }
|
||||
.compactMap { $0 as? UIWindowScene }
|
||||
.first
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user