Rename method

This commit is contained in:
Danny Moesch 2021-08-26 23:12:13 +02:00 committed by Mingshen Sun
parent 545186da96
commit b3eef51a9d
6 changed files with 8 additions and 8 deletions

View file

@ -68,7 +68,7 @@ class PasswordNavigationDataSource: NSObject, UITableViewDataSource {
} }
filteredSections = sections.map { section in filteredSections = sections.map { section in
let entries = section.entries.filter { $0.match(text) } let entries = section.entries.filter { $0.matches(text) }
return Section(title: section.title, entries: entries) return Section(title: section.title, entries: entries)
} }
.filter { !$0.entries.isEmpty } .filter { !$0.entries.isEmpty }

View file

@ -39,7 +39,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
credentialProvider.identifier = serviceIdentifiers.first credentialProvider.identifier = serviceIdentifiers.first
let url = serviceIdentifiers.first.flatMap { URL(string: $0.identifier) } let url = serviceIdentifiers.first.flatMap { URL(string: $0.identifier) }
passwordsViewController.navigationItem.prompt = url?.host passwordsViewController.navigationItem.prompt = url?.host
passwordsViewController.showPasswordsWithSuggstion(matching: url?.host ?? "") passwordsViewController.showPasswordsWithSuggestion(matching: url?.host ?? "")
} }
override func provideCredentialWithoutUserInteraction(for credentialIdentity: ASPasswordCredentialIdentity) { override func provideCredentialWithoutUserInteraction(for credentialIdentity: ASPasswordCredentialIdentity) {
@ -57,7 +57,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
} }
credentialProvider.identifier = credentialIdentity.serviceIdentifier credentialProvider.identifier = credentialIdentity.serviceIdentifier
passwordsViewController.navigationItem.prompt = identifier passwordsViewController.navigationItem.prompt = identifier
passwordsViewController.showPasswordsWithSuggstion(matching: identifier) passwordsViewController.showPasswordsWithSuggestion(matching: identifier)
} }
@objc @objc

View file

@ -43,7 +43,7 @@ class PasswordsViewController: UIViewController {
tableView.dataSource = dataSource tableView.dataSource = dataSource
} }
func showPasswordsWithSuggstion(matching text: String) { func showPasswordsWithSuggestion(matching text: String) {
dataSource.showTableEntriesWithSuggestion(matching: text) dataSource.showTableEntriesWithSuggestion(matching: text)
tableView.reloadData() tableView.reloadData()
} }

View file

@ -61,7 +61,7 @@ class PasswordsTableDataSource: NSObject, UITableViewDataSource {
return return
} }
filteredPasswordsTableEntries = passwordTableEntries.filter { $0.match(text) } filteredPasswordsTableEntries = passwordTableEntries.filter { $0.matches(text) }
showSuggestion = false showSuggestion = false
} }
@ -73,7 +73,7 @@ class PasswordsTableDataSource: NSObject, UITableViewDataSource {
} }
for entry in passwordTableEntries { for entry in passwordTableEntries {
if entry.match(text) { if entry.matches(text) {
suggestedPasswordsTableEntries.append(entry) suggestedPasswordsTableEntries.append(entry)
} else { } else {
otherPasswordsTableEntries.append(entry) otherPasswordsTableEntries.append(entry)

View file

@ -59,7 +59,7 @@ class ExtensionViewController: UIViewController {
func completeTask(_ text: String?) { func completeTask(_ text: String?) {
DispatchQueue.main.async { DispatchQueue.main.async {
self.passwordsViewController.showPasswordsWithSuggstion(matching: text ?? "") self.passwordsViewController.showPasswordsWithSuggestion(matching: text ?? "")
self.passwordsViewController.navigationItem.prompt = text self.passwordsViewController.navigationItem.prompt = text
} }
} }

View file

@ -23,7 +23,7 @@ public class PasswordTableEntry: NSObject {
self.categoryText = entity.getCategoryText() self.categoryText = entity.getCategoryText()
} }
public func match(_ searchText: String) -> Bool { public func matches(_ searchText: String) -> Bool {
PasswordTableEntry.match(nameWithCategory: passwordEntity.nameWithCategory, searchText: searchText) PasswordTableEntry.match(nameWithCategory: passwordEntity.nameWithCategory, searchText: searchText)
} }