mirror of
https://github.com/yattee/yattee.git
synced 2025-10-09 17:08:15 +00:00
Fix lint issues
This commit is contained in:
@@ -338,7 +338,8 @@ struct ChannelVideosView: View {
|
||||
private var resource: Resource? {
|
||||
guard let channel = presentedChannel else { return nil }
|
||||
|
||||
let data = contentType != .videos ? channel.tabs.first(where: { $0.contentType == contentType })?.data : nil
|
||||
let tabData = channel.tabs.first { $0.contentType == contentType }?.data
|
||||
let data = contentType != .videos ? tabData : nil
|
||||
let resource = accounts.api.channel(channel.id, contentType: contentType, data: data)
|
||||
|
||||
if contentType == .videos {
|
||||
@@ -451,7 +452,8 @@ struct ChannelVideosView: View {
|
||||
next = next ?? ""
|
||||
}
|
||||
|
||||
let data = contentType != .videos ? channel.tabs.first(where: { $0.contentType == contentType })?.data : nil
|
||||
let tabData = channel.tabs.first { $0.contentType == contentType }?.data
|
||||
let data = contentType != .videos ? tabData : nil
|
||||
accounts.api.channel(channel.id, contentType: contentType, data: data, page: next).load().onSuccess { response in
|
||||
if let page: ChannelPage = response.typedContent() {
|
||||
self.page = page
|
||||
|
@@ -152,7 +152,8 @@ struct Sidebar: View {
|
||||
if case .recentlyOpened = selection {
|
||||
scrollView.scrollTo("recentlyOpened")
|
||||
return
|
||||
} else if case let .playlist(id) = selection {
|
||||
}
|
||||
if case let .playlist(id) = selection {
|
||||
scrollView.scrollTo(id)
|
||||
return
|
||||
}
|
||||
|
@@ -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()
|
||||
|
@@ -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
|
||||
|
@@ -47,7 +47,7 @@ struct TVControls: UIViewRepresentable {
|
||||
|
||||
func updateUIView(_: UIView, context _: Context) {}
|
||||
|
||||
func makeCoordinator() -> TVControls.Coordinator {
|
||||
func makeCoordinator() -> Self.Coordinator {
|
||||
Coordinator(controlsArea)
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
}
|
||||
}
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
|
@@ -47,16 +47,16 @@ struct AccountValidationStatus: View {
|
||||
var validationStatusSystemImage: String {
|
||||
if isValidating {
|
||||
return "bolt.horizontal.fill"
|
||||
} else {
|
||||
return isValid ? "checkmark.circle.fill" : "xmark.circle.fill"
|
||||
}
|
||||
|
||||
return isValid ? "checkmark.circle.fill" : "xmark.circle.fill"
|
||||
}
|
||||
|
||||
var validationStatusColor: Color {
|
||||
if isValidating {
|
||||
return .accentColor
|
||||
} else {
|
||||
return isValid ? .green : .red
|
||||
}
|
||||
|
||||
return isValid ? .green : .red
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ struct FeedView: View {
|
||||
}
|
||||
#endif
|
||||
#if !os(tvOS)
|
||||
.background(
|
||||
.background(
|
||||
Button("Refresh") {
|
||||
feed.loadResources(force: true)
|
||||
}
|
||||
@@ -42,8 +42,8 @@ struct FeedView: View {
|
||||
)
|
||||
#endif
|
||||
#if !os(macOS)
|
||||
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
|
||||
feed.loadResources()
|
||||
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
|
||||
feed.loadResources()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@@ -41,9 +41,11 @@ struct URLParser {
|
||||
|
||||
if hasAnyOfPrefixes(path, Self.prefixes[.playlist]!) || queryItemValue("v") == "playlist" {
|
||||
return .playlist
|
||||
} else if hasAnyOfPrefixes(path, Self.prefixes[.channel]!) {
|
||||
}
|
||||
if hasAnyOfPrefixes(path, Self.prefixes[.channel]!) {
|
||||
return .channel
|
||||
} else if hasAnyOfPrefixes(path, Self.prefixes[.search]!) {
|
||||
}
|
||||
if hasAnyOfPrefixes(path, Self.prefixes[.search]!) {
|
||||
return .search
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ListView: View {
|
||||
|
@@ -253,11 +253,11 @@ struct VideoBanner: View {
|
||||
private var timeLabel: String? {
|
||||
if let watch, let watchStoppedAtLabel, let videoDurationLabel, !watch.finished {
|
||||
return "\(watchStoppedAtLabel) / \(videoDurationLabel)"
|
||||
} else if let videoDurationLabel {
|
||||
return videoDurationLabel
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
if let videoDurationLabel {
|
||||
return videoDurationLabel
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ViewBuilder private var timeView: some View {
|
||||
|
@@ -3,7 +3,7 @@ import SwiftUI
|
||||
struct AccentButton: View {
|
||||
var text: String?
|
||||
var imageSystemName: String?
|
||||
var maxWidth: CGFloat? = .infinity
|
||||
var maxWidth: CGFloat? = .infinity // swiftlint:disable:this no_cgfloat
|
||||
var bold = true
|
||||
var verticalPadding = 10.0
|
||||
var horizontalPadding = 10.0
|
||||
|
@@ -98,7 +98,7 @@ struct YatteeApp: App {
|
||||
HostingWindowFinder { window in
|
||||
Windows.playerWindow = window
|
||||
|
||||
NotificationCenter.default.addObserver(
|
||||
NotificationCenter.default.addObserver( // swiftlint:disable:this discarded_notification_center_observer
|
||||
forName: NSWindow.willExitFullScreenNotification,
|
||||
object: window,
|
||||
queue: OperationQueue.main
|
||||
|
Reference in New Issue
Block a user