Add Periphery configuration, remove unused code

This commit is contained in:
Arkadiusz Fal
2021-09-29 16:29:17 +02:00
parent 1b1be1aefe
commit e270b7b213
28 changed files with 400 additions and 242 deletions

View File

@@ -90,7 +90,6 @@ struct AddToPlaylistView: View {
VStack(alignment: formAlignment) {
#if os(tvOS)
selectPlaylistButton
#else
Picker("Playlist", selection: $model.selectedPlaylistID) {
@@ -132,14 +131,6 @@ struct AddToPlaylistView: View {
.padding(.horizontal)
}
private var footerAlignment: HorizontalAlignment {
#if os(tvOS)
.trailing
#else
.leading
#endif
}
private var selectPlaylistButton: some View {
Button(model.currentPlaylist?.title ?? "Select playlist") {
guard model.currentPlaylist != nil else {

View File

@@ -42,12 +42,8 @@ struct PlaylistFormView: View {
.padding(.leading, 10)
.focused($focused)
Picker("Visibility", selection: $visibility) {
ForEach(Playlist.Visibility.allCases, id: \.self) { visibility in
Text(visibility.name)
}
}
.pickerStyle(.segmented)
visibilityFormItem
.pickerStyle(.segmented)
}
HStack {
@@ -126,7 +122,7 @@ struct PlaylistFormView: View {
Text("Visibility")
.frame(maxWidth: .infinity, alignment: .leading)
visibilityButton
visibilityFormItem
}
.padding(.top, 10)
@@ -189,7 +185,7 @@ struct PlaylistFormView: View {
editing ? api.playlist(playlist.id) : api.playlists
}
var visibilityButton: some View {
var visibilityFormItem: some View {
#if os(macOS)
Picker("Visibility", selection: $visibility) {
ForEach(Playlist.Visibility.allCases) { visibility in

View File

@@ -5,18 +5,12 @@ import SwiftUI
struct PlaylistsView: View {
@EnvironmentObject<PlaylistsModel> private var model
@EnvironmentObject<InvidiousAPI> private var api
@EnvironmentObject<NavigationModel> private var navigation
@State private var showingNewPlaylist = false
@State private var createdPlaylist: Playlist?
@State private var showingEditPlaylist = false
@State private var editedPlaylist: Playlist?
@State private var showingAddToPlaylist = false
@State private var videoIDToAddToPlaylist = ""
@Namespace private var focusNamespace
var videos: [Video] {
@@ -98,34 +92,38 @@ struct PlaylistsView: View {
}
#endif
}
.focusScope(focusNamespace)
#if os(tvOS)
.focusScope(focusNamespace)
#endif
.onAppear {
model.load()
}
}
var toolbar: some View {
HStack {
if model.isEmpty {
Text("No Playlists")
.foregroundColor(.secondary)
} else {
Text("Current Playlist")
.foregroundColor(.secondary)
#if os(tvOS)
var toolbar: some View {
HStack {
if model.isEmpty {
Text("No Playlists")
.foregroundColor(.secondary)
} else {
Text("Current Playlist")
.foregroundColor(.secondary)
selectPlaylistButton
selectPlaylistButton
}
if model.currentPlaylist != nil {
editPlaylistButton
}
Spacer()
newPlaylistButton
.padding(.leading, 40)
}
if model.currentPlaylist != nil {
editPlaylistButton
}
Spacer()
newPlaylistButton
.padding(.leading, 40)
}
}
#endif
func hintText(_ text: String) -> some View {
VStack {