diff --git a/Fixtures/View+Fixtures.swift b/Fixtures/View+Fixtures.swift index c82e79f5..c8aa3402 100644 --- a/Fixtures/View+Fixtures.swift +++ b/Fixtures/View+Fixtures.swift @@ -5,13 +5,22 @@ struct FixtureEnvironmentObjectsModifier: ViewModifier { func body(content: Content) -> some View { content .environmentObject(InstancesModel()) - .environmentObject(InvidiousAPI()) + .environmentObject(api) .environmentObject(NavigationModel()) .environmentObject(PlaybackModel()) .environmentObject(PlaylistsModel()) .environmentObject(RecentsModel()) .environmentObject(SearchModel()) - .environmentObject(SubscriptionsModel(api: InvidiousAPI())) + .environmentObject(SubscriptionsModel(api: api)) + } + + private var api: InvidiousAPI { + let api = InvidiousAPI() + + api.validInstance = true + api.signedIn = true + + return api } } diff --git a/Shared/Playlists/AddToPlaylistView.swift b/Shared/Playlists/AddToPlaylistView.swift index 11b40318..e54ac527 100644 --- a/Shared/Playlists/AddToPlaylistView.swift +++ b/Shared/Playlists/AddToPlaylistView.swift @@ -154,6 +154,8 @@ struct AddToPlaylistView: View { model.selectedPlaylistID = playlist.id } } + + Button("Cancel", role: .cancel) {} } } diff --git a/Shared/Playlists/PlaylistFormView.swift b/Shared/Playlists/PlaylistFormView.swift index b4262a36..ac766ef0 100644 --- a/Shared/Playlists/PlaylistFormView.swift +++ b/Shared/Playlists/PlaylistFormView.swift @@ -103,10 +103,10 @@ struct PlaylistFormView: View { Spacer() - Button("Cancel") { - dismiss() - } #if !os(tvOS) + Button("Cancel") { + dismiss() + } .keyboardShortcut(.cancelAction) #endif } @@ -206,6 +206,10 @@ struct PlaylistFormView: View { self.visibility = visibility } } + + #if os(tvOS) + Button("Cancel", role: .cancel) {} + #endif } #endif } diff --git a/Shared/Playlists/PlaylistsView.swift b/Shared/Playlists/PlaylistsView.swift index fc4ff192..ebb2821c 100644 --- a/Shared/Playlists/PlaylistsView.swift +++ b/Shared/Playlists/PlaylistsView.swift @@ -17,6 +17,8 @@ struct PlaylistsView: View { @State private var showingAddToPlaylist = false @State private var videoIDToAddToPlaylist = "" + @Namespace private var focusNamespace + var videos: [Video] { model.currentPlaylist?.videos ?? [] } @@ -63,6 +65,7 @@ struct PlaylistsView: View { #if !os(iOS) if !model.isEmpty { selectPlaylistButton + .prefersDefaultFocus(in: focusNamespace) } if model.currentPlaylist != nil { @@ -95,6 +98,7 @@ struct PlaylistsView: View { } #endif } + .focusScope(focusNamespace) .onAppear { model.load() } @@ -112,18 +116,14 @@ struct PlaylistsView: View { selectPlaylistButton } - #if os(iOS) - Spacer() - #endif - if model.currentPlaylist != nil { editPlaylistButton } - #if !os(iOS) - newPlaylistButton - .padding(.leading, 40) - #endif + Spacer() + + newPlaylistButton + .padding(.leading, 40) } } @@ -182,6 +182,8 @@ struct PlaylistsView: View { model.selectPlaylist(playlist.id) } } + + Button("Cancel", role: .cancel) {} } #else Menu(model.currentPlaylist?.title ?? "Select playlist") { diff --git a/Shared/Settings/AccountsSettingsView.swift b/Shared/Settings/AccountsSettingsView.swift index 02719b72..3782b339 100644 --- a/Shared/Settings/AccountsSettingsView.swift +++ b/Shared/Settings/AccountsSettingsView.swift @@ -48,6 +48,7 @@ struct AccountsSettingsView: View { .contextMenu { Button("Toggle Default") { toggleDefault(account) } Button("Remove", role: .destructive) { removeAccount(account) } + Button("Cancel", role: .cancel) {} } #endif } diff --git a/Shared/Trending/TrendingView.swift b/Shared/Trending/TrendingView.swift index 75c8bd86..4b374fa0 100644 --- a/Shared/Trending/TrendingView.swift +++ b/Shared/Trending/TrendingView.swift @@ -124,6 +124,8 @@ struct TrendingView: View { ForEach(TrendingCategory.allCases) { category in Button(category.name) { self.category = category } } + + Button("Cancel", role: .cancel) {} } #else diff --git a/tvOS/AccountSelectionView.swift b/tvOS/AccountSelectionView.swift index 96f61c06..ba554771 100644 --- a/tvOS/AccountSelectionView.swift +++ b/tvOS/AccountSelectionView.swift @@ -29,6 +29,8 @@ struct AccountSelectionView: View { } } } + + Button("Cancel", role: .cancel) {} } } }