mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-21 08:32:00 +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()
|
setupPipIfSupported()
|
||||||
|
|
||||||
view.bringSubviewToFront(subtitleStackView)
|
view.bringSubviewToFront(subtitleStackView)
|
||||||
|
subtitleStackView.isHidden = !SubtitleSettingsManager.shared.settings.enabled
|
||||||
|
|
||||||
AniListMutation().fetchMalID(animeId: aniListID) { [weak self] result in
|
AniListMutation().fetchMalID(animeId: aniListID) { [weak self] result in
|
||||||
switch result {
|
switch result {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
struct SubtitleSettings: Codable {
|
struct SubtitleSettings: Codable {
|
||||||
|
var enabled: Bool = true
|
||||||
var foregroundColor: String = "white"
|
var foregroundColor: String = "white"
|
||||||
var fontSize: Double = 20.0
|
var fontSize: Double = 20.0
|
||||||
var shadowRadius: Double = 1.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 backgroundEnabled: Bool = SubtitleSettingsManager.shared.settings.backgroundEnabled
|
||||||
@State private var bottomPadding: Double = Double(SubtitleSettingsManager.shared.settings.bottomPadding)
|
@State private var bottomPadding: Double = Double(SubtitleSettingsManager.shared.settings.bottomPadding)
|
||||||
@State private var subtitleDelay: Double = SubtitleSettingsManager.shared.settings.subtitleDelay
|
@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 colors = ["white", "yellow", "green", "blue", "red", "purple"]
|
||||||
private let shadowOptions = [0, 1, 3, 6]
|
private let shadowOptions = [0, 1, 3, 6]
|
||||||
|
|
||||||
var body: some View {
|
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(
|
SettingsPickerRow(
|
||||||
icon: "paintbrush",
|
icon: "paintbrush",
|
||||||
title: "Subtitle Color",
|
title: "Subtitle Color",
|
||||||
|
|
@ -416,4 +429,4 @@ struct SubtitleSettingsSection: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue