feat(keyboard): add English QuickType bar and system lexicon
Show verbatim/correction/completion slots, mmap a 40k-word list, and use UITextChecker plus supplementary lexicon for conservative autocorrect.
This commit is contained in:
@@ -130,13 +130,26 @@ public final class AIAgentSkillLayoutStore: ObservableObject {
|
||||
}
|
||||
|
||||
public func saveUserSkill(_ skill: AIUserSkill) throws {
|
||||
let previousURL = userCatalog.skill(id: skill.id)?.shortcutICloudURL
|
||||
let previousSkill = userCatalog.skill(id: skill.id)
|
||||
let previousURL = previousSkill?.shortcutICloudURL
|
||||
let previousLayout = layout.sanitized(catalog: mergedCatalog)
|
||||
var catalog = userCatalog
|
||||
try catalog.upsert(skill)
|
||||
commitUserCatalog(catalog)
|
||||
if previousURL != nil, previousURL != skill.shortcutICloudURL {
|
||||
dropShortcutConfirmation(for: skill.id)
|
||||
guard previousSkill != nil, previousURL != skill.shortcutICloudURL else {
|
||||
return
|
||||
}
|
||||
let keepsKeyboardSlot = skill.shortcutICloudURL == nil
|
||||
commitLayout(
|
||||
AIAgentSkillLayout(
|
||||
enabledIDs: keepsKeyboardSlot
|
||||
? previousLayout.enabledIDs
|
||||
: previousLayout.enabledIDs.filter { $0 != skill.id },
|
||||
confirmedShortcutIDs: previousLayout.confirmedShortcutIDs.filter {
|
||||
$0 != skill.id
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
public func deleteUserSkill(id: String) {
|
||||
@@ -152,16 +165,6 @@ public final class AIAgentSkillLayoutStore: ObservableObject {
|
||||
)
|
||||
}
|
||||
|
||||
private func dropShortcutConfirmation(for id: String) {
|
||||
let current = layout.sanitized(catalog: mergedCatalog)
|
||||
commitLayout(
|
||||
AIAgentSkillLayout(
|
||||
enabledIDs: current.enabledIDs.filter { $0 != id },
|
||||
confirmedShortcutIDs: current.confirmedShortcutIDs.filter { $0 != id }
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private func commitLayout(_ layout: AIAgentSkillLayout) {
|
||||
persistLayout(layout)
|
||||
self.layout = loadLayout()
|
||||
|
||||
Reference in New Issue
Block a user