ReadKeep/readeck/UI/SpeechPlayer/GlobalPlayerContainerView.swift
Ilyas Hallak 09f1ddea58 Add text-to-speech functionality
- 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
2025-07-09 22:31:17 +02:00

40 lines
1.1 KiB
Swift

import SwiftUI
struct GlobalPlayerContainerView<Content: View>: View {
let content: Content
@State private var speechQueue = SpeechQueue.shared
init(@ViewBuilder content: () -> Content) {
self.content = content()
}
var body: some View {
ZStack(alignment: .bottom) {
content
.frame(maxWidth: .infinity, maxHeight: .infinity)
if speechQueue.hasItems {
VStack(spacing: 0) {
SpeechPlayerView()
.padding(.horizontal, 16)
.padding(.vertical, 8)
.transition(.move(edge: .bottom).combined(with: .opacity))
Rectangle()
.fill(.clear)
.frame(height: 49)
}
}
}
.animation(.spring(), value: speechQueue.hasItems)
}
}
#Preview {
GlobalPlayerContainerView {
Text("Main Content")
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(.systemBackground))
}
}