[JJC-20260618-005-B] Fix 6 critical bugs from review
- BUG-1: Restore KeyboardRootView top highlight + divider - BUG-2: App Group unavailable -> friendly error view (no fatalError) - BUG-3: pressBegan race condition (sync phase to .requestingPermissions) - BUG-4: cancelled LLMError no longer re-inserts original text - BUG-6: mode switch during recording flushes partial - ARCH-A1: State.Phase add .requestingPermissions + .denied(Reason) Notes: - 8/8 tests pass (LLMClientTests) - BUILD SUCCEEDED for both OSGKeyboard and OSGKeyboardExt - New file AppGroupErrorView.swift auto-registered via XcodeGen - Info.plist left untouched (NSSpeechRecognitionUsageDescription kept from A block)
This commit is contained in:
@@ -10,6 +10,22 @@ public enum AppGroup {
|
||||
/// App Group container identifier (must match entitlements in both targets)
|
||||
public static let identifier = "group.com.osgkeyboard.shared"
|
||||
|
||||
/// Whether the App Group container is available on this device.
|
||||
///
|
||||
/// Cached at first read — the underlying `UserDefaults(suiteName:)`
|
||||
/// call is cheap, but main-app startup and every keyboard-extension
|
||||
/// read hit it, so we memoize the result.
|
||||
///
|
||||
/// Production code paths MUST go through `isAvailable` first and
|
||||
/// surface a friendly error view (e.g. `AppGroupErrorView`) on the
|
||||
/// main app, or the keyboard extension's persisted-locale load.
|
||||
/// Calling `defaults` directly when the group is missing will trip
|
||||
/// the DEBUG `fatalError` below — that path is reserved for
|
||||
/// developer-only escape hatches and intentional debugging.
|
||||
public static let isAvailable: Bool = {
|
||||
UserDefaults(suiteName: identifier) != nil
|
||||
}()
|
||||
|
||||
/// Shared UserDefaults instance for cross-process config.
|
||||
///
|
||||
/// In DEBUG builds a missing App Group is a hard `fatalError`: silently
|
||||
|
||||
Reference in New Issue
Block a user