- Implemented a toggle for the 'Read Aloud' (TTS) feature in the general settings. - Refactored AppSettings and PlayerUIState to support TTS enable/disable. - Updated BookmarkDetailView, PadSidebarView, PhoneTabView, and GlobalPlayerContainerView to respect the TTS setting. - Added new RButton component for consistent button styling. - Improved LabelsView to support tag selection on iPad and iPhone. - Updated SettingsGeneralView and SettingsGeneralViewModel for new TTS logic and removed unused app info code. - Added app info section to SettingsContainerView. - Updated SettingsServerView to use English labels and messages. - Refactored SpeechPlayerViewModel to only initialize TTS when enabled. - Updated Core Data model to include enableTTS in SettingEntity. - Removed obsolete files (PersistenceController.swift, old PlayerUIState). - Various bugfixes, code cleanups, and UI improvements.
62 lines
1.9 KiB
Swift
62 lines
1.9 KiB
Swift
import Foundation
|
|
|
|
protocol PSaveSettingsUseCase {
|
|
func execute(endpoint: String, username: String, password: String) async throws
|
|
func execute(endpoint: String, username: String, password: String, hasFinishedSetup: Bool) async throws
|
|
func execute(token: String) async throws
|
|
func execute(selectedFontFamily: FontFamily, selectedFontSize: FontSize) async throws
|
|
func execute(enableTTS: Bool) async throws
|
|
}
|
|
|
|
class SaveSettingsUseCase: PSaveSettingsUseCase {
|
|
private let settingsRepository: PSettingsRepository
|
|
|
|
init(settingsRepository: PSettingsRepository) {
|
|
self.settingsRepository = settingsRepository
|
|
}
|
|
|
|
func execute(endpoint: String, username: String, password: String) async throws {
|
|
try await settingsRepository.saveSettings(
|
|
.init(
|
|
endpoint: endpoint,
|
|
username: username,
|
|
password: password
|
|
)
|
|
)
|
|
}
|
|
|
|
func execute(endpoint: String, username: String, password: String, hasFinishedSetup: Bool) async throws {
|
|
try await settingsRepository.saveSettings(
|
|
.init(
|
|
endpoint: endpoint,
|
|
username: username,
|
|
password: password,
|
|
hasFinishedSetup: hasFinishedSetup
|
|
)
|
|
)
|
|
}
|
|
|
|
func execute(token: String) async throws {
|
|
try await settingsRepository.saveSettings(
|
|
.init(
|
|
token: token
|
|
)
|
|
)
|
|
}
|
|
|
|
func execute(selectedFontFamily: FontFamily, selectedFontSize: FontSize) async throws {
|
|
try await settingsRepository.saveSettings(
|
|
.init(
|
|
fontFamily: selectedFontFamily,
|
|
fontSize: selectedFontSize
|
|
)
|
|
)
|
|
}
|
|
|
|
func execute(enableTTS: Bool) async throws {
|
|
try await settingsRepository.saveSettings(
|
|
.init(enableTTS: enableTTS)
|
|
)
|
|
}
|
|
}
|