From 5b9521caaa7cb8bc64d25e8723a73193ce1627e9 Mon Sep 17 00:00:00 2001 From: Ethan Pippin Date: Thu, 13 Jan 2022 23:26:06 -0700 Subject: [PATCH] begin moving things to customize settings --- Shared/Coordinators/SettingsCoordinator.swift | 7 ++++ Shared/Generated/Strings.swift | 2 ++ .../SettingsView/CustomizeViewsSettings.swift | 33 ++++++++++++++++++ .../Views/SettingsView/SettingsView.swift | 11 +++++- Swiftfin.xcodeproj/project.pbxproj | 10 +++++- .../SettingsView/CustomizeViewsSettings.swift | 31 ++++++++++++++++ .../Views/SettingsView/SettingsView.swift | 17 +++++---- Translations/en.lproj/Localizable.strings | Bin 11386 -> 11440 bytes 8 files changed, 103 insertions(+), 8 deletions(-) create mode 100644 Swiftfin tvOS/Views/SettingsView/CustomizeViewsSettings.swift create mode 100644 Swiftfin/Views/SettingsView/CustomizeViewsSettings.swift diff --git a/Shared/Coordinators/SettingsCoordinator.swift b/Shared/Coordinators/SettingsCoordinator.swift index 2467a708..5ffdaf27 100644 --- a/Shared/Coordinators/SettingsCoordinator.swift +++ b/Shared/Coordinators/SettingsCoordinator.swift @@ -23,6 +23,8 @@ final class SettingsCoordinator: NavigationCoordinatable { @Route(.push) var experimentalSettings = makeExperimentalSettings @Route(.push) + var customizeViewsSettings = makeCustomizeViewsSettings + @Route(.push) var missingSettings = makeMissingSettings @ViewBuilder @@ -41,6 +43,11 @@ final class SettingsCoordinator: NavigationCoordinatable { ExperimentalSettingsView() } + @ViewBuilder + func makeCustomizeViewsSettings() -> some View { + CustomizeViewsSettings() + } + @ViewBuilder func makeMissingSettings() -> some View { MissingItemsSettingsView() diff --git a/Shared/Generated/Strings.swift b/Shared/Generated/Strings.swift index 3842116f..e62b4404 100644 --- a/Shared/Generated/Strings.swift +++ b/Shared/Generated/Strings.swift @@ -76,6 +76,8 @@ internal enum L10n { internal static let `continue` = L10n.tr("Localizable", "continue") /// Continue Watching internal static let continueWatching = L10n.tr("Localizable", "continueWatching") + /// Customize + internal static let customize = L10n.tr("Localizable", "customize") /// Dark internal static let dark = L10n.tr("Localizable", "dark") /// Default Scheme diff --git a/Swiftfin tvOS/Views/SettingsView/CustomizeViewsSettings.swift b/Swiftfin tvOS/Views/SettingsView/CustomizeViewsSettings.swift new file mode 100644 index 00000000..65764e6f --- /dev/null +++ b/Swiftfin tvOS/Views/SettingsView/CustomizeViewsSettings.swift @@ -0,0 +1,33 @@ +// +// 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) 2022 Jellyfin & Jellyfin Contributors +// + +import Defaults +import SwiftUI + +struct CustomizeViewsSettings: View { + + @Default(.showPosterLabels) + var showPosterLabels + @Default(.showCastAndCrew) + var showCastAndCrew + + var body: some View { + Form { + Section { + + Toggle(L10n.showPosterLabels, isOn: $showPosterLabels) + + // TODO: Uncomment when cast and crew implemented in item views + // Toggle(L10n.showCastAndCrew, isOn: $showCastAndCrew) + + } header: { + L10n.customize.text + } + } + } +} diff --git a/Swiftfin tvOS/Views/SettingsView/SettingsView.swift b/Swiftfin tvOS/Views/SettingsView/SettingsView.swift index 212c076b..49f611a5 100644 --- a/Swiftfin tvOS/Views/SettingsView/SettingsView.swift +++ b/Swiftfin tvOS/Views/SettingsView/SettingsView.swift @@ -131,7 +131,16 @@ struct SettingsView: View { } Section(header: L10n.accessibility.text) { - Toggle(L10n.showPosterLabels, isOn: $showPosterLabels) + Button { + settingsRouter.route(to: \.customizeViewsSettings) + } label: { + HStack { + L10n.customize.text + .foregroundColor(.primary) + Spacer() + Image(systemName: "chevron.right") + } + } Button { settingsRouter.route(to: \.missingSettings) diff --git a/Swiftfin.xcodeproj/project.pbxproj b/Swiftfin.xcodeproj/project.pbxproj index ae5f4bae..c1d4ca3f 100644 --- a/Swiftfin.xcodeproj/project.pbxproj +++ b/Swiftfin.xcodeproj/project.pbxproj @@ -395,6 +395,8 @@ E1C812CE277AE43100918266 /* VideoPlayerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1C812C9277AE40900918266 /* VideoPlayerViewModel.swift */; }; E1C812D1277AE4E300918266 /* tvOSVideoPlayerCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1C812D0277AE4E300918266 /* tvOSVideoPlayerCoordinator.swift */; }; E1C812D2277AE50A00918266 /* URLComponentsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1C812C4277A90B200918266 /* URLComponentsExtensions.swift */; }; + E1CEFBF527914C7700F60429 /* CustomizeViewsSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1CEFBF427914C7700F60429 /* CustomizeViewsSettings.swift */; }; + E1CEFBF727914E6400F60429 /* CustomizeViewsSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1CEFBF627914E6400F60429 /* CustomizeViewsSettings.swift */; }; E1D4BF7C2719D05000A11E64 /* BasicAppSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1D4BF7B2719D05000A11E64 /* BasicAppSettingsView.swift */; }; E1D4BF7E2719D1DD00A11E64 /* BasicAppSettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1D4BF7D2719D1DC00A11E64 /* BasicAppSettingsViewModel.swift */; }; E1D4BF7F2719D1DD00A11E64 /* BasicAppSettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1D4BF7D2719D1DC00A11E64 /* BasicAppSettingsViewModel.swift */; }; @@ -732,6 +734,8 @@ E1C812C8277AE40900918266 /* VideoPlayerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayerView.swift; sourceTree = ""; }; E1C812C9277AE40900918266 /* VideoPlayerViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayerViewModel.swift; sourceTree = ""; }; E1C812D0277AE4E300918266 /* tvOSVideoPlayerCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = tvOSVideoPlayerCoordinator.swift; sourceTree = ""; }; + E1CEFBF427914C7700F60429 /* CustomizeViewsSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomizeViewsSettings.swift; sourceTree = ""; }; + E1CEFBF627914E6400F60429 /* CustomizeViewsSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomizeViewsSettings.swift; sourceTree = ""; }; E1D4BF7B2719D05000A11E64 /* BasicAppSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicAppSettingsView.swift; sourceTree = ""; }; E1D4BF7D2719D1DC00A11E64 /* BasicAppSettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicAppSettingsViewModel.swift; sourceTree = ""; }; E1D4BF802719D22800A11E64 /* AppAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppAppearance.swift; sourceTree = ""; }; @@ -1648,10 +1652,11 @@ E1E5D54A2783E26100692DFE /* SettingsView */ = { isa = PBXGroup; children = ( + E1CEFBF427914C7700F60429 /* CustomizeViewsSettings.swift */, E1E5D54B2783E27200692DFE /* ExperimentalSettingsView.swift */, + E176DE6F278E369F001EFD8D /* MissingItemsSettingsView.swift */, E1E5D5472783CCF900692DFE /* OverlaySettingsView.swift */, 539B2DA4263BA5B8007FF1A4 /* SettingsView.swift */, - E176DE6F278E369F001EFD8D /* MissingItemsSettingsView.swift */, ); path = SettingsView; sourceTree = ""; @@ -1659,6 +1664,7 @@ E1E5D54D2783E66600692DFE /* SettingsView */ = { isa = PBXGroup; children = ( + E1CEFBF627914E6400F60429 /* CustomizeViewsSettings.swift */, E1E5D5502783E67700692DFE /* ExperimentalSettingsView.swift */, E1BDE358278E9ED2004E4022 /* MissingItemsSettingsView.swift */, E1E5D54E2783E67100692DFE /* OverlaySettingsView.swift */, @@ -2222,6 +2228,7 @@ E1E00A36278628A40022235B /* DoubleExtensions.swift in Sources */, E1FA2F7427818A8800B4C270 /* SmallMenuOverlay.swift in Sources */, E193D53C27193F9500900D82 /* UserListCoordinator.swift in Sources */, + E1CEFBF727914E6400F60429 /* CustomizeViewsSettings.swift in Sources */, E13DD3C927164B1E009D4DAF /* UIDeviceExtensions.swift in Sources */, 535870A62669D8AE00D05A09 /* LazyView.swift in Sources */, E193D53A27193F9000900D82 /* ServerListCoordinator.swift in Sources */, @@ -2314,6 +2321,7 @@ 62E632DA267D2BC40063E547 /* LatestMediaViewModel.swift in Sources */, E1AD105C26D9ABDD003E4A08 /* PillHStackView.swift in Sources */, 625CB56F2678C23300530A6E /* HomeView.swift in Sources */, + E1CEFBF527914C7700F60429 /* CustomizeViewsSettings.swift in Sources */, E1C812BC277A8E5D00918266 /* PlaybackSpeed.swift in Sources */, E1E5D5492783CDD700692DFE /* OverlaySettingsView.swift in Sources */, E173DA5226D04AAF00CC4EB7 /* ColorExtension.swift in Sources */, diff --git a/Swiftfin/Views/SettingsView/CustomizeViewsSettings.swift b/Swiftfin/Views/SettingsView/CustomizeViewsSettings.swift new file mode 100644 index 00000000..2cbe816d --- /dev/null +++ b/Swiftfin/Views/SettingsView/CustomizeViewsSettings.swift @@ -0,0 +1,31 @@ +// +// 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) 2022 Jellyfin & Jellyfin Contributors +// + +import Defaults +import SwiftUI + +struct CustomizeViewsSettings: View { + + @Default(.showPosterLabels) + var showPosterLabels + @Default(.showCastAndCrew) + var showCastAndCrew + + var body: some View { + Form { + Section { + + Toggle(L10n.showPosterLabels, isOn: $showPosterLabels) + Toggle(L10n.showCastAndCrew, isOn: $showCastAndCrew) + + } header: { + L10n.customize.text + } + } + } +} diff --git a/Swiftfin/Views/SettingsView/SettingsView.swift b/Swiftfin/Views/SettingsView/SettingsView.swift index de5d8f39..a99fe88e 100644 --- a/Swiftfin/Views/SettingsView/SettingsView.swift +++ b/Swiftfin/Views/SettingsView/SettingsView.swift @@ -38,10 +38,6 @@ struct SettingsView: View { var jumpBackwardLength @Default(.jumpGesturesEnabled) var jumpGesturesEnabled - @Default(.showPosterLabels) - var showPosterLabels - @Default(.showCastAndCrew) - var showCastAndCrew @Default(.resumeOffset) var resumeOffset @Default(.subtitleSize) @@ -138,8 +134,17 @@ struct SettingsView: View { } Section(header: L10n.accessibility.text) { - Toggle(L10n.showPosterLabels, isOn: $showPosterLabels) - Toggle(L10n.showCastAndCrew, isOn: $showCastAndCrew) + + Button { + settingsRouter.route(to: \.customizeViewsSettings) + } label: { + HStack { + L10n.customize.text + .foregroundColor(.primary) + Spacer() + Image(systemName: "chevron.right") + } + } Button { settingsRouter.route(to: \.missingSettings) diff --git a/Translations/en.lproj/Localizable.strings b/Translations/en.lproj/Localizable.strings index 77dcbd36d5f60fdc53ababf7df5793cb1fbd7079..cc09b41e36cdfbc25e4b2280cd27dce5b40fde0f 100644 GIT binary patch delta 62 zcmewru_1Cpm5!MbLo!1tLoq`MLq0<;LncENLn?z3g93vs5Gye_W0A9F;9>v(?XnEm delta 7 OcmdlG`72^Wl@0(9UjwoL