feat(ios): add background listening core toggle (#18261)

Co-authored-by: Mariano Belinky <mariano@mb-server-643.local>
This commit is contained in:
Mariano
2026-02-16 17:36:17 +00:00
committed by GitHub
parent ad27716d3f
commit b3859b488c
4 changed files with 25 additions and 6 deletions

View File

@@ -219,8 +219,12 @@ final class TalkModeManager: NSObject {
/// Suspends microphone usage without disabling Talk Mode.
/// Used when the app backgrounds (or when we need to temporarily release the mic).
func suspendForBackground() -> Bool {
func suspendForBackground(keepActive: Bool = false) -> Bool {
guard self.isEnabled else { return false }
if keepActive {
self.statusText = self.isListening ? "Listening" : self.statusText
return false
}
let wasActive = self.isListening || self.isSpeaking || self.isPushToTalkActive
self.isListening = false
@@ -247,7 +251,8 @@ final class TalkModeManager: NSObject {
return wasActive
}
func resumeAfterBackground(wasSuspended: Bool) async {
func resumeAfterBackground(wasSuspended: Bool, wasKeptActive: Bool = false) async {
if wasKeptActive { return }
guard wasSuspended else { return }
guard self.isEnabled else { return }
await self.start()