mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Minor tvOS UI improvements
This commit is contained in:
parent
282170209b
commit
1b1be1aefe
@ -5,13 +5,22 @@ struct FixtureEnvironmentObjectsModifier: ViewModifier {
|
|||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
content
|
content
|
||||||
.environmentObject(InstancesModel())
|
.environmentObject(InstancesModel())
|
||||||
.environmentObject(InvidiousAPI())
|
.environmentObject(api)
|
||||||
.environmentObject(NavigationModel())
|
.environmentObject(NavigationModel())
|
||||||
.environmentObject(PlaybackModel())
|
.environmentObject(PlaybackModel())
|
||||||
.environmentObject(PlaylistsModel())
|
.environmentObject(PlaylistsModel())
|
||||||
.environmentObject(RecentsModel())
|
.environmentObject(RecentsModel())
|
||||||
.environmentObject(SearchModel())
|
.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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +154,8 @@ struct AddToPlaylistView: View {
|
|||||||
model.selectedPlaylistID = playlist.id
|
model.selectedPlaylistID = playlist.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,10 +103,10 @@ struct PlaylistFormView: View {
|
|||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Button("Cancel") {
|
|
||||||
dismiss()
|
|
||||||
}
|
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
|
Button("Cancel") {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
.keyboardShortcut(.cancelAction)
|
.keyboardShortcut(.cancelAction)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -206,6 +206,10 @@ struct PlaylistFormView: View {
|
|||||||
self.visibility = visibility
|
self.visibility = visibility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if os(tvOS)
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ struct PlaylistsView: View {
|
|||||||
@State private var showingAddToPlaylist = false
|
@State private var showingAddToPlaylist = false
|
||||||
@State private var videoIDToAddToPlaylist = ""
|
@State private var videoIDToAddToPlaylist = ""
|
||||||
|
|
||||||
|
@Namespace private var focusNamespace
|
||||||
|
|
||||||
var videos: [Video] {
|
var videos: [Video] {
|
||||||
model.currentPlaylist?.videos ?? []
|
model.currentPlaylist?.videos ?? []
|
||||||
}
|
}
|
||||||
@ -63,6 +65,7 @@ struct PlaylistsView: View {
|
|||||||
#if !os(iOS)
|
#if !os(iOS)
|
||||||
if !model.isEmpty {
|
if !model.isEmpty {
|
||||||
selectPlaylistButton
|
selectPlaylistButton
|
||||||
|
.prefersDefaultFocus(in: focusNamespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
if model.currentPlaylist != nil {
|
if model.currentPlaylist != nil {
|
||||||
@ -95,6 +98,7 @@ struct PlaylistsView: View {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
.focusScope(focusNamespace)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
model.load()
|
model.load()
|
||||||
}
|
}
|
||||||
@ -112,18 +116,14 @@ struct PlaylistsView: View {
|
|||||||
selectPlaylistButton
|
selectPlaylistButton
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(iOS)
|
|
||||||
Spacer()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if model.currentPlaylist != nil {
|
if model.currentPlaylist != nil {
|
||||||
editPlaylistButton
|
editPlaylistButton
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !os(iOS)
|
Spacer()
|
||||||
newPlaylistButton
|
|
||||||
.padding(.leading, 40)
|
newPlaylistButton
|
||||||
#endif
|
.padding(.leading, 40)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,6 +182,8 @@ struct PlaylistsView: View {
|
|||||||
model.selectPlaylist(playlist.id)
|
model.selectPlaylist(playlist.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Menu(model.currentPlaylist?.title ?? "Select playlist") {
|
Menu(model.currentPlaylist?.title ?? "Select playlist") {
|
||||||
|
@ -48,6 +48,7 @@ struct AccountsSettingsView: View {
|
|||||||
.contextMenu {
|
.contextMenu {
|
||||||
Button("Toggle Default") { toggleDefault(account) }
|
Button("Toggle Default") { toggleDefault(account) }
|
||||||
Button("Remove", role: .destructive) { removeAccount(account) }
|
Button("Remove", role: .destructive) { removeAccount(account) }
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -124,6 +124,8 @@ struct TrendingView: View {
|
|||||||
ForEach(TrendingCategory.allCases) { category in
|
ForEach(TrendingCategory.allCases) { category in
|
||||||
Button(category.name) { self.category = category }
|
Button(category.name) { self.category = category }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -29,6 +29,8 @@ struct AccountSelectionView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user