Refactor and merge code of extensions

This commit is contained in:
Mingshen Sun 2021-01-10 13:40:17 -08:00
parent 87d1dd5be1
commit 776884e894
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
13 changed files with 391 additions and 446 deletions

View file

@ -32,6 +32,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
let dataSource = PasswordsTableDataSource(entries: passwordsTableEntries)
passwordsViewController.dataSource = dataSource
passwordsViewController.selectionDelegate = self
passwordsViewController.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancel))
}
override func prepareCredentialList(for serviceIdentifiers: [ASCredentialServiceIdentifier]) {
@ -58,6 +59,11 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
passwordsViewController.navigationItem.prompt = identifier
passwordsViewController.showPasswordsWithSuggstion(matching: identifier)
}
@objc
private func cancel(_: AnyObject?) {
self.extensionContext.cancelRequest(withError: NSError(domain: "PassExtension", code: 0))
}
}
extension CredentialProviderViewController: PasswordSelectionDelegate {