Add ability to hide "Recently Added" section at home screen (#1087)
This commit is contained in:
parent
1d284c800d
commit
5334c57c65
|
@ -112,6 +112,7 @@ extension Defaults.Keys {
|
||||||
static let showPosterLabels: Key<Bool> = UserKey("showPosterLabels", default: true)
|
static let showPosterLabels: Key<Bool> = UserKey("showPosterLabels", default: true)
|
||||||
static let nextUpPosterType: Key<PosterDisplayType> = UserKey("nextUpPosterType", default: .portrait)
|
static let nextUpPosterType: Key<PosterDisplayType> = UserKey("nextUpPosterType", default: .portrait)
|
||||||
static let recentlyAddedPosterType: Key<PosterDisplayType> = UserKey("recentlyAddedPosterType", default: .portrait)
|
static let recentlyAddedPosterType: Key<PosterDisplayType> = UserKey("recentlyAddedPosterType", default: .portrait)
|
||||||
|
static let showRecentlyAdded: Key<Bool> = UserKey("showRecentlyAdded", default: true)
|
||||||
static let latestInLibraryPosterType: Key<PosterDisplayType> = UserKey("latestInLibraryPosterType", default: .portrait)
|
static let latestInLibraryPosterType: Key<PosterDisplayType> = UserKey("latestInLibraryPosterType", default: .portrait)
|
||||||
static let shouldShowMissingSeasons: Key<Bool> = UserKey("shouldShowMissingSeasons", default: true)
|
static let shouldShowMissingSeasons: Key<Bool> = UserKey("shouldShowMissingSeasons", default: true)
|
||||||
static let shouldShowMissingEpisodes: Key<Bool> = UserKey("shouldShowMissingEpisodes", default: true)
|
static let shouldShowMissingEpisodes: Key<Bool> = UserKey("shouldShowMissingEpisodes", default: true)
|
||||||
|
|
|
@ -19,6 +19,9 @@ struct HomeView: View {
|
||||||
@StateObject
|
@StateObject
|
||||||
private var viewModel = HomeViewModel()
|
private var viewModel = HomeViewModel()
|
||||||
|
|
||||||
|
@Default(.Customization.showRecentlyAdded)
|
||||||
|
private var showRecentlyAdded
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private var contentView: some View {
|
private var contentView: some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
|
@ -29,10 +32,13 @@ struct HomeView: View {
|
||||||
|
|
||||||
NextUpView(viewModel: viewModel.nextUpViewModel)
|
NextUpView(viewModel: viewModel.nextUpViewModel)
|
||||||
|
|
||||||
|
if showRecentlyAdded {
|
||||||
RecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)
|
RecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if showRecentlyAdded {
|
||||||
CinematicRecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)
|
CinematicRecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)
|
||||||
|
}
|
||||||
NextUpView(viewModel: viewModel.nextUpViewModel)
|
NextUpView(viewModel: viewModel.nextUpViewModel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@ struct CustomizeViewsSettings: View {
|
||||||
private var libraryRandomImage
|
private var libraryRandomImage
|
||||||
@Default(.Customization.Library.showFavorites)
|
@Default(.Customization.Library.showFavorites)
|
||||||
private var showFavorites
|
private var showFavorites
|
||||||
|
@Default(.Customization.showRecentlyAdded)
|
||||||
|
private var showRecentlyAdded
|
||||||
|
|
||||||
@EnvironmentObject
|
@EnvironmentObject
|
||||||
private var router: SettingsCoordinator.Router
|
private var router: SettingsCoordinator.Router
|
||||||
|
@ -92,6 +94,9 @@ struct CustomizeViewsSettings: View {
|
||||||
Toggle("Random Image", isOn: $libraryRandomImage)
|
Toggle("Random Image", isOn: $libraryRandomImage)
|
||||||
|
|
||||||
Toggle("Show Favorites", isOn: $showFavorites)
|
Toggle("Show Favorites", isOn: $showFavorites)
|
||||||
|
|
||||||
|
Toggle("Show Recently Added", isOn: $showRecentlyAdded)
|
||||||
|
|
||||||
} header: {
|
} header: {
|
||||||
L10n.library.text
|
L10n.library.text
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@ struct HomeView: View {
|
||||||
|
|
||||||
@Default(.Customization.nextUpPosterType)
|
@Default(.Customization.nextUpPosterType)
|
||||||
private var nextUpPosterType
|
private var nextUpPosterType
|
||||||
|
@Default(.Customization.showRecentlyAdded)
|
||||||
|
private var showRecentlyAdded
|
||||||
@Default(.Customization.recentlyAddedPosterType)
|
@Default(.Customization.recentlyAddedPosterType)
|
||||||
private var recentlyAddedPosterType
|
private var recentlyAddedPosterType
|
||||||
|
|
||||||
|
@ -38,7 +40,9 @@ struct HomeView: View {
|
||||||
|
|
||||||
NextUpView(homeViewModel: viewModel)
|
NextUpView(homeViewModel: viewModel)
|
||||||
|
|
||||||
|
if showRecentlyAdded {
|
||||||
RecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)
|
RecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)
|
||||||
|
}
|
||||||
|
|
||||||
ForEach(viewModel.libraries) { viewModel in
|
ForEach(viewModel.libraries) { viewModel in
|
||||||
LatestInLibraryView(viewModel: viewModel)
|
LatestInLibraryView(viewModel: viewModel)
|
||||||
|
|
|
@ -38,6 +38,8 @@ struct CustomizeViewsSettings: View {
|
||||||
private var nextUpPosterType
|
private var nextUpPosterType
|
||||||
@Default(.Customization.recentlyAddedPosterType)
|
@Default(.Customization.recentlyAddedPosterType)
|
||||||
private var recentlyAddedPosterType
|
private var recentlyAddedPosterType
|
||||||
|
@Default(.Customization.showRecentlyAdded)
|
||||||
|
private var showRecentlyAdded
|
||||||
@Default(.Customization.latestInLibraryPosterType)
|
@Default(.Customization.latestInLibraryPosterType)
|
||||||
private var latestInLibraryPosterType
|
private var latestInLibraryPosterType
|
||||||
@Default(.Customization.similarPosterType)
|
@Default(.Customization.similarPosterType)
|
||||||
|
@ -160,6 +162,10 @@ struct CustomizeViewsSettings: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Section("Home") {
|
||||||
|
Toggle("Show recently added", isOn: $showRecentlyAdded)
|
||||||
|
}
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
Toggle("Remember layout", isOn: $rememberLibraryLayout)
|
Toggle("Remember layout", isOn: $rememberLibraryLayout)
|
||||||
} footer: {
|
} footer: {
|
||||||
|
|
Loading…
Reference in New Issue