Voice wake: send or dismiss on release
This commit is contained in:
@@ -137,12 +137,17 @@ actor VoicePushToTalk {
|
|||||||
let chime = finalText.isEmpty ? .none : (self.activeConfig?.sendChime ?? .none)
|
let chime = finalText.isEmpty ? .none : (self.activeConfig?.sendChime ?? .none)
|
||||||
|
|
||||||
await MainActor.run {
|
await MainActor.run {
|
||||||
VoiceWakeOverlayController.shared.presentFinal(
|
if finalText.isEmpty {
|
||||||
transcript: finalText,
|
VoiceWakeOverlayController.shared.dismiss(reason: .empty)
|
||||||
forwardConfig: forward,
|
} else {
|
||||||
delay: finalText.isEmpty ? 0.0 : 0.8,
|
VoiceWakeOverlayController.shared.presentFinal(
|
||||||
sendChime: chime,
|
transcript: finalText,
|
||||||
attributed: attributed)
|
forwardConfig: forward,
|
||||||
|
autoSendAfter: nil,
|
||||||
|
sendChime: chime,
|
||||||
|
attributed: attributed)
|
||||||
|
VoiceWakeOverlayController.shared.sendNow(sendChime: chime)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.committed = ""
|
self.committed = ""
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ final class VoiceWakeOverlayController: ObservableObject {
|
|||||||
func presentFinal(
|
func presentFinal(
|
||||||
transcript: String,
|
transcript: String,
|
||||||
forwardConfig: VoiceWakeForwardConfig,
|
forwardConfig: VoiceWakeForwardConfig,
|
||||||
delay: TimeInterval,
|
autoSendAfter delay: TimeInterval?,
|
||||||
sendChime: VoiceWakeChime = .none,
|
sendChime: VoiceWakeChime = .none,
|
||||||
attributed: NSAttributedString? = nil)
|
attributed: NSAttributedString? = nil)
|
||||||
{
|
{
|
||||||
@@ -66,7 +66,9 @@ final class VoiceWakeOverlayController: ObservableObject {
|
|||||||
self.model.attributed = attributed ?? self.makeAttributed(from: transcript)
|
self.model.attributed = attributed ?? self.makeAttributed(from: transcript)
|
||||||
self.model.level = 0
|
self.model.level = 0
|
||||||
self.present()
|
self.present()
|
||||||
self.scheduleAutoSend(after: delay, sendChime: sendChime)
|
if let delay {
|
||||||
|
self.scheduleAutoSend(after: delay, sendChime: sendChime)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func userBeganEditing() {
|
func userBeganEditing() {
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ actor VoiceWakeRuntime {
|
|||||||
VoiceWakeOverlayController.shared.presentFinal(
|
VoiceWakeOverlayController.shared.presentFinal(
|
||||||
transcript: finalTranscript,
|
transcript: finalTranscript,
|
||||||
forwardConfig: forwardConfig,
|
forwardConfig: forwardConfig,
|
||||||
delay: delay,
|
autoSendAfter: delay,
|
||||||
sendChime: sendChime,
|
sendChime: sendChime,
|
||||||
attributed: finalAttributed)
|
attributed: finalAttributed)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user