mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-25 01:25:06 +08:00
dev
87
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
213dab8e5b | refactor(ios): unify dictation routing, engine identity, and Parakeet plan (#2491) | ||
|
|
a2d940e3b7 | fix(ios): show recording only once audio starts flowing (#2478) | ||
|
|
4bb3a4edec |
iOS keyboard: the strip's words don't roll while the keyboard is coming on screen (#2475)
What: KeyboardStripView gains appearing (true until FullKeyboardView.keyboardDidAppear, which KeyboardViewController.viewDidAppear calls, and set again by prepareForField for the next field). While it is set the strip's changes just show, as they do while the recording bar holds it still: no letter roll, chip scale or divider fade. Once the keyboard is on screen they animate as before. Why: a tester on an iPad mini (A17 Pro, iPadOS 26.6) saw "a small flicker when switching keyboards". Frame by frame on the simulator (iPad mini A17 Pro on iPadOS 26.5 and 27.2, iPhone 17 Pro on both, build 147 and dev), every switch to Hex showed the middle word "The" turn into "the" and roll back to "The", and "I'm" into "I’m", over about 0.2 s (0.3 s with #2457's roll). The keyboard is built before iOS hands it the field's traits, so its first words are chosen as if the field didn't capitalize or use smart quotes; the traits arrive as iOS brings it in, with a window already there, so the correction animated in front of the person. Not changed, and why: on iOS 26 (26.5 simulator, iPad mini and iPhone 17 Pro) iOS also sizes the keyboard's view 95 pt taller (448 pt for 353 on the iPad mini) for about 25 ms as it switches in, which shows as one frame of a taller panel. A keyboard extension that is only a grey view with a fixed height does the same, at a 999 or a required height constraint, and Hex with its first height already right does too; iPadOS 27.2 doesn't. It is iOS's, noted in ios/docs. Verified: FullKeyboardEngineTests.testTheStripsWordsJustShowUntilTheKeyboardIsOnScreen (a strip in a window: changes before keyboardDidAppear are at rest at once, after it they roll, and prepareForField holds still again); frame strips of the switch on iPadOS 26.5 and 27.2 before and after: "The" and "I’m" from the first frame, no roll. |
||
|
|
d7b690661e |
iOS Settings: Home refreshes again while it shows, Into field falls back to the words over the keys, the speech model card lands on its row, docs match (#2471)
Four regressions from the Settings rework (#2450), nothing renamed or reordered:
1. Home and its setup sheet read the setup state once a second again while
they show and Hex is active (.task(id:) on the navigation stack, stopping
on any Settings page or in the background), as well as on foreground and
the keyboard's Full Access report. #2450 dropped the 1 Hz loop, so a
change made with Hex still in front never showed: the keyboard's Allow
Paste flag (Hex's own field) and a keyboard added from Settings beside Hex
in Split View. Timed on an iPhone 17 Pro simulator (iOS 27.2), Hex in
front: at
|
||
|
|
6651f3e0a0 |
iOS keyboard: Light is the default key haptic strength (#2463)
Ryan decided the default should be the lightest after three reports in one day that the key tap is too strong (two teammates on the latest TestFlight, one of whom turned haptics off, and a tester who found Medium too strong and Light too light). - FullKeyboardSettings.hapticStrength falls back to .light, not .medium, when nothing is stored. FullKeyboardView and KeyboardViewController start at .light until the first settings sync. - Comments that called Medium the default or "meant to feel like Apple's keyboard" now say Light is the default and why. - The three strengths are unchanged: Light a rigid impact at 0.5, Medium rigid at 0.8, Strong a medium impact at 1.0. - Who changes: anyone with no stored strength moves from Medium to Light on update, on the full keyboard and the dictation bar. Anyone who picked a strength keeps it: SettingsSegments calls onSelect on every tap, the selected segment's included, so picking the Medium that was shown stored "medium". - docs/settings-and-home.md: Strength and its default under Haptics. Verified: HEXMobile suite on an iPhone 17 Pro iOS 27.2 simulator (Mac Studio), 950 tests, 0 failures, with a new FullKeyboardSettingsTests.testKeyHapticStrengthIsLightUntilChosen (unset and without the App Group: Light; every stored choice reads back; a stored Medium stays Medium). On the simulator, Settings > Keyboard shows Light selected with nothing stored, and tapping the shown Light wrote "light" to the App Group. The simulator has no Taptic Engine and no iPhone could be tapped, so nothing was felt. code-shape: FullKeyboardView.swift 1,522 lines before and after; --check fails only on that file, as on dev. |
||
|
|
7cec10e3b5 |
iOS: Apple's . key in web search fields (Safari's address bar) (#2460)
Ryan asked for a dot when typing websites. Apple's keyboard gives a `.webSearch` field (Safari's address bar) a `.` between the space bar and return; Hex routed those fields to its plain text row, so it had none. - KeyboardFieldRouting routes .webSearch to a new KeyboardFieldKind .webSearch. The enum moves to KeyboardFieldKind.swift with takesWords (text and web search) and keysRightOfSpace(width:), which replaces the three copies of the URL/email keys switch (joined, split, docked iPad). - Upright on an iPhone the row stands on Apple's columns: 123 to z's edge, space from x, a letter-wide `.` 7.25 pitches in and a return 1.75 pitches wide, as Apple's measures (iPhone 17 Pro, iOS 26.5 and 27.2). Turned and on the Duo it takes the URL/email row. A docked iPad keeps its text row, as Apple's does (iPad mini, iOS 27.2). - Every word check that read `field == .text` (autocorrect, swipe, suggestions, text replacements, smart punctuation, Learn how I type, Adaptive touch, the emoji key and shortcodes) now reads field.takesWords, so a web search field types words exactly as before. - Comma and period keys and Dvorak punctuation stay off in web search, as in URL and email fields, so there is never a second `.`. - Holding `.` still offers `. …`; Apple's domain menu (.us .edu .com .net .org) is left for a follow-up. - ios/docs/keyboard.md: a Web search fields section, and the comma and period, Dvorak and emoji notes. Verified: full HEXMobile suite on an iPhone 17 Pro iOS 27.2 simulator (Mac Studio), 946 tests, 0 failures. New cases: the route; the row's keys and widths on six phone widths and against Apple's 402 pt measurements; the docked iPad row unchanged; the comma and period experiment adding no second dot; the Dvorak and comma loops with web search; swipe, autocorrect and suggestions identical to a text field; Adaptive touch learning there. Release simulator build in Safari: the row lands on Apple's keys to the pixel, and typing google.com on Hex's keys gave "google.com". code-shape: KeyboardLayout.swift 1,499 -> 1,481 lines; --check still fails only on FullKeyboardView.swift (1,537 lines, over already on dev from #2457, untouched here). |
||
|
|
1091f52f79 |
iOS keyboard: Type as I speak keeps listening after an app's Send and starts fresh (#2446)
What: with Type as I speak on, the app emptying the field while it ends with Hex's live words (Slack's or Messages' Send, or select all and delete) is a send (LiveFieldTyping.wasSent): the words went out as typed. When the field first reads empty (textDidChange, or the next live words), the capture's audio is held; 0.3 s later (KeyboardLiveTyping.sendConfirmation), if the field is still empty, the dictation so far ends: its words are never taken back or inserted again, they settle in DictationEditTracker as a dictation kept as typed (the host emptying the field, as the tracker has always read a send), Undo dictation forgets earlier text, and its audio file is deleted. The microphone stays on: KeyboardLocalDictation.startAfresh closes the file, opens a new one, restarts the live recogniser and resets the dictation's start, and the held audio goes into the new dictation, so every chunk lands in exactly one dictation's file (none lost, none transcribed twice). The words above the keys start empty, new speech is typed into the empty field from its first word, and ✓ (or a tap on the words) inserts only the speech since the send; each dictation has its own length and memory checks. If the field shows the words again within the 0.3 s (a host reporting late), the held audio goes on into the same dictation. An app changing the words without emptying the field still stops the typing, as before. Why: AJ dictates into Slack with Type as I speak and taps Send without stopping; new speech never reached the empty box and ✓ inserted the whole transcript again. Ryan: "We want to keep listening and start fresh." Verified: LiveDictationTests on the Studio simulator (15; new: three sends in a row typed from the first word into the emptied field with the sent words never typed again; an edit that isn't an emptying keeps hands-off; Undo after a send reaches only the next dictation). In the iPhone 17 Pro simulator with the recogniser fixture and a chat host whose Send empties its field: two and six sends in a row, each a new dictation typed from the first word, 4 chunks (341 ms) held per send and moved to the new dictation, one audio file at a time and none left after, the keyboard's footprint 37.2-37.4 MB after each of six sends. Not run on an iPhone. |
||
|
|
fb5f79e75f |
iOS keyboard: a New speech model notice in the bar that opens Hex (#2436)
* iOS keyboard: a New speech model notice in the bar that opens Hex
What: when the keyboard appears while it would dictate English with Hex's speech model on this
iPhone but the model isn't downloaded, the bar shows the existing two-line notice (#2394's
KeyboardStripNotice): "New speech model" / "Downloads in Hex on Wi-Fi" with an Open Hex chip,
which opens Hex as it is, starting nothing (Home when it wasn't running; the download starts by
itself on Wi-Fi). Shown only with Full Access (the App Group, where the model, the keyboard's
measured limit and the counts live, needs it), the switch on, an iPhone with the memory, the
keyboard's own limit measured and enough (KeyboardParakeetBudget.requiredLimit, as Hex's
download decides), English, not Two-language dictation or the multilingual model; never in a
password or one-time-code field and never while dictating. At most once a day and three times in
all, never again once tapped (KeyboardParakeetNotice: experiments.keyboardParakeet.notice.shown,
.day, .opened in the App Group); typing or dictating takes the bar back, as the Paste notice does.
Two new strings with Simplified Chinese ("Open Hex" is the existing one); FixtureTextTarget can
now be a password or one-time-code field for tests.
Why: Ryan: "do we have enough in the app ... to tell them to try out the new speech model?" The
model only downloads when Hex opens on Wi-Fi, and nothing told someone who only uses the keyboard.
Verified: KeyboardBridgeTests on the Studio simulator (36, two new: the conditions, a phone that
can't use it, not measured, downloaded, switched off, the same day twice, three showings, after
Open Hex; no notice or count in a password or one-time-code field; the chip opens Hex starting
nothing and the notice never comes back). In the simulator with the phone's measured 177 MB limit:
shown in English and Simplified Chinese, light and dark; not shown again the same day; gone on the
first key; the chip opened Hex and recorded it.
* iOS strings: the speech model notice's two strings beside Open Hex
What: moves "New speech model" and "Downloads in Hex on Wi-Fi" (with their Simplified Chinese)
from the end of Localizable.xcstrings to just after "Open Hex". No string changes.
Why: the Home card's pull request adds its strings at the end of the same file tonight; apart,
the two merge without a conflict.
Verified: the file parses and differs from
|
||
|
|
843122d24e |
iOS: Home card for Hex's own speech model, and Speech model in keyboard moves to Settings › Dictation (#2437)
* iOS: Home shows a card about Hex's own speech model and where its download stands What changed - SpeechModelHomeCard on Home, above the Paste card and in its style: "New: Hex's own speech model", "English dictation, right in the keyboard.", then KeyboardParakeetStatus (the same waiting, downloading, downloaded, getting ready and ready lines as Settings › Experiments). Shown only while the switch is on, the iPhone fits and no hold says the keyboard never will use it (another engine, not English, a keyboard too small). Once ready it can be dismissed; the dismissal is kept in the App Group and the card never returns. - --snap-state model-card-waiting|downloading|ready fixtures for simulator screenshots. - Two new strings, with Simplified Chinese; every status line is an existing one. Why - Ryan asked whether 1.0.3 tells people to try the new model: the only mention was the switch under Settings › Experiments. Verified - DictationControllerTests: shown while waiting (each hold that clears), downloading or ready; not with the switch off, under 6 GB, not English, another engine or a keyboard too small; dismissed stays dismissed. Studio suite and screenshots are in the pull request. * iOS: Speech model in keyboard moves from Settings › Experiments to Settings › Dictation What changed - The switch, its detail line and its status line (KeyboardParakeetStatus) leave the Experiments page and sit on the Dictation page in a card of their own, directly above the keyboard's live-words card (Show what I say, Type as I speak), below the card with Numbers as digits. Its own card because its status line sits under it, and it shows on every iOS while the live-words card is iOS 26 only. - Home's card is now a tap target that opens Settings › Dictation (a chevron until it's ready, then the dismiss button), and its status line is drawn without a second box inside it. - Comments and README that sent a reader to Experiments › Speech model in keyboard now name Settings › Dictation; README calls it "the switch", not "the experiment". - Removed from ExperimentsSettingsPage: the row, its state and its onChange, moved unchanged into DictationSettingsPage. Why - Ryan: "Move it out of Experiments, please. Put it in Settings, Dictation." Not changed - The setting: same App Group key (experiments.keyboardParakeet), same default (on for English where the keyboard can use it), same turned-on-by-hand meaning, same download rules; a switch turned off stays off. Verified - Studio suite on the rebased head and simulator screenshots of both pages are in the pull request. |
||
|
|
130835701d |
iOS keyboard: Show what I say and Type as I speak (words while you dictate) (#2410)
* iOS keyboard: live words over the keys while dictating (stage 1, two looks)
What: while the keyboard records (in-keyboard dictation, iOS 26+), the capture's
16-bit chunks also feed Apple's SpeechAnalyzer (SpeechTranscriber with volatile and
fast results, DictationTranscriber's progressive preset for its languages), and the
words so far show over the keys: settled words in the keys' ink, the tentative tail
muted, newest line in view, whole lines at the top. Two looks behind a temporary App
Group key (debug.liveDictationLook): dim (keys at 10%) and hide. The preview takes every
touch on the keys, so nothing types while it shows; the recording bar, its cancel and
done, and the globe (drawn over the words where the keyboard has its own) work as before.
The final text still comes from the recording exactly as today; the live recogniser is
stopped when the capture stops (model lingering for the final pass).
Why: Ryan asked for the dictation to show in real time over a hidden or dimmed keyboard.
LiveTranscriptSource is one small protocol so the source can be swapped:
ParakeetLiveTranscriber (the audio so far again about once a second, a 20 s window) is
written but not wired. Never worse than today: no preview when neither switch wants it,
when less than 24 MB is left, when the language's model isn't on the iPhone (no
download), on an error, or before iOS 26. Hooks in KeyboardLocalDictation stay in the
capture's events and phase, away from the transcription call.
Verified: Studio simulator (iPhone 17 Pro iOS 27.2, SE iOS 26.5), real keyboard in a
host app with results recorded from Apple's recogniser on macOS 27.2.1 replayed (the
simulator has no speech models; LiveTranscriptReplay is simulator-only): both looks,
light and dark, upright and turned, a 60 s dictation scrolling, taps on Q and space
while recording type nothing with the preview (and "Q " without it), the globe switches
keyboards on the SE, no model -> no preview and the keys as today. Measured on macOS
with the same source: first words 0.5-1.0 s after the first word ends, word lag median
0.56-0.76 s, 2.1% of shown words rewritten, +0.4-2.6 MB in the feeding process.
code-shape.py passes. No settings UI yet (stage 2).
* iOS keyboard: Show what I say (hide look) and Type as I speak
What: look (b) only. While the keyboard records by itself the keys go and the words
so far take their place under the recording bar; the dim look and its temporary
debug.liveDictationLook key are gone. Two switches in Settings › Dictation on their
own card under the style card, iOS 26 and later only, Simplified Chinese:
- Show what I say (on by default): the preview.
- Type as I speak (off by default, "Words can change until you stop"):
LiveFieldTyping types the live words through the text document proxy, retyping only
the changed tail, and keeps exactly what it typed. It edits only while the text
before the cursor still ends with that (smart quotes allowed for; a host showing only
the end must show the part that changes); otherwise it stops and leaves the field,
and the dictation goes in at the cursor as today. When the dictation's text goes in,
KeyboardLiveTyping.handOver takes the words out first and returns the field as it was,
so spacing, Undo dictation (the whole dictation), Learn how I type and typing logs see
exactly what they did before. Cancel, a failure, nothing heard and the keyboard hiding
take the words out (a held dictation goes in at the next keyboard as before). Never
in secure, password, one-time code or card number fields, over a selection or a
two-thumb Dictate's range, or with Translate what I say on (Ryan's call).
- Never worse than today: live words only with 32 MB left once the capture runs (the
speech model's 24 MB transcription headroom plus the recogniser's share), stopped under
24 MB or on a memory warning; the preview never shows before a recogniser is running,
so a dictation without one never flashes it.
- The hand-over: the preview fades with the words it had while the keys and the
dictation's own text come in; with Parakeet now English's default the field's words
can differ slightly from the preview's (Apple's), and never flash in the preview.
Why: Ryan picked look (b) and the two switch names at the checkpoint.
Verified: Studio simulator (iPhone 17 Pro, iOS 27.2) with the replayed recogniser
results: the field typed and revised as the words came ("Quick note: Hey, I am running
about 10 minutes late. Can you grab us a table by...") and back to "Quick note:" after
Cancel; Settings › Dictation in English, dark with both on, and Simplified Chinese.
New tests in DictationLearningTests (LiveDictationTests: accumulator, joining, switch
defaults, typing and revising, stopping when the field changes or reports nothing,
private fields). README describes what the keyboard shows while recording.
code-shape.py passes.
* iOS keyboard: the preview draws only the end of a long dictation
What: LiveDictationPreviewView draws its words with one label in a clipping box, moved up by
whole lines once they overflow it, and only about the box's worth of text and three lines more
(from a word's start). It replaces the scrolling UITextView, so the words can no longer be
dragged back.
Why: on the iPhone 17 Pro a 60 s dictation with the preview held up to 27 MB more in the
keyboard (peak 103 MB, against 60 MB with the recogniser on and the preview off); the Studio
simulator showed the same, +24.5 MB.
Verified: Studio simulator, the 60 s replay: +24.5 MB (text view) -> +17.3 (capped text view)
-> +5.7 MB with the label, against +7.0 MB for the same recording without the preview. Test
for the tail in LiveDictationTests.
* iOS keyboard: the preview's tail keeps a word that starts right at the cut
Verified: LiveDictationTests on the Studio simulator.
* iOS keyboard: Type as I speak's words are replaced by the held text after the keyboard hides
What: when the keyboard hides mid-dictation, KeyboardLiveTyping notes the words it typed
(LiveDictationSettings.leftover, in the App Group) as well as taking them out. When the held
dictation goes in (inserted by itself or by Paste dictation), it replaces those words if the
text before the cursor still ends with them (LiveFieldTyping(resuming:in:)); otherwise it goes in
at the cursor as before. A new dictation clears the note.
Why: on the iPhone 17 Pro, pressing Home mid-dictation left the typed words in the field (an
app gone to the background takes no edits) and, back in the app (a new document identifier),
the strip offered Paste dictation, which would have put the dictation after them.
Verified: LiveDictationTests on the Studio simulator (9 tests).
* iOS README: what the keyboard shows while recording, measured on the iPhone 17 Pro
Adds the phone's numbers (first words about 1.2-1.3 s after speech starts; 60 s dictation 60.1 MB
with the preview against 58.1 MB without, peaks 66.5 against 60.1), the hidden-keyboard case for
Type as I speak, and what is verified where and what isn't (VoiceOver on a device, lagging hosts).
|
||
|
|
62ba0b4984 |
iOS: a warm session dictates in the background on iOS 27 again, and a keyboard that opens Hex brings the warm default back (#2406)
TestFlight build 129 (iPhone 17 Pro, iOS 27.3): Dictate opened Hex every time, and back
in the chat app the Hex key said "Another app is using audio. Try again."
Cause, reproduced on an iPhone 17 Pro on iOS 27.2 with build 128's code (
|
||
|
|
bd8da45709 |
iOS: Keep mic warm defaults to Off and hides where the keyboard dictates by itself (#2393)
Ryan's decision: where the keyboard can dictate by itself (iOS 26, KeyboardLocalDictation), Keep mic warm defaults to Off and its row is hidden; everywhere else it stays as it was. There a warm session did nothing useful and got in the way: the keyboard records through it instead of dictating itself, which also bypasses the speech model now running in the keyboard. What changed - KeyboardSelfDictation (new, HEXShared): one answer to "can this phone's keyboard dictate by itself?": iOS 26 or later, no keyboardNeedsHex (case 3), Experiments > Multilingual model not taking the language while only Hex can load it (case 4, unless Speech model in keyboard is on), and no record of Dictate opening Hex in the last 7 days. The keyboard writes that record (reason + time: memory, speechModel or multilingual) when its cold-start URL opens Hex because it can't dictate here (case 2 left no record before), and clears it the next time it dictates in the keyboard. - KeyboardBridge.warmDuration: unset now reads Off where the keyboard dictates by itself and 15m elsewhere, worked out on each read, never stored (replaces the fixed 15m fallback). Nothing writes the default at first launch, but tapping the already-selected 15m (to warm the mic) stored it, so once on iOS 26 a stored 15m is taken for not chosen where the keyboard dictates by itself; Off, 5m and 1h stay as chosen. This runs in DictationController.init, where no warm session can be running yet. - DictationController: the duration in effect is read again as Hex becomes active and as the keyboard opens it (refreshWarmDuration, in the new DictationController+WarmDefault.swift); when it turns Off an idle warm session ends. With Off where the keyboard dictates by itself, a keyboard launch that missed its recording (Timed out, or /start) no longer starts a 15-minute warm session; it warms nothing. A Dictate that opens Hex in time still records one shot, as before. - Settings > Dictation: Keep mic warm shows unless it would say Off where the keyboard dictates by itself; any duration in effect shows it, and once picked it stays on the page (so picking Off doesn't pull it from under the finger). No new strings. - README's warm-session paragraph says so. Verified - xcodebuild test on an iOS 27.2 simulator (Mac Studio): 859 tests, 3 skipped (clip and replay fixtures), 0 failures. New cases in existing files: KeyboardBridgeTests (default per OS version 18/25/26/27, the memory record and its 7-day window, keyboardNeedsHex, multilingual with and without Speech model in keyboard, a choice kept; the one-time review of a stored 15m) and DictationControllerTests (Off hides the row, a timed-out handoff warms nothing, a memory record brings 15m and the row back, clearing it ends the idle session). testTenSecondHandoffWindow now sets 15m explicitly, since it pins the warm path. iOS 18-25 covered only by passing the version in; not run on a real iOS 18. - In the real app on the simulator: a fresh install shows no Keep mic warm row and no warm timer; an install of origin/dev with 15m stored, updated to this build, reads Off with the row hidden and the key removed; one with 1h kept 1h and the row; with the keyboard's memory record set, the row came back with 15m. The simulator has no Apple Speech model, so Hex marks keyboardNeedsHex there itself; the self-dictating states were checked with that mark cleared. - python3 scripts/code-shape.py passes; git diff --check clean. |
||
|
|
8b879d8ac4 |
iOS keyboard: remove the "Logging" mark; Record typing logs is only the switch (#2382)
Ryan: "When you have typing logging on, it doesn't show anything for that. It's only a toggle in settings, because the logging UI just looks horrible. So we need to just remove it completely." Removed behaviour: with Settings › Privacy › Advanced › Record typing logs on, the keyboard no longer shows a "● Logging" mark anywhere. Previously the mark sat in the full keyboard's suggestion strip corner (TypingLogMarkView, which also pushed the Full Access hint aside and made the outer suggestion slot centre its word in the rest), at the end of the recording bar's Dot Scope well (which shortened the scope), and beside the Hex mark in the dictation bar's top row (TypingLogMark). Removed with it: KeyboardStripView/HexKeyRecordingPanel.showsLoggingMark and their layout branches, SlotButton.leadingRoom/trailingRoom (the mark was their only user), KeyboardViewModel.isLoggingTyping, KeyboardViewController.syncLoggingMark() and its three calls (it only fed the mark; starting and ending log sessions and attachTypingLog are unchanged), the --typing-log-mark launch argument in the snapshot stage and preview host, the mark's assertions in testTheRecordingBarMirrorsWithTheHexKey (the test keeps checking the bar's layout without it), and the mark's mentions in ios/README.md, TypingLogSession.swift and KeyboardStripView.swift. No localized string was the mark's. Unchanged: the switch and its consent dialog, the Typing logs screen, the one-time migration, and everything recording does (events, skipped fields, caps, 14 days). Verified on the Mac Studio, iOS 27.2 iPhone 17 Pro simulator: - xcodebuild test: 853 tests, 3 skipped, 0 failures. - python3 scripts/code-shape.py passes. - Release build of the real keyboard extension in a hosted field, logging off vs on (--experiment-typing-logs, App Group flag read back as 1 and 0): the suggestions strip, the Full Access hint, the full keyboard's recording bar and the dictation bar keyboard look the same (strip crops pixel-identical for suggestions and dictation bar; the hint differs by one antialiased pixel, the recording bar only in its animated Dot Scope dots). - With it on, typing wrote TypingLogs/<day>.ndjson in the App Group (session_start, touch, edit, candidates, context, layout lines). |
||
|
|
90a10a5222 |
iOS: Experiments › Speech model in keyboard: Parakeet in the keyboard, with the app closed (off by default) (#2381)
What changed - New experiment, off by default (KeyboardParakeetSettings, App Group): the keyboard's own dictation transcribes with Parakeet on the Neural Engine in the keyboard's process (HEXKeyboard/KeyboardParakeet.swift): V2 for English, Ultra for a language the Multilingual model experiment dictates once its files are there (Dictate and the Hex key then stop opening Hex for it, once the keyboard has it loaded). Everything after transcription (styles, cleanup, punctuation, insertion, held results) is the same code path; KeyboardSpeech is unchanged and is what runs whenever Parakeet can't. - The keyboard loads the model after its first frame and launch work, off the main thread (preprocessor on the CPU, the rest on the CPU and Neural Engine, one chunk at a time, never the GPU), keeps it while its process lives and releases it on a memory warning. It falls back to Apple's speech recognition, silently, when the model is missing, still loading (the first compile), not on the Neural Engine (neural ledger, else Core ML's compute plan), short of memory (KeyboardParakeetBudget: limit = footprint + os_proc_available_memory must be 96 MB for V2 / 115 MB for Ultra, with headroom to load and to transcribe), busy, empty or failing. - Parakeet's files move from the app's Application Support into the App Group (SpeechModelStore, Library/Application Support/SpeechModels), renamed in place at launch (moveLegacyDownloads, partial downloads included) instead of downloaded again; folders are marked complete (.hex-complete) and the keyboard loads only a marked one. ParakeetTranscriber and ParakeetUltraModel point there; turning the multilingual model off still deletes it (and any old copy). - Turning the switch on downloads Parakeet V2 (464 MB, KeyboardParakeetDownload, FluidAudio's resumable download); off stops and deletes it unless Hex itself dictates with V2. The row says what is happening in a few words (Downloading the speech model, Downloaded. The keyboard gets it ready the next time it opens, Getting ready in the keyboard, Ready in the keyboard, or that the keyboard can't use it now), with Simplified Chinese; the keyboard writes its state to the App Group, and "getting ready" shows only while fresh (3 min). - Each keyboard dictation with the switch on logs its engine, the keyboard's limit, footprint before and at peak, load and transcription time (keyboard-capture-probe.log / os_log). - FluidAudio is linked into the keyboard target. README updated. Why - Ryan: a better model than Apple's should run from the keyboard with the Hex app not running. The probe (~/dev/experiments/2026-11-22-hex-keyboard-asr/native) showed it fits: Neural Engine memory is outside the keyboard's footprint, the limit on an iPhone 17 Pro is 177 MB. Verified - Studio simulator (iPhone 17 Pro, iOS 27.2, fresh): xcodebuild test, 856 tests, 0 failures, 3 skipped (as on dev). scripts/code-shape.py passes. - iPhone 17 Pro, iOS 27.2, Release, Hex app force-quit: switch on, 464 MB downloaded, first load in Hex's keyboard 15.4 s (compiling), then a dictation from the Mac's speakers: engine=parakeet-v2 limit=177 MB footprint before=56.1 MB peak=72.0 MB transcribe=0.28 s for 9.4 s of audio, neural 468 MB, text exact. Switch off: the same clip with Apple's speech recognition, 0.34 s, footprint as on dev; the model's files deleted. - Switch off against dev (12+12 cold keyboard launches, Release): first appearance unchanged (median 491 vs 479 ms), footprint at launch work +0.2 MB (18.3 -> 18.5 MB median), keyboard binary 5.92 -> 12.64 MB. The 0.2 MB is FluidAudio's writable data (164 KB __DATA + 49 KB __DATA_CONST) that dyld fixes up at every launch; accepted for the experiment (follow-up: load the Parakeet code from a framework only when the switch is on). |
||
|
|
3bb5e5702d |
iOS: add a Greeklish experiment for Greek dictation (#2366)
* iOS: add a Greeklish experiment for Greek dictation
Greeklish writes Greek dictation in Latin letters before the rest of the
pipeline, like Hinglish does for Hindi: accents are stripped, digraphs and
letters are transliterated by rule, and a diaeresis keeps vowels apart.
It is off by default under Settings > Experiments (experiments.greeklish,
--experiment-greeklish), applies only to Greek (el / el-GR), renames Greek in
the language menus and offers it on the keyboard's quick switch. A dictation
that translates keeps its Greek letters, as Hinglish keeps Devanagari, and is
romanized only when it goes in as spoken. The app, its keyboard handoff and
in-keyboard dictation all read the same App Group setting.
* iOS: fix Greeklish punctuation, one-letter caps, and Greek ranges
Speak Greek question marks and ano teleia are usually normalized to a plain
";" and "·", so a ";" directly after a Greek letter now becomes "?" and a
"·" directly after one becomes ";", while both stay as written after Latin.
A one-letter Greek word only takes its capital ("Θ' αργήσω" -> "Th'
argiso"), instead of reading as all caps. The Greek letter test now covers
only the Greek block's letters (not Coptic or U+03F6) and the polytonic
letters (not its spacing marks), and the Greeklish tests move to their own
file.
* iOS: read Greek letter variants and document Greeklish
Greeklish reads the variant Greek letters fonts and keyboards produce (ϐ ϑ ϕ
ϖ ϰ ϱ ϲ ϵ) as their base letters, the feature map lists the experiment beside
Hinglish, and the test settings use their own suite and clean it up.
* iOS: split the Experiments body so it type-checks
Adding the Greeklish row pushed the Experiments page's one modifier chain past
what the Swift compiler would type-check in reasonable time. Split it into a
page and three short chains, with no behavior change.
|
||
|
|
994b346982 |
iOS keyboard: stop leaking views, capture web views, and emoji indices across shows (#2352)
What was wrong: iOS creates a new KeyboardViewController almost every time the keyboard comes up inside one HEXKeyboard process. Three things stayed behind after each presentation (~0.44 MB per empty show, ~0.82 MB once a word was typed) until iOS killed the keyboard over its memory limit and fell back to the system keyboard: 1. KeyboardLocalDictation built a new WKWebView (KeyboardWebCapture) for every controller and never detached it from KeyboardInputView when the keyboard hid or deallocated. WebKit's process-wide observers kept each WKWebView alive, and its Auto Layout engine kept the whole dismissed KeyboardInputView and FullKeyboardView alive with it. 2. On iOS 27, UIKit keeps every UIInputView shell alive in ObjC associated storage after its controller deallocates, so any subviews Hex left attached (FullKeyboardView, the bar, KeyboardBackdropView's UIVisualEffectView) stayed in memory too. In hosts with an autofocusing inputAccessoryView (#2302), iOS also keeps earlier controllers alive without calling viewWillDisappear, leaving their views and 4 Hz poll timers running. 3. EmojiLibrary.load built a new ~0.8 MB index per FullKeyboardView instead of sharing one copy per process like TypingDecoderModel and GermanCapitals. What changed (and what was replaced): - Replaced per-controller WKWebView creation with one shared KeyboardWebCapture per extension process, guarded by KeyboardCaptureOwnership so only the current owner (or any caller while parked with no owner) can detach, park, or evict it on a memory warning. A stale controller that hid or received a memory warning drops only its own pointer instead of stopping a newer keyboard's active recording. - Replaced eager KeyboardBackdropView allocation with a lazy backdrop created only while KeyboardsOnScreen.isOverAnother is true. KeyboardInputView records weak references to only the subviews Hex mounted (surface, backdrop, barEmojiPanel) and removes those exact views in viewDidDisappear and deinit without touching UIKit's own views. - Superseded controllers in the same named field (KeyboardsOnScreen.isSuperseded) stop their poll timer and unmount their surface; if the newer keyboard above leaves while the older one is still on screen, restoreRetiredKeyboard() rebuilds only its surface and poll timer without handing off number pads, auto-starting dictation, or resetting its cold-start job. Cleared handOffWaitsForPosture on appear, disappear, teardown, and retire. - Added EmojiLibrary.bundled(language:bundle:) and EmojiLibrary.evictCached() to share one index across presentations until a memory warning. Checked: - Release on iPhone Air iOS 27.2 simulator vs origin/dev: - 30 hide/shows + 20 Apple switches: 46.35 MB (peak 54.71 MB) -> 25.25 MB (peak 33.57 MB); FullKeyboardView 51 -> 1, WKWebView 51 -> 1, KeyboardBackdropView 51 -> 0. - 6 switches in autofocus inputAccessoryView host: 28.50 MB -> 24.96 MB (1 live FullKeyboardView, 1 WKWebView, 1 backdrop on the top keyboard). - First-frame commit time (20 shows): 1.19 ms median (new controller) vs 1.25 ms on dev; 15.66 ms when forcibly reusing one controller; keys present across Messages, Safari address bar and web fields, Spotlight, two-field focus, and rotation. - 48 kHz mock-mic dictation across first show, 10 hide/shows, keyboard switches, bar, auto-start, hide mid-recording/transcribing, active recording surviving an older controller's memory warning/hide/deinit, and number-pad restore without hand-off or auto-start. - xcodebuild test -scheme HEXMobile: 808 executed, 3 skipped, 0 failures; code-shape and hex-agent-policy clean. |
||
|
|
8a84d85c76 |
iOS keyboard: Korean two-set (두벌식) layout with Hangul composition (experiment, off by default) (#2339)
* iOS keyboard: Korean two-set (두벌식) layout with Hangul composition (experiment, off by default) * iOS keyboard: commit Hangul runs on cursor moves, selections and direct edits * iOS keyboard: keep Hangul runs through delete jitter and trimmed hosts * iOS keyboard: prefer Hex's typing record on lagging hosts * iOS keyboard: keep the engine under the size check after the rebase |
||
|
|
c167fbbf93 |
iOS keyboard: no automatic hand-off or Code from Messages where Apple's keyboard is split (#2349)
Follow-up to #2340 (
|
||
|
|
8a4216fdbb |
iOS dictation: no spaces or stray full stops around Chinese and Japanese; the bar's emoji panel says Back (#2347)
TestFlight build 121 (iPhone Air, iOS 27.3), a tester dictating Chinese on the
dictation bar: a dictation inserted mid-sentence got a space before and after
it, sentences gained periods in the middle, and the emoji panel's ABC key
returned to the bar, not to letters.
Spacing (TranscriptFormatter.insertionText): no space is added where the
character before or after the cursor, or the dictation's own first or last
character, is written without spaces (Han, kana, bopomofo, CJK and full-width
punctuation; isUnspacedScript). Hangul and Latin text are spaced as before.
Han beside a Latin word or a number also takes no space: Apple's Pinyin
keyboard (iOS 27.0 simulator, black box) commits "iPhone" and "下午" next to
Han with none, and Apple's DictationTranscriber writes "我用iPhone拍了".
A Chinese or Japanese dictation that ends in "。" loses it when the sentence
goes on after the cursor ("我想|去超市" + "买点水果。" read "我想去超市 买点水果。 然后");
a whole sentence put between two keeps it.
Full stops: measured Apple's SpeechTranscriber (zh-CN, macOS 27.2, the module
Hex uses for Chinese) on 18 spoken clips with pauses. It writes a space before
every full-width mark ("牛奶 ,然后") and beside Latin words and numbers ("我用 iPhone拍了"),
which Hex inserted as is; it cuts a dictation into results at pauses of about
1.5 s or more and leaves the cut unpunctuated, which Hex joined back to back
into one run-on clause; and it writes "。" itself at some long pauses mid-phrase.
Now, for zh, ja and yue dictations (writesWithoutSpaces), every style but
Verbatim drops spaces with a CJK character on either side
(closingUnspacedGaps); SpeechSegments.joined puts "," (or "、" beside kana)
between two results that meet without a mark; and Polished ends a Chinese line
that finishes in a Latin word or number with "。", never ".". Apple's own
mid-phrase "。" is left alone (no guesser); DictationTranscriber wrote commas
and no mid-phrase stop for the same clips.
Emoji panel: on the dictation bar the ABC key shows the bar's back chevron
(accessibility "Back", already translated to 返回); the full keyboard keeps ABC.
Verified: new cases in KeyboardBridgeTests, TranscriptCleanupTests
(SpokenCleanupRulesTests) and EmojiPanelLettersKeyTests; existing English,
Spanish, German and French cases unchanged and passing; on an iOS 27.0
simulator with the dictation bar, Paste dictation of a planted dictation into
a UITextView: origin/dev gives "我们明天 下午 去公园吧。" and
"我想去超市 买点水果和牛奶。 然后回家做饭。", this change "我们明天下午去公园吧。" and
"我想去超市买点水果和牛奶然后回家做饭。"; the chevron returns to the bar.
|
||
|
|
8583160e68 |
iOS: the multilingual model experiment never takes dictation away; its download says what it's doing and recovers (#2337)
A TestFlight tester (build 120, iPhone 15 Pro Max, iOS 26.6) had Experiments ›
Multilingual model (Parakeet) on: voice input "started demanding Set up", then
sat at "Downloading 632.2 MB · Wi-Fi recommended" with no movement.
Why it blocked: with the experiment on and the dictation language one of
Parakeet Ultra's 25 (English included), Ultra became Hex's engine at once,
before it was downloaded. Hex's phase stayed on preparing (or failed, which
shows Set up) for the whole 632 MB download and the first Core ML compile, and
the keyboard's Dictate and Hex key opened Hex for it whether or not the model
was there, so nothing dictated anywhere until it finished.
Why it sat still: the download ran in prepare() on a foreground URLSession,
one 594 MB encoder file, shown only as a bar at 70% scale under a label that
never changed. Leaving Hex (the keyboard's handoff sends you back to the app you
type in) or Auto-Lock suspends it; on return a dead connection showed nothing
for up to 60-90 s, then failed to Set up.
What changed:
- Until Ultra is ready, Hex and the keyboard dictate with the engine they use
with the experiment off. ParakeetUltraDownload (new) downloads beside it and
ParakeetUltraTranscriber.prepare only loads (throws notDownloaded otherwise).
A first load (Core ML's compile) runs beside the usual engine
(DictationController.loadMultilingualParakeetBeside) and switches to Ultra
when loaded; launches load Ultra directly only once downloaded and compiled
for this iOS (multilingualStep). Where V2 dictates and leaves no room
(English before iOS 26), Ultra takes V2's place for that load.
- The keyboard opens Hex for the experiment only once Hex has loaded it
(MultilingualParakeetSettings.isModelReady in the App Group, set after a
load, cleared while missing, set aside or off).
- The download shows bytes ("Downloading the multilingual model: 123.4 MB of
632.2 MB" with a bar) on home and under the switch; resumes every file from its
.partial (launch, retry, return to the front); a drop or 20 s without bytes
tries again after 2, 4, 8, 16, 30 s, starting over whenever it got further; in
the background it waits and picks up at once on return (fresh connection after
25 s away). After 6 fruitless tries, a refused request or a full iPhone it says
what happened in plain words with Try again and Turn off.
- A failed Ultra load or a load that ended Hex (ParakeetLoadGuard) falls back
to the usual engine and says so with Try again (no longer only by turning the
switch off, which deletes the 632 MB).
- A launch deletes a leftover download only when the switch is stored as off
(isTurnedOff), not when the App Group reads empty (a launch before the first
unlock would have deleted a good model). Turning it off now stops the download
and waits for it before deleting.
- Removed: ParakeetUltraTranscriber.downloadDetail, its .downloadFailed error
and the download/StallWatch inside its prepare (replaced by the above);
strings "Downloading %@ · Wi-Fi recommended" and the old switch detail.
New strings have zh-Hans. README describes the experiment's new behaviour.
- DEBUG builds read HEX_ULTRA_MODEL_BASE to download from a stand-in server.
Verified:
- xcodebuild test, iPhone 17 Pro Max iOS 26.5 simulator on the Mac Studio:
753 tests, 0 failures, 3 skipped (new cases in DictationControllerTests:
resume from .partial with Range, drop + stall retries, a moving download never
running out of tries, 503 x6 / 404 failures with their words, stop before
delete, keyboard flag, stored-off rule, multilingualStep).
- iPhone 15 Pro Max iOS 26.5 simulator, experiment on, a local stand-in server
(Range, throttled, drop/stall switches): Dictate stayed available with the
usual engine (V2 here; the sim has no Apple Speech) while the status counted
MB; a dropped connection said "Trying again in 1 s" and resumed with Range; a
20 s stall said so and resumed; Hex killed mid-download resumed from the
partial at relaunch; backgrounded with the connection cut, it resumed at once
on return; after a kill the resumed download from real Hugging Face finished
from a partial and passed the hashes; Ultra loaded beside and took over (setup
sheet "English · Parakeet Ultra", keyboard flag set); a forced load guard
showed the failure with Try again, which loaded Ultra; deleting the model with
the flag set cleared it at launch and downloaded again; the keyboard logged
"multilingual model on, Dictate opens Hex" only when ready (else the sim's own
"speech model missing" reason) and its Hex key went straight to recording
instead of the download screen; turning it off deleted the folder and cleared
the flag; with it off nothing shows or downloads.
- Not verified: a real iPhone, a real slow or flaky network, iOS's own
suspension timing, the V2-replacement path (sims report no memory limit), and
real audio (the Studio has no microphone).
|
||
|
|
c7e96f1808 |
iOS keyboard: the full keyboard on iPad, sized like Apple's iPad keyboards (#2313)
Why: on an iPad Hex always showed the dictation bar, which testers read as a bug
("Full keyboard doesn't work on iPad"; three TestFlight reports and three replies on X
in one day). The app stays iPhone-only, but iPadOS runs its keyboard as an iPad keyboard,
so this is Phase 1 of ~/dev/experiments/2026-11-22-hex-ipad-keyboard/scope.md.
What changed:
- KeyboardViewController: the idiom == .phone gate is gone (mountSurface and the emoji
key). An iPad follows Settings › Keyboard as an iPhone does: Full by default, the
dictation bar when chosen (it was always the bar on iPad). The bar itself is unchanged.
- KeyboardLayout: KeyboardPadSize (mini, 11-inch, 13-inch by the screen's shorter side)
and KeyboardPadPlacement (docked or floating) beside KeyboardPhoneSize, and
KeyboardMetrics.pad: Apple's key heights, row pitch, gaps and side insets per iPad and
orientation, measured beside Apple's keyboard in the iPadOS 27.2 simulator, so Hex's
four rows sit on Apple's bottom four from the screen's bottom (iPadOS leaves 20 pt under
a third-party keyboard). Above them the strip (Apple's 44 pt bar, words centred) and 44
pt kept clear for iPadOS's shortcut bar, which some apps draw over a custom keyboard's
top (the dictation bar keeps the same room). Floating: Apple's floating keyboard (26 x
38.25 pt keys, 54.3 pt pitch, 271 pt), no globe of Hex's own (iPadOS draws one under it).
Docked: a hide-keyboard key (KeyKind.dismiss, dismissKeyboard()) ends the bottom row;
the email/web rows' function keys are one letter wide there so it fits; no balloons, as
Apple's docked iPad keyboard has none; labels keep their upright sizes turned.
- FullKeyboardView: on an iPad the orientation comes from the keyboard's width against
the screen (an iPad's size classes stay regular either way), and the placement and
height follow docking, floating and turning.
- Settings › Keyboard on iPad: "On iPad, Hex shows the dictation bar" is replaced. While
Full is chosen the row says "The full keyboard works on iPad too" (zh-Hans "iPad 上也能
使用完整键盘"); with the dictation bar chosen it says what the iPhone says (#2304's Full
Access line). Auto-start shows only while the dictation bar is chosen, as on iPhone.
README describes the iPad.
iPhone unchanged: every iPad value is behind KeyboardMetrics.pad, nil on an iPhone.
Verified (iPadOS 27.2 simulators, iPad mini A17 Pro, iPad Pro 11- and 13-inch M5):
- rows against Apple's in portrait, landscape and floating, light and dark: every row's
top and bottom within 0.5 pt (one device pixel) of Apple's;
- real HID touches: typing with autocorrect (teh -> the), swipe typing (keyboard), a hold
menu, the space-bar trackpad, 123 and #+= pages, the emoji panel, the hide key (iPadOS
minimizes the keyboard to its bar, as with Apple's own hide key), docked either way up
and floating;
- the Hex key's in-keyboard dictation (recording bar, stop; the simulator has no speech
model, so no transcript), Hex's hosted recording bar, Paste dictation (a held
dictation past its 30 s inserted on tap);
- a hardware keyboard: iPadOS minimizes Hex to its pill, typing goes to the field, Hex
returns full size when it's detached; Stage Manager and Windowed Apps windows 375 pt
wide and Slide Over: the docked keyboard still spans the screen;
- Settings row in English and Chinese; the dictation bar still shows on iPad when chosen;
- iPhone 17 Pro (iOS 27.2): the keyboard's pixels identical to origin/dev in the same
field, light and dark;
- KeyboardLayoutTests (new testPad... cases, existing cases unchanged) and the full
HEXMobile suite (732 tests, 3 skipped, 0 failures) on an iPhone 17 Pro and an iPad Pro
13-inch simulator, iOS 27.2.
Not verified (no real iPad): memory, whether apps that draw iPadOS's shortcut bar over a
custom keyboard leave the strip clear, iPadOS 26.x.
|
||
|
|
742516b580 |
iOS: the keyboard is iOS's own glass again; the backdrop shows only over an earlier Hex keyboard iOS left on screen (#2302)
A tester on build 117 (iPhone 14 Pro, iOS 27.2.1, Spotlight) marked the top of Hex's keyboard: a greyer rounded panel sitting inside iOS's panel, with a seam under the band iOS adds above a third-party keyboard. Ryan: the space is fine as long as it is the same colour. Cause: since #2256 a thin material sat under the whole keyboard, always. It compresses whatever is behind it: on an iPhone 17 Pro (iOS 27.2, dark mode) Hex's area read 36 where the glass is 31 (Notes), 45 where it is 54 (a light page), and stayed neutral grey where the glass takes a wallpaper's tint (Spotlight: 37,38,38 under a band of 32,37,39 in the tester's screenshot). No tint can match glass that follows its background, so Hex was a panel of another colour inside iOS's panel, with its own corners. The material was there for one reason: iOS can leave Apple's keyboard under a third-party one, and Hex's keys are translucent. What the extension can observe turned out to mark that case exactly. iOS makes a new input view controller each time the keyboard comes up, tells the one before it disappeared, and frees it. In a field that takes focus as its screen appears and has an input accessory view, opened with Hex, it doesn't: switching to Apple's keyboard gives Hex no viewWillDisappear and keeps its controller and remote view; Apple's keyboard is added beside it, and switching back makes a second Hex on top without taking Apple's away. Opened with Apple's keyboard, the same field hides and frees Hex as usual and nothing is left behind, and so do a field focused by a tap, Safari and Spotlight (iOS 27.0 and 27.2 simulators, a keyboard extension logging its own lifecycle). Changed: - KeyboardsOnScreen (new, pure): Hex's keyboards on screen in this process, in order, each with its field (UIKit's documentIdentifier). A keyboard is over another when an earlier one was never told to disappear and is still in the same field; a field UIKit hasn't named counts as the same one. - KeyboardViewController keeps one for the process (viewWillAppear, viewWillDisappear, deinit, and the field in textDidChange) and shows its backdrop only while its keyboard is over another. Otherwise the backdrop is hidden and Hex draws nothing behind its keys: its background is iOS's glass, the colour of iOS's band and of the globe row, on any background. - KeyboardBackdropView is unchanged in what it draws (the ultra-thin material, shaded in dark mode, the panel's corners). Replaced: the always-on material from #2256. Its protection is kept for the case it was for; in that case Hex still shows the material's slightly different tone until the keyboard is next dismissed. Verified: - xcodebuild test on an iPhone 17 Pro simulator (iOS 27.2), Mac Studio: 693 tests, 3 skipped (AppleSpeechClipTests and the two TypingReplayTests, which need local files), 0 failures. KeyboardLayoutTests has the on-screen rule (dismiss and reopen, the kept keyboard, another field, an unnamed field, a keyboard appearing again) beside the material's and outline's cases. - iOS 27.0 and 27.2 simulators with this build: the accessory field opened with Hex is clear; after Hex, Apple's keyboard, Hex it is covered and shows no key shapes (light and dark); reopened it is clear again. Opened with Apple's keyboard, a tap-focused field, Safari, another app after Safari and Spotlight stay clear after switching, with nothing showing through. Hex's area equals the glass beside it exactly (0 of 255) over a white app, light and dark web pages and Spotlight, light and dark. - The strip over real glass, light and dark: suggestions, the correction chip, the Full Access hint, the emoji panel and emoji search (live), and recording, transcribing and Undo dictation in the snapshot stage. - Apple's keys overlaid on Hex's (iPhone 17 Pro, iOS 27.2 simulator), with and without iOS's band: every key edge on Apple's pixel, as before. - Ryan's iPhone 17 Pro (iOS 27.2): Spotlight over his wallpaper, Notes, a Safari form and DuckDuckGo. The step at Hex's top edge went from 8, 5 to the background's own texture (0 in Notes), and at its bottom edge from 6, 5, 8, 9 to 1, 0, 0, 0. Switching to Apple's keyboard and back in each, and dismissing and refocusing DuckDuckGo's field, stayed clear with no trace of another keyboard. Not verified: the leftover-keys case on a real iPhone (no field there reproduces it, so the cover engaging on a device is untested), a keyboard process iOS restarts between the two keyboards (the new process can't know of the earlier keyboard), Paste and Paste dictation over glass (they need Full Access on the simulator), iOS 26 and earlier, an iPad, a Duo. |
||
|
|
2d52c720cb |
iOS: two-thumb selection on the space bar (experiment, off by default) (#2265)
While the space bar is the trackpad, a second finger can pick a range the keyboard can't set in the host: each thumb moves one end with its own TrackpadCursor.State, the strip shows the text with the selected part highlighted, and both thumbs up offers Delete, Cut, Copy, Dictate and Cancel. Off, a second finger is ignored exactly as before. Settings > Experiments > Two-thumb selection, experiments.twoThumbSelection, off by default. Idea from @sieversjosua in #2255. Co-authored-by: Hex <hex@anoma.ly> |
||
|
|
a5adb4c23b |
iOS keyboard: a dictation handed off to Hex goes in when you come back (and the bar offers Paste dictation) (#2293)
TestFlight build 115, iPad mini (A17 Pro), iPadOS 18.7.8: "When I go to dictate, it opens
Hex. I click Done. Then I have to go back to Hex to copy it." Before iOS 26 Dictate opens
Hex to record (by design); the text is meant to go into the field when you return.
Cause: iOS often starts a new keyboard view controller as you come back from Hex, and
viewDidLoad's syncFromBridge inserted Hex's result before the keyboard was shown. The
proxy accepted the text (its documentContextBeforeInput even showed it) but the field never
got it, and lastInsertedResultID marked it delivered, so nothing offered it afterwards.
Results now go in only while the keyboard is shown (viewWillAppear onwards), as the held
in-keyboard dictation already did. Same on iPhone.
Second gap: a result that missed its 30 s was offered as Paste dictation only in the full
keyboard's strip. The dictation bar, the only keyboard on an iPad, offered nothing. The
bar's top row now shows a Paste dictation chip (zh-Hans: 粘贴听写) while one is on offer.
Verified on the Mac Studio, with a diagnostic build (not committed) that forces the
pre-iOS 26 path, a simulated microphone and a fixed transcript, in a UITextView host that
logs its text:
- iPad mini (A17 Pro) sim, iOS 26.2 (no iOS 18 runtime: Xcode 27.2 won't download one),
full-screen apps, portrait, dictation bar. Return via the "< App" breadcrumb and by
launching the app (Dock/Spotlight/switcher equivalent) at 2, 10, 40 and 90 s after Done.
|
||
|
|
efd5cea0a3 | iOS: the dictation bar can start dictating by itself (Auto-start: never, on switch, always) (#2267) | ||
|
|
87ab5fd85f |
iOS: a 38 pt top bar with room above its words, on a glass-coloured material instead of a fixed-colour panel (#2256)
On an iPhone 17 Pro (iOS 27.2) Hex's top bar looked thin and clipped where Gboard's and SwiftKey's never do. Thin: iOS draws about 17 pt of its own panel above a third-party keyboard in some presentations and nothing in others (Notes has it, a Safari form's first focus in a fresh Safari doesn't; Hex, Gboard and SwiftKey get the same, and a keyboard can't tell which). Hex's strip was 27 pt, the part of Apple's 44 pt bar below that band, so without the band its words sat 9 pt under the keyboard's own top edge and a chip touched it. Gboard and SwiftKey keep about 25 pt of their own room there. Clipped: the keyboard painted an opaque panel in one colour (#2139: 34,34,35 dark, 226,227,232 light). iOS's glass follows the app: in dark mode it reads 31 of 255 over Notes and 54 over a light web page. Over light pages Hex was a slab 20 darker than the glass with a hard, straight top edge and square corners inside iOS's rounded panel. A 38 pt bar on the same opaque panel still shows that edge (captured on the phone); a clear keyboard doesn't. Changed: - KeyboardMetrics.stripBarHeight is 38 pt (was 27): Apple's bar from the top of its suggestion pill down, then Apple's 8 pt, so row 1 starts 46 pt down and the keyboard is 247 pt (254 on an SE, 266 on an Air or Pro Max). It grows upward: the keys stay on Apple's rows. The words stay on Apple's line, 26 pt above the keys, now 20 pt below Hex's own edge. An autocorrection, a pressed word and a revert keep the small 18 pt chip (barChipHeight). The pills (the Hex key's frame, the recording bar and its buttons) are 28 pt, centred on the words' line, 6 pt down as Apple's pill is below its panel's edge (they were 27 pt, flush with the top). The Full Access hint, notices, the emoji panel's top row and the emoji search field centre on the same line (stripLineBand). The Hex key still takes touches from the strip's top. Landscape, the iPad's bar and the Duo are untouched. - KeyboardBackdropView is the system's ultra-thin material (shaded 22% in dark mode) with the panel's 26 pt top corners, 1 pt inside its rim. On the phone Hex's area now reads 36 over Notes and 46 over the light page: 5 and 8 off the glass, where it was 3 and 20, and its corners are the panel's when iOS adds nothing above the keyboard. Replaced: the 27 pt strip and its flush pills, and #2139's opaque fill, whose outline assumed iOS's 17 pt was always there. #2139's protection is kept, not dropped: the reason for it turned out to be reproducible. In a field that has an input accessory view and takes focus as its screen appears, switching from Hex to Apple's keyboard and back leaves Apple's key plane in the host's view tree under the remote keyboard (a UIKeyboardAutomatic beside the remote view in _UIKBCompatInputView, from a dump of the host's windows). It happened on every switch in the iOS 27.0 and 27.2 simulators with a clear Hex at today's geometry, with English and with English & Indonesian, and under a bare keyboard extension with a clear view and none of Hex's code, so it is iOS's, and a keyboard can only cover it. It did not happen in a field focused by a tap, without an accessory view, in Safari's address bar, or in Spotlight. A clear keyboard would match the glass exactly but show those keys (the TestFlight build 56 report, iPhone 17, iOS 27.0.1). Through the material they are an even, slightly lighter tone with no shapes. Not chosen: clear (exact glass, shows the leftover keys), opaque (hides them, the slab), UIGlassEffect (81 and 61 on the phone, far lighter), UIBlurEffect .dark (35 and 29, as fixed as the opaque fill). Verified: - xcodebuild test on an iPhone 17 Pro simulator (iOS 27.2), Mac Studio: 661 tests, 1 skipped as on dev, 0 failures. KeyboardLayoutTests has the new heights, the strip's line, chip, pills and band, and the material's outline (inside the panel's corners and rim with and without iOS's 17 pt, over every keycap). - Apple's keys against Hex's in the same field (screenshots overlaid, iPhone 17 Pro, iOS 27.2 simulator), with and without iOS's 17 pt: every key edge on the same pixel in rows 1 to 3, row 4 the same top edge and 4 pt short at the bottom, as before. - Every strip state in the snapshot stage (suggestions and the chip in light and dark, Undo dictation, the recording and transcribing bars, the Full Access hint, the emoji panel, emoji search, an emoji strip, a pressed key, the Logging mark): nothing touches the top edge. - The leftover-keys switch with this build, iOS 27.0 and 27.2 simulators, light and dark: no key shapes (the key area within 12 levels of a clean Hex in light, an even 17 lighter in dark). - On Ryan's iPhone 17 Pro (iOS 27.2): the Safari form with and without iOS's 17 pt, DuckDuckGo and Notes captured with this build; switching from Apple's keyboard and from Gboard to Hex in those three fields showed no trace of another keyboard (30 switches: 18 with a clear build, 12 with this one). Not verified: iOS 26 and earlier (the material, and whether iOS leaves the keys there), an iPad or a Duo, light mode on a phone, Reduce Transparency, and the leftover keys on a real iPhone (no field on the phone reproduced them). |
||
|
|
5145a44158 |
ios: give the dictation bar's top row 44 pt hit areas (#2258)
* ios: give the dictation bar's top row 44 pt hit areas * ios: keep the language tray's width and the translation chip's taps |
||
|
|
2a7b12bfa6 |
iOS: Undo dictation works after the cursor moves, and goes when it can't (#2240)
TestFlight build 56 ( |
||
|
|
811881e98e |
iOS: onboarding always shows the Hex key, and practice needs Hex's dictation (#2211)
* iOS: onboarding's practice says how to bring up Hex's keyboard David (iPhone 17 Pro Max, iOS 26.6.2, TestFlight) switched to Hex with the globe in onboarding's practice and saw "a big blank bar" with no Hex key, so he used iOS's own dictation mic instead. Not reproduced in the iOS 27.2 (iPhone 17 Pro) and 26.4 (iPhone 17 Pro Max) simulators, from first launch with Full Access granted before and while the keyboard ran: the keys, suggestions and Hex key are up in the first screenshot after the switch (0.5 s) every time. In the keyboard only the recording bar hides the Hex key with the keys up, and nothing in onboarding starts it, so the blank bar was most likely iOS's empty panel before the keyboard's first frame on that iPhone (as in #2185's report). The app couldn't tell, and the page kept saying "tap the Hex key". What changed - The keyboard notes in the App Group when its view has appeared (viewDidAppear, after its first frame) and when it goes away (viewWillDisappear): KeyboardBridge.recordKeyboardShown/Hidden. - KeyboardPresence.isShown: shown since it last appeared and not hidden since, with a sign of life (that appearance or the Full Access report it repeats every 5 s while shown) under 7 s old. - The practice page: after a keyboard switch by hand, when Hex's keyboard isn't on screen within 2 s (another keyboard, iOS's dictation, or Hex's never drew), it says "Don't see the Hex key? Tap the globe until Hex's keyboard comes up", gone as soon as Hex's keyboard is up. Only with Full Access, which the keyboard needs to write the App Group; without it the existing Full Access note shows. The three practice notes share one view (practiceNote); zh-Hans string added; README. Verified (anomastudio, ad-hoc signed Debug build, iPhone 17 Pro iOS 27.2, onboarding from first launch): switching from Hex to Apple's keyboard shows the note after 2 s, switching back hides it; tapping iOS's mic under Hex's keyboard takes Hex's keyboard off screen (hiddenAt written). Not verified on a physical iPhone. * iOS: onboarding's practice finishes only on Hex's own input David finished onboarding's practice with iOS's dictation (the system mic at the bottom right), not Hex: the practice counted any three words in its field once a keyboard had ever reported Full Access, so iOS's dictation, or Apple's keyboard, passed it. Reproduced on an iOS 27.2 simulator: three words typed on Apple's keyboard showed "That's Hex". What changed - Words count as typed only when they arrive while Hex's keyboard is on screen (KeyboardPresence, from the previous change): iOS's dictation and other keyboards take Hex's keyboard off screen, so their text never counts. OnboardingPractice.isDone takes typedWithHex (the words Hex's keyboard was up for, never more than the field holds) in place of the field's word count; wordsAdded works out a change's new words. - Text that arrives while Hex's keyboard is off screen shows "That came from iOS dictation or another keyboard, not Hex. Tap the Hex key on Hex's keyboard." and the practice doesn't finish; Hex's own input clears it, as does emptying the field. Only with Full Access (without it the Full Access note shows). zh-Hans string added; README. - Unchanged: a dictation Hex's keyboard inserted (lastInsertedResultID) still finishes it at once, and snapshot fixtures count their text. Verified (anomastudio, ad-hoc signed Debug build, iPhone 17 Pro iOS 27.2, practice reached from first launch): - Before: "See you at" typed on Apple's keyboard showed "That's Hex". - After: the same text keeps "Your turn" and shows the note; switching to Hex and typing "we" clears the note and still isn't done; "go now" with Hex's keys shows "That's Hex". - Tapping iOS's mic under Hex's keyboard takes Hex's keyboard off screen (the simulator has no microphone, so iOS's dictation inserted nothing). - xcodebuild test (both changes): 620 passed, 1 skipped, 0 failures. Not verified on a physical iPhone. |
||
|
|
0e7a1030a9 |
iOS: hold the bar to dictate, Learn how I type on, a plain centred Paste, and typing logs off (#2210)
* iOS: hold an empty part of the top bar to dictate A tester found the Hex key (44 pt, in the strip) too small to hit quickly. A still hold of 0.4 s (Apple's long press) anywhere on the bar with no word under it now dictates exactly as holding the Hex key does: hold to talk, release to finish. It reuses the Hex key's own path: a HexKeyGesture fed by FullKeyboardView's touches, then the key's press (in-keyboard dictation arms) and hexKeyHeld / hexKeyReleased, so without Full Access it shows the Full Access hint, and a hold that can only open Hex opens Hex, as the key does. The empty space is every touch nothing else takes in the bar: empty slots (their buttons take no touches), the strip around Paste, Undo or a status, the gaps beside the Hex key, and a bar with no suggestions. A word's slot keeps its tap and its hold (Add to vocabulary, #2205). A tap on empty space does nothing, and a slide past 10 pt cancels the hold. No hold while the bar shows the Full Access hint or a notice, while a dictation records or transcribes, or with the emoji panel or style menu up. Typing logs name the source (bar_hold / bar_release). Verified in the iOS 27.2 simulator (iPhone 17 Pro, a UIKit host app, Hex keyboard with Full Access): holding an empty slot showed the recording panel and releasing finished it; holding a suggestion ("The") and tapping empty space did nothing; holds in the 2 pt gap left of the Hex key and past its right edge took the Hex key's path (opened Hex, as the key does once in-keyboard dictation is unavailable). On origin/dev the same hold did nothing. * iOS: Learn how I type is on by default Settings › Privacy › Learn how I type now reads on when the switch was never set (no key in the App Group: true). The toggle saves an explicit false when turned off (UserDefaults.set on change), so "off" and "never set" are distinct and nobody who turned it off is switched back on; no migration is needed. Without an App Group (no Full Access) it stays off, as there is nowhere to learn. Every reader goes through TypingJournalSettings.isEnabled, so both sides follow it: typing (TypingJournal.sharedIfEnabled in the full keyboard) and dictation (the keyboard's DictationEditInference tracking in learnsFromDictation, its learned fixes for in-keyboard dictation, and the app's DictationPipeline fixes and raw-transcript sharing in DictationController). The switch's line now says what it does: "Learns on this iPhone from your taps and the words you fix with Hex, never from what you write elsewhere" (zh-Hans added; the old line is removed from the catalog). Verified: TypingJournalLearningTests.testLearnHowITypeIsOnUntilTurnedOff (an unset switch learns, one turned off stays off and stores nothing) in the full xcodebuild test run. * iOS: the bar's Paste is plain text, centred on the keyboard The clipboard offer drew Paste as a chip (a filled background with a 15 pt corner radius, 12.5 pt medium type) and centred it in the strip's bounds, which leave out the Hex key, so it sat visibly left of the middle. Ryan wanted no chip: plain text in the bar like a suggestion word. - Paste (and Paste dictation) is now SF 17 pt regular in the bar words' ink (palette.stripText), with no background. The clipboard glyph stays, sized to the text's font (small scale), since it sits on the line beside the word. - Paste and the Next keyboard chip (or the pair in a code field) centre on the keyboard's middle, where the middle slot's word centres (KeyboardStripView.barMidX = stripBarFrame.midX in the strip's coordinates), clamped inside the strip. - Their line stays the bar's word line (textCenterY, KeyboardMetrics.stripTextCenter from #2207); the chip and line geometry of #2207 is unchanged. Verified in the iOS 27.2 simulator (iPhone 17 Pro, a copied string through simctl pbcopy): before, the chip spanned x 126-219 pt of a 402 pt keyboard (centre 172); after, glyph and word span 169-232 (centre 201, the keyboard's middle), on the same line as "The" in the middle slot. * iOS: turn Record typing logs off once for everyone The bar's "● Logging" mark shows while Settings › Privacy › Advanced › Record typing logs is on, and Ryan wants it gone. A one-time migration, TypingLogSettings.turnOffOnce, switches the setting off for anyone who has it on and records migrations.typingLogsOff.v1 in the App Group so it never runs again: turning it back on afterwards keeps it on. It runs where either process starts, the app's launch (before the simulator scenes' launch argument) and the keyboard's viewDidLoad (before any typing log session), so a keyboard updated before Hex is opened drops the mark too. The logs already recorded stay, and so does the switch in Settings. Nothing in a build turns it on: the key is set to true only by the switch's consent dialog, the simulator-only --experiment-typing-logs launch argument, and the Settings snapshot fixtures (settings-*-on scenes); no scheme, ci_scripts or Xcode Cloud step passes either, so there was no build or TestFlight default to remove. Verified: TypingLogTests.testTypingLogsTurnOffOnceAndKeepWhatTheyRecorded in the full xcodebuild test run, and in the iOS 27.2 simulator: with experiments.typingLogs set to true and the flag removed from the keyboard's defaults, showing the keyboard left it false and the flag true. |
||
|
|
56a93e80b2 |
iOS keyboard: stale microphone errors clear, Hex key audio calls leave the main thread, counts read 1, 2, 3 (#2203)
* iOS keyboard: a failure from Hex shows for seconds, not forever, and the Hex key retries it X testers on build 56 and earlier: "The keyboard keeps either bringing me back to the app or telling me another app is using the microphone" (@itsjling) and "The another app is using audio message seems inaccurate cause it's showing for me all the time although it's working fine" (@RedaSjakur). Cause, reproduced on build 56 ( |
||
|
|
b5fa4bd5a6 |
iOS: Return follows the app's return key type, and the dictation bar's does too (#2200)
Testers said many apps give Hex no Enter/Send key. The full keyboard always had a Return key, but some of its types didn't match Apple's. The dictation bar's Return was always a plain ↵, even in send, go and search fields, and it ignored enablesReturnKeyAutomatically. So in those fields the bar never looked like it could send. What changed - New ReturnKeyStyle (HEXShared/FullKeyboard/ReturnKeyStyle.swift): the symbol, the blue action style and the accessibility label for each UIReturnKeyType, as observed on Apple's iOS 27.2 keyboard (black box: simulator screenshots and axe describe-ui in a throwaway host app, one field per type). send ↑, go/join/route →, search/google/yahoo magnifier, done ✓ and emergency call (phone) are blue; return ↵, next and continue › are plain keys. - Full keyboard: uses ReturnKeyStyle. Fixes: next showed ↵ (now ›), continue was a blue → (now a plain ›), and emergency call drew the text "SOS" (now a blue phone symbol, like Apple's). The unused text-label path (returnLabel) is removed. - Off return key (enablesReturnKeyAutomatically and an empty field) now looks like Apple's: the glyph at 10% of the label colour, on a grey key (191,192,197; white 0.39 on dark) for the acting types, instead of the darker muted grey. - Dictation bar: its Return key uses the same style (blue send/go/search, disabled while the host asks and the field is empty) and still inserts "\n". Its accessibility label comes from ReturnKeyStyle; "SOS" becomes "Emergency call". - New zh-Hans strings: Return, Send, Go, Join, Route, Search, Next, Emergency call (Done and Continue already existed). Why some apps had no Enter/send: on the full keyboard, Return is present for every text keyboard type. Number pads hand off to Apple's keypad, which has no Return either. Apps such as Messages use the default return type and send from their own button, and Apple's keyboard also shows ↵ there. The gap was the dictation bar's Return, which was always a grey ↵. Verified (Mac Studio, iPhone 17 Pro sim, iOS 27.2) - Apple vs Hex screenshots for every UIReturnKeyType, light and dark, plus empty fields with enablesReturnKeyAutomatically: the full keyboard matches. - Dictation bar, live in a host app: send, go, search, next and emergency call styles shown. Send is grey and ignores taps in an empty field, turns blue after "," is typed, turns grey again after delete, and a tap reaches the host (textFieldShouldReturn counted once). - Generic iOS build (CODE_SIGNING_ALLOWED=NO) succeeded; xcodebuild test: 581 tests, 0 failures, 1 skipped. |
||
|
|
b849b63f01 |
iOS: Multilingual model (Parakeet Ultra) experiment, off by default (#2197)
* iOS: Parakeet's preparation, compile record and load guard take a model name
A second Parakeet model (Parakeet Ultra, next commit) needs its own load guard
and compile record, and its own words while it downloads, without changing V2's.
- ParakeetLoadGuard(model:) and ParakeetCompileRecord(key:) name their
UserDefaults keys; the defaults ("parakeet.loadStartedAt",
"parakeet.loadInterrupted", "parakeet.compiledForSystem") are V2's keys as
before, so V2's state carries over.
- ParakeetLoadGuard.forget() clears an interrupted load, for a person who asks
to try again.
- ParakeetPreparationProgress takes the download's detail, defaulting to V2's
"Downloading the speech model".
- ParakeetProgressFeed is no longer private to ParakeetTranscriber.swift.
Nothing V2 does changes: same keys, same words, same progress.
Verified: xcodebuild test on an iPhone 17 Pro Max iOS 26.4 simulator (Mac
Studio), 575 tests, 0 failures, 1 skipped, with the next commit applied.
* iOS: Experiments › Multilingual model (Parakeet) dictates 25 languages, mixed in a sentence
A TestFlight tester (iPhone 17 Pro Max, iOS 26.6.2, build 56) asked for Parakeet
Ultra: they mix Dutch phrases and English words in one sentence, which Apple
Speech, one locale at a time, gets wrong, and Ultra on desktop Hex gets right.
The experiment is off by default. While it's on, Hex dictates Parakeet Ultra's
25 languages (Moondream's post-training of NVIDIA Parakeet TDT 0.6B v3, CC BY
4.0) with FluidInference's Core ML build of it; other languages keep the engine
Hex picks without it.
- MultilingualParakeetSettings (HEXShared, App Group): the switch, Ultra's
languages, and the rule both processes use: the language set, else the
keyboard's language Automatic follows, else the iPhone's first, on iPhones
with 6 GB or more.
- ParakeetUltraModel: the 18 files FluidAudio's v3 path reads, pinned to
revision 95eaa59 with sizes and SHA-256 (632 MB), downloaded into
Application Support (out of backups) with Range resume from a .partial and a
digest check before each file gets its name, hashed in 4 MB chunks drained
one at a time (without that the encoder's 594 MB stayed in memory during the
check). FluidAudio 0.15.5 has no .ultra (0.17.7 added it) and its loader
replaces a folder it can't load with v3's download, so Hex loads the four
models itself and hands FluidAudio v3 AsrModels. The pin stays at 0.15.5, so
V2 and everything else run the same FluidAudio as before.
- ParakeetUltraTranscriber: download through StallWatch (90 s, as V2), stopped
if the switch goes off mid-way; load and transcribe as V2. Chosen only with
1.5 GB left (os_proc_available_memory), as #2190 does for V2, and set aside
after a load that ended Hex or found too little memory (its own
ParakeetLoadGuard keys) until the switch is turned off and on; then home says
Hex uses its usual model.
- Engine choice: DictationController.defaultTranscriber and prepareAtLaunch ask
for Ultra first; with the switch off they only delete a download it left.
multilingualParakeetChanged prepares the new engine now, or after the
dictation in flight. Download failures count as interruptions, retried once
back in the foreground.
- Keyboard: the model can't load in a keyboard, so while Ultra takes the
dictation language, Dictate and the Hex key open Hex, as before iOS 26
(KeyboardViewController), and KeyboardSpeechPreparation follows the app
instead of downloading Apple's model. A warm session still dictates without
leaving the app.
- Settings › Experiments › "Multilingual model (Parakeet)": "25 languages,
even mixed in a sentence. 632.2 MB download. Keyboard dictation opens Hex.",
disabled with "Needs an iPhone with 6 GB of memory or more" below that. On
downloads it; off deletes it. The preparation bar (#2171) says "Downloading
632.2 MB · Wi-Fi recommended". zh-Hans for every new string.
- Acknowledgements and ios/README.md credit Parakeet Ultra, NVIDIA Parakeet TDT
0.6B v3 and FluidInference's conversion (CC BY 4.0).
- Onboarding's language line checks for "Parakeet V2" by name, not any
"Parakeet", so Ultra isn't taken for English.
Measured on the Mac Studio (~/dev/experiments/2026-11-21-hex-multilingual-parakeet,
159 macOS say clips: Dutch-English sentences spoken by Xander and Ellen and
spliced with Samantha, pure Dutch, pure English): word error rate on the mixed
sentences 7.5% for Ultra against 26.9% for Apple Speech nl-NL
(DictationTranscriber) and ~80% for Apple Speech en-US and Parakeet V2; pure
Dutch 0.9% (Apple nl-NL 0.4%), pure English 0% (Apple en-US 0%). Core ML on the
Mac: compile 7.4 s (V2 11.4 s), same speed as V2.
Verified: xcodebuild test on an iPhone 17 Pro Max iOS 26.4 simulator, 575
tests, 0 failures, 1 skipped, with new cases in DictationControllerTests (off
by default, language and memory rules, separate guard, download words, pinned
files, re-prepare on toggle). In that simulator a fresh install with the switch
on downloaded, checked and loaded Ultra in under 10 s and became ready, and the
app's ParakeetUltraTranscriber transcribed the test clips (a throwaway case,
not committed). The simulator has no microphone here and runs Core ML on the
CPU: a real iPhone must confirm load memory, Neural Engine compile time, speed,
the keyboard opening Hex, and dictation of real speech.
* iOS: Acknowledgements credit Parakeet V2
Hex downloads NVIDIA Parakeet TDT 0.6B v2 (FluidInference's Core ML conversion)
to dictate English, and its licence, CC BY 4.0, asks for credit, but
Settings › Acknowledgements and the README named only the data Hex ships and,
since the previous commit, Parakeet Ultra.
- AcknowledgementsView and ios/README.md's Acknowledgements credit NVIDIA's
model and FluidInference's conversion, both CC BY 4.0, with links, and say
the conversion stores the encoder at reduced precision and Hex uses it
unchanged.
FluidAudio stays at 0.15.5.
Verified: generic build (CODE_SIGNING_ALLOWED=NO) and xcodebuild test on an
iPhone 17 Pro Max simulator on the Mac Studio, all tests passing.
|
||
|
|
2863cd6507 |
iOS: delete keeps an autocorrection and the strip offers the revert, smart quotes, a two-way trackpad, and key clicks (#2192)
* iOS: delete after an autocorrection takes only its space, and the strip offers what you typed
X tester Brandon McConnell (and a TestFlight tester about text replacements, fixed in
uncorrected version." Apple's keyboard doesn't (black box, iOS 27.2 simulator, a
UITextView): after "becuase " became "Because ", delete took only the space and the text
view showed "Becuase" with an undo arrow; space then kept "Because ", a letter continued
the word, a second delete took a letter, a comma went like a space, tapping the bubble put
"Becuase" back without the space, and deleting back to the word later brought the bubble
back. Revisions ("well see " -> "We'll see ", bubble "Well see") and splits ("ofthe" ->
"Of the", bubble "Ofthe") work the same.
Removed: Hex's deliberate "one backspace undoes the correction" (FullKeyboardEngine.
deleteBackward's undo branch and AutocorrectEngine's pending undo, consumed by the next
delete). Replaced by:
- AutocorrectEngine.lastCorrection keeps the latest autocorrection with what was typed,
what went in and an anchor (the text before the cursor right after it); it is offered
while the text before the cursor reads that again (its last 64 characters for long
text), and forgotten on a new field, a new language or a newer correction. The many
clearPendingUndo calls after other input are gone: the anchor check covers them.
- KeyboardSuggestion.Kind.revert: the strip's left slot shows it in place of the word as
it reads, pill-highlighted with Apple's undo arrow (a keyboard can't draw a bubble in
the host's text). Tapping it puts back what was typed, suppresses the fix for the
session, and counts as an undone autocorrection for Learn how I type and Adaptive touch
(whose word taps the delete of the space now keeps for it). Typing logs: autocorrect_undo
with src strip, context why revert.
- Merges, splits and #2144's revisions go through the same record.
- deleteBackward's allowAutocorrectUndo is now takesSwipeBack: it only gates a swipe's
whole-word delete, which stays.
Verified on the Studio (iPhone 17, iOS 27.2 simulator): AutocorrectEngineTests,
FullKeyboardEngineTests and TypingLogTests pass (updated: the keep loop, the revision,
the edge-space join, punctuation and Adaptive touch tests now revert from the strip; new:
testDeleteAfterAnAutocorrectionTakesOnlyItsSpaceAsOnApplesKeyboard with the black-box
cases).
* iOS: smart quotes and dashes as the system keyboard types them, per language
X tester Brandon McConnell: "no smart quotes/etc." Hex typed straight quotes and two
hyphens everywhere. Apple's keyboard (black box, iOS 27.2 simulator, a UITextView with
each trait on and off, a text field, Messages, and 15 of its keyboards):
- ' and " open at the start, after a space or new line, a bracket or an opening quote,
and close elsewhere: 'hi' it's "yes" ("ok") 5'9" became ‘Hi’ it’s “yes” (“ok”) 5’9”.
- A second hyphen makes an em dash (a--b is a—b, a third stays a hyphen, delete takes
the dash whole); " - " stays.
- Autocorrect's apostrophes are ’ (Don’t, I’ll), and the strip shows I’m.
- smartQuotesType or smartDashesType .no turns each off; Messages' composer types
straight quotes and -- (both off there).
- Quotes per keyboard: „ “ ‚ ‘ in German and Swiss German (the apostrophe key types ‘
even inside a word), « » with no-break spaces inside in French, Canadian and Swiss
French, „ ” ‚ ’ in Polish, « » in Norwegian, Russian and Ukrainian, “ ” ‘ ’ in English,
Spanish, Italian, Portuguese and Romanian. Serbian (no simulator keyboard) gets the
English ones.
- smartInsertDeleteType changed nothing it types: after a picked suggestion, , . ! ? ;
: ) took the suggestion's space ("Hello,") with it on or off; " ( @ kept it, and so did
a space typed by hand ("Hello .").
Hex now does the same:
- SmartPunctuation.swift: SmartQuotes per KeyboardLanguage, curled() for typed keys and
for autocorrect, suggestion, swipe and revert text, the em dash in typeIntoField, and
the strip's apostrophes (displayed). Accent picks, emoji and text replacements go in as
they are. KeyboardTextTarget gains smartQuotesType and smartDashesType (the proxy's;
nil, off, for fixtures); .default counts as on, Smart Punctuation's default, which a
keyboard can't read.
- The keys still reason with straight quotes: FullKeyboardEngine reads textBefore, the
field's text with curly quotes made straight one for one (SmartPunctuation.plain), so
tokens, revisions, reverts and swipes keep matching what they typed.
- dropsSuggestionSpace: , . ! ? ; : ) right after a picked suggestion delete its space.
- AutocorrectEngine.midSentenceMarks gains ' (what ’ reads as now).
Verified on the Studio (iPhone 17, iOS 27.2 simulator): AutocorrectEngineTests,
FullKeyboardEngineTests, TypingLogTests and EmojiSuggesterTests pass, with new
testSmartQuotesAndDashesFollowTheFieldAsOnApplesKeyboard, testSmartQuotesFollowTheKeysLanguage
and testMarksGoAgainstAPickedSuggestion. Live in the simulator's HEXKeyboard (Release, App
Group) in a UITextView host: 'hi' it's "yes" well--known dont typed ‘hi’ it’s “yes”
well—known don’t, straight quotes with smartQuotesType .no, well--known with smartDashesType
.no, and the strip showed I’m.
* iOS: the space-bar trackpad moves up and down lines, as the system keyboard's does
X tester Brandon McConnell: "holding down on the space bar only allows scrubbing
horizontally, whereas Apple's keyboard treats it like a cursor on both x/y axes".
Apple's (black box, iOS 27.2 simulator, iPhone 17, a UITextView with 17 pt text and
20.3 pt lines, the caret read back from the host): after the hold, the caret moved a line
every 15 to 16 pt of finger travel up or down, the first after about 8 (crossings at 9,
24, 39, 54, 72 and 87 pt both ways), kept its x, and stayed on the first or last line
past them; in a wrapped paragraph it moved by a wrapped line (about 43 characters in a
360 pt line). Along a line it moved about a character per 6 pt and stopped at the line's
ends.
A keyboard can only move the cursor by characters (adjustTextPosition), so
TrackpadCursor works out the line before or after from the text the field shares around
the cursor: lines split at new lines and every lineLength characters (the keyboard's
width less 40 pt, at 8.2 pt a character, as the field's width and font can't be read),
at the same column, kept across short lines until a move along the line. Vertical steps
are trackpadPointsPerLine (15.5 pt), the first half as far; past the first or last line
the cursor stays and coming back moves it at once. Horizontal movement is unchanged (7.5 pt
a character, crossing line ends as before).
The host's context lags the moves: in the simulator a second line up read the text from
before the first, and after a move the host shared only the cursor's own line. So each
gesture keeps a copy of the text (TrackpadCursor.State) and adds the host's context once it
has caught up (it reads the same either side of the cursor). Lines the host never shares
stay out of reach. KeyboardTextTarget gains documentContextAfterInput.
Not done: Apple's tap with a second finger while holding space starts a selection. The
iOS 27.2 SDK's UITextDocumentProxy has documentContextBeforeInput/AfterInput, selectedText
(read-only), documentInputMode, documentIdentifier, adjustTextPosition(byCharacterOffset:),
setMarkedText(_:selectedRange:) and unmarkText, and UIInputViewController nothing more: no
public API makes or extends a selection, and marked text would type provisional text into
the field, so Hex doesn't fake it.
TrackpadCursor is surface-independent so the dictation bar's trackpad (#2180) can use it
too; it isn't wired there here.
Verified on the Studio (iPhone 17, iOS 27.2 simulator): FullKeyboardEngineTests (new
testTheSpaceBarTrackpadMovesUpAndDownLines), AutocorrectEngineTests and EmojiSuggesterTests
pass. Live in the simulator's HEXKeyboard (Release) in a UITextView with four lines: from
the end, holding space and sliding up moved the cursor 88 -> 64 -> 41 -> 20 (each line up,
same column), further up kept it on the first line, and sliding back down returned it 41 ->
64 -> 88; nothing was typed.
* iOS: key clicks: the keyboard's input view adopts UIInputViewAudioFeedback
TestFlight: "Cannot hear the iOS typing sound when using your keyboard. Need the clicky
sound for my dopamine pls."
Hex already called UIDevice.playInputClick() on every key's touch-down, but the
UIInputViewAudioFeedback conformance sat on FullKeyboardView, a subview; UIKit plays the
click only for the input view itself. In the iOS 27.2 simulator's keyboard log, typing
"abc" and a delete reached AudioServices' system sound 1104 0 times with the old view and
4 times (one per press) with the new one.
- KeyboardInputView (HEXKeyboard): a UIInputView adopting UIInputViewAudioFeedback, with
enableInputClicksWhenVisible true. KeyboardViewController.loadView keeps UIKit's own input
view's style, size and sizing flags but makes it this class; nothing else in the
controller's lifecycle changes.
- Removed: FullKeyboardView's UIInputViewAudioFeedback conformance, which did nothing.
keyFeedback plays the click first, through a playInputClick seam tests count.
- The dictation bar's key feedback clicks too.
- One click for every key (delete, shift, 123 and return included, and each delete repeat):
Apple's keyboard plays other sounds for delete and the modifier keys, but the click is the
only keyboard sound the API offers a keyboard.
- No setting: the click follows Settings › Sounds & Haptics › Keyboard Feedback › Sound
(in the simulator, keyboard-audio NO in com.apple.preferences.sounds made it play none).
Apple's custom keyboard guide lists playing keyboard clicks among the things that need
open access; the simulator played it with the keyboard's Full Access rows removed too, so
Hex calls it either way and iOS decides.
Verified on the Studio (iPhone 17, iOS 27.2 simulator): FullKeyboardEngineTests (new
testEveryKeyClicksOnTouchDown) and HexKeyGestureTests pass; the Release HEXKeyboard
launched, laid out and typed as before in a UITextView host, with the click counts above.
A real iPhone must confirm the sound itself, with Full Access on and off.
|
||
|
|
a0a7da5ef8 |
ios: learn each language separately (experiment) (#2188)
* ios: learn each language separately (experiment) * ios: split KeyboardSurface under the file cap * ios: per-language learning review fixes |
||
|
|
c0f15f7689 |
iOS keyboard: nothing heavy before the keys' first frame (#2185)
TestFlight build 56 (AD4gTl68aP78, iPhone 15 Pro Max, iOS 27.2): switching to Hex showed only empty panels, then iOS went back to the previous keyboard. Until a keyboard's first frame iOS shows an empty panel, and it drops a keyboard that is slow to draw or ends while starting. The keyboard did device-only blocking work on that path: - viewDidLoad called AVAudioSession setAllowHapticsAndSystemSoundsDuringRecording synchronously on the main thread (an audio-server round trip). It now runs once per process on KeyboardLocalDictation's audio-session queue, before any dictation's session work on that same serial queue. - viewDidAppear queued the text checker warm-up, Apple Speech's language listing and the capture page's WKWebView with DispatchQueue.main.async, which the run loop can service before the first Core Animation commit. They now run from KeyboardLaunchWork: the text checker and lexicon 0.3 s after appearing, then the optional work (Speech and Translation language lists, capture page) at 0.6 s, only while iOS reports 32 MB of headroom (or none, as in the simulator) and never after a memory warning. Both are cancelled when the keyboard hides. Translation's language list no longer starts from viewDidLoad's first bridge sync. Not reproduced in the iOS 27.2 simulator on |
||
|
|
83717ce6a2 |
iOS: remove and add dictation languages from the keyboard, and a space-bar cursor on the Dictation bar (#2180)
* iOS: remove and add dictation languages right in the keyboard A TestFlight tester (build 56, iPhone 17 Pro, iOS 26.7.2) couldn't take a recognition language off the keyboard's switch, and a new one only showed up after picking it in Hex. - A long press on a language (a dictation bar chip, or a row on the Hex key menu's Language page) shows Remove. Removing takes it out of the recents and keeps it off while it is one of the iPhone's own languages (settings.dictationLanguage.removed); the one set goes back to Automatic. Picking it again brings it back. - Settings › Dictation language has Remove from keyboard for the same list. - More languages… lists every other language Apple Speech has, the iPhone's preferred ones (and their other regions) first, then the rest by name. Picking one adds it. In the dictation bar the list takes the keys' place; on the Hex key menu it is a scrolling page. - The switch now shows while More languages has anything, so removing every language never hides the way to add one back. - Automatic is unchanged and still follows the keyboard's language (#2164). - zh-Hans for Auto, More languages…, Remove and Remove from keyboard. DictationLanguageSwitch.choices takes a removed list (the one set always shows); LanguageSettings.keyboardLanguageChoices builds the list for the keyboard and Settings alike. Verified: xcodebuild test on an iPhone 17 Pro simulator (iOS 26.4), 517 tests, 0 failures, including two new cases in KeyboardBridgeTests. Live in the simulator's real HEXKeyboard with AXe: removed and added languages from the dictation bar, the full keyboard's Hex key menu and Settings, checking the App Group each time; snapshot scenes in English and Chinese, light and dark. * iOS: the dictation bar's space bar moves the cursor A TestFlight tester (build 56) found that long-pressing space on the Dictation bar keyboard couldn't drag the cursor, as the full keyboard's and Apple's can. The bar's space key (KeyboardSurface's TrackpadSpaceKey, replacing its Button) is now the full keyboard's trackpad, with FullKeyboardEngine's own constants: a hold of trackpadHoldDelay (0.35 s since #2178) or a slide of trackpadActivationDistance (10 pt) starts it, and each trackpadPointsPerCharacter (7.5 pt) moves the cursor a character through adjustTextPosition, with a selection haptic per step (Settings › Keyboard › Haptics, Full Access) and a "cursor" typing-log line. The bar's glyphs blank while it slides, as the full keyboard's do: a 0.12 s fade, at once under Reduce Motion. Letting go of a trackpad types nothing; a tap still types a space, and a cancelled touch types nothing. VoiceOver still activates it as a button that types a space. Verified: xcodebuild test on an iPhone 17 Pro simulator (iOS 26.4), all passing. Live in the simulator's HEXKeyboard with AXe on "Running 10 min late, ": a tap typed a space; a slide moved the cursor left (a comma then landed after "min") with no space typed; a 0.9 s hold then a slide moved it right; the screenshot mid-slide shows the blank keys. |
||
|
|
d23acdf8ca |
iOS: dictation picks the car's mic in CarPlay, and a warm session never holds call audio (#2179)
Settings › Dictation › Microphone (Automatic, iPhone, Bluetooth) replaces the Always use iPhone microphone switch. In a car the old default recorded from the iPhone, often in a cupholder hearing the speakers and the road, while the car's microphone sat unused; Hex's own recording mixes, so the car went on playing over it. Automatic (the default) now records from a wired or USB headset's microphone, from the car's in CarPlay (the driver's microphone Siri uses), else from the iPhone's, so AirPods and other Bluetooth headphones keep playing at full quality and nothing waits for call audio. iPhone is the old default; Bluetooth also takes Bluetooth hands-free microphones (AirPods, Bluetooth car kits, which iOS can't tell from headphones). The stored switch migrates: left on reads as Automatic, turned off as Bluetooth. Changed behaviour: - The input is always set explicitly (MicrophoneRoute). Before, Bluetooth mode set no preferred input, so an iPhone preference set earlier in the same session stuck, and Automatic-style CarPlay/wired choices didn't exist. - The warm keepalive stays on the iPhone's microphone without HFP whatever the choice. Before, with the switch off, it took the headset's or car's hands-free microphone for the whole warm session (up to an hour of call audio). A dictation moves to its input as it starts; a new route device re-pins the keepalive in every mode, not only with Bluetooth allowed. - In-keyboard dictation asks WebKit for the same input by its label (getUserMedia deviceId), read from the keyboard's own session. Before, with the switch off it asked for nothing, and WebKit takes the input of the route already playing, the iPhone's while a car or headphones play over A2DP, so the switch had no effect there. The probe log now lists the inputs offered and the one chosen. Kept: mixWithOthers, no preferred sample rate, RetiredRecorders, keepalive backoff, and the keyboard's resume request after WebKit's capture. Verified: xcodebuild test on an iPhone 18 Pro simulator (iOS 27.2) on the Mac Studio, 519 tests, 0 failures (1 opt-in skip), including new cases for each choice on each route (CarPlay, AirPods, Bluetooth car kit, wired headset, nothing), the keepalive's input, HFP only for Bluetooth, the migration and the controller passing its choice to the capture. Settings row rendered in English and Simplified Chinese. The simulator has no Bluetooth or CarPlay: the route behaviour itself is unverified on an iPhone. |
||
|
|
9ca17141d6 |
iOS: the full keyboard matches the system keyboard one to one (#2178)
* iOS keyboard: key haptic fires on touch-down before the key's work, as a crisp tick
Adam (build 56) said the haptics feel weird. In KeyboardKeyPlaneView.began the
haptic and click came after engine.touchBegan, which for a fast typist first
commits the rolled-over key (autocorrect, suggestions) or deletes, so the tick
could trail the finger by tens of ms. The plane now asks the engine which key
kind the finger lands on (new FullKeyboardEngine.keyKind(at:), a pure hit test)
and fires onKeyDown before any typing; delete's repeat still ticks per step.
The tick itself is now a rigid impact at 0.6 (FullKeyboardView.keyTickStyle /
keyTickIntensity, shared with the dictation bar) instead of light at 0.65:
Apple's key haptic is a light, crisp tick and rigid is the sharpest impact
style. The Hex key's hold and menu keep the fuller light thud. The haptic now
fires before UIDevice.playInputClick rather than after it.
KeyboardViewController reads Settings > Keyboard > Haptics on each bridge sync
(appear and poll) instead of building FullKeyboardSettings on every key press.
Verified: new FullKeyboardEngineTests.testKeyFeedbackFiresOnceOnTouchDownBeforeTheKeyTypes
(rollover ticks before either letter types; space, delete, shift, return and
123 tick once each on the way down; lifting never ticks) and the existing
testEveryLayoutAsksForTheSameKeyHaptics; full HEXMobileTests 383 run, 0 failed
(iPhone 17 sim, iOS 27.2). The simulator has no Taptic Engine: style and
intensity need a real iPhone.
* iOS keyboard: Apple's 43 pt keys on a 54 pt row pitch, so rows sit where fingers expect
Black-box measurement beside Apple's keyboard in the same Messages field
(iPhone 17 simulator, iOS 27.2): Apple's keycaps are 43.0 pt tall on a 54 pt
pitch (rows at 598/652/706/760 pt on screen); Hex drew iOS 26's 45 pt on
56 pt, rows at 581/637/693/749. Hex's hit borders therefore sat 12 to 21 pt
above Apple's on screen, so taps aimed by Apple-trained thumbs landed low on
Hex's keys and crossed into the row below ("the hit box is super weird").
iPhone portrait is now 43 pt keys, 11 pt gaps, 5 pt under row 4 (262 pt, was
270): rows sit 9 pt above Apple's everywhere and borders within 6 to 9 pt.
Row 4 can't go lower: a third-party keyboard's view ends 4 pt above Apple's
row 4 bottom, and dropping the 5 pt margin cost low space-bar taps (held-out
benchmark EN 5.94% -> 6.19% WER). The Duo's cover screen keeps its measured
45 pt on 56 pt. Hit frames still tile the key area (gaps split at their
middles, edge keys to the screen edges), which matched Apple's base borders.
Verified: held-out tap benchmark (2,000 sentences each, Spatial on) EN 824
edits before and after (5.9409%); ES 1,145 -> 1,146 (one sentence better, one
worse, both from the fixed 5 pt next-letter reach). KeyboardLayoutTests updated
for 262 pt and the 54 pt pitch; HEXMobileTests 383 run, 0 failed.
Rebased on #2146: Adaptive touch's contexts now key on the key height and row
pitch too (AdaptiveTouchGeometry), so offsets learned on Hex's 45 pt keys on a
56 pt pitch, in keycap units, aren't read on these rows. A key plane with the
same rows keeps its profile, as before.
* iOS keyboard: the key plane matches Apple's, key for key, on every iPhone
Measured from screenshots beside Apple's keyboard in the same Messages field
(iOS 27.2 simulators: iPhone 17 Pro, 17e, Air, 17 Pro Max, SE 3rd gen; light and
dark; letters, shifted, numbers and symbols pages), black box only.
Geometry (KeyboardLayout):
- Key height and row pitch follow the screen (KeyboardPhoneSize): 43 pt on 54 pt
on 844-874 pt iPhones, 45 on 56 on the Air and Pro Max, 42 on 54 on the SE.
Hex drew 45 on 56 everywhere, rows 11-17 pt above Apple's. Rows now sit on
Apple's lines. On 390/402 pt iPhones Apple's row 4 ends 4 pt below where a
third-party keyboard's view ends (touches below y 799 never reach Hex), so
Hex's row 4 keeps Apple's top edge and is 39 pt tall (bottomRowTrim); its
labels are centred as on Apple's 43 pt row.
- The SE's keys start 6.5 pt in, as Apple's (Hex used 4.5).
- Shift, delete, #+= and 123 are 1.227 pitches less 3 pt (fits all five
iPhones within a pixel; a fixed 1.34 letters was 0.5 pt narrow on the 17 Pro).
- The portrait bottom row stands on row 3's columns: 123 (and emoji, or the
globe) end at z's right edge, space runs x to n, return m to the edge. With no
emoji key 123 fills that block, which is what Apple's own keyboard does with
the Emoji keyboard removed; on the SE Apple's row matches with dictation off.
- Apple's emoji key takes taps only 6 pt inside its sides and 7.5 pt below its
top, the margins typing nothing (mapped by tapping); Hex's emoji key does the
same (Erick hit it by accident).
- Keycaps are pixel-aligned and the corner radius is 7.9 pt (same corner fit as
Apple's, 8.1 by the measuring tool; Hex's 8.5 measured 8.7).
Labels (KeyboardKeyPlaneView), fitted against labels rendered offscreen at known
sizes: lowercase 24.5 pt (was 22.5), capitals 21 pt weight 0.12, digits and
symbols 21.5 pt weight 0.08 with case-sensitive forms, a few symbols at their
own sizes, 123/ABC 17.75 pt, #+= 12.25 pt, shift/delete/return/globe symbols
19 pt; the quote keys show " and ' curly as Apple's (they still type straight).
Result: every keycap edge on every iPhone, page and appearance within 0.00 pt
of Apple's (except row 4's bottom on 390/402 pt and the emoji-less 123);
label boxes within 1 pt (median 0.34 pt), ink within 2% (median), except ^, <
and > on the symbols page (different shapes).
Held-out tap benchmark (2,000 sentences each, taps aimed at Hex's own keys):
EN 5.94% -> 6.41% WER, ES 8.61% -> 9.32%: low space-bar taps now fall below the
view's bottom edge (19.5 pt below the space bar's centre instead of 27.5).
With taps aimed where Apple's keys are (a user used to Apple's keyboard):
EN 21.34% -> 6.97%, ES 23.45% -> 10.04%.
KeyboardLayoutTests updated to the measured numbers (heights 253/260/272,
54/56 pt pitch, shift and delete edges, SE inset, bottom-row columns, emoji
target, tiling with the emoji margins); HEXMobileTests 385 run, 0 failed.
Rebased on #2142: the emoji panel's bar sits from keysBottom, so on these
iPhones it now reaches the panel's bottom edge as row 4 does.
testTheBarsKeysTakeTheWholeBandUnderTheGrid skips its probes below the panel,
where nothing can be hit.
Rebased on #2172: Dvorak's letters size from this shift width
(dvorakLetterWidth reads modifierWidth), so its row 3 of shift and nine letters
still fills edge to edge. Its rows take these heights and pitch like every
layout's.
* iOS keyboard: Settings > Keyboard > Strength for key haptics, Medium by default
Testers on X said Hex's key haptic is too weak beside Apple's keyboard (Tareq:
"add an option to adjust the haptic feedback strength", Erick: "not nearly as
nice as apple keyboard"). The tick was a light impact at 0.65 (0d4f78e5 made it
rigid 0.6).
- KeyHapticStrength (light, medium, strong) in the App Group, read on each
bridge sync (FullKeyboardSettings.hapticStrength, default medium).
- Light is a rigid impact at 0.5, Medium (meant to feel like Apple's crisp
tick) rigid at 0.8, Strong a medium impact at 1.0. The full keyboard and the
dictation bar use the same mapping (FullKeyboardView.keyTickStyle/Intensity).
- Settings > Keyboard shows Strength (Light | Medium | Strong) under Haptics
while Haptics is on, with zh-Hans strings (强度, 轻, 中, 强).
Verified: HEXMobileTests 385 run, 0 failed; the Settings page renders the row
in English and zh-Hans (simulator scene settings-keyboard-end). The simulator
has no Taptic Engine: which intensity matches Apple's tick needs a real iPhone.
* iOS keyboard: the Duo folded matches Apple's keys, and a tester fixture follows the new rows
The Duo folded (iPhone Duo simulator, iOS 27.2 iPhone19-4 runtime, cover screen,
Hex beside Apple's keyboard in Messages; Ethan on X: "a tiny bit off"):
- Apple's row 4 ends 7 pt above the keyboard's bottom; Hex's ended 5 pt above, so
every Hex row sat 2 pt low. keysBottom is 7 folded and upright (the strip stays
the top bar's 32 + 8 pt).
- Apple's keys start 6.67 pt from the screen's side, a third of a point outside
the 452 pt view a third-party keyboard gets; Hex's started 8.0 pt in (a 1 pt
minimum inset). The inset may now be 0, so Hex's keys run to the view's edges.
- Apple's keycaps round about 9.8 pt there (Hex drew 7.9).
- Row 4 stands on the letter columns, as Apple's does folded: 123, globe and
emoji one key wide on q, w and e, space from r, return from l's column. Apple
puts dictation on m's column; Hex has none, so its space bar runs on (a Hex key
right of space takes that slot).
Result: rows on the same y as Apple's, every edge within 0.67 pt (the view's
edge), corners 10.2 vs 10.1 by the same measuring tool. Not measured unfolded
(no unfold tool on the Studio); the unfolded metrics are unchanged.
testTheTestersSentenceComesOutRightWithSpatialAutocorrect (from origin/dev) placed
its taps on the old 45 pt rows on a 56 pt pitch, down to y 242 where row 4 now
ends at 236, so low space taps fell off the keys. Each tap now sits at the same
spot on today's row; the expected sentence is unchanged.
KeyboardLayoutTests: the cover's Apple edge is 6.67 pt, and the bounds checks
allow 0.001 pt of rounding now that keys can touch the view's edge.
Verified: HEXMobileTests all passing (iPhone 17 sim, iOS 27.2); Duo cover
screenshots measured as above.
* iOS keyboard: turned, the keys match Apple's on every iPhone
Measured turned beside Apple's keyboard in the same Messages field (iOS 27.2
simulators: iPhone 17e, 17 Pro, Air, 17 Pro Max, SE), black box:
- Apple's keys are 32 pt on a 40 pt pitch with 2 pt under row 4 on every iPhone
(4 pt on the SE), corners 7.9 pt. Hex drew iOS 26's 27.5 pt on 35.5 pt with
3 pt under, every row 2 to 17 pt below Apple's. The strip stays the top bar's
42 + 8 pt; the keyboard is 204 pt (was 187).
- Row 4 stands on row 1's columns: 123 on q, emoji (or the globe) on w, space
from e to i, return from o to p (KeyboardMetrics.bottomRowReturnColumn, which
the Duo folded now shares with its own 8.5).
- Shift, delete, #+= and 123 on row 3 are 1.33 letters wide turned (the portrait
rule left them 2.3 pt narrow).
- The SE sets its keys 72 pt in from each side, 47 pt wide; Hex's ran 4 pt from
the edges, 60.5 pt wide.
Result: every keycap edge on the five iPhones within 0.5 pt of Apple's turned
(0.00 on all but the SE's delete, 0.5). Apple's SE reaches emoji through the globe
and shows no emoji key turned; Hex keeps its emoji key after the globe, so the
SE's space bar starts one key later. Not measured: the Duo turned (its cover
screen doesn't rotate in the simulator); it follows the iPhone.
Verified: KeyboardLayoutTests (heights 204 and 198 turned, new
testLandscapeMatchesApplesKeys); turned screenshots on all five iPhones.
* iOS keyboard: turned labels and held keys look like Apple's
Black box, beside Apple's keyboard in the same field (iOS 27.2 simulators):
Turned labels (17e, 17 Pro, SE; fitted against labels rendered offscreen at
known sizes and weights): letters, digits and symbols are about 0.875 of their
portrait sizes (lowercase 21.5 pt, capitals and symbols 18.75 pt a little
heavier), with per-symbol sizes where Apple's differ (. , : _ # * • and others);
123 15.5 pt, ABC 17.75 pt, #+= 12.25 pt; shift, delete and return symbols 18 to
18.5 pt (Hex drew 15.5 to 16), and the emoji key's face semibold, as Apple's.
Hex drew 18 and 19 pt labels, about 14% lighter than Apple's. Now each label's
box is within 1 to 1.25 pt of Apple's and its ink within 1% (median) on the 17e
and SE turned.
Held keys: Apple paints a held key one of three greys. A letter under its pop-up
222 (105 dark), which Hex already drew for every key; shift, delete, globe, emoji
and return 197, 197, 201 (131 dark); the space bar 242, 242, 247 (56 dark). 123
and ABC switch the page as they go down and aren't shaded. FullKeyboardPalette
gains keyHeldFill, functionHeldFill and spaceHeldFill; every held key now
measures within 1 grey level of Apple's in light and dark (17e).
Checked, nothing to change: keycaps have no shadow, edge highlight or inner
stroke on Apple's keys (letter or function, light or dark); the fill meets the
panel in one anti-aliased pixel, as Hex's does, and a 32 x 32 px corner differs
by at most 6/255. The keys draw over #2139's opaque backdrop.
Verified: HEXMobileTests passing; screenshots above on the simulators.
* Draw iOS 27's floating key pop-up and let it linger after lift
What: the key pop-up is now iOS 27's bubble: a rounded rectangle (radius 12)
23.33 pt wider than the key and 65 pt tall, floating 3.5 pt above it, with no
border or stem. The letter is 36.5 pt in either case; digits and symbols use the
key's own style scaled 1.5x. The dark bubble shades from 63 to 85 grey, and the
pressed key stays drawn grey under it. Over row 1 the bubble shrinks to the room
there is, down to 50 pt, because an extension can't draw above its view, which
Apple's can. After lift the pop-up and its grey key stay 45 ms, then go in one
frame.
Removed: iOS 26's balloon (a 46 pt bubble on an 8 pt stem that covered the key,
1 px border, 33 pt light label). Also removed: the pop-up disappearing before its
letter reached the field, and edge bubbles kept 2 pt in from the sides (now
pushed in only as far as the screen needs, as Apple's are).
Why: black-box comparison with the system keyboard on the iPhone 17e and 17 Pro
simulators (iOS 27.2), measured from screenshots and 60 fps recordings.
Verified: popups-17e-apple-vs-hex.png comparison, light and dark. On 60 fps
recordings of 120 ms taps, Hex's pop-up now leaves about 47 ms after the letter
lands (Apple about 50). Full HEXMobileTests pass.
* Match Apple's long-press accent callout: arrangement, layout, timing
What: the accent callout now looks and behaves like the system keyboard's
(iOS 27.2 simulators, every English letter, digit and symbol key held and
screenshotted):
- Arrangement: options sit where Apple puts them, the key's own selected over
the key (e: ë é [e] è ê ě ẽ ē ė ę; $: ₽ ¥ € [$] ¢ £ ₩; " « » „ “ ” ["]).
"a" gets two rows (æ ã å ā ă ą over a à á â ä ǎ). The characters stay
#2140's observed lists (KeyboardLanguage.letterHolds, symbolHolds, the
123/#+= list). AccentCatalog.arrangement only places them, and only while its
table lists exactly the same options, so a list change can't drop or invent
one. Languages without a checked arrangement open from the key toward the
middle, as before.
- Geometry: cells are the held key's width + 4 pt (36.3 on a 390 pt iPhone's
letters, 51.7 on the wide . , ? ! ' keys, 67 in landscape). Rows are 47 pt
with 10.5/10.35 pt padding and 20.8 pt corners, 3 pt above the key, kept
6.67 pt from the sides. Sliding picks by row, then by nearest cell.
- Look: the selection is a grey rounded square (227/227/230, dark 87 grey,
6.3 pt corners) behind 21.5 pt regular options, on the pop-up's bubble with no
border. The dark callout lightens toward its bottom.
- Letting go more than 57.5 pt below the key's middle closes the callout with
nothing typed (Apple: 55 pt types, 60 cancels).
- Hold delay 0.36 s: the callout replaces the pop-up about 380 ms in (Apple
382, Hex was 420).
The emoji panel's skin-tone picker passes its own cell width and keeps its
layout and drawing unchanged (AccentMenu.buildFixed, drawFixed).
Removed: the blue selected cell with white medium text, the 1 px border, the
44 pt cells and 4 pt padding, and opening every list sideways from the key with
the base at the thumb end.
Why: press-and-hold visuals should match the system keyboard one to one.
Verified: 17e simulator screenshots of Apple vs Hex holds (e with slide and
drag-off cancel, a, n, u, k, $, 0, ", ', .), light and dark, and landscape (i).
The drag-off typed nothing on both. Updated testLongPressAccentPicker... for
Apple's arrangement. Full HEXMobileTests pass apart from #2142's emoji bar band
test, fixed with the key-plane geometry it depends on.
Rebased on #2164 and #2172: the arrangement is looked up for the layout's
language and letters, as the options are (the bilingual English & Spanish
keyboard holds English's; Spanish on plain QWERTY, whose n also holds ñ, opens
its own list). testEnglishOnQWERTZTypesOnItsOwnKeys checks the selected option
is the key's own instead of the first, since Apple's y reads ÿ ŷ ý [y].
* Match Apple's key-plane micro-animations: shift press, key release, trackpad fade
What, each measured against the system keyboard from 60 fps recordings and
mid-press screenshots on the iPhone 17 Pro simulator (iOS 27.2):
- Shift: a press that turns shift on now shows nothing until lift: no shade,
outline arrow, lowercase letters (ShiftStateMachine.pressShowsOff,
FullKeyboardEngine.keycapLabel). Hex used to shade the key and show capitals on
touch-down. Shift still engages on touch-down, so a chord types a capital, and
the keycaps show capitals once a letter has been typed during the hold. Presses
that turn shift or caps lock off still shade at once, as Apple's do.
- Delete, space, return, globe and emoji stay shaded 60 ms after a tap lifts.
Apple shows them 265-284 ms for a 200 ms tap; Hex showed 200-210 and now
265-277. A delete held long enough to repeat, or used for a word swipe, lets
go at once, as Apple's does.
- Trackpad: the key labels fade out and back in, ease-out over 0.24 s (visible
change 204/198 ms against Apple's 202/200, first step 10 ms after the change,
Apple 13). The space bar unshades as it becomes the trackpad. Hex used to blank
the labels in one frame and keep the space bar shaded. Reduce Motion, or no
window, switches at once. A CADisplayLink drives the fade through a weak ticker,
only while it runs.
- Trackpad hold delay 0.4 s -> 0.35 s: it now starts 363 ms after touch-down,
as Apple's does (Hex was 417).
Unchanged, because Apple's are instant too: pop-up appear/disappear, page
switches (123/ABC/#+=), accent callout open, select and close, and caps lock.
Verified: recordings and screenshots of Apple vs Hex for shift (held from off,
from on and from caps lock), delete/space/return taps (50, 200 and 600 ms),
the trackpad, page switches and accent open. Full HEXMobileTests pass. Tap
latency is untouched (the linger and fade run after lift or after the trackpad
starts).
* Place portrait letter labels where Apple's sit, not centred by advance
What: letter keycaps (letters page, portrait) now draw each letter at its key's
middle plus Apple's measured offset for where that middle falls between whole
points: sixths of a point on 3x screens, quarters on 2x (KeyboardKeyPlaneView
drawLetter, letterNudge3x/letterNudge2x; lowercase and capitals separately).
Capitals move up a pixel (yOffset -1 -> -1.33).
Why: a TestFlight tester (build 56, iOS 27.2.1) said the letters look slightly
off-centre. Measured at native resolution against the system keyboard (iOS 27.2
simulators, ink centroid of each of the 26 letters relative to its keycap's
centre, lowercase and capitals, light and dark), Apple doesn't centre letters by
their advance as plain text does. Its offset depends on the key's position: on
the 17 Pro, keys centred on a whole point have letters 0.2-0.6 pt left of plain
centring, and keys centred on a half point have them 0.3-0.8 pt right. The same
fraction gives the same offset on the Pro Max. Hex's plain centring was therefore
0.27-0.32 pt off Apple's per letter (median; up to 0.82) on 3x screens, and
0.35/0.58 (up to 1.16) on the SE. Capitals also sat 0.27 pt (0.8 px) low on every
letter.
Removed: plain advance centring for portrait letters. Landscape letters, digits
and symbols keep it.
Verified (Apple minus Hex, ink centroids, median|max, pt):
- 17 Pro: lowercase 0.31|0.82 -> 0.09|0.49; capitals 0.27|0.63 -> 0.14|0.42
- Pro Max: lowercase 0.29|0.77 -> 0.10|0.44; capitals 0.28|0.75 -> 0.13|0.53
- Air (held out of the fit): lowercase 0.29|0.77 -> 0.10|0.44; capitals
0.28|0.75 -> 0.13|0.53
- SE (2x): lowercase 0.58|1.16 -> 0.15|0.44; capitals 0.35|0.70 -> 0.12|0.37
- Vertical, capitals on 3x: 0.27 -> 0.06.
Lowercase stays 0.13 pt low and SE capitals 0.28 low: text lands on whole
pixels, so a whole pixel would overshoot. Light and dark measure the same. Full
HEXMobileTests pass.
* Draw Apple's grinning emoji-key face instead of SF Symbols' face.smiling
What: the emoji key draws the face Apple's shows (KeyboardKeyPlaneView
drawEmojiFace): a 19 pt face (18 in landscape) with an open mouth and a band of
teeth, centred 0.67 pt above the key's middle. Light mode draws a 1.58 pt ring;
dark mode draws a solid face with the eyes and mouth cut through to the keycap
(even-odd fill). The teeth are always the light colour.
Why: the key-plane overlays showed Hex's emoji key drawing a closed smile
(face.smiling), and in landscape at 16 pt instead of Apple's 18. Apple's grinning
face isn't a public SF Symbol (face.grinning and the like don't exist), so it is
drawn from primitives sized from measurements of 3x simulator screenshots on the
17 Pro, Pro Max, Air, 17e and SE (iOS 27.2): ring, eyes 2 x 2.67 pt at
(+/-2.78, -2.13), and a mouth 12.33 pt wide, its top 0.5-1.5 pt and its bottom
6.5 pt below the centre. No Apple artwork is copied.
Removed: the face.smiling symbol on the emoji key.
Verified: zoomed Apple vs Hex crops on the 17 Pro in light, dark and landscape
match by eye; within the glyph, 5.2% (light) and 2.0% (dark) of pixels differ by
more than 64/255, mostly a one-pixel horizontal phase. Full HEXMobileTests pass.
* Lay out Spanish holds as Apple's; keep the key's own until the finger moves
What:
- Spanish callouts use the system keyboard's arrangement, read off every letter,
digit and symbol held on the iOS 27.2 Spanish keyboard
(AccentCatalog.spanishOrder). Examples: º ō œ ø õ ô ò ó [o] ö with ö to the
right of o; ū û ù ü ú [u]; l·l [l]; ń [n]; 9ª [9] 9º; [0] 0ª ° 0º. Symbols as
English's. The characters stay #2140's Spanish letterHolds and symbolHolds,
which match these on screen.
- The accent callout keeps the key's own character selected until the finger
moves into another cell, and lifting types the current selection
(FullKeyboardEngine.accentOpenCell, accentIndex). The debug fixtures select a
callout option directly (debugSelectAccent), as a slide to it does.
Removed: lifting choosing the cell under the finger even if the finger never
moved. At the screen's edge the callout shifts, so 0 typed "0º" on a plain hold;
Apple's types "0". Also removed: the fixtures' synthetic move, which landed in
the cell the finger opened in when a long callout shifted (Italian e), so it
selected nothing.
Why: the Spanish system keyboard comparison (17e simulators, both set to
Spanish) showed the arrangement differing and the 0 hold typing the wrong
character.
Verified: Apple vs Hex screenshots of o s d l n z c 1 9 0 held on the Spanish
keyboard all match. A plain hold of 0 now types "0", and slide-then-drag-off
cancels. Lowercase holds confirmed đ (Spanish) vs ď ð (English). Full
HEXMobileTests pass apart from #2142's emoji bar band test, fixed with the
key-plane geometry it depends on.
* Replace the letter-position table with per-scale constants: it didn't generalize
What: portrait letters are again centred by advance, plus a constant per case
and screen scale: lowercase +0.17 pt and capitals 0 on 3x screens, +0.55 and
+0.23 on the 2x SE (KeyboardKeyPlaneView drawLetter). The capitals' one-pixel
lift from cef53885 stays.
Removed: cef53885's letterNudge3x/letterNudge2x tables, which offset each letter
by where its key's middle falls between whole points. They were fitted on the
17 Pro and Pro Max (the Air shares the Max's key phases, so it wasn't an
independent check). On the 17e, held out, they made letters worse: lowercase
0.23 -> 0.42 pt (median, Apple minus Hex), capitals 0.22 -> 0.27, worst cases up
to 1.0. The 17e's half-point keys need the opposite offset from the 17 Pro's.
No model tried (rounding to pixels or points from the screen, the keyboard or
the row; ink-weighted centring; optical sizes) predicted Apple's per-key
scatter across devices; the best managed 0.31 pt RMS against 0.385 for plain
centring.
Why: only the per-case constant holds on every device of a scale. Apple's
lowercase sits 0.13-0.22 pt right of plain centring on all four 3x iPhones
measured, its capitals within 0.13 either way, and the SE's by 0.55 and 0.23.
Verified (ink centroids, all 26 letters, light and dark; median|max, pt):
- Lowercase x: 17 Pro 0.31|0.82 -> 0.25|0.82; Air and Pro Max unchanged
0.29|0.77 (the half-pixel nudge rounds away there); 17e 0.26|0.81; SE
0.58|1.16 -> 0.27|0.69.
- Capitals x: unchanged on 3x (0.25-0.28); SE 0.35|0.70 -> 0.33|0.64.
- Capitals y on 3x: 0.27 -> 0.06.
- Full HEXMobileTests pass.
|
||
|
|
2a023f9122 |
iOS: translation says when it pastes as spoken, retries, and never turns itself off (#2176)
* iOS: Translate what I say says when it pastes as spoken, and nothing turns it off by itself
TestFlight build 56 testers saw translation stop "after a while" with no sign of why
(a Chinese tester: "翻译功能突然没办法用了,一开始可以"; another lost the Hex key menu's
Paste in Hindi / Paste in English pair and had to re-enable translation in Settings).
Every failure path in DictationTranslator returned nil, so the transcript went in as
spoken with nothing said: no language pack (never downloaded, removed in iOS Settings,
or still downloading), a pair Apple can't translate, a TranslationSession whose
translate() threw (internalError, as when Apple's Translate app is missing), and
build 56's "Paste in <source>" choice, which left pastesTranslation false while
Settings' switch still read on.
What changed:
- DictationTranslator.translate returns a TranslationOutcome (skipped, translated, or
failed with a TranslationFailure: notDownloaded, unsupported, failed, plus Apple's
error code, never the text). A failed translate() is tried once more in a new
TranslationSession; a missing pack or unsupported pair isn't retried. Sessions are
never kept. Apple's framework sits behind TranslationEngine so tests stand in for it.
- The failure rides DictationPipeline.Stages, KeyboardSnapshot (optional, old snapshots
still decode) and in-keyboard dictation's finished phase. When the keyboard inserts
such a dictation, both keyboards show "Couldn't translate, pasted as spoken" over the
fix ("Download Chinese in Settings") for 8 s: the full keyboard's strip in the Full
Access hint's shape with Open Hex, the dictation bar as a tappable two-line note.
Both open hex-dictation://keyboard/translation (KeyboardLaunchRequest.translationSettings),
which opens Settings › Dictation. VoiceOver announces it.
- Settings keeps the last failure (experiments.translateDictation.lastFailure) until a
dictation translates, checks status for the pair that failed, refreshes it on
foreground (packs can be removed meanwhile), and its Download button invalidates a
repeated TranslationSession.Configuration, which translationTask otherwise never
runs again after a cancelled download.
- One switch: removed the pastesTranslation setting, Settings' "Paste in English"
toggle and KeyboardViewModel.pastesTranslation/isTranslating's paste half. A stored
pastesTranslation=false from build 56 reads as off in Settings and the keyboard alike,
and the next switch removes it, so the two never disagree again.
- zh-Hans strings for the new copy.
Verified: xcodebuild test on an iPhone 17 simulator (iOS 27.2), 515 tests, 0 failures,
new cases in HexKeyGestureTests (missing pack zh->en and en->zh, unsupported pair,
retry in a new session, 30 dictations with intermittent failures never sticking,
build 56's stored "as spoken", the pipeline both ways, the strip's note) and
KeyboardBridgeTests (snapshot round trip and old JSON, the launch URL). Screenshots of
both keyboards' notes in English and Chinese. The simulator reports Apple translation
unsupported on the device, so real downloads and sessions need an iPhone.
* iOS: Hinglish dictations going into another language are translated from Devanagari
With Hinglish on (#2119), DictationPipeline romanized Hindi into Latin letters before
every step, translation included, so Translate what I say handed Apple's Hindi
translator Latin-letter Hindi it can't read: the result came back garbled or unchanged.
Now a Hindi dictation that may go into another language keeps Apple Speech's
Devanagari through the steps and translation; if it goes in as spoken (off, failed, or
skipped) it is romanized then, so it is still Hinglish. Stages.heard stays in Latin
letters for learning, as before; Hindi into Hindi is unchanged.
Verified: xcodebuild test on an iPhone 17 simulator (iOS 27.2), all tests passing,
with HinglishRomanizerTests.testHinglishTranslatesFromDevanagari (the translator gets
the Devanagari; a missing pack pastes "Mera phone charge nahi ho raha." and says
"Download Hindi in Settings").
|
||
|
|
edeccfcdeb |
iOS: dictation follows the keyboard's language, English and Spanish share one layout, and Spanish never goes to Parakeet (#2164)
* iOS: dictation follows the keyboard's language on Automatic
TestFlight build 56 (iPhone 17, iOS 27.3), English and Spanish chosen in
Settings › Keyboard › Languages: "dictation for Spanish is incomprehensible".
Reproduced in the iOS 27.2 simulator: with the keyboard switched to Español
and Dictation language on Automatic, the Hex key menu still said English, so
Spanish speech went to an English model. With Switch dictation too on, each
switch wrote the keyboard's language as a hand-picked choice, which stayed
after Spanish was unticked (English keys, es-ES dictation: stuck in Spanish).
- LanguageSettings.keyboardDictationLanguage: with two or more keyboard
languages and Automatic, dictation is in the language the space bar shows
(KeyboardLanguage.dictationLanguage, the iPhone's region where Apple Speech
has it). Not where the iPhone's own language has no layout (Hebrew), unless
Switch dictation too is on.
- AppleSpeechLanguages.resolve uses it for in-keyboard dictation and Hex; the
keyboard's Hex key menu names it; DictationController prepares the new
language between dictations when the keyboard switches.
- Replaced: Switch dictation too no longer writes the keyboard's language as
an explicit dictation language. It puts a hand-picked language back on
Automatic at each switch, which then follows live, so nothing is left
behind when the list or the switch changes.
Verified: KeyboardLayoutTests.testAutomaticDictationFollowsTheKeyboardsLanguage,
DictationControllerTests.testAutomaticDictationFollowsTheKeyboardsLanguage, the
updated Polish/Ukrainian/French switching tests; live on an iPhone 17 iOS 27.2
simulator (Release, Full Access): Español on the space bar now shows Language
Español in the Hex key menu, English shows English, and Switch dictation too
cleared a picked es-MX on the next switch.
* iOS: English and Spanish together type on the first one's keys
TestFlight build 56: with English and Spanish chosen, "the keyboard is always
stuck in Spanish, with the extra ñ key stuck on the right of the L key".
Black box on Apple's keyboard (iOS 27.2 simulator): adding Spanish offers "Add
to English (US) Keyboard", checked by default, which makes one bilingual
"English & Spanish" keyboard. With English first it is QWERTY with no ñ key, ñ
on a held n (N Ñ Ń Ņ Ň) and English's long presses; English added to the
Spanish keyboard keeps the ñ key and Spanish's long presses (ñ, ª, º, l·l).
Hex instead showed Spanish's own layout whenever the space bar was on
Español, so a bilingual English typist saw the ñ key and Spanish holds.
- KeyboardLanguageList.layout: with English and Spanish both chosen, both type
on the letters and long presses of whichever comes first; any other
language (and Spanish alone, or beside French) keeps its own.
- FullKeyboardEngine.layoutLanguage carries it to the keys and the accent
menu; language (autocorrect, the Spatial and swipe models, the space-bar
label, dictation) still switches on the space bar. The typing models already
read ñ typed from n where a layout has no ñ key.
Unchanged: the language last switched to is global, as Apple's is (a switch in
Messages held in Safari and back), and comes back after the keyboard process
restarts. A field gives Hex nothing to pick from: documentInputMode is nil in
Messages and Hex's own en-US in a test field that asks for English.
Verified: KeyboardLayoutTests.testEnglishAndSpanishTypeOnTheFirstOnesKeys,
FullKeyboardEngineTests.testEnglishAndSpanishShareTheFirstLanguagesKeys; live
on an iPhone 17 iOS 27.2 simulator (Release, Full Access): English + Español
shows QWERTY in both with ñ on a held n, Español + English the ñ key in both,
in Messages, Safari and an English-only field, before and after a keyboard
restart, with the iPhone's languages English or English + Spanish.
* iOS: Spanish dictation never goes to English-only Parakeet
Part of the TestFlight build 56 report ("dictation for Spanish is
incomprehensible"). Checked every path a Spanish dictation can take:
in-keyboard dictation is Apple Speech only, and Hex picks Parakeet V2 only for
English that Apple Speech would run on DictationTranscriber. One gap: when
Apple Speech gives no language at all (Speech not answering), Hex fell back to
Parakeet whatever the language, so Spanish would come out as English words.
- DictationController.appleSpeechLanguage decides Apple Speech or Parakeet for
both the launch check and defaultTranscriber: Apple Speech's pick unless it
is English Parakeet takes (AppleSpeechTranscriber.shouldUse, unchanged);
with no pick, English still goes to Parakeet and any other language (the one
set, else the keyboard's Automatic follows, else the iPhone's) stays on
Apple Speech, whose install then says it can't dictate it.
Verified: DictationControllerTests.testSpanishNeverGoesToEnglishOnlyParakeet
(es-ES and es-MX on either Apple module, es-ES and es-US with no pick go to
Apple Speech; en-US on DictationTranscriber and English with no pick still go
to Parakeet).
|
||
|
|
62f2064db1 |
iOS: a handoff to Hex can't leave the keyboard stuck, and dismissed dictations still deliver (#2163)
* iOS: a dictation handed to Hex can't leave the keyboard stuck TestFlight build 56 (iPhone 14, iOS 27.2.1): dictate in the keyboard, dismiss it, dictate again (Hex opens and records), swipe back: the keyboard stayed in recording, no text arrived, and it never healed. Reproduced on an iOS 27.2 simulator (iPhone 14) with the exact sequence in a Safari field and a simulated microphone in Hex: - With Hex alive and a warm session, the handoff works: Done in the keyboard stops Hex and the text goes in. - When Hex stops during the handoff (killed here; build 56 could also crash in AVAudioRecorder's callback, fixed by RetiredRecorders), the App Group snapshot keeps saying recording with a heartbeat that only ages. The keyboard trusted the state alone, so every keyboard after showed a recording; Done and Cancel were written for no one. It lasted through dismissing, new keyboard processes, everything until Hex was opened again. - With One shot, Hex never read the keyboard's commands after a handoff (only the warm session loop did): Done flipped back to recording and the recording ran to its 60 s limit. Fix: - KeyboardSnapshot.isOrphanedJob: a recording or transcription whose heartbeat is more than 6 s old is over. KeyboardViewModel drops it (reads as offline, any result kept), so the keyboard returns to idle and dictates again. The heartbeat is wall-clock time, so a new keyboard process reads an orphaned App Group snapshot the same way. - DictationController runs its keyboard loop while any keyboard job is in flight, not only in a warm session: One shot handoffs read Done and Cancel, and every keyboard transcription keeps heartbeating (endWarmSession restarts it for an accepted transcription). Before, One shot published no heartbeat while transcribing. - Hex asks for background time while it finishes a keyboard's transcription: in One shot nothing kept Hex running once its microphone closed. Tests: KeyboardBridgeTests.testAJobHexStoppedHeartbeatingForNoLongerHoldsTheKeyboard, DictationControllerTests.testAKeyboardHandoffFinishedFromTheKeyboardDeliversItsTextInEitherMode and testAOneShotHandoffCancelledFromTheKeyboardStops; with the next commit the full HEXMobile suite passes (477 tests, one skipped as before) on the iOS 27.2 simulator. * iOS: a keyboard dictation cut short by dismissing the keyboard still delivers its text Steps 1 and 2 of the TestFlight build 56 report (dictate in the keyboard, then dismiss it). On the iOS 27.2 simulator the keyboard's viewWillDisappear called KeyboardLocalDictation.discard, which only drops a touch-down capture: a recording stayed .recording, WebKit kept the microphone until the view controller was torn down about a second later (a new one comes with each appearance), and what was said was lost with it (its WAV left in tmp). A transcription in flight finished into a deallocated object and was dropped. Nothing of it reached the App Group: the next keyboard started idle. Now: - keyboardWillHide: a recording stops its capture at once and finishes with what was said without waiting for the page (WebKit may not answer once the keyboard is gone); a transcription carries on. Either job's text is held in the App Group (KeyboardHeldDictation, keyboard.heldDictation), so the next keyboard, in this process or a new one, inserts it into the same field when it comes back there within 30 s, and offers it otherwise. - Paste dictation: the full keyboard's strip offers a dictation the keyboard didn't insert by itself (a held one for another field or past its 30 s, or Hex's result that came after its 30 s, such as Done in Hex then back late), for 10 minutes. Hex keeps a keyboard result in its snapshot for that long (KeyboardSnapshot.resultOfferWindow); only Paste reads it, never the clipboard. After a handoff the field's documentIdentifier changes (seen on the simulator), so Hex's results still go into whichever field is open. - Self-heal for in-keyboard dictation (KeyboardJobWatchdog), checked on each poll: a capture without audio for 6 s finishes with what it heard, a transcription stuck for 2 minutes is given up and the keyboard goes idle. - Hex's results also arrive while an in-keyboard dictation shows (the local snapshot used to hide them entirely). Tests: KeyboardBridgeTests.testADictationTheKeyboardFinishedAfterItHidReachesTheNextKeyboard and testAResultPastItsTimeToGoInIsOfferedForTenMinutes, and the offer window in DictationControllerTests' handoff test; the full HEXMobile suite passes (477 tests, one skipped as before) on the iOS 27.2 simulator. |
||
|
|
64c028c519 |
iOS: on iPad, the Dictation bar clears iPadOS's shortcut bar, and Settings explains it (#2155)
* iOS: keep the iPad dictation bar's top row clear of iPadOS's shortcut bar On an iPad, iPadOS adds its shortcut bar (undo, redo, paste and the app's own buttons) to a custom keyboard. It usually sits above the keyboard, but some apps draw it over the keyboard's top instead: a TestFlight tester's iPad mini (A17 Pro, iPadOS 26.6, build 56) showed it in Notes over the dictation bar's top row, covering the language tray (Auto / English / Español). KeyboardKit reports the same for every custom keyboard (Gboard, Grammarly) once a keyboard comes back after another one (FB23560337). The keyboard can't tell which an app does (its own frame and position are the same either way), so on an iPad the docked dictation bar now sits 44 pt below the keyboard's top: the overlaid bar's buttons reached about 40 pt down. The keyboard grows from 140 to 184 pt there. A floating keyboard (iPhone-wide, under 500 pt) has no shortcut bar and keeps 140 pt; the inset follows the width as the keyboard floats or docks. The iPhone is unchanged (the inset is iPad only, and the full keyboard isn't touched). Trade-off: where iPadOS does reserve its own strip above the keyboard (Settings, Safari, most apps), the bar now has 44 pt of empty panel under iPadOS's strip. Verified: iPad mini (A17 Pro) simulators on iOS 27.2 and 26.5, Settings and a UITextView host with shortcut-bar buttons (the simulator has no Notes), light and dark, portrait and landscape, plus the floating keyboard; the simulator never drew the bar over the keyboard, so the overlap itself was checked against the tester's screenshot geometry. xcodebuild test on an iPhone 17 Pro simulator: 465 tests, 0 failures, 1 skipped. * iOS: say in Settings › Keyboard that an iPad shows the dictation bar The full keyboard is iPhone only: the keyboard mounts it only on a phone idiom (since #914), so on an iPad it always shows the dictation bar, even with Full chosen and Full Access on. A TestFlight tester (iPad mini A17 Pro, iPadOS 26.6, build 56) read that as the full keyboard being broken. On an iPad, the Keyboard row now says "On iPad, Hex shows the dictation bar" (zh-Hans "在 iPad 上显示听写栏"). Hex runs there as an iPhone app, whose interface idiom says phone, so the row reads the hardware model (the simulated one in the simulator). The row gains 10 pt of vertical padding so the two-line label has room; on an iPhone it stays 50 pt tall. Verified on an iPad mini (A17 Pro) simulator, iOS 27.2: English (dark) and zh-Hans (light). xcodebuild test on an iPhone 17 Pro simulator: 465 tests, 0 failures, 1 skipped. |
||
|
|
efbc618b2c |
iOS: Full Access confirms on its own, and shows Off after a revoke (#2154)
* iOS keyboard: report Full Access, on or off, on every load and appearance
A tester on build 56 (iPhone 13 Pro, iOS 27.2.1) gave the Hex keyboard Full
Access "multiple times" and setup still said Not confirmed yet. Only a keyboard
can read Full Access, and the app learned it from keyboard.fullAccessSeenAt,
which the keyboard wrote from syncFromBridge after updating its traits,
settings and typing log, and only with Full Access (or, in the simulator, a
live Hex session). Nothing was ever written without it, so an "on" never went
away after Full Access was turned off, and the app could not tell off from
not checked.
What changed
- KeyboardFullAccessReport (on or off, when, and when the keyboard process
started) in the App Group: keyboard.fullAccessOn and keyboard.fullAccessOff.
An on also sets keyboard.fullAccessSeenAt, which earlier builds and
Adaptive touch read; a seenAt from an earlier keyboard reads as an on from
the oldest process.
- The keyboard reports first thing in viewDidLoad and viewWillAppear, before
any view work or field read (no documentIdentifier), then every 5 s while
shown from the poll. It uses hasFullAccess itself: the simulator's live
session stand-in no longer marks Full Access on.
- Each report posts the Darwin notification
anomaly.hex.mobile.keyboard.fullAccess; the app can forward it to
NotificationCenter (KeyboardBridge.forwardFullAccessReports).
- KeyboardFullAccess.resolve: an off counts over an on only when newer and
from the same or a later keyboard process (a process started before a
grant can still say off), and is shown as off only if written since Hex
last came to the foreground (Full Access changes only in Settings, so an
older off may predate a grant). Otherwise on, else unconfirmed.
Verified: KeyboardBridgeTests cover the reports' storage, the legacy key and
the resolution cases; on anomastudio (iPhone 13 Pro simulator, iOS 27.2,
Release, ad-hoc signed with the App Group) the keyboard wrote an off from
Hex's own field and from Contacts without Full Access and an on with it.
* iOS setup: read the keyboard's Full Access reports and say what to do
The tester's sheet said Full Access "Not confirmed yet" with nothing tying it
to the field below, so the fix looked like Settings again. In the simulator
the grant kills Hex and its keyboard: back in Hex the sheet stays unconfirmed
until the Hex keyboard runs once, and the only hint was a faint placeholder in
an unfocused field. After Full Access was turned off the sheet kept saying On.
What changed
- KeyboardSetupMonitor.fullAccess (on, off, unconfirmed) from the keyboard's
reports (KeyboardFullAccess.resolve), with when Hex last came to the
foreground (willEnterForeground, or launch). fullAccessOn stays for
onboarding and the step count. It refreshes on the keyboard's Darwin
notification as well as the 1 s poll, so the row flips while the sheet is
open.
- Full Access row: "Not confirmed yet" with "Switch to Hex below to confirm."
under it; "Off" with "Turn on Allow Full Access in Settings." once a keyboard
said so since Hex came back.
- While unconfirmed the field takes focus as the sheet opens or Hex comes
back, so the keyboard comes up: Hex, if it was last, confirms at once;
another keyboard shows "Switch to Hex with (globe)" (was "Tap here, then...",
kept while unfocused), in the muted ink instead of the faint one, with a
border while focused.
- zh-Hans strings for the three new lines; README's Setup paragraph.
Verified on anomastudio (iPhone 13 Pro simulator, iOS 27.2, Release, ad-hoc
signed with the App Group), before (
|
||
|
|
1b44779efb |
iOS: text replacements without autocorrect, End with a period, and emoji and symbols on the Dictation bar (#2147)
* iOS: text replacements apply with Autocorrect off
A TestFlight tester (build 56) kept Settings > Keyboard > Autocorrect on only so
iOS text replacements (UILexicon shortcuts like "omw") would work: the engine's
isEnabled gate returned no fix on space or a closing mark, and the strip never
offered the replacement.
Apple's keyboard with Auto-Correction off (black box, iOS 27.2 simulator, Settings
> General > Keyboard) still shows "On my way!" as the highlighted centre
suggestion for "omw", puts it in on space and on ".", and leaves "teh" alone. Hex
now matches: with Autocorrect off, only text replacements show (auto-replacing) in
the strip and apply on space or punctuation; every other fix stays off. Fields with
autocorrectionType .no still get none, and the existing per-word suppression (a
tapped literal, an undone fix) still blocks them. One backspace puts the shortcut
back, as before.
Verified: new AutocorrectEngineTests case (strip, space, backspace, ".", a .no
field); AutocorrectEngineTests pass; live in Messages on an iOS 27.2 sim with
Hex's Autocorrect off: "omw" offers and becomes "On my way! ", backspace -> "Omw".
* iOS: Settings > Dictation > End with a period
A TestFlight tester (build 56) asked to dictate without punctuation at the end of
the sentence while keeping the marks inside it.
Until now each style decided: Polished ends every line with "." (or "。" after
Chinese or Japanese), Casual drops the final "."/"。" of a short message (one line,
up to three sentences) but keeps the one Apple Speech wrote on longer ones, Notes
drops it from every line, and Verbatim keeps the model's text.
The new switch, on by default, keeps exactly that. Off, no line in Polished,
Casual or Notes ends with a full stop (. 。 . 。, also before a closing quote or
bracket), whether Apple Speech or the style put it there; "?" "!" "?" "!" stay,
as do ellipses, abbreviations ("etc.") and initialisms ("U.S."). Lists (Format
lists) follow it per line. Verbatim still keeps the model's exact words. It lives
in the App Group (settings.dictationEndWithPeriod) and is read at the start of each
dictation in the app and in in-keyboard dictation, like Format lists. zh-Hans
strings included.
Verified: new TranscriptCleanupTests cases (English, Chinese 。/?/!, Japanese
「」, Casual's long messages, Notes, Verbatim, list lines, pipeline and the
setting's default); full HEXMobileTests suite passes; Settings > Dictation
checked in Chinese on an iOS 27.2 sim.
* iOS: punctuation keys and an emoji key on the dictation bar
A TestFlight tester (build 56) asked for an emoji button and symbol input on the
dictation bar keyboard style (Settings > Keyboard > Dictation bar), whose bottom row
had only the globe (on Touch ID iPhones), space, delete and return.
The bottom row now also holds an emoji key and the commonest punctuation
, . ? ! ' " @ #, as many as leave the space bar 60 pt (ViewThatFits: five on a
402 pt iPhone, six on a Pro Max, three on the SE beside its globe). The bar keeps
its 140 pt height, its top bar and its 44 pt well with Dictate/Hex untouched; to
make room the delete and return keys narrow (52 -> 44, 56 -> 48 pt) and the row's
spacing goes from 6 to 5 pt.
The emoji key opens the full keyboard's EmojiPanelView in place of the bar, at the
full keyboard's height (the bar can't hold its grid); its ABC key goes back to the
bar at 140 pt. It records use like the full keyboard (Frequently used is shared),
hides the search button (its query is typed on letter keys the bar doesn't have,
new EmojiPanelView.showsSearch), and closes when the keyboard hides, on a memory
warning, when dictation starts, or when the keyboard style changes. The panel's
fill logic moved from FullKeyboardView into EmojiPanelView.fill(before:) so both
share it. The key follows Settings > Keyboard > Emoji (whose detail no longer says
it needs the full keyboard while the bar is chosen) and shows in fields that take
emoji on iPhone, as the full keyboard's.
Verified: Release build on an iOS 27.2 sim (iPhone 17 Pro) in Messages, light and
dark: five punctuation keys typed ",.?!' ", the emoji panel opened at full height,
an emoji went in and delete worked, ABC returned to the bar; Settings > Keyboard in
Chinese; full HEXMobileTests suite passes.
|
||
|
|
3302fb4c0b |
iOS: Adaptive touch, personal key centres learned on device (Experiment, off by default) (#2146)
* iOS keyboard: Adaptive touch learns personal key centres for the decoder (Experiments, off) Adds Adaptive touch, stages 1 and 2 of the adaptive-touch design: the keyboard learns where you land on each physical letter key, on this device, and Spatial autocorrect's decoder (TypingDecoder.Keys) and the suggestion strip read your taps with those personal centres. Hit rectangles, keycaps, key(at:) and Swipe typing are unchanged. - AdaptiveTouch.swift: fixed-size sums (4 rotating bins of 200 labelled taps) per physical key and context (letters, posture, orientation, split, Hex key side, width bin, plus one of two grip regimes); offsets in keycaps, hierarchically shrunk (key 20, row 50, keyboard 40), bounded to 0.3 keycap, 0.05 per promotion, fixed sigma. The decoder reads a context only after 400 labelled taps over 3 sessions, while the profile fits recent taps better than the stock centres; once it fits worse it falls back to stock at once and labels go to the other regime (a returning grip is taken back). The model serializes to 23,588 bytes: a protected file in the keyboard's own container, excluded from backup, never in the App Group, written off the main thread; without Full Access, memory only. Reset generation in the App Group drops RAM and file, and stale writes can't resurrect. - AdaptiveTouchLabels.swift: RAM-only spans. A tap teaches only with evidence of intent, and only once the next word shows its word stood: a word left as typed (only letters the key under the finger typed), a same-length picked suggestion, a word kept over an autocorrection (undo or tapping it), and an erased letter retyped as a neighbour. Never autocorrections left in place, swipes, slides, strip touches, accent picks, or secure, code, email, URL or no-autocorrect fields. - No new automatic rewrites: AutocorrectEngine.decoderStockKeys; space applies a personal reading only if the stock centres also clear it by the margin (TypingDecoder.replaces), else the stock decision. Experiment on replaces Learn how I type's per-letter offsets for decoding (its word-level learning stays). Off, the engine has no AdaptiveTouch and behaves exactly as before. - Hooks: FullKeyboardEngine (touch-down point, letter commit, delete, undo, word ends, picks, swipes, cursor, field), FullKeyboardView.syncSettings, the keyboard saving on hide. KeyboardTextTarget gains isSecureTextEntry. Verified: xcodebuild test on an iPhone 17 simulator (iOS 27.2), 440 tests, 0 failures (1 skipped, existing); new cases in FullKeyboardEngineTests and AutocorrectEngineTests cover label admission, excluded fields and swipes, no hit-rectangle change, contexts, grip fallback, evidence floor, untrained equals off, the file cap, backup exclusion, damage and reset, and the no-new-rewrite guard. * iOS: Settings › Experiments › Adaptive touch, with its status and Reset touch learning The switch (off by default, App Group key experiments.adaptiveTouch) reads "Learns where you land on the keys on this device. Stores averages, not what you type." While on, a status line says Session only (Full Access not confirmed: the keyboard keeps its averages in memory until it closes), Learning: n of 400 taps, or Active, from the counts the keyboard reports (adaptiveTouch.summary.*); and Reset touch learning, after a confirmation, bumps the reset generation every keyboard honours. Delete what Hex learned (Typing insights) resets it too. Strings have zh-Hans. The settings-experiments-on fixture shows it on, partway through learning. Verified: built and tested with the previous commit (440 tests, 0 failures). * iOS keyboard: Adaptive touch's guard follows the Experiment-off decoder, and its grip check reads each axis Three refinements found while replaying the public benchmark: - No new automatic rewrites now means none the keyboard wouldn't make with the Experiment off: AutocorrectEngine.decoderStockKeys becomes decoderBaselineKeys, the centres Spatial autocorrect reads without Adaptive touch (stock, or moved by Learn how I type's per-letter offsets). Those offsets still never move the centres the decoder reads while the Experiment is on (no stacking), so journal users keep its correction authority as the ceiling. Before, the baseline was always the stock centres, which let a journal user's rewrites change on enabling. - The fit monitor keeps separate x and y log-likelihood gains. A grip that shifts taps sideways while the learned up/down offsets still fit used to average out: in the right-to-left grip replay the profile flapped in and out ~80 times and kept breaking words. Now a profile falls back once either axis fits worse than the stock centres (-0.06 nats per tap over 32 labels) and is only taken back when neither axis misfits. - TypingDecoder.replaces first scores the reading letter for letter (or with one untyped letter), an alignment the search also tries, and skips the one-word search when that already clears the margin: the guard runs on most letters. Verified: xcodebuild test on the iPhone 17 simulator (iOS 27.2), 446 tests, 0 failures (1 skipped, existing), including a new case for the journal baseline. * iOS keyboard: Adaptive touch switches grip profiles only once one had the evidence to be used The public replay showed a false switch while learning the steady base typist: the early, thin profile (368 taps) misfit one axis by noise and labels moved to a fresh second profile, throwing that evidence away. Before the activation floor nothing is in use, so a new grip now just mixes into what is learned; the per-axis fallback and switching apply once the profile is eligible (400 taps, 3 sessions). Also skips the accent comparison in TypingDecoder.replaces when it can't lower the margin (it allocates), the guard's remaining per-letter cost on the simulator. Adds AutocorrectEngineTests.testPersonalCentresKeepNamesYourWordsAndWordsTypedRight: with every centre pushed to the bound, words typed right, lowercase names and days, Contacts-style terms and shorthand come out exactly as with the Experiment off. Verified: xcodebuild test on the iPhone 17 simulator (iOS 27.2), rebased on |
||
|
|
ae6eca79ed |
iOS: opaque keyboard panel so stale system layers can't show through, and a nil-safe field ID (#2139)
* iOS: an opaque panel under the keyboard so iOS's leftovers can't show through
TestFlight build 56 (iPhone 17, iOS 27.0.1, English and Indonesian): after a
switch from Apple's keyboard, Apple's layout showed through Hex about a row
above Hex's own keys, and kept doing so switch after switch.
Cause: Hex drew nothing under its keys. The keyboard view was clear and its
dark keys are white at 16% alpha, like Apple's over the iOS 26+ glass panel,
so anything iOS leaves behind the keyboard shows through. The tester's
screenshot has two layouts:
- Apple's keyboard, with its emoji key, the "ID EN" badge on its space bar
and its wide greyed search key. Rows are about 54 pt apart, starting at
the panel's top, where Apple puts them in a search field (no predictive
bar).
- Hex, with the Logging mark and the Hex key in its strip, "Indonesia" on
its space bar, and rows about 56 pt apart.
The upper layer has keys only Apple's keyboard has, so it's a leftover
system layer, not a second Hex surface. The iOS 27.0 and 27.2 simulators
never kept it: in every frame of the switch videos one keyboard is drawn
whole.
Fix: KeyboardBackdropView, an opaque shape layer under the surface, in the
panel's colour over a plain background, measured from simulator
screenshots (black box): 34,34,35 dark, 226,227,232 light. Its top corners
follow the panel's 26 pt corners, which start about 17.5 pt above the
keyboard, 1 pt inside the glass's rim. That holds on the iPhone 17, 17 Pro,
17 Pro Max, Air, 17e and SE, iOS 27.0 and 27.2. The keyboard's height is now
set once, before the first layout, at the surface's own height, instead of a
140 pt constraint then changed. Later changes (the emoji search's row) are
never animated. A remount removes only Hex's own views (the surface, child
views, any stray FullKeyboardView), never UIKit's.
Replaced: the clear keyboard. Over vivid content right behind the panel's
top, the glass still tints the band iOS draws above the keyboard but no
longer Hex's area. Over plain backgrounds the two are pixel-identical.
Verified: xcodebuild test on an iPhone 17 (iOS 27.2) simulator, all tests
passing (1 skipped, as on dev), with new KeyboardLayoutTests cases (opaque
in both modes, every key covered on every width, never outside the panel's
corners or rim). In the iOS 27.0 simulator (Messages and Safari, light and
dark), the backdrop matches the system panel pixel for pixel, the corners
and rim match Apple's, and the globe/list switch sequence is clean. The
overlap itself needs an iPhone on iOS 27.0.1 to confirm.
* iOS: read the field's documentIdentifier without trapping on nil
UITextDocumentProxy.documentIdentifier is declared non-optional, but the
keyboard's proxy returns nil early on (in viewDidLoad, and at times later).
Reading that nil as Swift's UUID traps. Two agents hit it: the Debug
keyboard crashed in followTypingLogField() and in viewDidLoad. In Release
it's undefined behaviour.
Reproduced on dev
|
||
|
|
05849318bd |
iOS: fewer paste prompts, and a translate switch in the keyboard (#2134)
* iOS: Translate to <language> switch in the Hex key menu, with a badge on the Hex key
A tester asked for a translate button where they dictate, not an app setting.
Translate what I say could only be turned on in Settings; the keyboards only
had a "Paste in English / Paste in Spanish" pair while it was already on.
- Full keyboard Hex key menu: "Translate to English" switch (checkmark while
on) and "Translation language ›", a page of up to six targets (current,
English, dictation and preferred languages, then common ones; only those
Apple's Translation lists once it has answered). Picking one sets the target
and turns translation on.
- Dictation bar language tray: the same switch as a chip; the tray also opens
when there's no language choice but translation is available.
- While dictations paste translated, the Hex key wears the target's code
("EN") in its corner, and the dictation bar shows "→ EN" beside the Hex mark
(its language label drops the "→ English" it now repeats).
- Same App Group keys as Settings: the switch writes
experiments.translateDictation (on also sets pastesTranslation to
translated, as Settings' switch does); Settings' row re-reads everything on
appear and on returning to the foreground.
- Replaced: the menu's "Paste in English / Paste in Spanish" rows and the bar's
"Paste in English" chip (and onPasteTranslationSelected), now one switch.
Settings keeps its Paste in English toggle.
- The keyboard target now includes the app's String Catalog, so the Hex key
menu (and the shared strings it already had) follow a Chinese iPhone; new
zh-Hans strings: Language, Translate to %@, Translating to %@, Translation
language. Menu's Language/Automatic are localized now.
Verified on the iOS 27.2 simulator: HEXMobileTests 391 run, 0 failures
(1 skipped); in the real keyboard in Messages, the menu switch and target page
wrote experiments.translateDictation / .target (en -> ja, then off) and the
badge followed; snapshot scenes in light, dark and zh-Hans.
* iOS: Paste chip reads once and points to Paste from Other Apps › Allow
A tester had to tap Allow Paste for every paste from the keyboard. iOS asks for
each programmatic read while Settings › Apps › Hex › Paste from Other Apps is
Ask (the default). No read path avoids it inside a keyboard: UIPasteControl
draws blank there (TestFlight build 4) and detectPatterns can't return the
text. But that one setting covers the keyboard, so the fix is to point to it.
Checked on the iOS 27.2 simulator: pasted resolves the keyboard's identity to
anomaly.hex.mobile (TCCGetIdentityForCredential), a keyboard read alone (Hex
never launched) made "Paste from Other Apps: Ask" appear under Hex, and with
Allow the chip pasted in Messages and Safari with only iOS's "Hex pasted
from..." banner.
- One read per paste: text if hasStrings, else the URL. Before, a link was read
as string then url, which could ask twice.
- The read blocks while iOS asks, so a read that took 0.3 s or more asked: the
strip then shows "Settings › Apps › Hex › Paste from Other Apps › Allow" for
8 s (VoiceOver gets a sentence), the first 3 times only. A refused read
(Don't Allow, or the setting is Deny, while the clipboard has text) always
shows it, since the chip did nothing. Typing takes the strip back; while it
shows, the pasted text's suggestions wait.
- zh-Hans strings for both. The chip, its slot and offering only a fresh copy
are unchanged.
Verified: HEXMobileTests 393 run, 0 failures (1 skipped), including two new
KeyboardClipboardTests; on the simulator, Ask -> hint in Messages and Safari
(the simulator can't show the prompt, so its read is refused), Allow -> pasted
with no prompt and no hint. A real iPhone must confirm the prompt's timing
(>= 0.3 s) and that Allow stops it there too.
|
||
|
|
82f5df56c9 |
iOS: Emoji and Swipe typing are on by default, under Settings › Keyboard (#2129)
Ryan approved graduating both full-keyboard experiments. Swipe typing (#2106) and the emoji key and panel (#2051) are on for new users and move out of Experiments. - Defaults: FullKeyboardSettings.emoji and .swipeTyping read experiments.emoji and experiments.swipeTyping as object-or-true (was bool(forKey:), unset meaning off), as spatialAutocorrect did in #2097. Only their Experiments switches ever wrote those keys, and only on a change, so unset means never touched: fresh installs and testers who never touched them get them on, a stored false stays off, a stored true stays on. The keys keep their names; no migration. Without the App Group (no Full Access on an iPhone) both read as on, like the keyboard's other on-by-default switches. --experiment-emoji and --experiment-swipe still turn them on. - Settings › Keyboard: a card under the main one with Swipe typing and Emoji, plus Clear emoji history while Emoji is on. Both keep "Needs the full keyboard" while the Dictation bar is chosen (now from the page's own Full/Dictation bar choice). Settings › Experiments keeps Hinglish and Clean up with Apple Intelligence. No new strings; every string already had zh-Hans. - Record typing logs' session line adds swipeTyping and emoji, beside spatialAutocorrect and cleanupTagger. - settings-<page> scenes write both switches on, as for spatialAutocorrect. Doc comments and README point at Settings › Keyboard. - Test: KeyboardLayoutTests.testSwipeTypingAndEmojiAreOnByDefaultAnd- AStoredOffStaysOff (unset, no App Group, stored off, launch arguments). Held back: Clean up what I say stays off by default. On the held-out generated set its false deletes match the reference (0.5% of words; 3.9% of clean and 2.7% of literal sentences lose a word; 1/43 hand-written clean sentences), and "late" was never deleted (0/247). But it deletes every hyphenated name tried: "Tell Hye-jin I said thanks." became "Tell thanks.", and Jean-Luc, Anne-Marie, Mary-Kate, Ji-woo, Marie-Claire, Smith-Jones and Zeta-Jones all went (P(DELETE) 0.996-1.0), with "follow-up" and "re-entry". It also drops a literal "maybe" ("Call me later, maybe after dinner"). Verified on iPhone 17 simulators (iOS 27.2) on the Mac Studio: - xcodebuild test: 383 tests, 1 skipped (needs HEX_SPEECH_CLIPS), 0 failures. - Swipe on vs off, taps unchanged: the hex-vs-apple held-out sets (2,000 English and 2,000 Spanish sentences) typed through a real KeyboardKeyPlaneView with a temporary, uncommitted harness gave identical output in every sentence and 0 swipes from 116,253 letter touches, for still taps, motion drawn from Record typing logs, every letter dragged 30-95% of a key's pitch, and overlapping (rollover) taps. English WER 5.94%, 79/9,203 correct words broken (still) both ways; Spanish 8.61%, 23/7,978. A control dragging 1.05-1.5 pitches made 7,000/7,000 swipes with it on, 0 off. In the typing logs, 1 of about 1,000 letter touches moved more than a pitch. - Live keyboard in Messages: with no stored keys the emoji key shows and a drag from h to e swipes "He" (strip: Here, Her, He's); with both stored false (an upgrade that turned them off) there's no emoji key and the same drag slides and types "E". - Keyboard memory (Release, Full Access, mock mic, probe transcript, vmmap physical footprint, resident/peak MB, 2 runs each; a temporary, uncommitted probe faked the transcript and headroom): typing, emoji and swipe off 34.0 / 46.1 typing, both on 35.0-39.9 / 47.0-51.8 + in-keyboard dictation, Clean up off 35.0 / 46.6 + dictation, Clean up on 37.6-43.6 / 46.5-51.9 + emoji panel, a few picks 38.3-38.8 / 51.4-52.2 + every emoji category browsed 58.8-59.3 / 68.2-68.3 + all that, then dictation, Clean up 69.2 / 73.7 Typing sets the peak, not the tagger (loaded after recording stops, about 2.6 MB). With a faked 60 MB headroom the 80 MB cleanup guard skipped the tagger and the transcript went in as heard (2/2). The simulator reports no headroom, so #2045's 32 MB start guard can't fire there. On a 4 GB iPhone (reported limits 60-77 MB), browsing every emoji category approaches the limit, and a dictation after it would open Hex instead. Unverified on a device. |
||
|
|
e6319e98be |
iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default) (#2119)
* iOS: Hinglish romaniser, Hindi in Latin letters as people text it
Adds HinglishRomanizer and HinglishLexicon in HEXShared, so the app and
the keyboard share them, for the Hinglish experiment in the next commit.
Why: testers asked for Hindi dictation in the Latin alphabet ("kya kar
rahe ho"), not Devanagari and not translated. On macOS 27.2, Apple's
SpeechTranscriber hi-IN already writes Hindi in Latin letters, but
DictationTranscriber hi-IN (the module on iPhones without
SpeechTranscriber, and the fallback when its model won't install)
writes Devanagari, English words included (मीटिंग).
How:
- Devanagari words take the lexicon's spelling when it has them (about
45 common Hindi words, 270 English loanwords back in English).
Otherwise: Hindi schwa deletion, then ICU Devanagari-Latin, then casual
spelling (no diacritics; aa/ee/oo only where stressed; ch, sh, w).
- Latin words (SpeechTranscriber) keep their words. A few Apple spellings
change (mei -> main, hoo -> hoon, nahin -> nahi), and Apple's
mid-sentence capitals on common Hindi words are lowered.
- Devanagari digits become 0-9, and a spoken hour before "baje" becomes
digits ("paanch baje" -> "5 baje").
Verified: HinglishRomanizerTests (5 cases) pass in xcodebuild test on an
iOS 27.2 simulator. Word accuracy against the expected casual spelling,
over 45 synthesized Hinglish sentences (Lekha voice, macOS 27.2 Speech):
- DictationTranscriber output: 1.3% -> 82.1%
- clean Devanagari: 100%
- 30 held-out sentences: 100% (93.0% exact spelling)
Latency is about 0.01 ms per sentence (macOS -O) after a 3-6 ms first
call. It adds 0.7 MB in the simulator.
* iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default)
Settings › Experiments › Hinglish (Hindi in Latin letters). While it is
on, Hindi dictation is written in Latin letters the way people text it
("meeting kal 5 baje hai"), in the app and in-keyboard dictation alike.
Hindi is also offered in the Hex key's language menu and named
"Hinglish" there and in Settings › Dictation language.
- HinglishSettings (App Group key experiments.hinglish; the launch
argument --experiment-hinglish turns it on in simulator scenes).
- DictationPipeline runs HinglishRomanizer as its first step, only for
Hindi and only while the experiment is on. Learned fixes, custom
vocabulary, the style (#2103) and Lowercase then work on the Latin
words. The new Stages.heard (Latin for Hinglish) is what learning
compares with the inserted text. It replaces the raw transcript, so
Devanagari isn't learned against Latin edits.
- DictationController reads the setting when a capture starts, as it
does for Lowercase. KeyboardLocalDictation reads it at transcription.
Both stay string rules with no model, so the keyboard's memory guard
(#2045) needs no new headroom.
- DictationLanguageSwitch: nativeName/nativeNames return "Hinglish" for
hi while on, and choices(hinglish:) offers hi-IN after the recents
when Apple Speech lists it. KeyboardViewController passes the setting
and adds it to the menu's signature.
- AppleSpeechLanguages.options and DictationLanguageRow name Hindi
"Hinglish" while on.
- zh-Hans strings for the new row. settings-*-on scenes turn it on. The
keyboard fixture puts a --dictation-language missing from its list
first, for the Hinglish menu scene.
Not changed: Apple Speech still picks the module (SpeechTranscriber for
hi-IN where available, which already writes Latin), and nothing changes
while the experiment is off.
Verified: xcodebuild test on an iOS 27.2 simulator (iPhone 17 Pro):
372 tests, 0 failures, 1 skipped. New tests:
- HinglishRomanizerTests.testStylesAndLowercaseApplyToHinglish
- DictationLanguageSwitchTests.testHinglishOffersHindiByThatName
Screenshots of settings-experiments-on, full-keyboard-languages
(--experiment-hinglish --dictation-language hi-IN) and
settings-dictation-on with hi-IN show the toggle, "Hinglish" ticked in
the Hex key's menu, and Dictation language "Hinglish".
|