mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
* iOS keyboard: the full keyboard by default, typing without Full Access
App Review 4.4.1 needs a keyboard extension to type, and to keep working
without Full Access and without network. Hex's default was the dictation
bar (space, delete, return, Dictate; no letter keys), and without Full
Access it showed only setup steps.
What changed
- FullKeyboardSettings.isEnabled (App Group key experiments.fullKeyboard,
what Settings › Keyboard's Full / Dictation bar row binds) now reads
unset as true: new installs and testers who never touched the old
experiment get the full keyboard; an explicit false (turned off, or
Dictation bar picked) keeps the dictation bar. --keyboard
full|dictation-bar picks it in simulator scenes.
- Without Full Access the keyboard always mounts the full keyboard,
whatever is chosen (the bar types only spaces and line breaks).
- Removed: the full keyboard's permanent "Allow Full Access to dictate
with Hex" strip notice; the strip suggests and corrects as usual.
- Without Full Access the Hex key (tap, hold, VoiceOver, or sliding for
its menu) no longer tries to dictate or open Hex: the strip shows
"Allow Full Access to dictate" and "Settings › Apps › Hex › Keyboards"
for 8 s (until a key is typed), with an Open Hex chip, the only thing
that opens Hex (hex-dictation://keyboard/setup) without Full Access.
- In-keyboard dictation (onLocalDictateTap) is offered only with Full
Access; before, it was set without it too, so the Hex key would have
started a capture that can't work there.
- Scene full-keyboard-no-access-hint; README: the default, behaviour
without Full Access, memory numbers and proof limits.
Verified (anomastudio, iPhone 13 simulator, iOS 27.2, Release, keyboard
in a real hosted field, a temporary uncommitted probe):
- Fresh install, Full Access off: full keyboard, no in-keyboard
dictation; taps through the engine typed "thw " -> "the ", "tk " ->
"to "; with Spatial autocorrect on (decoder active) also "ofthw " ->
"of the ". The hint renders light and dark.
- Full Access on: full keyboard by default; --keyboard dictation-bar
mounts the bar.
- Memory, 3 runs each, MB, before (78e4458d) -> after:
full keyboard idle 18.4-18.5 -> 18.5-18.6 (18.0-18.3 without Full
Access), first dictation max within 3 s 30.8-31.3 -> 31.2-31.8, peak
32.1-32.5 -> 32.3-33.0; bar idle 20.7 -> 20.8, first dictation
27.5-27.8 -> 27.3-27.9. Unchanged within noise, so #2045's 32/24 MB
guard still covers it.
- xcodebuild test: 267 tests, 0 failures, 1 skipped (as before).
Not verified on a physical iPhone.
* iOS keyboard: show a Logging mark while typing logs record
App Review 2.5.14: a keyboard that records what is typed must say so the
whole time. Record typing logs had no indicator in the keyboard.
What changed
- KeyboardViewModel.isLoggingTyping, set by the keyboard from
TypingLogger.isRecording (session start and end, and every bridge
poll), so a skipped field (password, one-time code, card) shows no
mark.
- Full keyboard: a flat "● Logging" mark (10 pt, the strip's muted ink)
in the strip's top-leading corner, in from the keyboard's rounded
corner; while dictating, at the start of the recording bar's well, with
the scope moved past it, so it never disappears.
- Dictation bar: the same mark beside the Hex mark in its top row, there
while idle and while recording.
- The dot is muted, not orange: an orange dot would read as iOS's
microphone indicator. VoiceOver reads "Typing logs are recording".
- --typing-log-mark shows it in the full-keyboard and keyboard-* scenes;
README.
Verified (anomastudio, iPhone 13 simulator, iOS 27.2, Release, keyboard
in a real hosted field with --experiment-typing-logs): the mark shows in
the full keyboard's strip, in its recording bar during an in-keyboard
dictation, and in the dictation bar idle and recording; the scenes
render it light and dark. Idle footprint with logging on 18.5-18.7 MB
(full) and 20.8-20.9 MB (bar), as without. Built for testing.
* iOS keyboard: cap keyboard-capture-probe.log at 512 KB
The in-keyboard dictation probe log in the App Group grew without limit:
every dictation and memory change appends to it, and nothing removed it.
What changed
- KeyboardProbeLog.write: once the file passes 512 KB, it keeps only its
newest 256 KB, from the first whole line in them (atomic rewrite).
Nothing user-facing reads the log; testers' copies keep their recent
footprint lines.
- README: the cap.
Verified (anomastudio, iPhone 13 simulator, iOS 27.2, Release): a
614,400-byte log in the simulator's App Group container became 262,590
bytes after the keyboard's next in-keyboard dictation wrote to it,
starting on a whole filler line and ending with that dictation's lines.
90 lines
4 KiB
Swift
90 lines
4 KiB
Swift
import Foundation
|
||
|
||
/// The full keyboard's switches in the shared App Group.
|
||
///
|
||
/// Without Full Access an iPhone may not let the keyboard read the App Group (the simulator
|
||
/// does), so every switch's default must work there: the full keyboard, which types
|
||
/// without Full Access.
|
||
@MainActor
|
||
struct FullKeyboardSettings {
|
||
static let launchArgument = "--experiment-full-keyboard"
|
||
static let emojiLaunchArgument = "--experiment-emoji"
|
||
/// Simulator scenes pass `--keyboard dictation-bar` (or `full`) to pick the keyboard.
|
||
static let keyboardLaunchArgument = "--keyboard"
|
||
|
||
private enum Key {
|
||
static let fullKeyboard = "experiments.fullKeyboard"
|
||
static let autocorrect = "settings.keyboardAutocorrect"
|
||
static let spatialAutocorrect = "experiments.spatialAutocorrect"
|
||
static let keyPopups = "settings.keyboardKeyPopups"
|
||
static let haptics = "settings.keyboardHaptics"
|
||
static let emoji = "experiments.emoji"
|
||
}
|
||
|
||
private let defaults: UserDefaults?
|
||
|
||
init(defaults: UserDefaults? = UserDefaults(suiteName: KeyboardBridge.appGroup)) {
|
||
self.defaults = defaults
|
||
}
|
||
|
||
/// Settings › Keyboard: Full (true) or Dictation bar (false). The full keyboard (letters,
|
||
/// numbers, symbols, autocorrect and the Hex key) by default; the dictation bar (space,
|
||
/// delete, return and Dictate) only once it was chosen. Stored as
|
||
/// `experiments.fullKeyboard`, from when the full keyboard was an experiment: unset or
|
||
/// true is the full keyboard and false the dictation bar, so testers who never touched
|
||
/// the experiment get the full keyboard and those who turned it off keep the bar.
|
||
var isEnabled: Bool {
|
||
get { defaults?.object(forKey: Key.fullKeyboard) as? Bool ?? true }
|
||
nonmutating set { defaults?.set(newValue, forKey: Key.fullKeyboard) }
|
||
}
|
||
|
||
/// Cautious autocorrect on space. On by default.
|
||
var autocorrect: Bool {
|
||
get { defaults?.object(forKey: Key.autocorrect) as? Bool ?? true }
|
||
nonmutating set { defaults?.set(newValue, forKey: Key.autocorrect) }
|
||
}
|
||
|
||
/// Experiment: autocorrect reads your taps with a language model (`TypingDecoder`) instead
|
||
/// of `UITextChecker`'s one-edit guesses, in English and Spanish. Off by default.
|
||
var spatialAutocorrect: Bool {
|
||
get { defaults?.bool(forKey: Key.spatialAutocorrect) ?? false }
|
||
nonmutating set { defaults?.set(newValue, forKey: Key.spatialAutocorrect) }
|
||
}
|
||
|
||
/// The enlarged letter that pops up over a pressed key. On by default.
|
||
var keyPopups: Bool {
|
||
get { defaults?.object(forKey: Key.keyPopups) as? Bool ?? true }
|
||
nonmutating set { defaults?.set(newValue, forKey: Key.keyPopups) }
|
||
}
|
||
|
||
/// A light tap under your finger for each key press. On by default.
|
||
var haptics: Bool {
|
||
get { defaults?.object(forKey: Key.haptics) as? Bool ?? true }
|
||
nonmutating set { defaults?.set(newValue, forKey: Key.haptics) }
|
||
}
|
||
|
||
/// Experiment: an emoji key whose panel suggests emoji for what you just typed, from
|
||
/// what the words mean and what you use. Off by default.
|
||
var emoji: Bool {
|
||
get { defaults?.bool(forKey: Key.emoji) ?? false }
|
||
nonmutating set { defaults?.set(newValue, forKey: Key.emoji) }
|
||
}
|
||
|
||
/// Simulator scenes pass `--experiment-full-keyboard` or `--keyboard full|dictation-bar`
|
||
/// to pick the keyboard, and `--experiment-emoji` to turn the emoji experiment on.
|
||
func applyLaunchArguments(_ arguments: [String] = ProcessInfo.processInfo.arguments) {
|
||
if arguments.contains(Self.launchArgument) {
|
||
isEnabled = true
|
||
}
|
||
if let index = arguments.firstIndex(of: Self.keyboardLaunchArgument), index + 1 < arguments.count {
|
||
switch arguments[index + 1] {
|
||
case "full": isEnabled = true
|
||
case "dictation-bar": isEnabled = false
|
||
default: break
|
||
}
|
||
}
|
||
if arguments.contains(Self.emojiLaunchArgument) {
|
||
emoji = true
|
||
}
|
||
}
|
||
}
|