- Move and replace utility files (SafariUtil, SpeechQueue, StringExtensions, TTSManager, VoiceManager) - Refactor and extend SpeechPlayer components (UI, progress, volume, queue) - Improved state and EnvironmentObject management (PlayerUIState) - UI and logic optimizations in menu and tab views - Remove obsolete and duplicate files - General code and UX improvements
20 lines
537 B
Swift
20 lines
537 B
Swift
import Foundation
|
|
|
|
class AddTextToSpeechQueueUseCase {
|
|
private let speechQueue: SpeechQueue
|
|
|
|
init(speechQueue: SpeechQueue = .shared) {
|
|
self.speechQueue = speechQueue
|
|
}
|
|
|
|
func execute(bookmarkDetail: BookmarkDetail) {
|
|
var text = bookmarkDetail.title + "\n"
|
|
if let content = bookmarkDetail.content {
|
|
text += content.stripHTML
|
|
} else {
|
|
text += bookmarkDetail.description.stripHTML
|
|
}
|
|
speechQueue.enqueue(bookmarkDetail.toSpeechQueueItem(text))
|
|
}
|
|
}
|