mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-25 01:30:06 +08:00
iOS: Speech model in keyboard starts its download once Hex's own engine preparation ends (#2435)
What changed - DictationController.phase's didSet calls startKeyboardParakeetDownloadIfWanted() when the phase leaves .preparingModel. Why - startKeyboardParakeetDownloadIfWanted() returns early while the transcriber is a ParakeetTranscriber and the phase is .preparingModel. At a cold launch the transcriber still holds the initial ParakeetTranscriber while Hex prepares the engine it will actually use (Apple's, when V2 isn't downloaded), so the call Hex makes when it comes to the front was skipped. Nothing called it again in that visit: the skipped call never created the network monitor or the keyboard-limit observer either. The download started only the next time Hex came to the front. - On the iPhone 17 Pro the race went either way; it lost whenever the preparation ran past the moment Hex became active (reliably under load). The probe log of a lost one: "scenePhase active", "controller transcriber=ParakeetTranscriber phase=preparingModel", and nothing else until Hex came back from Settings. Verified - Studio suite and the iPhone 17 Pro run are in the pull request.
This commit is contained in:
@@ -144,6 +144,8 @@ final class DictationController {
|
||||
didSet {
|
||||
captureFailed = false
|
||||
if case .failed = phase { failedAt = now() }
|
||||
// Speech model in keyboard holds back while a preparation runs; it starts once that ends.
|
||||
if oldValue == .preparingModel, phase != .preparingModel { startKeyboardParakeetDownloadIfWanted() }
|
||||
guard phase.keepsScreenAwake != oldValue.keepsScreenAwake else { return }
|
||||
// Only applies while Hex is in front; nothing else in Hex sets it, so ending a
|
||||
// dictation hands the screen back to Auto-Lock.
|
||||
|
||||
Reference in New Issue
Block a user