Fix swiftformat offenses

This commit is contained in:
Arkadiusz Fal 2024-07-06 11:48:49 +02:00
parent f88a1d17d6
commit 89dfbdb5c7
6 changed files with 78 additions and 78 deletions

View File

@ -415,6 +415,7 @@ final class PipedAPI: Service, ObservableObject, VideosAPI {
if let channel = extractChannel(from: content) { if let channel = extractChannel(from: content) {
return ContentItem(channel: channel) return ContentItem(channel: channel)
} }
default: default:
return nil return nil
} }

View File

@ -542,6 +542,7 @@ final class AVPlayerBackend: PlayerBackend {
} }
} }
} }
case .failed: case .failed:
DispatchQueue.main.async { DispatchQueue.main.async {
self.model.playerError = item.error self.model.playerError = item.error

View File

@ -469,6 +469,7 @@ struct FavoriteItemView: View {
switch item.section { switch item.section {
case .history: case .history:
return nil return nil
case .subscriptions: case .subscriptions:
if accounts.app.supportsSubscriptions { if accounts.app.supportsSubscriptions {
return accounts.api.feed(1) return accounts.api.feed(1)

View File

@ -30,7 +30,6 @@ enum PlayerControlsLayout: String, CaseIterable, Defaults.Serializable {
#else #else
return isIPad return isIPad
#endif #endif
case .large: case .large:
return true return true
case .medium: case .medium:

View File

@ -164,7 +164,6 @@ struct VideoActions: View {
} }
case .musicMode: case .musicMode:
actionButton("Music", systemImage: "music.note", active: player.musicMode, action: player.toggleMusicMode) actionButton("Music", systemImage: "music.note", active: player.musicMode, action: player.toggleMusicMode)
case .settings: case .settings:
actionButton("Settings", systemImage: "gear") { actionButton("Settings", systemImage: "gear") {
withAnimation(ControlOverlaysModel.animation) { withAnimation(ControlOverlaysModel.animation) {
@ -179,7 +178,6 @@ struct VideoActions: View {
actionButton("Hide", systemImage: "chevron.down") { actionButton("Hide", systemImage: "chevron.down") {
player.hide(animate: true) player.hide(animate: true)
} }
case .close: case .close:
actionButton("Close", systemImage: "xmark") { actionButton("Close", systemImage: "xmark") {
player.closeCurrentItem() player.closeCurrentItem()

View File

@ -31,7 +31,7 @@ struct FeedView: View {
@State private var selectedChannel: Channel? @State private var selectedChannel: Channel?
#if os(tvOS) #if os(tvOS)
@FocusState private var focusedChannel: String? @FocusState private var focusedChannel: String?
#endif #endif
@State private var feedChannelsViewVisible = false @State private var feedChannelsViewVisible = false
private var navigation = NavigationModel.shared private var navigation = NavigationModel.shared
@ -77,107 +77,107 @@ struct FeedView: View {
selectedFeedView selectedFeedView
#endif #endif
} }
#if os(tvOS) #if os(tvOS)
var accountsPicker: some View { var accountsPicker: some View {
ForEach(accountsModel.sortedAccounts.filter{ $0.anonymous == false }) { account in ForEach(accountsModel.sortedAccounts.filter { $0.anonymous == false }) { account in
Button(action: { Button(action: {
AccountsModel.shared.setCurrent(account) AccountsModel.shared.setCurrent(account)
}) { }) {
HStack { HStack {
Text("\(account.description) (\(account.instance.app.rawValue))") Text("\(account.description) (\(account.instance.app.rawValue))")
if account == accountsModel.currentAccount { if account == accountsModel.currentAccount {
Image(systemName: "checkmark") Image(systemName: "checkmark")
}
} }
} }
.buttonStyle(PlainButtonStyle())
} }
.buttonStyle(PlainButtonStyle())
} }
}
var feedChannelsView: some View {
ScrollViewReader { proxy in
VStack {
Text("Channels")
.font(.subheadline)
if #available(tvOS 17.0, *) {
List(selection: $selectedChannel) {
Button(action: {
self.selectedChannel = nil
self.feedChannelsViewVisible = false
}) {
HStack(spacing: 16) {
Image(systemName: RecentsModel.symbolSystemImage("A"))
.imageScale(.large)
.foregroundColor(.accentColor)
.frame(width: 35, height: 35)
Text("All")
Spacer()
feedCount.unwatchedText
}
}
.padding(.all)
.background(RoundedRectangle(cornerRadius: 8.0)
.fill(self.selectedChannel == nil ? Color.secondary : Color.clear))
.font(.caption)
.buttonStyle(PlainButtonStyle())
.focused(self.$focusedChannel, equals: "all")
ForEach(channels, id: \.self) { channel in var feedChannelsView: some View {
ScrollViewReader { proxy in
VStack {
Text("Channels")
.font(.subheadline)
if #available(tvOS 17.0, *) {
List(selection: $selectedChannel) {
Button(action: { Button(action: {
self.selectedChannel = channel self.selectedChannel = nil
self.feedChannelsViewVisible = false self.feedChannelsViewVisible = false
}) { }) {
HStack(spacing: 16) { HStack(spacing: 16) {
ChannelAvatarView(channel: channel, subscribedBadge: false) Image(systemName: RecentsModel.symbolSystemImage("A"))
.frame(width: 50, height: 50) .imageScale(.large)
Text(channel.name) .foregroundColor(.accentColor)
.lineLimit(1) .frame(width: 35, height: 35)
Text("All")
Spacer() Spacer()
if let unwatchedCount = feedCount.unwatchedByChannelText(channel) { feedCount.unwatchedText
unwatchedCount
}
} }
} }
.padding(.all) .padding(.all)
.background(RoundedRectangle(cornerRadius: 8.0) .background(RoundedRectangle(cornerRadius: 8.0)
.fill(self.selectedChannel == channel ? Color.secondary : Color.clear)) .fill(self.selectedChannel == nil ? Color.secondary : Color.clear))
.font(.caption) .font(.caption)
.buttonStyle(PlainButtonStyle()) .buttonStyle(PlainButtonStyle())
.focused(self.$focusedChannel, equals: channel.id) .focused(self.$focusedChannel, equals: "all")
}
} ForEach(channels, id: \.self) { channel in
.onChange(of: self.focusedChannel) { Button(action: {
if self.focusedChannel == "all" { self.selectedChannel = channel
withAnimation { self.feedChannelsViewVisible = false
self.selectedChannel = nil }) {
HStack(spacing: 16) {
ChannelAvatarView(channel: channel, subscribedBadge: false)
.frame(width: 50, height: 50)
Text(channel.name)
.lineLimit(1)
Spacer()
if let unwatchedCount = feedCount.unwatchedByChannelText(channel) {
unwatchedCount
}
}
}
.padding(.all)
.background(RoundedRectangle(cornerRadius: 8.0)
.fill(self.selectedChannel == channel ? Color.secondary : Color.clear))
.font(.caption)
.buttonStyle(PlainButtonStyle())
.focused(self.$focusedChannel, equals: channel.id)
} }
} else if self.focusedChannel == dismiss_channel_list_id { }
self.feedChannelsViewVisible = false .onChange(of: self.focusedChannel) {
} else { if self.focusedChannel == "all" {
withAnimation { withAnimation {
self.selectedChannel = channels.first { self.selectedChannel = nil
$0.id == self.focusedChannel }
} else if self.focusedChannel == dismiss_channel_list_id {
self.feedChannelsViewVisible = false
} else {
withAnimation {
self.selectedChannel = channels.first {
$0.id == self.focusedChannel
}
} }
} }
} }
} .onAppear {
.onAppear { guard let selectedChannel = self.selectedChannel else {
guard let selectedChannel = self.selectedChannel else { return
return }
proxy.scrollTo(selectedChannel, anchor: .top)
} }
proxy.scrollTo(selectedChannel, anchor: .top) .onExitCommand {
} withAnimation {
.onExitCommand { self.feedChannelsViewVisible = false
withAnimation { }
self.feedChannelsViewVisible = false
} }
} }
} }
} }
} }
}
#endif #endif
var selectedFeedView: some View { var selectedFeedView: some View {