UI improvements

This commit is contained in:
Arkadiusz Fal
2021-11-07 17:52:42 +01:00
parent 63406a2933
commit 7d247bddb3
11 changed files with 71 additions and 45 deletions

View File

@@ -11,6 +11,24 @@
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.263",
"green" : "0.290",
"red" : "0.859"
}
},
"idiom" : "universal"
}
],
"info" : {

View File

@@ -10,24 +10,37 @@ struct FavoritesView: View {
@State private var dragging: FavoriteItem?
@State private var presentingEditFavorites = false
@State private var favoritesChanged = false
var favoritesObserver: Any?
#if !os(tvOS)
@Default(.favorites) private var favorites
#endif
var body: some View {
PlayerControlsView {
ScrollView(.vertical, showsIndicators: false) {
if !accounts.current.isNil {
ForEach(Defaults[.favorites]) { item in
FavoriteItemView(item: item, dragging: $dragging)
}
#if os(tvOS)
Button {
presentingEditFavorites = true
} label: {
Text("Edit Favorites...")
ForEach(Defaults[.favorites]) { item in
FavoriteItemView(item: item, dragging: $dragging)
}
#else
ForEach(favorites) { item in
FavoriteItemView(item: item, dragging: $dragging)
}
#endif
}
}
.redrawOn(change: presentingEditFavorites)
.onAppear {
Defaults.observe(.favorites) { _ in
favoritesChanged.toggle()
}
.tieToLifetime(of: accounts)
}
.redrawOn(change: favoritesChanged)
#if os(tvOS)
.sheet(isPresented: $presentingEditFavorites) {
EditFavorites()

View File

@@ -26,7 +26,7 @@ struct Sidebar: View {
}
.navigationTitle("Yattee")
#if os(iOS)
.navigationBarTitleDisplayMode(.inline)
.navigationBarTitleDisplayMode(.inline)
#endif
}

View File

@@ -34,6 +34,14 @@ struct PlaybackBar: View {
Image(systemName: "dot.radiowaves.left.and.right")
} else if player.isLoadingAvailableStreams || player.isLoadingStream {
Image(systemName: "bolt.horizontal.fill")
} else if !player.playerError.isNil {
Button {
player.presentingErrorDetails = true
} label: {
Image(systemName: "exclamationmark.circle.fill")
.foregroundColor(.red)
}
.buttonStyle(.plain)
}
streamControl
@@ -57,6 +65,9 @@ struct PlaybackBar: View {
Spacer()
}
}
.alert(player.playerError?.localizedDescription ?? "", isPresented: $player.presentingErrorDetails) {
Button("OK") {}
}
.environment(\.colorScheme, .dark)
.frame(minWidth: 0, maxWidth: .infinity)
.padding(4)

View File

@@ -55,6 +55,12 @@ struct SettingsView: View {
List {
#if os(tvOS)
AccountSelectionView()
Section(header: SettingsHeader(text: "Favorites")) {
NavigationLink("Edit favorites...") {
EditFavorites()
}
}
#endif
InstancesSettings()
BrowsingSettings()