81581f0e5f
Two related cleanups the user asked for in one shot:
1. iPhone-only is now enforced at every target — Mac Catalyst and
visionOS were never configured in `project.yml`, but the
`OSGKeyboardShared` framework and the two test bundles were
still defaulting to `TARGETED_DEVICE_FAMILY = "1,2"` (iPhone +
iPad). All four targets now explicitly set `"1"`. SDK is
`iphoneos` for everyone, no `xros` / `macosx`.
2. Deployment target bumped from iOS 18.0 to iOS 26.0 across the
board (`project.yml` + the ext's per-target setting). With
iOS 26 as the floor, the iOS 18–25 SFSpeechRecognizer path
became dead code and several `#available` checks became
always-true. Removed:
- `AppleSpeechASR` (the entire SFSpeechRecognizer-based ASR
backend) and the `#available(iOS 26.0, *)` factory branch.
`ASRServiceFactory.make()` now returns `SpeechAnalyzerASR()`
directly. SpeechAnalyzer is always fully on-device, which
also made the `requiresOnDevice` flag meaningless.
- `requiresOnDevice` from the `ASRService.transcribe` protocol
signature, from `ProviderConfig`, `AppGroupStore`,
`KeyboardState`, `AppGroupPersistor`, and the ext's
`KeyboardViewController` (`state.requiresOnDevice`,
`state.setRequiresOnDevice`, `persistRequiresOnDevice`).
- `#available(iOS 17.0, *)` branch in
`PreviewASRController.requestMicrophonePermission` and the
ext's `PermissionManager.requestMicPermission` — both now
just call the iOS 17+ `AVAudioApplication` API directly.
- The `else` (iOS 18–25) branch in `SettingsView.asrEngineRow`
— the on-device-only toggle is gone, the row is a static
"SpeechAnalyzer active" badge. Same for the `else` branch
in `EnginePickerSection.localSubtitle`.
- `makeMicAuthHandler` (the iOS < 17 mic permission callback
wrapper) from `PreviewASRController`.
No `#available` / `@available` checks remain in the codebase
except for the SpeechAnalyzer class itself (now unnecessary
too, but kept for clarity — `AVAudioApplication` and
`SpeechAnalyzer` are both iOS 17+ / iOS 26+ respectively,
and the deployment target of 26 makes the explicit
`@available` redundant; I left the SpeechAnalyzer class
un-`@available` and removed the `@available(iOS 26.0, *)`
decoration since it's no longer needed).
The Keyboard ext's existing ASRService usage
(`asr.transcribe(stream:locale:)`) is unchanged at the
call-site level — just the third argument is gone.
3. Updated `info.plist` UISupportedInterfaceOrientations is
already `[UIInterfaceOrientationPortrait]` only, which is
correct for an iPhone-only app; no change needed.
Build: BUILD SUCCEEDED.
Tests: 22/22 pass.
Verified: `TARGETED_DEVICE_FAMILY = 1` on all four targets,
`SDKROOT = iphoneos` on all four.
🤖 Generated with Claude Code
226 lines
7.6 KiB
YAML
226 lines
7.6 KiB
YAML
# XcodeGen configuration for OSGKeyboard
|
||
# Run `xcodegen generate` to create OSGKeyboard.xcodeproj
|
||
# Repo only tracks project.yml; .xcodeproj is gitignored.
|
||
|
||
name: OSGKeyboard
|
||
options:
|
||
bundleIdPrefix: com.osgkeyboard
|
||
# Minimum OS: iOS 26. We dropped iOS 18–25 support so the
|
||
# SFSpeechRecognizer + AVAudioSession branching could be removed in
|
||
# favour of iOS 26's `SpeechAnalyzer` (always on-device) and
|
||
# `AVAudioApplication.requestRecordPermission` (iOS 17+). iPhone
|
||
# only — no Mac Catalyst, no visionOS.
|
||
deploymentTarget:
|
||
iOS: "26.0"
|
||
developmentLanguage: en
|
||
createIntermediateGroups: true
|
||
generateEmptyDirectories: true
|
||
groupSortPosition: top
|
||
|
||
settings:
|
||
base:
|
||
SWIFT_VERSION: "6.0"
|
||
IPHONEOS_DEPLOYMENT_TARGET: "26.0"
|
||
ENABLE_USER_SCRIPT_SANDBOXING: YES
|
||
SWIFT_STRICT_CONCURRENCY: complete
|
||
GENERATE_INFOPLIST_FILE: NO
|
||
ENABLE_MODULE_VERIFIER: YES
|
||
MARKETING_VERSION: "0.1.2"
|
||
CURRENT_PROJECT_VERSION: "3"
|
||
# 签名配置来自 Signing.local.xcconfig(gitignored,不会被覆盖)
|
||
|
||
# 项目级签名 xcconfig,适用于所有 target
|
||
configFiles:
|
||
Debug: Signing.local.xcconfig
|
||
Release: Signing.local.xcconfig
|
||
|
||
targets:
|
||
|
||
# =========================================================
|
||
# 主 App
|
||
# =========================================================
|
||
OSGKeyboard:
|
||
type: application
|
||
platform: iOS
|
||
sources:
|
||
- path: OSGKeyboard
|
||
entitlements:
|
||
path: OSGKeyboard/OSGKeyboard.entitlements
|
||
properties:
|
||
com.apple.security.application-groups:
|
||
- group.com.osgkeyboard.shared
|
||
com.apple.security.device.audio-input: true
|
||
# Shared Keychain access group: the host app writes the LLM API
|
||
# key here in Settings; the keyboard extension reads it before
|
||
# each request. The first entry below becomes each process's
|
||
# default access group, so the Keychain helper does not need to
|
||
# specify kSecAttrAccessGroup explicitly.
|
||
com.apple.security.keychain-access-groups:
|
||
- com.osgkeyboard.shared
|
||
resources:
|
||
- path: OSGKeyboard/Assets.xcassets
|
||
- path: OSGKeyboard/en.lproj
|
||
- path: OSGKeyboard/zh-Hans.lproj
|
||
info:
|
||
path: OSGKeyboard/Info.plist
|
||
properties:
|
||
CFBundleDisplayName: OSGKeyboard
|
||
CFBundleShortVersionString: "$(MARKETING_VERSION)"
|
||
CFBundleVersion: "$(CURRENT_PROJECT_VERSION)"
|
||
# English is the development language; zh-Hans is the only
|
||
# translation right now. The list also tells iOS to surface
|
||
# the keyboard in the per-app language picker for both.
|
||
CFBundleDevelopmentRegion: en
|
||
CFBundleLocalizations:
|
||
- en
|
||
- zh-Hans
|
||
UILaunchScreen:
|
||
UIColorName: "BackgroundColor"
|
||
UISupportedInterfaceOrientations:
|
||
- UIInterfaceOrientationPortrait
|
||
UIApplicationSceneManifest:
|
||
UIApplicationSupportsMultipleScenes: false
|
||
NSMicrophoneUsageDescription: "OSGKeyboard needs microphone access to transcribe your voice into text."
|
||
NSSpeechRecognitionUsageDescription: "OSGKeyboard uses on-device speech recognition to transcribe your dictation. Audio never leaves your device."
|
||
NSAppTransportSecurity:
|
||
NSAllowsArbitraryLoads: false
|
||
CFBundleURLTypes:
|
||
- CFBundleURLName: com.osgkeyboard.ios.settings
|
||
CFBundleURLSchemes:
|
||
- osgkeyboard
|
||
settings:
|
||
base:
|
||
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios
|
||
TARGETED_DEVICE_FAMILY: "1"
|
||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents: YES
|
||
dependencies:
|
||
- target: OSGKeyboardShared
|
||
embed: true
|
||
- target: OSGKeyboardExt
|
||
# Keyboard Extension is a plugin of the main App; embed it.
|
||
- sdk: Speech.framework
|
||
|
||
# =========================================================
|
||
# Keyboard Extension
|
||
# =========================================================
|
||
OSGKeyboardExt:
|
||
type: app-extension
|
||
platform: iOS
|
||
sources:
|
||
- path: OSGKeyboardExt
|
||
excludes:
|
||
- "en.lproj"
|
||
- "zh-Hans.lproj"
|
||
- path: OSGKeyboardExt/en.lproj
|
||
- path: OSGKeyboardExt/zh-Hans.lproj
|
||
settings:
|
||
base:
|
||
IPHONEOS_DEPLOYMENT_TARGET: "26.0"
|
||
entitlements:
|
||
path: OSGKeyboardExt/OSGKeyboardExt.entitlements
|
||
properties:
|
||
com.apple.security.application-groups:
|
||
- group.com.osgkeyboard.shared
|
||
# Shared with the host app so the keyboard extension can read the
|
||
# user's LLM API key. See OSGKeyboard/OSGKeyboard.entitlements
|
||
# for the full rationale.
|
||
com.apple.security.keychain-access-groups:
|
||
- com.osgkeyboard.shared
|
||
info:
|
||
path: OSGKeyboardExt/Info.plist
|
||
properties:
|
||
CFBundleDisplayName: OSGKeyboard
|
||
CFBundleShortVersionString: "$(MARKETING_VERSION)"
|
||
CFBundleVersion: "$(CURRENT_PROJECT_VERSION)"
|
||
NSMicrophoneUsageDescription: "OSGKeyboard needs microphone access to transcribe your voice into text."
|
||
NSSpeechRecognitionUsageDescription: "OSGKeyboard uses on-device speech recognition to transcribe your dictation. Audio never leaves your device."
|
||
NSExtension:
|
||
NSExtensionAttributes:
|
||
IsASCIICapable: false
|
||
PrefersRightToLeft: false
|
||
PrimaryLanguage: "en-US"
|
||
RequestsOpenAccess: true
|
||
NSExtensionPointIdentifier: com.apple.keyboard-service
|
||
NSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).KeyboardViewController
|
||
settings:
|
||
base:
|
||
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios.keyboard
|
||
TARGETED_DEVICE_FAMILY: "1"
|
||
dependencies:
|
||
- target: OSGKeyboardShared
|
||
embed: false
|
||
|
||
# =========================================================
|
||
# Shared Framework (主 App 与扩展共用)
|
||
# =========================================================
|
||
OSGKeyboardShared:
|
||
type: framework
|
||
platform: iOS
|
||
sources:
|
||
- path: OSGKeyboardShared
|
||
info:
|
||
path: OSGKeyboardShared/Info.plist
|
||
settings:
|
||
base:
|
||
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios.shared
|
||
TARGETED_DEVICE_FAMILY: "1"
|
||
DEFINES_MODULE: YES
|
||
SKIP_INSTALL: YES
|
||
BUILD_LIBRARY_FOR_DISTRIBUTION: NO
|
||
DYLIB_INSTALL_NAME_BASE: "@rpath"
|
||
APPLICATION_EXTENSION_API_ONLY: YES
|
||
ENABLE_MODULE_VERIFIER: YES
|
||
dependencies:
|
||
- sdk: Speech.framework
|
||
- sdk: AVFoundation.framework
|
||
|
||
# =========================================================
|
||
# 单元测试
|
||
# =========================================================
|
||
OSGKeyboardTests:
|
||
type: bundle.unit-test
|
||
platform: iOS
|
||
sources:
|
||
- path: OSGKeyboardTests
|
||
info:
|
||
path: OSGKeyboardTests/Info.plist
|
||
dependencies:
|
||
- target: OSGKeyboard
|
||
settings:
|
||
base:
|
||
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios.tests
|
||
TARGETED_DEVICE_FAMILY: "1"
|
||
|
||
# =========================================================
|
||
# 键盘扩展单元测试 (TEST-4)
|
||
# =========================================================
|
||
OSGKeyboardExtTests:
|
||
type: bundle.unit-test
|
||
platform: iOS
|
||
sources:
|
||
- path: OSGKeyboardExtTests
|
||
info:
|
||
path: OSGKeyboardExtTests/Info.plist
|
||
dependencies:
|
||
- target: OSGKeyboardShared
|
||
settings:
|
||
base:
|
||
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios.ext.tests
|
||
TARGETED_DEVICE_FAMILY: "1"
|
||
|
||
schemes:
|
||
OSGKeyboard:
|
||
build:
|
||
targets:
|
||
OSGKeyboard: all
|
||
OSGKeyboardExt: all
|
||
run:
|
||
config: Debug
|
||
test:
|
||
config: Debug
|
||
targets:
|
||
- OSGKeyboardTests
|
||
- OSGKeyboardExtTests
|
||
archive:
|
||
config: Release
|