mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Fix new offenses
This commit is contained in:
parent
2701c1ccb5
commit
db9f7e5f5d
@ -55,14 +55,14 @@ struct FavoriteItemView: View {
|
||||
resource?.loadIfNeeded()
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.onDrag {
|
||||
dragging = item
|
||||
return NSItemProvider(object: item.id as NSString)
|
||||
}
|
||||
.onDrop(
|
||||
of: [UTType.text],
|
||||
delegate: DropFavorite(item: item, favorites: $favorites, current: $dragging)
|
||||
)
|
||||
.onDrag {
|
||||
dragging = item
|
||||
return NSItemProvider(object: item.id as NSString)
|
||||
}
|
||||
.onDrop(
|
||||
of: [UTType.text],
|
||||
delegate: DropFavorite(item: item, favorites: $favorites, current: $dragging)
|
||||
)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ struct FavoritesView: View {
|
||||
.navigationTitle("Favorites")
|
||||
#endif
|
||||
#if os(macOS)
|
||||
.background()
|
||||
.frame(minWidth: 360)
|
||||
.background()
|
||||
.frame(minWidth: 360)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -53,46 +53,46 @@ struct ContentView: View {
|
||||
.environmentObject(navigation)
|
||||
}
|
||||
#if os(iOS)
|
||||
.fullScreenCover(isPresented: $player.presentingPlayer) {
|
||||
VideoPlayerView()
|
||||
.environmentObject(accounts)
|
||||
.environmentObject(instances)
|
||||
.environmentObject(navigation)
|
||||
.environmentObject(player)
|
||||
.environmentObject(playlists)
|
||||
.environmentObject(subscriptions)
|
||||
.environmentObject(thumbnailsModel)
|
||||
}
|
||||
.fullScreenCover(isPresented: $player.presentingPlayer) {
|
||||
VideoPlayerView()
|
||||
.environmentObject(accounts)
|
||||
.environmentObject(instances)
|
||||
.environmentObject(navigation)
|
||||
.environmentObject(player)
|
||||
.environmentObject(playlists)
|
||||
.environmentObject(subscriptions)
|
||||
.environmentObject(thumbnailsModel)
|
||||
}
|
||||
#elseif os(macOS)
|
||||
.sheet(isPresented: $player.presentingPlayer) {
|
||||
VideoPlayerView()
|
||||
.frame(minWidth: 900, minHeight: 800)
|
||||
.environmentObject(accounts)
|
||||
.environmentObject(instances)
|
||||
.environmentObject(navigation)
|
||||
.environmentObject(player)
|
||||
.environmentObject(playlists)
|
||||
.environmentObject(subscriptions)
|
||||
.environmentObject(thumbnailsModel)
|
||||
}
|
||||
.sheet(isPresented: $player.presentingPlayer) {
|
||||
VideoPlayerView()
|
||||
.frame(minWidth: 900, minHeight: 800)
|
||||
.environmentObject(accounts)
|
||||
.environmentObject(instances)
|
||||
.environmentObject(navigation)
|
||||
.environmentObject(player)
|
||||
.environmentObject(playlists)
|
||||
.environmentObject(subscriptions)
|
||||
.environmentObject(thumbnailsModel)
|
||||
}
|
||||
#endif
|
||||
#if !os(tvOS)
|
||||
.handlesExternalEvents(preferring: Set(["*"]), allowing: Set(["*"]))
|
||||
.onOpenURL(perform: handleOpenedURL)
|
||||
.sheet(isPresented: $navigation.presentingAddToPlaylist) {
|
||||
AddToPlaylistView(video: navigation.videoToAddToPlaylist)
|
||||
.environmentObject(playlists)
|
||||
}
|
||||
.sheet(isPresented: $navigation.presentingPlaylistForm) {
|
||||
PlaylistFormView(playlist: $navigation.editedPlaylist)
|
||||
.environmentObject(accounts)
|
||||
.environmentObject(playlists)
|
||||
}
|
||||
.sheet(isPresented: $navigation.presentingSettings, onDismiss: openWelcomeScreenIfAccountEmpty) {
|
||||
SettingsView()
|
||||
.environmentObject(accounts)
|
||||
.environmentObject(instances)
|
||||
}
|
||||
.handlesExternalEvents(preferring: Set(["*"]), allowing: Set(["*"]))
|
||||
.onOpenURL(perform: handleOpenedURL)
|
||||
.sheet(isPresented: $navigation.presentingAddToPlaylist) {
|
||||
AddToPlaylistView(video: navigation.videoToAddToPlaylist)
|
||||
.environmentObject(playlists)
|
||||
}
|
||||
.sheet(isPresented: $navigation.presentingPlaylistForm) {
|
||||
PlaylistFormView(playlist: $navigation.editedPlaylist)
|
||||
.environmentObject(accounts)
|
||||
.environmentObject(playlists)
|
||||
}
|
||||
.sheet(isPresented: $navigation.presentingSettings, onDismiss: openWelcomeScreenIfAccountEmpty) {
|
||||
SettingsView()
|
||||
.environmentObject(accounts)
|
||||
.environmentObject(instances)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -22,17 +22,17 @@ struct PlayerQueueView: View {
|
||||
}
|
||||
}
|
||||
#if !os(iOS)
|
||||
.padding(.vertical, 5)
|
||||
.listRowInsets(EdgeInsets())
|
||||
.padding(.vertical, 5)
|
||||
.listRowInsets(EdgeInsets())
|
||||
#endif
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
.listStyle(.inset)
|
||||
.listStyle(.inset)
|
||||
#elseif os(iOS)
|
||||
.listStyle(.grouped)
|
||||
.listStyle(.grouped)
|
||||
#else
|
||||
.listStyle(.plain)
|
||||
.listStyle(.plain)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,11 @@ struct RelatedView: View {
|
||||
}
|
||||
}
|
||||
#if os(macOS)
|
||||
.listStyle(.inset)
|
||||
.listStyle(.inset)
|
||||
#elseif os(iOS)
|
||||
.listStyle(.grouped)
|
||||
.listStyle(.grouped)
|
||||
#else
|
||||
.listStyle(.plain)
|
||||
.listStyle(.plain)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ struct VideoDetails: View {
|
||||
toggleFullScreenDetailsButton
|
||||
}
|
||||
#if os(macOS)
|
||||
.padding(.top, 10)
|
||||
.padding(.top, 10)
|
||||
#endif
|
||||
|
||||
if !video.isNil {
|
||||
@ -188,7 +188,7 @@ struct VideoDetails: View {
|
||||
confirmationShown = true
|
||||
}
|
||||
#if os(iOS)
|
||||
.tint(.gray)
|
||||
.tint(.gray)
|
||||
#endif
|
||||
.confirmationDialog("Are you you want to unsubscribe from \(video!.channel.name)?", isPresented: $confirmationShown) {
|
||||
Button("Unsubscribe") {
|
||||
@ -309,9 +309,9 @@ struct VideoDetails: View {
|
||||
}
|
||||
}
|
||||
#if os(iOS)
|
||||
.sheet(isPresented: $presentingShareSheet) {
|
||||
ShareSheet(activityItems: [shareURL])
|
||||
}
|
||||
.sheet(isPresented: $presentingShareSheet) {
|
||||
ShareSheet(activityItems: [shareURL])
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ struct VideoDetailsPaddingModifier: ViewModifier {
|
||||
#if os(macOS)
|
||||
30
|
||||
#else
|
||||
35
|
||||
40
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ struct VideoPlayerSizeModifier: ViewModifier {
|
||||
#if os(iOS)
|
||||
verticalSizeClass == .regular ? .fit : .fill
|
||||
#else
|
||||
.fit
|
||||
.fit
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import Siesta
|
||||
import SwiftUI
|
||||
|
||||
struct VideoPlayerView: View {
|
||||
static let defaultAspectRatio: Double = 1.77777778
|
||||
static let defaultAspectRatio = 16 / 9.0
|
||||
static var defaultMinimumHeightLeft: Double {
|
||||
#if os(macOS)
|
||||
300
|
||||
@ -76,14 +76,14 @@ struct VideoPlayerView: View {
|
||||
}
|
||||
}
|
||||
#if os(iOS)
|
||||
.onSwipeGesture(
|
||||
up: {
|
||||
withAnimation {
|
||||
fullScreen = true
|
||||
}
|
||||
},
|
||||
down: { dismiss() }
|
||||
)
|
||||
.onSwipeGesture(
|
||||
up: {
|
||||
withAnimation {
|
||||
fullScreen = true
|
||||
}
|
||||
},
|
||||
down: { dismiss() }
|
||||
)
|
||||
#endif
|
||||
|
||||
.background(.black)
|
||||
@ -104,7 +104,7 @@ struct VideoPlayerView: View {
|
||||
#endif
|
||||
}
|
||||
#if os(macOS)
|
||||
.frame(minWidth: 650)
|
||||
.frame(minWidth: 650)
|
||||
#endif
|
||||
#if os(iOS)
|
||||
if sidebarQueue {
|
||||
|
@ -33,13 +33,13 @@ struct AddToPlaylistView: View {
|
||||
}
|
||||
}
|
||||
#if os(macOS)
|
||||
.frame(width: 500, height: 270)
|
||||
.padding(.vertical)
|
||||
.frame(width: 500, height: 270)
|
||||
.padding(.vertical)
|
||||
#elseif os(tvOS)
|
||||
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
|
||||
.background(.thickMaterial)
|
||||
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
|
||||
.background(.thickMaterial)
|
||||
#else
|
||||
.padding(.vertical)
|
||||
.padding(.vertical)
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ struct AddToPlaylistView: View {
|
||||
#if os(tvOS)
|
||||
600
|
||||
#else
|
||||
.infinity
|
||||
.infinity
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ struct PlaylistFormView: View {
|
||||
.pickerStyle(.segmented)
|
||||
}
|
||||
#if os(macOS)
|
||||
.padding(.horizontal)
|
||||
.padding(.horizontal)
|
||||
#endif
|
||||
|
||||
HStack {
|
||||
@ -225,7 +225,7 @@ struct PlaylistFormView: View {
|
||||
)
|
||||
}
|
||||
#if os(macOS)
|
||||
.foregroundColor(.red)
|
||||
.foregroundColor(.red)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -49,73 +49,73 @@ struct PlaylistsView: View {
|
||||
}
|
||||
}
|
||||
#if os(tvOS)
|
||||
.fullScreenCover(isPresented: $showingNewPlaylist, onDismiss: selectCreatedPlaylist) {
|
||||
PlaylistFormView(playlist: $createdPlaylist)
|
||||
.environmentObject(accounts)
|
||||
}
|
||||
.fullScreenCover(isPresented: $showingEditPlaylist, onDismiss: selectEditedPlaylist) {
|
||||
PlaylistFormView(playlist: $editedPlaylist)
|
||||
.environmentObject(accounts)
|
||||
}
|
||||
.fullScreenCover(isPresented: $showingNewPlaylist, onDismiss: selectCreatedPlaylist) {
|
||||
PlaylistFormView(playlist: $createdPlaylist)
|
||||
.environmentObject(accounts)
|
||||
}
|
||||
.fullScreenCover(isPresented: $showingEditPlaylist, onDismiss: selectEditedPlaylist) {
|
||||
PlaylistFormView(playlist: $editedPlaylist)
|
||||
.environmentObject(accounts)
|
||||
}
|
||||
#else
|
||||
.sheet(isPresented: $showingNewPlaylist, onDismiss: selectCreatedPlaylist) {
|
||||
PlaylistFormView(playlist: $createdPlaylist)
|
||||
.environmentObject(accounts)
|
||||
}
|
||||
.sheet(isPresented: $showingEditPlaylist, onDismiss: selectEditedPlaylist) {
|
||||
PlaylistFormView(playlist: $editedPlaylist)
|
||||
.environmentObject(accounts)
|
||||
}
|
||||
#endif
|
||||
.toolbar {
|
||||
ToolbarItemGroup {
|
||||
#if !os(iOS)
|
||||
if !model.isEmpty {
|
||||
selectPlaylistButton
|
||||
.prefersDefaultFocus(in: focusNamespace)
|
||||
}
|
||||
|
||||
if currentPlaylist != nil {
|
||||
editPlaylistButton
|
||||
}
|
||||
#endif
|
||||
FavoriteButton(item: FavoriteItem(section: .playlist(selectedPlaylistID)))
|
||||
|
||||
newPlaylistButton
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
ToolbarItemGroup(placement: .bottomBar) {
|
||||
Group {
|
||||
if model.isEmpty {
|
||||
Text("No Playlists")
|
||||
.foregroundColor(.secondary)
|
||||
} else {
|
||||
Text("Current Playlist")
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
selectPlaylistButton
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
if currentPlaylist != nil {
|
||||
editPlaylistButton
|
||||
}
|
||||
}
|
||||
.transaction { t in t.animation = .none }
|
||||
.sheet(isPresented: $showingNewPlaylist, onDismiss: selectCreatedPlaylist) {
|
||||
PlaylistFormView(playlist: $createdPlaylist)
|
||||
.environmentObject(accounts)
|
||||
}
|
||||
.sheet(isPresented: $showingEditPlaylist, onDismiss: selectEditedPlaylist) {
|
||||
PlaylistFormView(playlist: $editedPlaylist)
|
||||
.environmentObject(accounts)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if os(tvOS)
|
||||
.focusScope(focusNamespace)
|
||||
#endif
|
||||
.onAppear {
|
||||
model.load()
|
||||
}
|
||||
.onChange(of: accounts.current) { _ in
|
||||
model.load(force: true)
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItemGroup {
|
||||
#if !os(iOS)
|
||||
if !model.isEmpty {
|
||||
selectPlaylistButton
|
||||
.prefersDefaultFocus(in: focusNamespace)
|
||||
}
|
||||
|
||||
if currentPlaylist != nil {
|
||||
editPlaylistButton
|
||||
}
|
||||
#endif
|
||||
FavoriteButton(item: FavoriteItem(section: .playlist(selectedPlaylistID)))
|
||||
|
||||
newPlaylistButton
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
ToolbarItemGroup(placement: .bottomBar) {
|
||||
Group {
|
||||
if model.isEmpty {
|
||||
Text("No Playlists")
|
||||
.foregroundColor(.secondary)
|
||||
} else {
|
||||
Text("Current Playlist")
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
selectPlaylistButton
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
if currentPlaylist != nil {
|
||||
editPlaylistButton
|
||||
}
|
||||
}
|
||||
.transaction { t in t.animation = .none }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if os(tvOS)
|
||||
.focusScope(focusNamespace)
|
||||
#endif
|
||||
.onAppear {
|
||||
model.load()
|
||||
}
|
||||
.onChange(of: accounts.current) { _ in
|
||||
model.load(force: true)
|
||||
}
|
||||
}
|
||||
|
||||
#if os(tvOS)
|
||||
|
@ -29,12 +29,12 @@ struct AccountForm: View {
|
||||
.frame(maxWidth: 1000)
|
||||
}
|
||||
#if os(iOS)
|
||||
.padding(.vertical)
|
||||
.padding(.vertical)
|
||||
#elseif os(tvOS)
|
||||
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
|
||||
.background(.thickMaterial)
|
||||
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
|
||||
.background(.thickMaterial)
|
||||
#else
|
||||
.frame(width: 400, height: 145)
|
||||
.frame(width: 400, height: 145)
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ struct AccountForm: View {
|
||||
dismiss()
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.keyboardShortcut(.cancelAction)
|
||||
.keyboardShortcut(.cancelAction)
|
||||
#endif
|
||||
}
|
||||
.padding(.horizontal)
|
||||
@ -61,7 +61,7 @@ struct AccountForm: View {
|
||||
Form {
|
||||
formFields
|
||||
#if os(macOS)
|
||||
.padding(.horizontal)
|
||||
.padding(.horizontal)
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
@ -97,7 +97,7 @@ struct AccountForm: View {
|
||||
#if os(tvOS)
|
||||
.padding(.top, 30)
|
||||
#endif
|
||||
.padding(.horizontal)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
private func initializeForm() {
|
||||
|
@ -46,7 +46,7 @@ struct AccountsSettings: View {
|
||||
}
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(maxWidth: 1000)
|
||||
.frame(maxWidth: 1000)
|
||||
#endif
|
||||
|
||||
.navigationTitle(instance.description)
|
||||
@ -78,7 +78,7 @@ struct AccountsSettings: View {
|
||||
AccountForm(instance: instance)
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.listStyle(.insetGrouped)
|
||||
.listStyle(.insetGrouped)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ struct InstanceForm: View {
|
||||
dismiss()
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.keyboardShortcut(.cancelAction)
|
||||
.keyboardShortcut(.cancelAction)
|
||||
#endif
|
||||
}
|
||||
.padding(.horizontal)
|
||||
@ -63,7 +63,7 @@ struct InstanceForm: View {
|
||||
Form {
|
||||
formFields
|
||||
#if os(macOS)
|
||||
.padding(.horizontal)
|
||||
.padding(.horizontal)
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
@ -105,7 +105,7 @@ struct InstanceForm: View {
|
||||
#endif
|
||||
}
|
||||
#if os(tvOS)
|
||||
.padding(.top, 30)
|
||||
.padding(.top, 30)
|
||||
#endif
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
@ -22,21 +22,21 @@ struct InstancesSettings: View {
|
||||
}
|
||||
}
|
||||
#if os(iOS)
|
||||
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
|
||||
removeInstanceButton(instance)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
|
||||
removeInstanceButton(instance)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
#else
|
||||
.contextMenu {
|
||||
removeInstanceButton(instance)
|
||||
}
|
||||
.contextMenu {
|
||||
removeInstanceButton(instance)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
addInstanceButton
|
||||
}
|
||||
#if os(iOS)
|
||||
.listStyle(.insetGrouped)
|
||||
.listStyle(.insetGrouped)
|
||||
#endif
|
||||
}
|
||||
.sheet(isPresented: $presentingInstanceForm) {
|
||||
|
@ -87,7 +87,7 @@ struct ServicesSettings: View {
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.buttonStyle(.plain)
|
||||
.buttonStyle(.plain)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ struct SettingsView: View {
|
||||
#endif
|
||||
}
|
||||
#if os(tvOS)
|
||||
.background(.black)
|
||||
.background(.black)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ struct TrendingCountry: View {
|
||||
.searchable(text: $query, placement: searchPlacement, prompt: Text(TrendingCountry.prompt))
|
||||
#endif
|
||||
#if os(tvOS)
|
||||
.background(.thinMaterial)
|
||||
.background(.thinMaterial)
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -72,8 +72,8 @@ struct TrendingCountry: View {
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
.listStyle(.inset(alternatesRowBackgrounds: true))
|
||||
.padding(.bottom, 5)
|
||||
.listStyle(.inset(alternatesRowBackgrounds: true))
|
||||
.padding(.bottom, 5)
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -49,79 +49,79 @@ struct TrendingView: View {
|
||||
}
|
||||
}
|
||||
#if os(tvOS)
|
||||
.fullScreenCover(isPresented: $presentingCountrySelection) {
|
||||
TrendingCountry(selectedCountry: $country)
|
||||
}
|
||||
.fullScreenCover(isPresented: $presentingCountrySelection) {
|
||||
TrendingCountry(selectedCountry: $country)
|
||||
}
|
||||
#else
|
||||
.sheet(isPresented: $presentingCountrySelection) {
|
||||
TrendingCountry(selectedCountry: $country)
|
||||
#if os(macOS)
|
||||
.frame(minWidth: 400, minHeight: 400)
|
||||
#endif
|
||||
}
|
||||
.navigationTitle("Trending")
|
||||
#endif
|
||||
.toolbar {
|
||||
#if os(macOS)
|
||||
ToolbarItemGroup {
|
||||
if let favoriteItem = favoriteItem {
|
||||
FavoriteButton(item: favoriteItem)
|
||||
.id(favoriteItem.id)
|
||||
}
|
||||
|
||||
if accounts.app.supportsTrendingCategories {
|
||||
categoryButton
|
||||
}
|
||||
countryButton
|
||||
.sheet(isPresented: $presentingCountrySelection) {
|
||||
TrendingCountry(selectedCountry: $country)
|
||||
#if os(macOS)
|
||||
.frame(minWidth: 400, minHeight: 400)
|
||||
#endif
|
||||
}
|
||||
#elseif os(iOS)
|
||||
ToolbarItemGroup(placement: .bottomBar) {
|
||||
Group {
|
||||
HStack {
|
||||
if accounts.app.supportsTrendingCategories {
|
||||
Text("Category")
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
categoryButton
|
||||
// only way to disable Menu animation is to
|
||||
// force redraw of the view when it changes
|
||||
.id(UUID())
|
||||
.navigationTitle("Trending")
|
||||
#endif
|
||||
.toolbar {
|
||||
#if os(macOS)
|
||||
ToolbarItemGroup {
|
||||
if let favoriteItem = favoriteItem {
|
||||
FavoriteButton(item: favoriteItem)
|
||||
.id(favoriteItem.id)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
if let favoriteItem = favoriteItem {
|
||||
FavoriteButton(item: favoriteItem)
|
||||
.id(favoriteItem.id)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("Country")
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
if accounts.app.supportsTrendingCategories {
|
||||
categoryButton
|
||||
}
|
||||
countryButton
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
.onChange(of: resource) { _ in
|
||||
resource.load()
|
||||
updateFavoriteItem()
|
||||
}
|
||||
.onAppear {
|
||||
if videos.isEmpty {
|
||||
resource.addObserver(store)
|
||||
resource.loadIfNeeded()
|
||||
} else {
|
||||
store.replace(videos)
|
||||
}
|
||||
#elseif os(iOS)
|
||||
ToolbarItemGroup(placement: .bottomBar) {
|
||||
Group {
|
||||
HStack {
|
||||
if accounts.app.supportsTrendingCategories {
|
||||
Text("Category")
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
updateFavoriteItem()
|
||||
}
|
||||
categoryButton
|
||||
// only way to disable Menu animation is to
|
||||
// force redraw of the view when it changes
|
||||
.id(UUID())
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
if let favoriteItem = favoriteItem {
|
||||
FavoriteButton(item: favoriteItem)
|
||||
.id(favoriteItem.id)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("Country")
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
countryButton
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
.onChange(of: resource) { _ in
|
||||
resource.load()
|
||||
updateFavoriteItem()
|
||||
}
|
||||
.onAppear {
|
||||
if videos.isEmpty {
|
||||
resource.addObserver(store)
|
||||
resource.loadIfNeeded()
|
||||
} else {
|
||||
store.replace(videos)
|
||||
}
|
||||
|
||||
updateFavoriteItem()
|
||||
}
|
||||
}
|
||||
|
||||
private var toolbar: some View {
|
||||
|
@ -22,11 +22,11 @@ struct HorizontalCells: View {
|
||||
}
|
||||
}
|
||||
#if os(tvOS)
|
||||
.padding(.horizontal, 40)
|
||||
.padding(.vertical, 30)
|
||||
.padding(.horizontal, 40)
|
||||
.padding(.vertical, 30)
|
||||
#else
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.vertical, 10)
|
||||
#endif
|
||||
}
|
||||
.frame(height: cellHeight)
|
||||
|
@ -58,7 +58,7 @@ struct VideoBanner: View {
|
||||
#if os(macOS)
|
||||
playbackTime.isNil ? .center : .top
|
||||
#else
|
||||
.center
|
||||
.center
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ struct VideoCell: View {
|
||||
#endif
|
||||
}
|
||||
#if os(macOS)
|
||||
.background()
|
||||
.background()
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -171,11 +171,11 @@ struct VideoCell: View {
|
||||
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: channelOnThumbnail ? 80 : 120, alignment: .top)
|
||||
.frame(minHeight: channelOnThumbnail ? 80 : 120, alignment: .top)
|
||||
#elseif os(macOS)
|
||||
.frame(minHeight: 35, alignment: .top)
|
||||
.frame(minHeight: 35, alignment: .top)
|
||||
#else
|
||||
.frame(minHeight: 50, alignment: .top)
|
||||
.frame(minHeight: 50, alignment: .top)
|
||||
#endif
|
||||
.padding(.bottom, 4)
|
||||
|
||||
@ -316,9 +316,9 @@ struct VideoCell_Preview: PreviewProvider {
|
||||
VideoCell(video: Video.fixture)
|
||||
}
|
||||
#if os(macOS)
|
||||
.frame(maxWidth: 300, maxHeight: 250)
|
||||
.frame(maxWidth: 300, maxHeight: 250)
|
||||
#elseif os(iOS)
|
||||
.frame(maxWidth: 300, maxHeight: 200)
|
||||
.frame(maxWidth: 300, maxHeight: 200)
|
||||
#endif
|
||||
.injectFixtureEnvironmentObjects()
|
||||
}
|
||||
|
@ -54,33 +54,33 @@ struct ChannelPlaylistView: View {
|
||||
VerticalCells(items: items)
|
||||
}
|
||||
#if os(iOS)
|
||||
.sheet(isPresented: $presentingShareSheet) {
|
||||
if let url = accounts.api.shareURL(contentItem) {
|
||||
ShareSheet(activityItems: [url])
|
||||
}
|
||||
.sheet(isPresented: $presentingShareSheet) {
|
||||
if let url = accounts.api.shareURL(contentItem) {
|
||||
ShareSheet(activityItems: [url])
|
||||
}
|
||||
}
|
||||
#endif
|
||||
.onAppear {
|
||||
resource?.addObserver(store)
|
||||
resource?.loadIfNeeded()
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigation) {
|
||||
ShareButton(
|
||||
contentItem: contentItem,
|
||||
presentingShareSheet: $presentingShareSheet
|
||||
)
|
||||
}
|
||||
|
||||
ToolbarItem {
|
||||
FavoriteButton(item: FavoriteItem(section: .channelPlaylist(playlist.id, playlist.title)))
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigation) {
|
||||
ShareButton(
|
||||
contentItem: contentItem,
|
||||
presentingShareSheet: $presentingShareSheet
|
||||
)
|
||||
}
|
||||
.navigationTitle(playlist.title)
|
||||
|
||||
ToolbarItem {
|
||||
FavoriteButton(item: FavoriteItem(section: .channelPlaylist(playlist.id, playlist.title)))
|
||||
}
|
||||
}
|
||||
.navigationTitle(playlist.title)
|
||||
|
||||
#else
|
||||
.background(.thickMaterial)
|
||||
.background(.thickMaterial)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -75,44 +75,44 @@ struct ChannelVideosView: View {
|
||||
.focusScope(focusNamespace)
|
||||
#endif
|
||||
#if !os(tvOS)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigation) {
|
||||
ShareButton(
|
||||
contentItem: contentItem,
|
||||
presentingShareSheet: $presentingShareSheet
|
||||
)
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigation) {
|
||||
ShareButton(
|
||||
contentItem: contentItem,
|
||||
presentingShareSheet: $presentingShareSheet
|
||||
)
|
||||
}
|
||||
|
||||
ToolbarItem {
|
||||
HStack {
|
||||
Text("**\(store.item?.subscriptionsString ?? "loading")** subscribers")
|
||||
.foregroundColor(.secondary)
|
||||
.opacity(store.item?.subscriptionsString != nil ? 1 : 0)
|
||||
ToolbarItem {
|
||||
HStack {
|
||||
Text("**\(store.item?.subscriptionsString ?? "loading")** subscribers")
|
||||
.foregroundColor(.secondary)
|
||||
.opacity(store.item?.subscriptionsString != nil ? 1 : 0)
|
||||
|
||||
subscriptionToggleButton
|
||||
subscriptionToggleButton
|
||||
|
||||
FavoriteButton(item: FavoriteItem(section: .channel(channel.id, channel.name)))
|
||||
}
|
||||
FavoriteButton(item: FavoriteItem(section: .channel(channel.id, channel.name)))
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
.background(.thickMaterial)
|
||||
.background(.thickMaterial)
|
||||
#endif
|
||||
#if os(iOS)
|
||||
.sheet(isPresented: $presentingShareSheet) {
|
||||
if let url = accounts.api.shareURL(contentItem) {
|
||||
ShareSheet(activityItems: [url])
|
||||
}
|
||||
.sheet(isPresented: $presentingShareSheet) {
|
||||
if let url = accounts.api.shareURL(contentItem) {
|
||||
ShareSheet(activityItems: [url])
|
||||
}
|
||||
}
|
||||
#endif
|
||||
.modifier(UnsubscribeAlertModifier())
|
||||
.onAppear {
|
||||
if store.item.isNil {
|
||||
resource.addObserver(store)
|
||||
resource.load()
|
||||
}
|
||||
.onAppear {
|
||||
if store.item.isNil {
|
||||
resource.addObserver(store)
|
||||
resource.load()
|
||||
}
|
||||
.navigationTitle(navigationTitle)
|
||||
}
|
||||
.navigationTitle(navigationTitle)
|
||||
}
|
||||
|
||||
private var resource: Resource {
|
||||
|
@ -14,8 +14,8 @@ struct PlayerControlsView<Content: View>: View {
|
||||
ZStack(alignment: .bottomLeading) {
|
||||
content
|
||||
#if !os(tvOS)
|
||||
.frame(minHeight: 0, maxHeight: .infinity)
|
||||
.padding(.bottom, 50)
|
||||
.frame(minHeight: 0, maxHeight: .infinity)
|
||||
.padding(.bottom, 50)
|
||||
#endif
|
||||
|
||||
#if !os(tvOS)
|
||||
|
@ -142,7 +142,7 @@ struct SearchView: View {
|
||||
state.changeQuery { query in query.duration = duration }
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.navigationTitle("Search")
|
||||
.navigationTitle("Search")
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -194,13 +194,13 @@ struct SearchView: View {
|
||||
state.changeQuery { query in query.query = item.title }
|
||||
}
|
||||
#if os(iOS)
|
||||
.swipeActions(edge: .trailing) {
|
||||
deleteButton(item)
|
||||
}
|
||||
.swipeActions(edge: .trailing) {
|
||||
deleteButton(item)
|
||||
}
|
||||
#elseif os(tvOS)
|
||||
.contextMenu {
|
||||
deleteButton(item)
|
||||
}
|
||||
.contextMenu {
|
||||
deleteButton(item)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -212,7 +212,7 @@ struct SearchView: View {
|
||||
}
|
||||
}
|
||||
#if os(iOS)
|
||||
.listStyle(.insetGrouped)
|
||||
.listStyle(.insetGrouped)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ struct SignInRequiredView<Content: View>: View {
|
||||
}
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.navigationTitle(title)
|
||||
.navigationTitle(title)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -12,11 +12,11 @@ struct YatteeApp: App {
|
||||
ContentView()
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.handlesExternalEvents(matching: Set(["*"]))
|
||||
.commands {
|
||||
SidebarCommands()
|
||||
CommandGroup(replacing: .newItem, addition: {})
|
||||
}
|
||||
.handlesExternalEvents(matching: Set(["*"]))
|
||||
.commands {
|
||||
SidebarCommands()
|
||||
CommandGroup(replacing: .newItem, addition: {})
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(macOS)
|
||||
|
Loading…
Reference in New Issue
Block a user