Skip to content

Commit

Permalink
Re-organize Customize Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
JPKribs committed Dec 21, 2024
1 parent af602d3 commit e910791
Show file tree
Hide file tree
Showing 9 changed files with 457 additions and 211 deletions.
36 changes: 24 additions & 12 deletions Shared/Strings/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ internal enum L10n {
internal static let allMedia = L10n.tr("Localizable", "allMedia", fallback: "All Media")
/// Allow collection management
internal static let allowCollectionManagement = L10n.tr("Localizable", "allowCollectionManagement", fallback: "Allow collection management")
/// Allow media item deletion
internal static let allowItemDeletion = L10n.tr("Localizable", "allowItemDeletion", fallback: "Allow media item deletion")
/// Allow media item editing
internal static let allowItemEditing = L10n.tr("Localizable", "allowItemEditing", fallback: "Allow media item editing")
/// Allow item deletion
internal static let allowItemDeletion = L10n.tr("Localizable", "allowItemDeletion", fallback: "Allow item deletion")
/// Allow item editing
internal static let allowItemEditing = L10n.tr("Localizable", "allowItemEditing", fallback: "Allow item editing")
/// All Servers
internal static let allServers = L10n.tr("Localizable", "allServers", fallback: "All Servers")
/// View and manage all registered users on the server, including their permissions and activity status.
Expand Down Expand Up @@ -522,8 +522,6 @@ internal enum L10n {
internal static let enterSeasonNumber = L10n.tr("Localizable", "enterSeasonNumber", fallback: "Enter the season number.")
/// Episode
internal static let episode = L10n.tr("Localizable", "episode", fallback: "Episode")
/// Episode Landscape Poster
internal static let episodeLandscapePoster = L10n.tr("Localizable", "episodeLandscapePoster", fallback: "Episode Landscape Poster")
/// Episode %1$@
internal static func episodeNumber(_ p1: Any) -> String {
return L10n.tr("Localizable", "episodeNumber", String(describing: p1), fallback: "Episode %1$@")
Expand Down Expand Up @@ -738,6 +736,8 @@ internal enum L10n {
internal static let mediaDownloads = L10n.tr("Localizable", "mediaDownloads", fallback: "Media downloads")
/// Media playback
internal static let mediaPlayback = L10n.tr("Localizable", "mediaPlayback", fallback: "Media playback")
/// Configure how libraries are presented.
internal static let mediaSettingsDescription = L10n.tr("Localizable", "mediaSettingsDescription", fallback: "Configure how libraries are presented.")
/// Mbps
internal static let megabitsPerSecond = L10n.tr("Localizable", "megabitsPerSecond", fallback: "Mbps")
/// Menu Buttons
Expand All @@ -754,6 +754,8 @@ internal enum L10n {
internal static let missing = L10n.tr("Localizable", "missing", fallback: "Missing")
/// Missing Items
internal static let missingItems = L10n.tr("Localizable", "missingItems", fallback: "Missing Items")
/// Missing items will be displayed if available.
internal static let missingItemsDisplayed = L10n.tr("Localizable", "missingItemsDisplayed", fallback: "Missing items will be displayed if available.")
/// Mixer
internal static let mixer = L10n.tr("Localizable", "mixer", fallback: "Mixer")
/// Movies
Expand Down Expand Up @@ -784,12 +786,14 @@ internal enum L10n {
internal static let nextItem = L10n.tr("Localizable", "nextItem", fallback: "Next Item")
/// Next Up
internal static let nextUp = L10n.tr("Localizable", "nextUp", fallback: "Next Up")
/// Days in Next Up
internal static let nextUpDays = L10n.tr("Localizable", "nextUpDays", fallback: "Days in Next Up")
/// Maximum days
internal static let nextUpDays = L10n.tr("Localizable", "nextUpDays", fallback: "Maximum days")
/// Set the maximum amount of days a show should stay in the 'Next Up' list without watching it.
internal static let nextUpDaysDescription = L10n.tr("Localizable", "nextUpDaysDescription", fallback: "Set the maximum amount of days a show should stay in the 'Next Up' list without watching it.")
/// Rewatching in Next Up
internal static let nextUpRewatch = L10n.tr("Localizable", "nextUpRewatch", fallback: "Rewatching in Next Up")
/// Include rewatched items
internal static let nextUpRewatch = L10n.tr("Localizable", "nextUpRewatch", fallback: "Include rewatched items")
/// Configure which items are visible in 'Next Up'.
internal static let nextUpSettingsDescription = L10n.tr("Localizable", "nextUpSettingsDescription", fallback: "Configure which items are visible in 'Next Up'.")
/// No
internal static let no = L10n.tr("Localizable", "no", fallback: "No")
/// No episodes available
Expand Down Expand Up @@ -956,6 +960,12 @@ internal enum L10n {
internal static let regular = L10n.tr("Localizable", "regular", fallback: "Regular")
/// Release Date
internal static let releaseDate = L10n.tr("Localizable", "releaseDate", fallback: "Release Date")
/// Remember layout
internal static let rememberLayout = L10n.tr("Localizable", "rememberLayout", fallback: "Remember layout")
/// Remember the last preferences for each library separately.
internal static let rememberPreferencesPerLibrary = L10n.tr("Localizable", "rememberPreferencesPerLibrary", fallback: "Remember the last preferences for each library separately.")
/// Remember sorting
internal static let rememberSorting = L10n.tr("Localizable", "rememberSorting", fallback: "Remember sorting")
/// Remixer
internal static let remixer = L10n.tr("Localizable", "remixer", fallback: "Remixer")
/// Remote connections
Expand Down Expand Up @@ -1058,8 +1068,10 @@ internal enum L10n {
internal static let selectAll = L10n.tr("Localizable", "selectAll", fallback: "Select All")
/// Series
internal static let series = L10n.tr("Localizable", "series", fallback: "Series")
/// Series Backdrop
internal static let seriesBackdrop = L10n.tr("Localizable", "seriesBackdrop", fallback: "Series Backdrop")
/// Use series posters
internal static let seriesBackdrop = L10n.tr("Localizable", "seriesBackdrop", fallback: "Use series posters")
/// Uses series images for episodes when available.
internal static let seriesBackdropDescription = L10n.tr("Localizable", "seriesBackdropDescription", fallback: "Uses series images for episodes when available.")
/// Server
internal static let server = L10n.tr("Localizable", "server", fallback: "Server")
/// %@ is already connected.
Expand Down
14 changes: 13 additions & 1 deletion Swiftfin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
/* Begin PBXBuildFile section */
091B5A8A2683142E00D78B61 /* ServerDiscovery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 091B5A872683142E00D78B61 /* ServerDiscovery.swift */; };
091B5A8D268315D400D78B61 /* ServerDiscovery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 091B5A872683142E00D78B61 /* ServerDiscovery.swift */; };
4E00338A2D17445100EB2C92 /* LibrarySection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E0033892D17444D00EB2C92 /* LibrarySection.swift */; };
4E00338C2D17632600EB2C92 /* FilterSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E00338B2D17632200EB2C92 /* FilterSection.swift */; };
4E00338E2D1763FC00EB2C92 /* PosterSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E00338D2D1763F900EB2C92 /* PosterSection.swift */; };
4E01446C2D0292E200193038 /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E01446B2D0292E000193038 /* Trie.swift */; };
4E01446D2D0292E200193038 /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E01446B2D0292E000193038 /* Trie.swift */; };
4E0195E42CE0467B007844F4 /* ItemSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E0195E32CE04678007844F4 /* ItemSection.swift */; };
Expand Down Expand Up @@ -1175,6 +1178,9 @@

