- Remove dead provideCredentialWithoutUserInteraction override and unlockSilently() helper (nothing registers credential identities, so it could never run, and it was a footgun for future inline QuickType work). - Surface non-cancellation biometric unlock failures into errorMessage instead of swallowing them, matching UnlockViewModel.unlockWithBiometrics(). - Forward VaultSession.objectWillChange into ExtensionViewModel via Combine so the lock/unlock UI transition no longer depends on an accidental isUnlocking side effect, matching VaultViewModel's pattern. - Show the "Open MyPass" deep-link escape hatch whenever unlock fails (errorMessage set), not only when there's no bookmark yet, per the extension constraints spec. - Add INFOPLIST_KEY_NSFaceIDUsageDescription to the MyPass and AutoFill targets' Debug/Release build configs. Also folds in pre-existing alphabetical reordering of two PBXBuildFile/PBXFileReference entries in project.pbxproj from an earlier task, since this same file is already being touched here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WYqycDFsynHH9VnnK7LNSf
51 lines
1.9 KiB
Swift
51 lines
1.9 KiB
Swift
//
|
|
// CredentialProviderViewController.swift
|
|
// AutoFill
|
|
//
|
|
// Created by Christophe Vila on 19/09/2026.
|
|
//
|
|
|
|
import AuthenticationServices
|
|
import SwiftUI
|
|
import MyPassCore
|
|
|
|
final class CredentialProviderViewController: ASCredentialProviderViewController {
|
|
|
|
private let session = VaultSession()
|
|
private let bookmarkService = FileBookmarkService()
|
|
private let keychainStore = KeychainStore(accessGroup: "org.antiloop222.mypass")
|
|
private let biometricService = BiometricAuthService()
|
|
|
|
// Called when the user selects MyPass from the QuickType bar.
|
|
override func prepareCredentialList(for serviceIdentifiers: [ASCredentialServiceIdentifier]) {
|
|
let ids = serviceIdentifiers.map(\.identifier)
|
|
showUI(serviceIdentifiers: ids)
|
|
}
|
|
|
|
private func showUI(serviceIdentifiers: [String]) {
|
|
let rootView = ExtensionRootView(
|
|
session: session,
|
|
serviceIdentifiers: serviceIdentifiers,
|
|
bookmarkService: bookmarkService,
|
|
keychainStore: keychainStore,
|
|
biometricService: biometricService,
|
|
onSelect: { [weak self] (entry: Entry) in
|
|
let credential = ASPasswordCredential(
|
|
user: entry.username,
|
|
password: entry.password.reveal()
|
|
)
|
|
self?.extensionContext.completeRequest(withSelectedCredential: credential, completionHandler: nil)
|
|
},
|
|
onCancel: { [weak self] in
|
|
self?.extensionContext.cancelRequest(withError: ASExtensionError(.userCanceled))
|
|
}
|
|
)
|
|
let host = UIHostingController(rootView: rootView)
|
|
addChild(host)
|
|
view.addSubview(host.view)
|
|
host.view.frame = view.bounds
|
|
host.view.autoresizingMask = [UIView.AutoresizingMask.flexibleWidth, UIView.AutoresizingMask.flexibleHeight]
|
|
host.didMove(toParent: self)
|
|
}
|
|
}
|