- Add TTSManager and SpeechQueue utilities - Create AddTextToSpeechQueueUseCase and ReadBookmarkUseCase - Add SpeechPlayer UI components (GlobalPlayerContainerView, SpeechPlayerView, SpeechPlayerViewModel) - Update BookmarkDetailView and BookmarkDetailViewModel for TTS integration - Add audio background mode to Info.plist - Update PhoneTabView for TTS controls - Add StringExtensions for text processing - Add StringExtensionsTests for testing - Update Localizable.xcstrings with new strings - Add VS Code settings
25 lines
433 B
Swift
25 lines
433 B
Swift
import Foundation
|
|
|
|
@Observable
|
|
class SpeechPlayerViewModel {
|
|
var isSpeaking: Bool {
|
|
return TTSManager.shared.isCurrentlySpeaking()
|
|
}
|
|
|
|
var currentText: String {
|
|
return SpeechQueue.shared.currentText
|
|
}
|
|
|
|
func pause() {
|
|
TTSManager.shared.pause()
|
|
}
|
|
|
|
func resume() {
|
|
TTSManager.shared.resume()
|
|
}
|
|
|
|
func stop() {
|
|
SpeechQueue.shared.clear()
|
|
}
|
|
}
|