Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove URLs from suggestion search terms #2683

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10032,8 +10032,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 132.0.1;
branch = "alessandro/autocomplete-search-term-remove-urls";
kind = branch;
};
};
9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/DuckDuckGo/BrowserServicesKit",
"state" : {
"revision" : "73f68ee1c0dda3cd4a0b0cc3cc38a6cc7e605829",
"version" : "132.0.1"
"branch" : "alessandro/autocomplete-search-term-remove-urls",
"revision" : "5a6b0de96b14aec867ca0b9544dfd4fb0256fab8"
}
},
{
Expand Down Expand Up @@ -183,7 +183,7 @@
{
"identity" : "trackerradarkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/TrackerRadarKit",
"location" : "https://github.com/duckduckgo/TrackerRadarKit.git",
"state" : {
"revision" : "a6b7ba151d9dc6684484f3785293875ec01cc1ff",
"version" : "1.2.2"
Expand Down
11 changes: 1 addition & 10 deletions DuckDuckGo/AutocompleteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,7 @@ class AutocompleteViewController: UIViewController {
selectedItem = -1
tableView.reloadData()

loader = SuggestionLoader(dataSource: self, urlFactory: { phrase in
guard let url = URL(trimmedAddressBarString: phrase),
let scheme = url.scheme,
scheme.description.hasPrefix("http"),
url.isValid else {
return nil
}

return url
})
loader = SuggestionLoader(dataSource: self, urlFactory: URL.makeURL(fromSuggestionPhrase:))
Copy link
Contributor Author

@alessandroboron alessandroboron Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought to align iOS with macOS. I moved the URLFactory function into BSK/Suggestions and have iOS & macOS use the function without duplicating the/having similar code.

pendingRequest = true

loader?.getSuggestions(query: query) { [weak self] result, error in
Expand Down
Loading