mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 00:08:21 +00:00
Settings for new features
This commit is contained in:
parent
3de18da7a7
commit
2ce903b6c3
@ -31,6 +31,7 @@ struct ChannelVideosView: View {
|
|||||||
@Namespace private var focusNamespace
|
@Namespace private var focusNamespace
|
||||||
|
|
||||||
@Default(.channelPlaylistListingStyle) private var channelPlaylistListingStyle
|
@Default(.channelPlaylistListingStyle) private var channelPlaylistListingStyle
|
||||||
|
@Default(.expandChannelDescription) private var expandChannelDescription
|
||||||
|
|
||||||
var presentedChannel: Channel? {
|
var presentedChannel: Channel? {
|
||||||
store.item ?? channel ?? recents.presentedChannel
|
store.item ?? channel ?? recents.presentedChannel
|
||||||
@ -165,6 +166,8 @@ struct ChannelVideosView: View {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
.onAppear {
|
.onAppear {
|
||||||
|
descriptionExpanded = expandChannelDescription
|
||||||
|
|
||||||
if let channel,
|
if let channel,
|
||||||
let cache = ChannelsCacheModel.shared.retrieve(channel.cacheKey),
|
let cache = ChannelsCacheModel.shared.retrieve(channel.cacheKey),
|
||||||
store.item.isNil
|
store.item.isNil
|
||||||
|
@ -23,6 +23,7 @@ extension Defaults.Keys {
|
|||||||
|
|
||||||
static let showHome = Key<Bool>("showHome", default: true)
|
static let showHome = Key<Bool>("showHome", default: true)
|
||||||
static let showOpenActionsInHome = Key<Bool>("showOpenActionsInHome", default: true)
|
static let showOpenActionsInHome = Key<Bool>("showOpenActionsInHome", default: true)
|
||||||
|
static let showQueueInHome = Key<Bool>("showQueueInHome", default: true)
|
||||||
static let showOpenActionsToolbarItem = Key<Bool>("showOpenActionsToolbarItem", default: false)
|
static let showOpenActionsToolbarItem = Key<Bool>("showOpenActionsToolbarItem", default: false)
|
||||||
static let showFavoritesInHome = Key<Bool>("showFavoritesInHome", default: true)
|
static let showFavoritesInHome = Key<Bool>("showFavoritesInHome", default: true)
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@ -35,6 +36,8 @@ extension Defaults.Keys {
|
|||||||
static let playerButtonSingleTapGesture = Key<PlayerTapGestureAction>("playerButtonSingleTapGesture", default: .togglePlayer)
|
static let playerButtonSingleTapGesture = Key<PlayerTapGestureAction>("playerButtonSingleTapGesture", default: .togglePlayer)
|
||||||
static let playerButtonDoubleTapGesture = Key<PlayerTapGestureAction>("playerButtonDoubleTapGesture", default: .togglePlayerVisibility)
|
static let playerButtonDoubleTapGesture = Key<PlayerTapGestureAction>("playerButtonDoubleTapGesture", default: .togglePlayerVisibility)
|
||||||
static let playerButtonShowsControlButtonsWhenMinimized = Key<Bool>("playerButtonShowsControlButtonsWhenMinimized", default: false)
|
static let playerButtonShowsControlButtonsWhenMinimized = Key<Bool>("playerButtonShowsControlButtonsWhenMinimized", default: false)
|
||||||
|
static let playerButtonIsExpanded = Key<Bool>("playerButtonIsExpanded", default: false)
|
||||||
|
static let playerBarMaxWidth = Key<String>("playerBarMaxWidth", default: "600")
|
||||||
|
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
@ -48,6 +51,7 @@ extension Defaults.Keys {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
static let lockPortraitWhenBrowsing = Key<Bool>("lockPortraitWhenBrowsing", default: UIDevice.current.userInterfaceIdiom == .phone)
|
static let lockPortraitWhenBrowsing = Key<Bool>("lockPortraitWhenBrowsing", default: UIDevice.current.userInterfaceIdiom == .phone)
|
||||||
#endif
|
#endif
|
||||||
|
static let expandChannelDescription = Key<Bool>("expandChannelDescription", default: false)
|
||||||
static let channelOnThumbnail = Key<Bool>("channelOnThumbnail", default: false)
|
static let channelOnThumbnail = Key<Bool>("channelOnThumbnail", default: false)
|
||||||
static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true)
|
static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true)
|
||||||
static let roundedThumbnails = Key<Bool>("roundedThumbnails", default: true)
|
static let roundedThumbnails = Key<Bool>("roundedThumbnails", default: true)
|
||||||
|
@ -27,6 +27,7 @@ struct HomeView: View {
|
|||||||
@Default(.homeHistoryItems) private var homeHistoryItems
|
@Default(.homeHistoryItems) private var homeHistoryItems
|
||||||
@Default(.showFavoritesInHome) private var showFavoritesInHome
|
@Default(.showFavoritesInHome) private var showFavoritesInHome
|
||||||
@Default(.showOpenActionsInHome) private var showOpenActionsInHome
|
@Default(.showOpenActionsInHome) private var showOpenActionsInHome
|
||||||
|
@Default(.showQueueInHome) private var showQueueInHome
|
||||||
|
|
||||||
private var navigation: NavigationModel { .shared }
|
private var navigation: NavigationModel { .shared }
|
||||||
|
|
||||||
@ -69,13 +70,14 @@ struct HomeView: View {
|
|||||||
.padding(.horizontal, 15)
|
.padding(.horizontal, 15)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QueueView()
|
if showQueueInHome {
|
||||||
.padding(.vertical, 15)
|
QueueView()
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.padding(.horizontal, 40)
|
.padding(.horizontal, 40)
|
||||||
#else
|
#else
|
||||||
.padding(.horizontal, 15)
|
.padding(.horizontal, 15)
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if !accounts.current.isNil, showFavoritesInHome {
|
if !accounts.current.isNil, showFavoritesInHome {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
|
@ -8,21 +8,24 @@ struct QueueView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
LazyVStack {
|
LazyVStack {
|
||||||
if !items.isEmpty {
|
if !items.isEmpty {
|
||||||
HStack {
|
Button {
|
||||||
sectionLabel("Next in queue")
|
withAnimation {
|
||||||
Button {
|
expanded.toggle()
|
||||||
withAnimation {
|
}
|
||||||
expanded.toggle()
|
} label: {
|
||||||
}
|
HStack {
|
||||||
} label: {
|
sectionLabel(label)
|
||||||
|
Spacer()
|
||||||
Label("Show more", systemImage: expanded ? "chevron.up" : "chevron.down")
|
Label("Show more", systemImage: expanded ? "chevron.up" : "chevron.down")
|
||||||
.animation(nil, value: expanded)
|
.animation(nil, value: expanded)
|
||||||
.foregroundColor(.accentColor)
|
.foregroundColor(.accentColor)
|
||||||
.imageScale(.large)
|
.imageScale(.large)
|
||||||
.labelStyle(.iconOnly)
|
.labelStyle(.iconOnly)
|
||||||
|
.opacity(items.count > 1 ? 1 : 0)
|
||||||
}
|
}
|
||||||
.opacity(items.count > 1 ? 1 : 0)
|
|
||||||
}
|
}
|
||||||
|
.disabled(items.count < 2)
|
||||||
|
|
||||||
ForEach(limitedItems) { item in
|
ForEach(limitedItems) { item in
|
||||||
ContentItemView(item: .init(video: item.video))
|
ContentItemView(item: .init(video: item.video))
|
||||||
.environment(\.listingStyle, .list)
|
.environment(\.listingStyle, .list)
|
||||||
@ -32,6 +35,15 @@ struct QueueView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.padding(.vertical, items.isEmpty ? 0 : 15)
|
||||||
|
}
|
||||||
|
|
||||||
|
var label: String {
|
||||||
|
if items.count < 2 {
|
||||||
|
return "Next in Queue"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Next in Queue (\(items.count))"
|
||||||
}
|
}
|
||||||
|
|
||||||
var limitedItems: [PlayerQueueItem] {
|
var limitedItems: [PlayerQueueItem] {
|
||||||
|
@ -9,6 +9,8 @@ struct PlayerOverlayModifier: ViewModifier {
|
|||||||
@Environment(\.navigationStyle) private var navigationStyle
|
@Environment(\.navigationStyle) private var navigationStyle
|
||||||
|
|
||||||
@Default(.playerButtonShowsControlButtonsWhenMinimized) private var controlsWhenMinimized
|
@Default(.playerButtonShowsControlButtonsWhenMinimized) private var controlsWhenMinimized
|
||||||
|
@Default(.playerButtonIsExpanded) private var playerButtonIsExpanded
|
||||||
|
@Default(.playerBarMaxWidth) private var playerBarMaxWidth
|
||||||
|
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
content
|
content
|
||||||
@ -23,10 +25,20 @@ struct PlayerOverlayModifier: ViewModifier {
|
|||||||
ControlsBar(fullScreen: .constant(false), expansionState: $expansionState, playerBar: true)
|
ControlsBar(fullScreen: .constant(false), expansionState: $expansionState, playerBar: true)
|
||||||
.offset(x: expansionState == .mini && !controlsWhenMinimized ? 10 : 0, y: 0)
|
.offset(x: expansionState == .mini && !controlsWhenMinimized ? 10 : 0, y: 0)
|
||||||
.transition(.opacity)
|
.transition(.opacity)
|
||||||
|
.frame(maxWidth: maxWidth, alignment: .trailing)
|
||||||
|
.onAppear {
|
||||||
|
if playerButtonIsExpanded {
|
||||||
|
expansionState = .full
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.animation(.default, value: player.currentItem)
|
.animation(.default, value: player.currentItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var maxWidth: Double {
|
||||||
|
playerBarMaxWidth == "0" ? .infinity : (Double(playerBarMaxWidth) ?? 600)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PlayerOverlayModifier_Previews: PreviewProvider {
|
struct PlayerOverlayModifier_Previews: PreviewProvider {
|
||||||
|
@ -17,6 +17,7 @@ struct BrowsingSettings: View {
|
|||||||
@Default(.timeOnThumbnail) private var timeOnThumbnail
|
@Default(.timeOnThumbnail) private var timeOnThumbnail
|
||||||
@Default(.showHome) private var showHome
|
@Default(.showHome) private var showHome
|
||||||
@Default(.showFavoritesInHome) private var showFavoritesInHome
|
@Default(.showFavoritesInHome) private var showFavoritesInHome
|
||||||
|
@Default(.showQueueInHome) private var showQueueInHome
|
||||||
@Default(.showOpenActionsInHome) private var showOpenActionsInHome
|
@Default(.showOpenActionsInHome) private var showOpenActionsInHome
|
||||||
@Default(.showOpenActionsToolbarItem) private var showOpenActionsToolbarItem
|
@Default(.showOpenActionsToolbarItem) private var showOpenActionsToolbarItem
|
||||||
@Default(.homeHistoryItems) private var homeHistoryItems
|
@Default(.homeHistoryItems) private var homeHistoryItems
|
||||||
@ -24,6 +25,9 @@ struct BrowsingSettings: View {
|
|||||||
@Default(.playerButtonSingleTapGesture) private var playerButtonSingleTapGesture
|
@Default(.playerButtonSingleTapGesture) private var playerButtonSingleTapGesture
|
||||||
@Default(.playerButtonDoubleTapGesture) private var playerButtonDoubleTapGesture
|
@Default(.playerButtonDoubleTapGesture) private var playerButtonDoubleTapGesture
|
||||||
@Default(.playerButtonShowsControlButtonsWhenMinimized) private var playerButtonShowsControlButtonsWhenMinimized
|
@Default(.playerButtonShowsControlButtonsWhenMinimized) private var playerButtonShowsControlButtonsWhenMinimized
|
||||||
|
@Default(.playerButtonIsExpanded) private var playerButtonIsExpanded
|
||||||
|
@Default(.playerBarMaxWidth) private var playerBarMaxWidth
|
||||||
|
@Default(.expandChannelDescription) private var expandChannelDescription
|
||||||
|
|
||||||
@ObservedObject private var accounts = AccountsModel.shared
|
@ObservedObject private var accounts = AccountsModel.shared
|
||||||
|
|
||||||
@ -86,6 +90,7 @@ struct BrowsingSettings: View {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Toggle("Show Open Videos quick actions", isOn: $showOpenActionsInHome)
|
Toggle("Show Open Videos quick actions", isOn: $showOpenActionsInHome)
|
||||||
|
Toggle("Show Next in Queue", isOn: $showQueueInHome)
|
||||||
|
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
HStack {
|
HStack {
|
||||||
@ -157,9 +162,21 @@ struct BrowsingSettings: View {
|
|||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
private var playerBarSettings: some View {
|
private var playerBarSettings: some View {
|
||||||
Section(header: SettingsHeader(text: "Player Bar".localized()), footer: playerBarFooter) {
|
Section(header: SettingsHeader(text: "Player Bar".localized()), footer: playerBarFooter) {
|
||||||
|
Toggle("Open expanded", isOn: $playerButtonIsExpanded)
|
||||||
Toggle("Always show controls buttons", isOn: $playerButtonShowsControlButtonsWhenMinimized)
|
Toggle("Always show controls buttons", isOn: $playerButtonShowsControlButtonsWhenMinimized)
|
||||||
playerBarGesturePicker("Single tap gesture", selection: $playerButtonSingleTapGesture)
|
playerBarGesturePicker("Single tap gesture", selection: $playerButtonSingleTapGesture)
|
||||||
playerBarGesturePicker("Double tap gesture", selection: $playerButtonDoubleTapGesture)
|
playerBarGesturePicker("Double tap gesture", selection: $playerButtonDoubleTapGesture)
|
||||||
|
HStack {
|
||||||
|
Text("Maximum width expanded")
|
||||||
|
Spacer()
|
||||||
|
TextField("Maximum width expanded", text: $playerBarMaxWidth)
|
||||||
|
.frame(maxWidth: 100, alignment: .trailing)
|
||||||
|
.multilineTextAlignment(.trailing)
|
||||||
|
.labelsHidden()
|
||||||
|
#if !os(macOS)
|
||||||
|
.keyboardType(.numberPad)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,6 +222,8 @@ struct BrowsingSettings: View {
|
|||||||
|
|
||||||
Toggle("Show anonymous accounts", isOn: $accountPickerDisplaysAnonymousAccounts)
|
Toggle("Show anonymous accounts", isOn: $accountPickerDisplaysAnonymousAccounts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Toggle("Open channels with description expanded", isOn: $expandChannelDescription)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user