mirror of
https://github.com/yattee/yattee.git
synced 2025-12-08 00:58:15 +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:
@@ -7,6 +7,7 @@ disabled_rules:
|
|||||||
- number_separator
|
- number_separator
|
||||||
- multiline_arguments
|
- multiline_arguments
|
||||||
- implicit_return
|
- implicit_return
|
||||||
|
- closure_end_indentation
|
||||||
excluded:
|
excluded:
|
||||||
- Vendor
|
- Vendor
|
||||||
- Tests Apple TV
|
- Tests Apple TV
|
||||||
|
|||||||
@@ -687,7 +687,8 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
|||||||
func extractXTags(from urlString: String) -> [String: String] {
|
func extractXTags(from urlString: String) -> [String: String] {
|
||||||
guard let urlComponents = URLComponents(string: urlString),
|
guard let urlComponents = URLComponents(string: urlString),
|
||||||
let queryItems = urlComponents.queryItems,
|
let queryItems = urlComponents.queryItems,
|
||||||
let xtagsValue = queryItems.first(where: { $0.name == "xtags" })?.value else {
|
let xtagsValue = queryItems.first(where: { $0.name == "xtags" })?.value
|
||||||
|
else {
|
||||||
return [:]
|
return [:]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -722,10 +722,10 @@ final class PipedAPI: Service, ObservableObject, VideosAPI {
|
|||||||
}
|
}
|
||||||
.sorted { track1, track2 in
|
.sorted { track1, track2 in
|
||||||
// Sort: ORIGINAL first, then DUBBED, then others
|
// Sort: ORIGINAL first, then DUBBED, then others
|
||||||
if track1.content == "ORIGINAL" && track2.content != "ORIGINAL" {
|
if track1.content == "ORIGINAL", track2.content != "ORIGINAL" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if track1.content != "ORIGINAL" && track2.content == "ORIGINAL" {
|
if track1.content != "ORIGINAL", track2.content == "ORIGINAL" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// If both are same type, sort by language
|
// If both are same type, sort by language
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ final class NavigationModel: ObservableObject {
|
|||||||
func multipleTapHandler() {
|
func multipleTapHandler() {
|
||||||
switch tabSelection {
|
switch tabSelection {
|
||||||
case .search:
|
case .search:
|
||||||
self.search.focused = true
|
search.focused = true
|
||||||
default:
|
default:
|
||||||
print("not implemented")
|
print("not implemented")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ final class NetworkStateModel: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var bufferingStateText: String? {
|
var bufferingStateText: String? {
|
||||||
guard detailsAvailable && player.hasStarted else { return nil }
|
guard detailsAvailable, player.hasStarted else { return nil }
|
||||||
return String(format: "%.0f%%", bufferingState)
|
return String(format: "%.0f%%", bufferingState)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,8 +190,8 @@ final class AVPlayerBackend: PlayerBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// After the video has ended, hitting play restarts the video from the beginning.
|
// After the video has ended, hitting play restarts the video from the beginning.
|
||||||
if currentTime?.seconds.formattedAsPlaybackTime() == model.playerTime.duration.seconds.formattedAsPlaybackTime() &&
|
if currentTime?.seconds.formattedAsPlaybackTime() == model.playerTime.duration.seconds.formattedAsPlaybackTime(),
|
||||||
currentTime!.seconds > 0 && model.playerTime.duration.seconds > 0
|
currentTime!.seconds > 0, model.playerTime.duration.seconds > 0
|
||||||
{
|
{
|
||||||
seek(to: 0, seekType: .loopRestart)
|
seek(to: 0, seekType: .loopRestart)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ final class MPVBackend: PlayerBackend {
|
|||||||
video.captions.first { $0.code.contains(captionsDefaultLanguageCode) }
|
video.captions.first { $0.code.contains(captionsDefaultLanguageCode) }
|
||||||
|
|
||||||
// If there are still no captions, try to get captions with the fallback language code
|
// If there are still no captions, try to get captions with the fallback language code
|
||||||
if captions.isNil && !captionsFallbackLanguageCode.isEmpty {
|
if captions.isNil, !captionsFallbackLanguageCode.isEmpty {
|
||||||
captions = video.captions.first { $0.code == captionsFallbackLanguageCode } ??
|
captions = video.captions.first { $0.code == captionsFallbackLanguageCode } ??
|
||||||
video.captions.first { $0.code.contains(captionsFallbackLanguageCode) }
|
video.captions.first { $0.code.contains(captionsFallbackLanguageCode) }
|
||||||
}
|
}
|
||||||
@@ -369,7 +369,7 @@ final class MPVBackend: PlayerBackend {
|
|||||||
replaceItem(self.model.preservedTime)
|
replaceItem(self.model.preservedTime)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
replaceItem(self.model.preservedTime)
|
replaceItem(model.preservedTime)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
replaceItem(nil)
|
replaceItem(nil)
|
||||||
@@ -400,8 +400,8 @@ final class MPVBackend: PlayerBackend {
|
|||||||
setRate(model.currentRate)
|
setRate(model.currentRate)
|
||||||
|
|
||||||
// After the video has ended, hitting play restarts the video from the beginning.
|
// After the video has ended, hitting play restarts the video from the beginning.
|
||||||
if let currentTime, currentTime.seconds.formattedAsPlaybackTime() == model.playerTime.duration.seconds.formattedAsPlaybackTime() &&
|
if let currentTime, currentTime.seconds.formattedAsPlaybackTime() == model.playerTime.duration.seconds.formattedAsPlaybackTime(),
|
||||||
currentTime.seconds > 0 && model.playerTime.duration.seconds > 0
|
currentTime.seconds > 0, model.playerTime.duration.seconds > 0
|
||||||
{
|
{
|
||||||
seek(to: 0, seekType: .loopRestart)
|
seek(to: 0, seekType: .loopRestart)
|
||||||
}
|
}
|
||||||
@@ -466,23 +466,23 @@ final class MPVBackend: PlayerBackend {
|
|||||||
func closeItem() {
|
func closeItem() {
|
||||||
pause()
|
pause()
|
||||||
stop()
|
stop()
|
||||||
self.video = nil
|
video = nil
|
||||||
self.stream = nil
|
stream = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func closePiP() {}
|
func closePiP() {}
|
||||||
|
|
||||||
func startControlsUpdates() {
|
func startControlsUpdates() {
|
||||||
guard model.presentingPlayer, model.controls.presentingControls, !model.controls.presentingOverlays else {
|
guard model.presentingPlayer, model.controls.presentingControls, !model.controls.presentingOverlays else {
|
||||||
self.logger.info("ignored controls update start")
|
logger.info("ignored controls update start")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.logger.info("starting controls updates")
|
logger.info("starting controls updates")
|
||||||
controlsUpdates = true
|
controlsUpdates = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func stopControlsUpdates() {
|
func stopControlsUpdates() {
|
||||||
self.logger.info("stopping controls updates")
|
logger.info("stopping controls updates")
|
||||||
controlsUpdates = false
|
controlsUpdates = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,7 +514,7 @@ final class MPVBackend: PlayerBackend {
|
|||||||
self.model.updateWatch(time: currentTime)
|
self.model.updateWatch(time: currentTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.model.updateTime(currentTime)
|
model.updateTime(currentTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func stopClientUpdates() {
|
private func stopClientUpdates() {
|
||||||
@@ -807,7 +807,7 @@ final class MPVBackend: PlayerBackend {
|
|||||||
guard let stream, let video else { return }
|
guard let stream, let video else { return }
|
||||||
|
|
||||||
// Validate the index is within bounds
|
// Validate the index is within bounds
|
||||||
guard index >= 0 && index < stream.audioTracks.count else {
|
guard index >= 0, index < stream.audioTracks.count else {
|
||||||
logger.error("Invalid audio track index: \(index), available tracks: \(stream.audioTracks.count)")
|
logger.error("Invalid audio track index: \(index), available tracks: \(stream.audioTracks.count)")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ final class PlayerModel: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Defaults[.activeBackend] = to
|
Defaults[.activeBackend] = to
|
||||||
self.activeBackend = to
|
activeBackend = to
|
||||||
|
|
||||||
let fromBackend: PlayerBackend = from == .appleAVPlayer ? avPlayerBackend : mpvBackend
|
let fromBackend: PlayerBackend = from == .appleAVPlayer ? avPlayerBackend : mpvBackend
|
||||||
let toBackend: PlayerBackend = to == .appleAVPlayer ? avPlayerBackend : mpvBackend
|
let toBackend: PlayerBackend = to == .appleAVPlayer ? avPlayerBackend : mpvBackend
|
||||||
@@ -628,13 +628,13 @@ final class PlayerModel: ObservableObject {
|
|||||||
toBackend.cancelLoads()
|
toBackend.cancelLoads()
|
||||||
fromBackend.cancelLoads()
|
fromBackend.cancelLoads()
|
||||||
|
|
||||||
if !self.backend.canPlayAtRate(currentRate) {
|
if !backend.canPlayAtRate(currentRate) {
|
||||||
currentRate = self.backend.suggestedPlaybackRates.last { $0 < currentRate } ?? 1.0
|
currentRate = backend.suggestedPlaybackRates.last { $0 < currentRate } ?? 1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
self.rateToRestore = Float(currentRate)
|
rateToRestore = Float(currentRate)
|
||||||
|
|
||||||
self.backend.didChangeTo()
|
backend.didChangeTo()
|
||||||
|
|
||||||
if wasPlaying {
|
if wasPlaying {
|
||||||
fromBackend.pause()
|
fromBackend.pause()
|
||||||
@@ -664,7 +664,7 @@ final class PlayerModel: ObservableObject {
|
|||||||
self.stream = stream
|
self.stream = stream
|
||||||
streamSelection = stream
|
streamSelection = stream
|
||||||
|
|
||||||
self.upgradeToStream(stream, force: true)
|
upgradeToStream(stream, force: true)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -1086,7 +1086,7 @@ final class PlayerModel: ObservableObject {
|
|||||||
|
|
||||||
logger.info("entering fullscreen")
|
logger.info("entering fullscreen")
|
||||||
toggleFullscreen(false, showControls: showControls)
|
toggleFullscreen(false, showControls: showControls)
|
||||||
self.playingFullScreen = true
|
playingFullScreen = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func exitFullScreen(showControls: Bool = true) {
|
func exitFullScreen(showControls: Bool = true) {
|
||||||
@@ -1094,7 +1094,7 @@ final class PlayerModel: ObservableObject {
|
|||||||
|
|
||||||
logger.info("exiting fullscreen")
|
logger.info("exiting fullscreen")
|
||||||
toggleFullscreen(true, showControls: showControls)
|
toggleFullscreen(true, showControls: showControls)
|
||||||
self.playingFullScreen = false
|
playingFullScreen = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateNowPlayingInfo() {
|
func updateNowPlayingInfo() {
|
||||||
@@ -1284,7 +1284,7 @@ final class PlayerModel: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func chapterForTime(_ time: Double) -> Int? {
|
private func chapterForTime(_ time: Double) -> Int? {
|
||||||
guard let chapters = self.videoForDisplay?.chapters else {
|
guard let chapters = videoForDisplay?.chapters else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,11 +186,7 @@ struct ChannelVideosView: View {
|
|||||||
.background(Color.background(scheme: colorScheme))
|
.background(Color.background(scheme: colorScheme))
|
||||||
.focusScope(focusNamespace)
|
.focusScope(focusNamespace)
|
||||||
#elseif os(macOS)
|
#elseif os(macOS)
|
||||||
if #available(macOS 12.0, *) {
|
|
||||||
return content.focusScope(focusNamespace)
|
return content.focusScope(focusNamespace)
|
||||||
} else {
|
|
||||||
return content
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
return content
|
return content
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ enum Constants {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static var iPadSystemControlsWidth: CGFloat {
|
static var iPadSystemControlsWidth: Double {
|
||||||
50
|
50
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ struct VideoDetailsOverlay: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
private var overlayLeadingPadding: CGFloat {
|
private var overlayLeadingPadding: Double {
|
||||||
// On iPad in non-fullscreen mode, add left padding for system controls
|
// On iPad in non-fullscreen mode, add left padding for system controls
|
||||||
if Constants.isIPad && !Constants.isWindowFullscreen {
|
if Constants.isIPad && !Constants.isWindowFullscreen {
|
||||||
return Constants.iPadSystemControlsWidth + 15
|
return Constants.iPadSystemControlsWidth + 15
|
||||||
@@ -28,7 +28,7 @@ struct VideoDetailsOverlay: View {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
private var overlayLeadingPadding: CGFloat {
|
private var overlayLeadingPadding: Double {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ final class MPVOGLView: GLKView {
|
|||||||
glGetIntegerv(UInt32(GL_FRAMEBUFFER_BINDING), &defaultFBO!)
|
glGetIntegerv(UInt32(GL_FRAMEBUFFER_BINDING), &defaultFBO!)
|
||||||
|
|
||||||
// Ensure the framebuffer is valid
|
// Ensure the framebuffer is valid
|
||||||
guard defaultFBO != nil && defaultFBO! != 0 else {
|
guard defaultFBO != nil, defaultFBO! != 0 else {
|
||||||
logger.error("Invalid framebuffer ID.")
|
logger.error("Invalid framebuffer ID.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ struct PlaybackSettings: View {
|
|||||||
.padding(.vertical, 10)
|
.padding(.vertical, 10)
|
||||||
|
|
||||||
if player.activeBackend == .mpv || !player.avPlayerUsesSystemControls {
|
if player.activeBackend == .mpv || !player.avPlayerUsesSystemControls {
|
||||||
HStack(alignment: .center) {
|
HStack {
|
||||||
controlsHeader("Rate".localized())
|
controlsHeader("Rate".localized())
|
||||||
Spacer()
|
Spacer()
|
||||||
HStack(alignment: .center, spacing: rateButtonsSpacing) {
|
HStack(spacing: rateButtonsSpacing) {
|
||||||
decreaseRateButton
|
decreaseRateButton
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.focused($focusedField, equals: .decreaseRate)
|
.focused($focusedField, equals: .decreaseRate)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import Foundation
|
|||||||
player.avPlayerBackend.playerLayer
|
player.avPlayerBackend.playerLayer
|
||||||
}
|
}
|
||||||
|
|
||||||
override init(frame frameRect: NSRect) {
|
override init(frame frameRect: CGRect) {
|
||||||
super.init(frame: frameRect)
|
super.init(frame: frameRect)
|
||||||
wantsLayer = true
|
wantsLayer = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -256,11 +256,7 @@ struct CommentView: View {
|
|||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
struct TextSelectionModifier: ViewModifier {
|
struct TextSelectionModifier: ViewModifier {
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
if #available(macOS 12.0, *) {
|
|
||||||
content.textSelection(.enabled)
|
content.textSelection(.enabled)
|
||||||
} else {
|
|
||||||
content
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ struct VideoDescription: View {
|
|||||||
|
|
||||||
@ViewBuilder var textDescription: some View {
|
@ViewBuilder var textDescription: some View {
|
||||||
#if canImport(AppKit)
|
#if canImport(AppKit)
|
||||||
if #available(macOS 12.0, *) {
|
|
||||||
DescriptionWithLinks(description: description, detailsSize: detailsSize)
|
DescriptionWithLinks(description: description, detailsSize: detailsSize)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.lineLimit(expand ? 500 : collapsedLinesDescription)
|
.lineLimit(expand ? 500 : collapsedLinesDescription)
|
||||||
@@ -67,21 +66,11 @@ struct VideoDescription: View {
|
|||||||
.font(.system(size: 14))
|
.font(.system(size: 14))
|
||||||
.lineSpacing(3)
|
.lineSpacing(3)
|
||||||
.allowsHitTesting(expand)
|
.allowsHitTesting(expand)
|
||||||
} else {
|
|
||||||
Text(description)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
.lineLimit(expand ? 500 : collapsedLinesDescription)
|
|
||||||
.multilineTextAlignment(.leading)
|
|
||||||
.font(.system(size: 14))
|
|
||||||
.lineSpacing(3)
|
|
||||||
.allowsHitTesting(expand)
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// If possibe convert URLs to clickable links
|
// If possibe convert URLs to clickable links
|
||||||
#if canImport(AppKit)
|
#if canImport(AppKit)
|
||||||
@available(macOS 12.0, *)
|
|
||||||
struct DescriptionWithLinks: View {
|
struct DescriptionWithLinks: View {
|
||||||
let description: String
|
let description: String
|
||||||
let detailsSize: CGSize?
|
let detailsSize: CGSize?
|
||||||
|
|||||||
@@ -242,11 +242,7 @@ struct QualityProfileForm: View {
|
|||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
let list = filteredFormatList
|
let list = filteredFormatList
|
||||||
|
|
||||||
if #available(macOS 12.0, *) {
|
|
||||||
list.listStyle(.inset(alternatesRowBackgrounds: true))
|
list.listStyle(.inset(alternatesRowBackgrounds: true))
|
||||||
} else {
|
|
||||||
list.listStyle(.inset)
|
|
||||||
}
|
|
||||||
Spacer()
|
Spacer()
|
||||||
#else
|
#else
|
||||||
filteredFormatList
|
filteredFormatList
|
||||||
|
|||||||
@@ -183,17 +183,10 @@ struct QualitySettings: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
if #available(macOS 12.0, *) {
|
|
||||||
List {
|
List {
|
||||||
list
|
list
|
||||||
}
|
}
|
||||||
.listStyle(.inset(alternatesRowBackgrounds: true))
|
.listStyle(.inset(alternatesRowBackgrounds: true))
|
||||||
} else {
|
|
||||||
List {
|
|
||||||
list
|
|
||||||
}
|
|
||||||
.listStyle(.inset)
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
list
|
list
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -223,7 +223,6 @@ struct FeedView: View {
|
|||||||
var header: some View {
|
var header: some View {
|
||||||
HStack(spacing: 16) {
|
HStack(spacing: 16) {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
if #available(tvOS 17.0, *) {
|
|
||||||
Menu {
|
Menu {
|
||||||
accountsPicker
|
accountsPicker
|
||||||
} label: {
|
} label: {
|
||||||
@@ -239,21 +238,6 @@ struct FeedView: View {
|
|||||||
}
|
}
|
||||||
.opacity(feedChannelsViewVisible ? 0 : 1)
|
.opacity(feedChannelsViewVisible ? 0 : 1)
|
||||||
.frame(minWidth: feedChannelsViewVisible ? 0 : nil, maxWidth: feedChannelsViewVisible ? 0 : nil)
|
.frame(minWidth: feedChannelsViewVisible ? 0 : nil, maxWidth: feedChannelsViewVisible ? 0 : nil)
|
||||||
} else {
|
|
||||||
Button {
|
|
||||||
withAnimation {
|
|
||||||
self.feedChannelsViewVisible = true
|
|
||||||
self.focusedChannel = selectedChannel?.id ?? "all"
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
Label("Channels", systemImage: "filemenu.and.selection")
|
|
||||||
.labelStyle(.iconOnly)
|
|
||||||
.imageScale(.small)
|
|
||||||
.font(.caption)
|
|
||||||
}
|
|
||||||
.opacity(feedChannelsViewVisible ? 0 : 1)
|
|
||||||
.frame(minWidth: feedChannelsViewVisible ? 0 : nil, maxWidth: feedChannelsViewVisible ? 0 : nil)
|
|
||||||
}
|
|
||||||
channelHeaderView
|
channelHeaderView
|
||||||
if selectedChannel == nil {
|
if selectedChannel == nil {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|||||||
@@ -58,11 +58,7 @@ struct TrendingCountry: View {
|
|||||||
|
|
||||||
return Group {
|
return Group {
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
if #available(macOS 12.0, *) {
|
|
||||||
list.listStyle(.inset(alternatesRowBackgrounds: true))
|
list.listStyle(.inset(alternatesRowBackgrounds: true))
|
||||||
} else {
|
|
||||||
list.listStyle(.inset)
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
list
|
list
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ struct ThumbnailView: View {
|
|||||||
|
|
||||||
init(url: URL?) {
|
init(url: URL?) {
|
||||||
self.url = url
|
self.url = url
|
||||||
self.thumbnailExtension = Self.extractExtension(from: url)
|
thumbnailExtension = Self.extractExtension(from: url)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func extractExtension(from url: URL?) -> String? {
|
private static func extractExtension(from url: URL?) -> String? {
|
||||||
|
|||||||
@@ -341,6 +341,7 @@ struct ControlsBar_Previews: PreviewProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - View Extension for Conditional Modifiers
|
// MARK: - View Extension for Conditional Modifiers
|
||||||
|
|
||||||
extension View {
|
extension View {
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
func `if`<Transform: View>(_ condition: Bool, transform: (Self) -> Transform) -> some View {
|
func `if`<Transform: View>(_ condition: Bool, transform: (Self) -> Transform) -> some View {
|
||||||
@@ -375,8 +376,7 @@ extension View {
|
|||||||
.stroke(Color("ControlsBorderColor"), lineWidth: 0.5)
|
.stroke(Color("ControlsBorderColor"), lineWidth: 0.5)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
self
|
background(
|
||||||
.background(
|
|
||||||
RoundedRectangle(cornerRadius: cornerRadius)
|
RoundedRectangle(cornerRadius: cornerRadius)
|
||||||
.fill(Color.gray.opacity(0.3))
|
.fill(Color.gray.opacity(0.3))
|
||||||
)
|
)
|
||||||
@@ -400,8 +400,7 @@ extension View {
|
|||||||
.stroke(Color("ControlsBorderColor"), lineWidth: 0.5)
|
.stroke(Color("ControlsBorderColor"), lineWidth: 0.5)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
self
|
background(
|
||||||
.background(
|
|
||||||
RoundedRectangle(cornerRadius: cornerRadius)
|
RoundedRectangle(cornerRadius: cornerRadius)
|
||||||
.fill(Color.gray.opacity(0.3))
|
.fill(Color.gray.opacity(0.3))
|
||||||
)
|
)
|
||||||
@@ -412,7 +411,7 @@ extension View {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
self.background(Color.clear)
|
background(Color.clear)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ struct SettingsPickerModifier: ViewModifier {
|
|||||||
// Extension to help remove picker row backgrounds
|
// Extension to help remove picker row backgrounds
|
||||||
extension View {
|
extension View {
|
||||||
func pickerRowStyle() -> some View {
|
func pickerRowStyle() -> some View {
|
||||||
self.buttonStyle(.plain)
|
buttonStyle(.plain)
|
||||||
.listRowBackground(Color.clear)
|
.listRowBackground(Color.clear)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,11 +71,7 @@ struct InstancesSettings: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if #available(macOS 12.0, *) {
|
|
||||||
list.listStyle(.inset(alternatesRowBackgrounds: true))
|
list.listStyle(.inset(alternatesRowBackgrounds: true))
|
||||||
} else {
|
|
||||||
list.listStyle(.inset)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if selectedInstance != nil, selectedInstance.app.hasFrontendURL {
|
if selectedInstance != nil, selectedInstance.app.hasFrontendURL {
|
||||||
|
|||||||
Reference in New Issue
Block a user