Fix matching algorithm in AutoFill
This commit is contained in:
parent
9e8994f576
commit
571281b655
3 changed files with 6 additions and 22 deletions
|
|
@ -38,8 +38,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
|
|||
credentialProvider.identifier = serviceIdentifiers.first
|
||||
let url = serviceIdentifiers.first.flatMap { URL(string: $0.identifier) }
|
||||
passwordsViewController.navigationItem.prompt = url?.host
|
||||
let keywords = url?.host?.sanitizedDomain?.components(separatedBy: ".") ?? []
|
||||
passwordsViewController.showPasswordsWithSuggstion(keywords)
|
||||
passwordsViewController.showPasswordsWithSuggstion(matching: url?.host ?? "")
|
||||
}
|
||||
|
||||
override func provideCredentialWithoutUserInteraction(for credentialIdentity: ASPasswordCredentialIdentity) {
|
||||
|
|
@ -57,7 +56,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
|
|||
}
|
||||
credentialProvider.identifier = credentialIdentity.serviceIdentifier
|
||||
passwordsViewController.navigationItem.prompt = identifier
|
||||
passwordsViewController.showPasswordsWithSuggstion([identifier])
|
||||
passwordsViewController.showPasswordsWithSuggstion(matching: identifier)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,14 +67,3 @@ extension CredentialProviderViewController: PasswordSelectionDelegate {
|
|||
credentialProvider.persistAndProvideCredentials(with: passwordEntity.getPath())
|
||||
}
|
||||
}
|
||||
|
||||
private extension String {
|
||||
var sanitizedDomain: String? {
|
||||
replacingOccurrences(of: ".com", with: "")
|
||||
.replacingOccurrences(of: ".org", with: "")
|
||||
.replacingOccurrences(of: ".edu", with: "")
|
||||
.replacingOccurrences(of: ".net", with: "")
|
||||
.replacingOccurrences(of: ".gov", with: "")
|
||||
.replacingOccurrences(of: "www.", with: "")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue