mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Fix swiftformat offenses
This commit is contained in:
parent
e3e0c4a92f
commit
5323d53f9e
@ -21,13 +21,13 @@ struct FeedView: View {
|
|||||||
$0.channel.id == selectedChannel.id
|
$0.channel.id == selectedChannel.id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var channels: [Channel] {
|
var channels: [Channel] {
|
||||||
feed.videos.map {
|
feed.videos.map {
|
||||||
$0.channel
|
$0.channel
|
||||||
}.unique()
|
}.unique()
|
||||||
}
|
}
|
||||||
|
|
||||||
@State private var selectedChannel: Channel?
|
@State private var selectedChannel: Channel?
|
||||||
@FocusState private var focusedChannel: String?
|
@FocusState private var focusedChannel: String?
|
||||||
@State private var feedChannelsViewVisible: Bool = false
|
@State private var feedChannelsViewVisible: Bool = false
|
||||||
@ -36,45 +36,45 @@ struct FeedView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
GeometryReader { geometry in
|
GeometryReader { geometry in
|
||||||
ZStack {
|
ZStack {
|
||||||
// selected channel feed view
|
// selected channel feed view
|
||||||
HStack(spacing: 0) {
|
|
||||||
// sidebar - show channels
|
|
||||||
if feedChannelsViewVisible {
|
|
||||||
Spacer()
|
|
||||||
.frame(width: geometry.size.width * 0.3)
|
|
||||||
}
|
|
||||||
selectedFeedView
|
|
||||||
}
|
|
||||||
.disabled(feedChannelsViewVisible)
|
|
||||||
.frame(width: geometry.size.width, height: geometry.size.height)
|
|
||||||
|
|
||||||
if feedChannelsViewVisible {
|
|
||||||
HStack(spacing: 0) {
|
HStack(spacing: 0) {
|
||||||
// sidebar - show channels
|
// sidebar - show channels
|
||||||
feedChannelsView
|
if feedChannelsViewVisible {
|
||||||
.padding(.all)
|
Spacer()
|
||||||
.frame(width: geometry.size.width * 0.3)
|
.frame(width: geometry.size.width * 0.3)
|
||||||
.background()
|
}
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 16))
|
selectedFeedView
|
||||||
.contentShape(RoundedRectangle(cornerRadius: 16))
|
|
||||||
Rectangle()
|
|
||||||
.fill(.clear)
|
|
||||||
.id(dismiss_channel_list_id)
|
|
||||||
.focusable()
|
|
||||||
.focused(self.$focusedChannel, equals: dismiss_channel_list_id)
|
|
||||||
}
|
}
|
||||||
|
.disabled(feedChannelsViewVisible)
|
||||||
.frame(width: geometry.size.width, height: geometry.size.height)
|
.frame(width: geometry.size.width, height: geometry.size.height)
|
||||||
.clipped()
|
|
||||||
|
if feedChannelsViewVisible {
|
||||||
|
HStack(spacing: 0) {
|
||||||
|
// sidebar - show channels
|
||||||
|
feedChannelsView
|
||||||
|
.padding(.all)
|
||||||
|
.frame(width: geometry.size.width * 0.3)
|
||||||
|
.background()
|
||||||
|
.clipShape(RoundedRectangle(cornerRadius: 16))
|
||||||
|
.contentShape(RoundedRectangle(cornerRadius: 16))
|
||||||
|
Rectangle()
|
||||||
|
.fill(.clear)
|
||||||
|
.id(dismiss_channel_list_id)
|
||||||
|
.focusable()
|
||||||
|
.focused(self.$focusedChannel, equals: dismiss_channel_list_id)
|
||||||
|
}
|
||||||
|
.frame(width: geometry.size.width, height: geometry.size.height)
|
||||||
|
.clipped()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
selectedFeedView
|
selectedFeedView
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
var feedChannelsView: some View {
|
var feedChannelsView: some View {
|
||||||
ScrollViewReader { proxy in
|
ScrollViewReader { proxy in
|
||||||
VStack {
|
VStack {
|
||||||
@ -102,7 +102,7 @@ struct FeedView: View {
|
|||||||
.font(.caption)
|
.font(.caption)
|
||||||
.buttonStyle(PlainButtonStyle())
|
.buttonStyle(PlainButtonStyle())
|
||||||
.focused(self.$focusedChannel, equals: "all")
|
.focused(self.$focusedChannel, equals: "all")
|
||||||
|
|
||||||
ForEach(channels, id: \.self) { channel in
|
ForEach(channels, id: \.self) { channel in
|
||||||
Button(action: {
|
Button(action: {
|
||||||
self.selectedChannel = channel
|
self.selectedChannel = channel
|
||||||
@ -127,7 +127,7 @@ struct FeedView: View {
|
|||||||
.focused(self.$focusedChannel, equals: channel.id)
|
.focused(self.$focusedChannel, equals: channel.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onChange(of: self.focusedChannel, {
|
.onChange(of: self.focusedChannel) {
|
||||||
if self.focusedChannel == "all" {
|
if self.focusedChannel == "all" {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
self.selectedChannel = nil
|
self.selectedChannel = nil
|
||||||
@ -141,9 +141,9 @@ struct FeedView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
.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)
|
||||||
@ -159,7 +159,7 @@ struct FeedView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var selectedFeedView: some View {
|
var selectedFeedView: some View {
|
||||||
VerticalCells(items: videos) { if shouldDisplayHeader { header } }
|
VerticalCells(items: videos) { if shouldDisplayHeader { header } }
|
||||||
.environment(\.loadMoreContentHandler) { feed.loadNextPage() }
|
.environment(\.loadMoreContentHandler) { feed.loadNextPage() }
|
||||||
@ -208,27 +208,26 @@ struct FeedView: View {
|
|||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}
|
||||||
.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)
|
||||||
channelHeaderView
|
channelHeaderView
|
||||||
if (selectedChannel == nil) {
|
if selectedChannel == nil {
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
if feedChannelsViewVisible == false {
|
if feedChannelsViewVisible == false {
|
||||||
ListingStyleButtons(listingStyle: $subscriptionsListingStyle)
|
ListingStyleButtons(listingStyle: $subscriptionsListingStyle)
|
||||||
HideWatchedButtons()
|
HideWatchedButtons()
|
||||||
HideShortsButtons()
|
HideShortsButtons()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if feedChannelsViewVisible == false {
|
if feedChannelsViewVisible == false {
|
||||||
if showCacheStatus {
|
if showCacheStatus {
|
||||||
|
|
||||||
CacheStatusHeader(
|
CacheStatusHeader(
|
||||||
refreshTime: feed.formattedFeedTime,
|
refreshTime: feed.formattedFeedTime,
|
||||||
isLoading: feed.isLoading
|
isLoading: feed.isLoading
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
Button {
|
Button {
|
||||||
feed.loadResources(force: true)
|
feed.loadResources(force: true)
|
||||||
@ -247,44 +246,44 @@ struct FeedView: View {
|
|||||||
.padding(.trailing, 30)
|
.padding(.trailing, 30)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
var channelHeaderView: some View {
|
var channelHeaderView: some View {
|
||||||
guard let selectedChannel = self.selectedChannel else {
|
guard let selectedChannel = selectedChannel else {
|
||||||
return AnyView(
|
return AnyView(
|
||||||
Text("All Channels")
|
Text("All Channels")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.frame(alignment: .leading)
|
.frame(alignment: .leading)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.padding(0)
|
.padding(0)
|
||||||
.padding(.leading, 16)
|
.padding(.leading, 16)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnyView(
|
return AnyView(
|
||||||
HStack(spacing: 16) {
|
HStack(spacing: 16) {
|
||||||
ChannelAvatarView(channel: selectedChannel, subscribedBadge: false)
|
ChannelAvatarView(channel: selectedChannel, subscribedBadge: false)
|
||||||
.id("channel-avatar-\(selectedChannel.id)")
|
.id("channel-avatar-\(selectedChannel.id)")
|
||||||
.frame(width: 80, height: 80)
|
.frame(width: 80, height: 80)
|
||||||
Text("\(selectedChannel.name)")
|
Text("\(selectedChannel.name)")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.frame(alignment: .leading)
|
.frame(alignment: .leading)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.fixedSize(horizontal: true, vertical: false)
|
.fixedSize(horizontal: true, vertical: false)
|
||||||
Spacer()
|
Spacer()
|
||||||
if feedChannelsViewVisible == false {
|
if feedChannelsViewVisible == false {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
navigation.openChannel(selectedChannel, navigationStyle: .tab)
|
navigation.openChannel(selectedChannel, navigationStyle: .tab)
|
||||||
}) {
|
}) {
|
||||||
Text("Visit Channel")
|
Text("Visit Channel")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.frame(alignment: .leading)
|
.frame(alignment: .leading)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.fixedSize(horizontal: true, vertical: false)
|
.fixedSize(horizontal: true, vertical: false)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(0)
|
}
|
||||||
.padding(.leading, 16)
|
.padding(0)
|
||||||
|
.padding(.leading, 16)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user