/* Begin PBXFileReference section */
091B5A872683142E00D78B61 /* ServerDiscovery.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServerDiscovery.swift; sourceTree = "<group>"; };
4E0033892D17444D00EB2C92 /* LibrarySection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibrarySection.swift; sourceTree = "<group>"; };
4E00338B2D17632200EB2C92 /* FilterSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterSection.swift; sourceTree = "<group>"; };
4E00338D2D1763F900EB2C92 /* PosterSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PosterSection.swift; sourceTree = "<group>"; };
4E01446B2D0292E000193038 /* Trie.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Trie.swift; sourceTree = "<group>"; };
4E0195E32CE04678007844F4 /* ItemSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemSection.swift; sourceTree = "<group>"; };
4E026A8A2CE804E7005471B5 /* ResetUserPasswordView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResetUserPasswordView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2420,8 +2426,11 @@
4E699BB72CB33FB0007CBD5D /* Sections */ = {
isa = PBXGroup;
children = (
4E0195E32CE04678007844F4 /* ItemSection.swift */,
4E00338B2D17632200EB2C92 /* FilterSection.swift */,
4E699BB82CB33FB5007CBD5D /* HomeSection.swift */,
4E0195E32CE04678007844F4 /* ItemSection.swift */,
4E0033892D17444D00EB2C92 /* LibrarySection.swift */,
4E00338D2D1763F900EB2C92 /* PosterSection.swift */,
);
path = Sections;
sourceTree = "<group>";
Expand Down Expand Up @@ -5656,6 +5665,7 @@
E19E551F2897326C003CE330 /* BottomEdgeGradientModifier.swift in Sources */,
4E661A0F2CEFE46300025C99 /* SeriesSection.swift in Sources */,
4E661A102CEFE46300025C99 /* TitleSection.swift in Sources */,
4E00338A2D17445100EB2C92 /* LibrarySection.swift in Sources */,
4E661A112CEFE46300025C99 /* LockMetadataSection.swift in Sources */,
4E661A122CEFE46300025C99 /* MediaFormatSection.swift in Sources */,
4E661A132CEFE46300025C99 /* EpisodeSection.swift in Sources */,
Expand Down Expand Up @@ -5988,6 +5998,7 @@
E1D8428F2933F2D900D1041A /* MediaSourceInfo.swift in Sources */,
E1BDF2EC2952290200CC0294 /* AspectFillActionButton.swift in Sources */,
BD0BA22B2AD6503B00306A8D /* OnlineVideoPlayerManager.swift in Sources */,
4E00338C2D17632600EB2C92 /* FilterSection.swift in Sources */,
E1BDF2F529524E6400CC0294 /* PlayNextItemActionButton.swift in Sources */,
BD3957772C112AD30078CEF8 /* SliderSection.swift in Sources */,
E18E01DD288747230022598C /* iPadOSSeriesItemContentView.swift in Sources */,
Expand Down Expand Up @@ -6027,6 +6038,7 @@
E1CB75792C80ECF100217C76 /* VideoPlayerType+Native.swift in Sources */,
E18ACA8F2A15A2CF00BB4F35 /* (null) in Sources */,
E1401CA72938140300E8B599 /* PrimaryAppIcon.swift in Sources */,
4E00338E2D1763FC00EB2C92 /* PosterSection.swift in Sources */,
E1937A3E288F0D3D00CB80AA /* UIScreen.swift in Sources */,
E10B1EBE2BD9AD5C00A92EAF /* V1ServerModel.swift in Sources */,
4EB1A8CC2C9B1BA200F43898 /* DestructiveServerTask.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// Swiftfin is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//

import Defaults
import SwiftUI

extension CustomizeViewsSettings {

struct FilterSection: View {

@Default(.Customization.Library.letterPickerEnabled)
private var letterPickerEnabled
@Default(.Customization.Library.letterPickerOrientation)
private var letterPickerOrientation
@Default(.Customization.Library.enabledDrawerFilters)
private var libraryEnabledDrawerFilters
@Default(.Customization.Search.enabledDrawerFilters)
private var searchEnabledDrawerFilters

@EnvironmentObject
private var router: SettingsCoordinator.Router

var body: some View {

Section(L10n.filters) {

// MARK: Letter Picker Toggle

Toggle(
L10n.letterPicker.localizedCapitalized,
isOn: $letterPickerEnabled
)

if letterPickerEnabled {

// MARK: Letter Picker Orientation

CaseIterablePicker(
L10n.orientation.localizedCapitalized,
selection: $letterPickerOrientation
)
}

// MARK: Library Filters

ChevronButton(L10n.library)
.onSelect {
router.route(to: \.itemFilterDrawerSelector, $libraryEnabledDrawerFilters)
}

// MARK: Search Filters

ChevronButton(L10n.search)
.onSelect {
router.route(to: \.itemFilterDrawerSelector, $searchEnabledDrawerFilters)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,37 @@ extension CustomizeViewsSettings {

@Default(.Customization.Home.showRecentlyAdded)
private var showRecentlyAdded

@Default(.Customization.Home.maxNextUp)
private var maxNextUp
@Default(.Customization.Home.resumeNextUp)
private var resumeNextUp

var body: some View {

Section(L10n.home) {

Toggle(L10n.showRecentlyAdded, isOn: $showRecentlyAdded)
// MARK: Show Recently Added Row

Toggle(
L10n.showRecentlyAdded.localizedCapitalized,
isOn: $showRecentlyAdded
)
}

Section {

// MARK: Rewatched Items in Next Up

Toggle(
L10n.nextUpRewatch.localizedCapitalized,
isOn: $resumeNextUp
)

Toggle(L10n.nextUpRewatch, isOn: $resumeNextUp)
// MARK: Maximum Duration in Next Up

ChevronAlertButton(
L10n.nextUpDays,
L10n.nextUpDays.localizedCapitalized,
subtitle: {
if maxNextUp > 0 {
return Text(maxNextUp, format: .interval(style: .narrow, fields: [.day]))
Expand All @@ -45,6 +62,10 @@ extension CustomizeViewsSettings {
)
.keyboardType(.numberPad)
}
} header: {
Text(L10n.nextUp)
} footer: {
Text(L10n.nextUpSettingsDescription)
}
}
}
Expand Down
Loading

0 comments on commit e910791

Please sign in to comment.