Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to hide "Recently Added" section at home screen #1087

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Shared/Services/SwiftfinDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ extension Defaults.Keys {
static let showPosterLabels: Key<Bool> = UserKey("showPosterLabels", default: true)
static let nextUpPosterType: Key<PosterDisplayType> = UserKey("nextUpPosterType", 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 shouldShowMissingSeasons: Key<Bool> = UserKey("shouldShowMissingSeasons", default: true)
static let shouldShowMissingEpisodes: Key<Bool> = UserKey("shouldShowMissingEpisodes", default: true)
Expand Down
12 changes: 9 additions & 3 deletions Swiftfin tvOS/Views/HomeView/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ struct HomeView: View {
@StateObject
private var viewModel = HomeViewModel()

@Default(.Customization.showRecentlyAdded)
private var showRecentlyAdded

@ViewBuilder
private var contentView: some View {
ScrollView {
Expand All @@ -29,10 +32,13 @@ struct HomeView: View {

NextUpView(viewModel: viewModel.nextUpViewModel)

RecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)
if showRecentlyAdded {
RecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)
}
} else {
CinematicRecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)

if showRecentlyAdded {
CinematicRecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)
}
NextUpView(viewModel: viewModel.nextUpViewModel)
}

Expand Down
5 changes: 5 additions & 0 deletions Swiftfin tvOS/Views/SettingsView/CustomizeViewsSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ struct CustomizeViewsSettings: View {
private var libraryRandomImage
@Default(.Customization.Library.showFavorites)
private var showFavorites
@Default(.Customization.showRecentlyAdded)
private var showRecentlyAdded

@EnvironmentObject
private var router: SettingsCoordinator.Router
Expand Down Expand Up @@ -92,6 +94,9 @@ struct CustomizeViewsSettings: View {
Toggle("Random Image", isOn: $libraryRandomImage)

Toggle("Show Favorites", isOn: $showFavorites)

Toggle("Show Recently Added", isOn: $showRecentlyAdded)

} header: {
L10n.library.text
}
Expand Down
6 changes: 5 additions & 1 deletion Swiftfin/Views/HomeView/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ struct HomeView: View {

@Default(.Customization.nextUpPosterType)
private var nextUpPosterType
@Default(.Customization.showRecentlyAdded)
private var showRecentlyAdded
@Default(.Customization.recentlyAddedPosterType)
private var recentlyAddedPosterType

Expand All @@ -38,7 +40,9 @@ struct HomeView: View {

NextUpView(homeViewModel: viewModel)

RecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)
if showRecentlyAdded {
RecentlyAddedView(viewModel: viewModel.recentlyAddedViewModel)
}

ForEach(viewModel.libraries) { viewModel in
LatestInLibraryView(viewModel: viewModel)
Expand Down
6 changes: 6 additions & 0 deletions Swiftfin/Views/SettingsView/CustomizeViewsSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ struct CustomizeViewsSettings: View {
private var nextUpPosterType
@Default(.Customization.recentlyAddedPosterType)
private var recentlyAddedPosterType
@Default(.Customization.showRecentlyAdded)
private var showRecentlyAdded
@Default(.Customization.latestInLibraryPosterType)
private var latestInLibraryPosterType
@Default(.Customization.similarPosterType)
Expand Down Expand Up @@ -160,6 +162,10 @@ struct CustomizeViewsSettings: View {
}
}

Section("Home") {
Toggle("Show recently added", isOn: $showRecentlyAdded)
}

Section {
Toggle("Remember layout", isOn: $rememberLibraryLayout)
} footer: {
Expand Down
Loading