mirror of
https://github.com/yattee/yattee.git
synced 2025-11-15 22:48:43 +00:00
Fix SwiftLint and SwiftFormat violations
- Run SwiftFormat to fix indentation, spacing, and formatting issues - Replace CGFloat with Double and NSRect with CGRect per style guide - Remove redundant .center alignment specifications - Remove unnecessary @available checks for satisfied deployment targets - Fix closure brace indentation for consistency - Disable closure_end_indentation rule to resolve SwiftFormat conflict All linting checks now pass with zero errors and warnings.
This commit is contained in:
@@ -111,7 +111,7 @@ struct PlayerControls: View {
|
||||
}
|
||||
.offset(y: playerControlsLayout.osdVerticalOffset + 5)
|
||||
#if os(iOS)
|
||||
.padding(.horizontal, Constants.isIPad && !Constants.isWindowFullscreen ? 10 : 0)
|
||||
.padding(.horizontal, Constants.isIPad && !Constants.isWindowFullscreen ? 10 : 0)
|
||||
#endif
|
||||
|
||||
Section {
|
||||
@@ -125,7 +125,7 @@ struct PlayerControls: View {
|
||||
}
|
||||
.font(.system(size: playerControlsLayout.bigButtonFontSize))
|
||||
#if os(iOS)
|
||||
.padding(.horizontal, Constants.isIPad && !Constants.isWindowFullscreen ? 10 : 0)
|
||||
.padding(.horizontal, Constants.isIPad && !Constants.isWindowFullscreen ? 10 : 0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -178,9 +178,9 @@ struct PlayerControls: View {
|
||||
.zIndex(1)
|
||||
.padding(.top, 2)
|
||||
#if os(iOS)
|
||||
.padding(.horizontal, Constants.isIPad && !Constants.isWindowFullscreen ? 10 : 0)
|
||||
.padding(.horizontal, Constants.isIPad && !Constants.isWindowFullscreen ? 10 : 0)
|
||||
#endif
|
||||
.transition(.opacity)
|
||||
.transition(.opacity)
|
||||
|
||||
HStack(spacing: playerControlsLayout.buttonsSpacing) {
|
||||
#if os(tvOS)
|
||||
@@ -217,7 +217,7 @@ struct PlayerControls: View {
|
||||
#else
|
||||
.offset(y: -playerControlsLayout.timelineHeight - 5)
|
||||
#if os(iOS)
|
||||
.padding(.horizontal, Constants.isIPad && !Constants.isWindowFullscreen ? 10 : 0)
|
||||
.padding(.horizontal, Constants.isIPad && !Constants.isWindowFullscreen ? 10 : 0)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ struct VideoDetailsOverlay: View {
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
private var overlayLeadingPadding: CGFloat {
|
||||
private var overlayLeadingPadding: Double {
|
||||
// On iPad in non-fullscreen mode, add left padding for system controls
|
||||
if Constants.isIPad && !Constants.isWindowFullscreen {
|
||||
return Constants.iPadSystemControlsWidth + 15
|
||||
@@ -28,7 +28,7 @@ struct VideoDetailsOverlay: View {
|
||||
return 0
|
||||
}
|
||||
#else
|
||||
private var overlayLeadingPadding: CGFloat {
|
||||
private var overlayLeadingPadding: Double {
|
||||
return 0
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -140,7 +140,7 @@ final class MPVOGLView: GLKView {
|
||||
glGetIntegerv(UInt32(GL_FRAMEBUFFER_BINDING), &defaultFBO!)
|
||||
|
||||
// Ensure the framebuffer is valid
|
||||
guard defaultFBO != nil && defaultFBO! != 0 else {
|
||||
guard defaultFBO != nil, defaultFBO! != 0 else {
|
||||
logger.error("Invalid framebuffer ID.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ struct PlaybackSettings: View {
|
||||
.padding(.vertical, 10)
|
||||
|
||||
if player.activeBackend == .mpv || !player.avPlayerUsesSystemControls {
|
||||
HStack(alignment: .center) {
|
||||
HStack {
|
||||
controlsHeader("Rate".localized())
|
||||
Spacer()
|
||||
HStack(alignment: .center, spacing: rateButtonsSpacing) {
|
||||
HStack(spacing: rateButtonsSpacing) {
|
||||
decreaseRateButton
|
||||
#if os(tvOS)
|
||||
.focused($focusedField, equals: .decreaseRate)
|
||||
@@ -243,18 +243,18 @@ struct PlaybackSettings: View {
|
||||
}
|
||||
} label: {
|
||||
#if os(macOS)
|
||||
Image(systemName: "plus")
|
||||
.imageScale(.large)
|
||||
.frame(width: 16, height: 16)
|
||||
Image(systemName: "plus")
|
||||
.imageScale(.large)
|
||||
.frame(width: 16, height: 16)
|
||||
#else
|
||||
Label("Increase rate", systemImage: "plus")
|
||||
.imageScale(.large)
|
||||
.labelStyle(.iconOnly)
|
||||
.foregroundColor(.accentColor)
|
||||
.padding(12)
|
||||
.frame(width: 40, height: 40)
|
||||
.background(RoundedRectangle(cornerRadius: 4).strokeBorder(Color.accentColor, lineWidth: 1))
|
||||
.contentShape(Rectangle())
|
||||
Label("Increase rate", systemImage: "plus")
|
||||
.imageScale(.large)
|
||||
.labelStyle(.iconOnly)
|
||||
.foregroundColor(.accentColor)
|
||||
.padding(12)
|
||||
.frame(width: 40, height: 40)
|
||||
.background(RoundedRectangle(cornerRadius: 4).strokeBorder(Color.accentColor, lineWidth: 1))
|
||||
.contentShape(Rectangle())
|
||||
#endif
|
||||
}
|
||||
#if os(macOS)
|
||||
@@ -280,18 +280,18 @@ struct PlaybackSettings: View {
|
||||
}
|
||||
} label: {
|
||||
#if os(macOS)
|
||||
Image(systemName: "minus")
|
||||
.imageScale(.large)
|
||||
.frame(width: 16, height: 16)
|
||||
Image(systemName: "minus")
|
||||
.imageScale(.large)
|
||||
.frame(width: 16, height: 16)
|
||||
#else
|
||||
Label("Decrease rate", systemImage: "minus")
|
||||
.imageScale(.large)
|
||||
.labelStyle(.iconOnly)
|
||||
.foregroundColor(.accentColor)
|
||||
.padding(12)
|
||||
.frame(width: 40, height: 40)
|
||||
.background(RoundedRectangle(cornerRadius: 4).strokeBorder(Color.accentColor, lineWidth: 1))
|
||||
.contentShape(Rectangle())
|
||||
Label("Decrease rate", systemImage: "minus")
|
||||
.imageScale(.large)
|
||||
.labelStyle(.iconOnly)
|
||||
.foregroundColor(.accentColor)
|
||||
.padding(12)
|
||||
.frame(width: 40, height: 40)
|
||||
.background(RoundedRectangle(cornerRadius: 4).strokeBorder(Color.accentColor, lineWidth: 1))
|
||||
.contentShape(Rectangle())
|
||||
#endif
|
||||
}
|
||||
#if os(macOS)
|
||||
|
||||
@@ -16,7 +16,7 @@ import Foundation
|
||||
player.avPlayerBackend.playerLayer
|
||||
}
|
||||
|
||||
override init(frame frameRect: NSRect) {
|
||||
override init(frame frameRect: CGRect) {
|
||||
super.init(frame: frameRect)
|
||||
wantsLayer = true
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ struct StreamControl: View {
|
||||
ForEach(kinds, id: \.self) { key in
|
||||
ForEach(availableStreamsByKind[key] ?? []) { stream in
|
||||
Text(stream.description)
|
||||
#if os(macOS)
|
||||
#if os(macOS)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.middle)
|
||||
#endif
|
||||
#endif
|
||||
.tag(Stream?.some(stream))
|
||||
}
|
||||
|
||||
|
||||
@@ -256,11 +256,7 @@ struct CommentView: View {
|
||||
#if os(macOS)
|
||||
struct TextSelectionModifier: ViewModifier {
|
||||
func body(content: Content) -> some View {
|
||||
if #available(macOS 12.0, *) {
|
||||
content.textSelection(.enabled)
|
||||
} else {
|
||||
content
|
||||
}
|
||||
content.textSelection(.enabled)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -58,30 +58,19 @@ struct VideoDescription: View {
|
||||
|
||||
@ViewBuilder var textDescription: some View {
|
||||
#if canImport(AppKit)
|
||||
if #available(macOS 12.0, *) {
|
||||
DescriptionWithLinks(description: description, detailsSize: detailsSize)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(expand ? 500 : collapsedLinesDescription)
|
||||
.textSelection(.enabled)
|
||||
.multilineTextAlignment(.leading)
|
||||
.font(.system(size: 14))
|
||||
.lineSpacing(3)
|
||||
.allowsHitTesting(expand)
|
||||
} else {
|
||||
Text(description)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(expand ? 500 : collapsedLinesDescription)
|
||||
.multilineTextAlignment(.leading)
|
||||
.font(.system(size: 14))
|
||||
.lineSpacing(3)
|
||||
.allowsHitTesting(expand)
|
||||
}
|
||||
DescriptionWithLinks(description: description, detailsSize: detailsSize)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(expand ? 500 : collapsedLinesDescription)
|
||||
.textSelection(.enabled)
|
||||
.multilineTextAlignment(.leading)
|
||||
.font(.system(size: 14))
|
||||
.lineSpacing(3)
|
||||
.allowsHitTesting(expand)
|
||||
#endif
|
||||
}
|
||||
|
||||
// If possibe convert URLs to clickable links
|
||||
#if canImport(AppKit)
|
||||
@available(macOS 12.0, *)
|
||||
struct DescriptionWithLinks: View {
|
||||
let description: String
|
||||
let detailsSize: CGSize?
|
||||
|
||||
@@ -314,17 +314,17 @@ struct VideoPlayerView: View {
|
||||
)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
|
||||
#if os(macOS)
|
||||
// TODO: Check whether this is needed on macOS.
|
||||
.onDisappear {
|
||||
if player.presentingPlayer {
|
||||
player.setNeedsDrawing(true)
|
||||
// TODO: Check whether this is needed on macOS.
|
||||
.onDisappear {
|
||||
if player.presentingPlayer {
|
||||
player.setNeedsDrawing(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
.id(player.currentVideo?.cacheKey)
|
||||
.transition(.opacity)
|
||||
.offset(y: detailViewDragOffset)
|
||||
.gesture(detailsDragGesture)
|
||||
.id(player.currentVideo?.cacheKey)
|
||||
.transition(.opacity)
|
||||
.offset(y: detailViewDragOffset)
|
||||
.gesture(detailsDragGesture)
|
||||
} else {
|
||||
VStack {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user