diff --git a/Sora.xcodeproj/project.pbxproj b/Sora.xcodeproj/project.pbxproj index 6741628..d2c5d28 100644 --- a/Sora.xcodeproj/project.pbxproj +++ b/Sora.xcodeproj/project.pbxproj @@ -23,6 +23,7 @@ 133D7C942D2BE2640075467E /* JSController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 133D7C8B2D2BE2640075467E /* JSController.swift */; }; 133D7C972D2BE2AF0075467E /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 133D7C962D2BE2AF0075467E /* Kingfisher */; }; 133F55BB2D33B55100E08EEA /* LibraryManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 133F55BA2D33B55100E08EEA /* LibraryManager.swift */; }; + 135CCBE22D4D1138008B9C0E /* SettingsViewPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 135CCBE12D4D1138008B9C0E /* SettingsViewPlayer.swift */; }; 138AA1B82D2D66FD0021F9DF /* EpisodeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138AA1B62D2D66FD0021F9DF /* EpisodeCell.swift */; }; 138AA1B92D2D66FD0021F9DF /* CircularProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138AA1B72D2D66FD0021F9DF /* CircularProgressBar.swift */; }; 139935662D468C450065CEFF /* ModuleManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 139935652D468C450065CEFF /* ModuleManager.swift */; }; @@ -57,6 +58,7 @@ 133D7C892D2BE2640075467E /* Modules.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Modules.swift; sourceTree = ""; }; 133D7C8B2D2BE2640075467E /* JSController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSController.swift; sourceTree = ""; }; 133F55BA2D33B55100E08EEA /* LibraryManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibraryManager.swift; sourceTree = ""; }; + 135CCBE12D4D1138008B9C0E /* SettingsViewPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewPlayer.swift; sourceTree = ""; }; 138AA1B62D2D66FD0021F9DF /* EpisodeCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EpisodeCell.swift; sourceTree = ""; }; 138AA1B72D2D66FD0021F9DF /* CircularProgressBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CircularProgressBar.swift; sourceTree = ""; }; 139935652D468C450065CEFF /* ModuleManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModuleManager.swift; sourceTree = ""; }; @@ -155,6 +157,7 @@ 1399FAD32D3AB38C00E97C31 /* SettingsViewLogger.swift */, 133D7C842D2BE2630075467E /* SettingsViewModule.swift */, 131845F82D47C62D00CA7A54 /* SettingsViewGeneral.swift */, + 135CCBE12D4D1138008B9C0E /* SettingsViewPlayer.swift */, ); path = SettingsSubViews; sourceTree = ""; @@ -360,6 +363,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 135CCBE22D4D1138008B9C0E /* SettingsViewPlayer.swift in Sources */, 13DC0C462D302C7500D0F966 /* VideoPlayer.swift in Sources */, 1399FAD62D3AB3DB00E97C31 /* Logger.swift in Sources */, 139935662D468C450065CEFF /* ModuleManager.swift in Sources */, diff --git a/Sora/Views/SettingsView/SettingsSubViews/SettingsViewPlayer.swift b/Sora/Views/SettingsView/SettingsSubViews/SettingsViewPlayer.swift new file mode 100644 index 0000000..6308fd8 --- /dev/null +++ b/Sora/Views/SettingsView/SettingsSubViews/SettingsViewPlayer.swift @@ -0,0 +1,56 @@ +// +// SettingsViewPlayer.swift +// Sora +// +// Created by Francesco on 31/01/25. +// + +import SwiftUI + +struct SettingsViewPlayer: View { + @AppStorage("externalPlayer") private var externalPlayer: String = "Default" + @AppStorage("AlwaysLandscape") private var isAlwaysLandscape = false + @AppStorage("hideNextButton") private var isHideNextButton = false + @AppStorage("holdSpeedPlayer") private var holdSpeedPlayer: Double = 2.0 + + private let mediaPlayers = ["Default", "VLC", "OutPlayer", "Infuse", "nPlayer", "Sora"] + + var body: some View { + Form { + Section(header: Text("Media Player"), footer: Text("The Force Landscape and HoldSpeed only work inside the default iOS player and Sora player.")) { + HStack { + Text("Media Player") + Spacer() + Menu(externalPlayer) { + ForEach(mediaPlayers, id: \.self) { player in + Button(action: { + externalPlayer = player + }) { + Text(player) + } + } + } + } + + Toggle("Hide 'Watch Next' after 5s", isOn: $isHideNextButton) + .tint(.accentColor) + + Toggle("Force Landscape", isOn: $isAlwaysLandscape) + .tint(.accentColor) + + HStack { + Text("Hold Speed:") + Spacer() + Stepper( + value: $holdSpeedPlayer, + in: 0.25...2.0, + step: 0.25 + ) { + Text(String(format: "%.2f", holdSpeedPlayer)) + } + } + } + } + .navigationTitle("Player") + } +} \ No newline at end of file diff --git a/Sora/Views/SettingsView/SettingsView.swift b/Sora/Views/SettingsView/SettingsView.swift index a8e7565..fd300b8 100644 --- a/Sora/Views/SettingsView/SettingsView.swift +++ b/Sora/Views/SettingsView/SettingsView.swift @@ -16,7 +16,7 @@ struct SettingsView: View { NavigationLink(destination: SettingsViewGeneral()) { Text("General Settings") } - NavigationLink(destination: SettingsViewModule()) { + NavigationLink(destination: SettingsViewPlayer()) { Text("Media Player") } NavigationLink(destination: SettingsViewModule()) {