Move pause media feature inside an experimental section
This commit is contained in:
parent
4601c4c67b
commit
0e2d9017c6
@ -21,6 +21,7 @@ struct GeneralSettings: Codable {
|
||||
let isSystemMuteEnabled: Bool?
|
||||
let isPauseMediaEnabled: Bool?
|
||||
let isTextFormattingEnabled: Bool?
|
||||
let isExperimentalFeaturesEnabled: Bool?
|
||||
}
|
||||
|
||||
struct VoiceInkExportedSettings: Codable {
|
||||
@ -96,7 +97,8 @@ class ImportExportService {
|
||||
isSoundFeedbackEnabled: soundManager.isEnabled,
|
||||
isSystemMuteEnabled: mediaController.isSystemMuteEnabled,
|
||||
isPauseMediaEnabled: playbackController.isPauseMediaEnabled,
|
||||
isTextFormattingEnabled: UserDefaults.standard.object(forKey: keyIsTextFormattingEnabled) as? Bool ?? true
|
||||
isTextFormattingEnabled: UserDefaults.standard.object(forKey: keyIsTextFormattingEnabled) as? Bool ?? true,
|
||||
isExperimentalFeaturesEnabled: UserDefaults.standard.bool(forKey: "isExperimentalFeaturesEnabled")
|
||||
)
|
||||
|
||||
let exportedSettings = VoiceInkExportedSettings(
|
||||
@ -252,6 +254,12 @@ class ImportExportService {
|
||||
if let pauseMedia = general.isPauseMediaEnabled {
|
||||
playbackController.isPauseMediaEnabled = pauseMedia
|
||||
}
|
||||
if let experimentalEnabled = general.isExperimentalFeaturesEnabled {
|
||||
UserDefaults.standard.set(experimentalEnabled, forKey: "isExperimentalFeaturesEnabled")
|
||||
if experimentalEnabled == false {
|
||||
playbackController.isPauseMediaEnabled = false
|
||||
}
|
||||
}
|
||||
if let textFormattingEnabled = general.isTextFormattingEnabled {
|
||||
UserDefaults.standard.set(textFormattingEnabled, forKey: self.keyIsTextFormattingEnabled)
|
||||
}
|
||||
|
||||
52
VoiceInk/Views/Settings/ExperimentalFeaturesSection.swift
Normal file
52
VoiceInk/Views/Settings/ExperimentalFeaturesSection.swift
Normal file
@ -0,0 +1,52 @@
|
||||
import SwiftUI
|
||||
|
||||
struct ExperimentalFeaturesSection: View {
|
||||
@AppStorage("isExperimentalFeaturesEnabled") private var isExperimentalFeaturesEnabled = false
|
||||
@ObservedObject private var playbackController = PlaybackController.shared
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: "flask")
|
||||
.font(.system(size: 20))
|
||||
.foregroundColor(.accentColor)
|
||||
.frame(width: 24, height: 24)
|
||||
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text("Experimental Features")
|
||||
.font(.headline)
|
||||
Text("Experimental features that might be unstable & bit buggy.")
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Toggle("Experimental Features", isOn: $isExperimentalFeaturesEnabled)
|
||||
.labelsHidden()
|
||||
.toggleStyle(.switch)
|
||||
.onChange(of: isExperimentalFeaturesEnabled) { _, newValue in
|
||||
if !newValue {
|
||||
playbackController.isPauseMediaEnabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Divider()
|
||||
.padding(.vertical, 4)
|
||||
|
||||
if isExperimentalFeaturesEnabled {
|
||||
Toggle(isOn: $playbackController.isPauseMediaEnabled) {
|
||||
Text("Pause Media on Playback")
|
||||
}
|
||||
.toggleStyle(.switch)
|
||||
.help("Automatically pause active media playback during recordings and resume afterward.")
|
||||
}
|
||||
}
|
||||
.padding(16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(CardBackground(isSelected: false, useAccentGradientWhenSelected: true))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -137,16 +137,11 @@ struct SettingsView: View {
|
||||
.toggleStyle(.switch)
|
||||
.help("Automatically mute system audio when recording starts and restore when recording stops")
|
||||
|
||||
Toggle(isOn: $playbackController.isPauseMediaEnabled) {
|
||||
Text("Pause media during recording (Experimental)")
|
||||
}
|
||||
.toggleStyle(.switch)
|
||||
.help("Automatically pause active media playback when recording starts and resume when recording stops. This feature is experimental and may occasionally cause unexpected behavior.")
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ExperimentalFeaturesSection()
|
||||
|
||||
SettingsSection(
|
||||
icon: "rectangle.on.rectangle",
|
||||
title: "Recorder Style",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user