-
-
Notifications
You must be signed in to change notification settings - Fork 621
Defer update prompts until dictation completes #746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b05c490
8e23a8b
957d43c
d5232e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,8 @@ final class AppServices: ObservableObject { | |
|
|
||
| /// Automatic speech recognition service (lazily initialized) | ||
| private var _asr: ASRService? | ||
| private var pendingDictationStartCount = 0 | ||
| private var isDeliveringDictationOutput = false | ||
| var asr: ASRService { | ||
| if let existing = self._asr { | ||
| return existing | ||
|
|
@@ -68,6 +70,24 @@ final class AppServices: ObservableObject { | |
| return service | ||
| } | ||
|
|
||
| var hasActiveDictation: Bool { | ||
| self.pendingDictationStartCount > 0 || | ||
| self.isDeliveringDictationOutput || | ||
| (self._asr.map { $0.isRunningOrStarting || $0.isFinalizing } ?? false) | ||
|
Comment on lines
+73
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a user triggers dictation as the automatic update check completes, Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| func beginDictationStartup() { | ||
| self.pendingDictationStartCount += 1 | ||
| } | ||
|
|
||
| func endDictationStartup() { | ||
| self.pendingDictationStartCount = max(0, self.pendingDictationStartCount - 1) | ||
| } | ||
|
|
||
| func setDictationOutputDeliveryActive(_ active: Bool) { | ||
| self.isDeliveringDictationOutput = active | ||
|
Comment on lines
+87
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When two stop triggers queue Useful? React with 👍 / 👎. |
||
| } | ||
|
Comment on lines
+73
to
+89
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When dictation uses AI post-processing, Useful? React with 👍 / 👎. |
||
|
|
||
| private var _microphonePreferenceCoordinator: MicrophonePreferenceCoordinator? | ||
| var microphonePreferenceCoordinator: MicrophonePreferenceCoordinator { | ||
| if let existing = self._microphonePreferenceCoordinator { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -593,7 +593,11 @@ struct CommandModeView: View { | |
| } | ||
| } | ||
| } else { | ||
| Task { await self.asr.start() } | ||
| self.appServices.beginDictationStartup() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When recording from Useful? React with 👍 / 👎. |
||
| Task { | ||
| defer { self.appServices.endDictationStartup() } | ||
| await self.asr.start() | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the external typing route, this defer clears
hasActiveDictationas soon asstopAndProcessTranscriptionreturns, but the actual insertion has only been dispatched:ASRService.typeOutputPlanToActiveFieldcallsTypingService.typeOutputPlanInstantly, which queues a background worker and can wait before inserting/pasting. Fresh evidence in this revision is that the new higher-level flag still drops before that worker completes, so a deferred automatic update alert can wake during that window, take focus, and cause the dictated output to miss or target the wrong UI; keep the flag active until the typing/paste operation has actually completed.Useful? React with 👍 / 👎.