Fix lint issues

This commit is contained in:
Arkadiusz Fal
2023-06-17 14:09:51 +02:00
parent b12933e61d
commit e827b97cd5
40 changed files with 130 additions and 101 deletions

View File

@@ -25,9 +25,8 @@ struct OpeningStream: View {
if let selection = player.streamSelection {
if selection.isLocal {
return "Opening file...".localized()
} else {
return String(format: "Opening %@ stream...".localized(), selection.shortQuality)
}
return String(format: "Opening %@ stream...".localized(), selection.shortQuality)
}
return "Loading streams...".localized()

View File

@@ -193,8 +193,11 @@ struct PlayerControls: View {
.frame(maxWidth: .infinity)
#if os(tvOS)
.onChange(of: model.presentingControls) { newValue in
if newValue { focusedField = .play }
else { focusedField = nil }
if newValue {
focusedField = .play
} else {
focusedField = nil
}
}
.onChange(of: focusedField) { _ in model.resetTimer() }
#else

View File

@@ -47,7 +47,7 @@ struct TVControls: UIViewRepresentable {
func updateUIView(_: UIView, context _: Context) {}
func makeCoordinator() -> TVControls.Coordinator {
func makeCoordinator() -> Self.Coordinator {
Coordinator(controlsArea)
}

View File

@@ -70,17 +70,15 @@ struct PlayerBackendView: View {
if UIDevice.current.userInterfaceIdiom != .pad {
return verticalSizeClass == .compact ? safeAreaModel.safeArea.top : 0
} else {
return safeAreaModel.safeArea.top.isZero ? safeAreaModel.safeArea.bottom : safeAreaModel.safeArea.top
}
return safeAreaModel.safeArea.top.isZero ? safeAreaModel.safeArea.bottom : safeAreaModel.safeArea.top
}
var controlsBottomPadding: Double {
if UIDevice.current.userInterfaceIdiom != .pad {
return player.playingFullScreen || verticalSizeClass == .compact ? safeAreaModel.safeArea.bottom : 0
} else {
return player.playingFullScreen ? safeAreaModel.safeArea.bottom : 0
}
return player.playingFullScreen ? safeAreaModel.safeArea.bottom : 0
}
#endif

View File

@@ -177,7 +177,8 @@ struct VideoDescription: View {
{
player.backend.seek(to: Double(time), seekType: .userInteracted)
return
} else if destination != nil {
}
if destination != nil {
urlToOpen = yatteeURL
}
}

View File

@@ -33,7 +33,7 @@ struct VideoPlayerSizeModifier: ViewModifier {
#endif
}
var ratio: CGFloat? {
var ratio: CGFloat? { // swiftlint:disable:this no_cgfloat
fullScreen ? detailsHiddenInFullScreen ? nil : usedAspectRatio : usedAspectRatio
}
@@ -57,9 +57,9 @@ struct VideoPlayerSizeModifier: ViewModifier {
guard !fullScreen else {
if detailsHiddenInFullScreen {
return geometry.size.height
} else {
return geometry.size.width / usedAspectRatio
}
return geometry.size.width / usedAspectRatio
}
return max(geometry.size.height - VideoPlayerView.defaultMinimumHeightLeft, 0)

View File

@@ -274,7 +274,11 @@ struct VideoPlayerView: View {
)
.onHover { hovering in
hoveringPlayer = hovering
hovering ? player.controls.show() : player.controls.hide()
if hovering {
player.controls.show()
} else {
player.controls.hide()
}
}
.gesture(player.controls.presentingOverlays ? nil : playerDragGesture)
#if os(macOS)