-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add FXIOS-13387 [Trending Searches] initial recent searches cache #29485
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
Add FXIOS-13387 [Trending Searches] initial recent searches cache #29485
Conversation
5b47985 to
5a659c5
Compare
💪 Quality guardian1 tests files modified. You're a champion of test coverage! 🚀 🧹 Tidy commitJust 4 file(s) touched. Thanks for keeping it clean and review-friendly! 💬 Description craftsmanGreat PR description! Reviewers salute you 🫡 🥇 Perfect PR sizeSmaller PRs are easier to review. Thanks for making life easy for reviewers! ✨ Client.app: Coverage: 37.32
Generated by 🚫 Danger Swift against 22c856a |
issammani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit in comment otherwise 🔥
firefox-ios/Client/Frontend/Browser/SearchEngines/RecentSearchProvider.swift
Outdated
Show resolved
Hide resolved
| for i in 1...15 { sut.addRecentSearch("search term \(i)") } | ||
|
|
||
| let result = sut.recentSearches() | ||
| XCTAssertEqual(result.count, 5) | ||
| XCTAssertEqual(result.first, "search term 15") | ||
| XCTAssertEqual(result.last, "search term 11") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
|
|
||
| var searches = recentSearches() | ||
|
|
||
| searches.removeAll { $0.caseInsensitiveCompare(trimmed) == .orderedSame } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍 . I remember using a naive lowercase + == causing some problems in desktop in form history for turkish. caseInsensitiveCompare is the way to go.
…Provider.swift Co-authored-by: Issam Mani <issamouu69@gmail.com>
📜 Tickets
Jira ticket
Github issue
💡 Description
Create a simple cache for storing recent search terms up to a max amount. The
RecentSearchProviderkeeps track of a list of search terms for each search engine.Note: We have a separate ticket to investigate using
RustPlacesinstead here. We will use this cache for now until then.🎥 Demos
Tested with different search engines and exceeding 5 search terms:

📝 Checklist
@Mergifyio backport release/v150.0)