mirror of
https://github.com/cranci1/Sora.git
synced 2026-03-11 17:45:37 +00:00
toggle for subtitles (#166)
* added persistance for subtitle toggling * fixed typo * now we good (i think fuck windows) * adasd WSEFG --------- Co-authored-by: cranci <100066266+cranci1@users.noreply.github.com>
This commit is contained in:
parent
c6e704c04d
commit
66353bc80c
3 changed files with 17 additions and 2 deletions
|
|
@ -307,6 +307,7 @@ class CustomMediaPlayerViewController: UIViewController, UIGestureRecognizerDele
|
|||
setupPipIfSupported()
|
||||
|
||||
view.bringSubviewToFront(subtitleStackView)
|
||||
subtitleStackView.isHidden = !SubtitleSettingsManager.shared.settings.enabled
|
||||
|
||||
AniListMutation().fetchMalID(animeId: aniListID) { [weak self] result in
|
||||
switch result {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
import UIKit
|
||||
|
||||
struct SubtitleSettings: Codable {
|
||||
var enabled: Bool = true
|
||||
var foregroundColor: String = "white"
|
||||
var fontSize: Double = 20.0
|
||||
var shadowRadius: Double = 1.0
|
||||
|
|
|
|||
|
|
@ -342,12 +342,25 @@ struct SubtitleSettingsSection: View {
|
|||
@State private var backgroundEnabled: Bool = SubtitleSettingsManager.shared.settings.backgroundEnabled
|
||||
@State private var bottomPadding: Double = Double(SubtitleSettingsManager.shared.settings.bottomPadding)
|
||||
@State private var subtitleDelay: Double = SubtitleSettingsManager.shared.settings.subtitleDelay
|
||||
@AppStorage("subtitlesEnabled") private var subtitlesEnabled: Bool = true
|
||||
|
||||
private let colors = ["white", "yellow", "green", "blue", "red", "purple"]
|
||||
private let shadowOptions = [0, 1, 3, 6]
|
||||
|
||||
var body: some View {
|
||||
SettingsSection(title: "Subtitle Settings") {
|
||||
SettingsSection(title: "Subtitle Settings") {
|
||||
SettingsToggleRow(
|
||||
icon: "captions.bubble",
|
||||
title: "Enable Subtitles",
|
||||
isOn: $subtitlesEnabled,
|
||||
showDivider: false
|
||||
)
|
||||
.onChange(of: subtitlesEnabled) { newValue in
|
||||
SubtitleSettingsManager.shared.update { settings in
|
||||
settings.enabled = newValue
|
||||
}
|
||||
}
|
||||
|
||||
SettingsPickerRow(
|
||||
icon: "paintbrush",
|
||||
title: "Subtitle Color",
|
||||
|
|
@ -416,4 +429,4 @@ struct SubtitleSettingsSection: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue