add text to speech play button on web links

This commit is contained in:
Satindar Dhillon 2022-08-03 21:44:57 -07:00 committed by Jackson Harper
parent 28c7d7be90
commit f8f94e2e70
2 changed files with 19 additions and 0 deletions

View file

@ -1,6 +1,8 @@
import AVFoundation
import Models
import Services
import SwiftUI
import Utils
import Views
import WebKit
@ -68,6 +70,22 @@ struct WebReaderContainerView: View {
.scaleEffect(navBarVisibilityRatio)
Spacer()
#endif
if FeatureFlag.enableTextToSpeechButton {
Button(
action: {
guard let htmlContent = item.htmlContent else { return }
let synthesizer = AVSpeechSynthesizer()
synthesizer.speak(AVSpeechUtterance(string: htmlContent))
AVSpeechUtterance(ss,)
},
label: {
Image(systemName: "play")
.font(.appTitleTwo)
}
)
.padding(.horizontal)
.scaleEffect(navBarVisibilityRatio)
}
Button(
action: { showPreferencesPopover.toggle() },
label: {

View file

@ -14,4 +14,5 @@ public enum FeatureFlag {
public static let enableShareButton = false
public static let enableSnooze = false
public static let enableGridCardsOnPhone = false
public static let enableTextToSpeechButton = true
}