Skip to content

Conversation

@cyndichin
Copy link
Contributor

📜 Tickets

Jira ticket
Github issue

💡 Description

Create a simple cache for storing recent search terms up to a max amount. The RecentSearchProvider keeps track of a list of search terms for each search engine.

Note: We have a separate ticket to investigate using RustPlaces instead here. We will use this cache for now until then.

🎥 Demos

Tested with different search engines and exceeding 5 search terms:
image

📝 Checklist

  • I filled in the ticket numbers and a description of my work
  • I updated the PR name to follow our PR naming guidelines
  • I ensured unit tests pass and wrote tests for new code
  • If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • If adding telemetry, I read the data stewardship requirements and will request a data review
  • If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • If needed, I updated documentation and added comments to complex code
  • If needed, I added a backport comment (example @Mergifyio backport release/v150.0)

@cyndichin cyndichin force-pushed the cc/FXIOS-13498_add-initial-recent-searches-cache branch from 5b47985 to 5a659c5 Compare September 22, 2025 15:08
@mobiletest-ci-bot
Copy link

mobiletest-ci-bot commented Sep 22, 2025

Messages
📖 Project coverage: 38.62%

💪 Quality guardian

1 tests files modified. You're a champion of test coverage! 🚀

🧹 Tidy commit

Just 4 file(s) touched. Thanks for keeping it clean and review-friendly!

💬 Description craftsman

Great PR description! Reviewers salute you 🫡

🥇 Perfect PR size

Smaller PRs are easier to review. Thanks for making life easy for reviewers! ✨

Client.app: Coverage: 37.32

File Coverage
RecentSearchProvider.swift 100.0%

Generated by 🚫 Danger Swift against 22c856a

@cyndichin cyndichin requested a review from issammani September 22, 2025 15:40
@cyndichin cyndichin marked this pull request as ready for review September 22, 2025 15:40
@cyndichin cyndichin requested a review from a team as a code owner September 22, 2025 15:40
Copy link
Collaborator

@issammani issammani left a 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 🔥

Comment on lines +77 to +82
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")
Copy link
Collaborator

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 }
Copy link
Collaborator

@issammani issammani Sep 24, 2025

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>
@issammani issammani merged commit 3d43d95 into main Sep 24, 2025
10 checks passed
@issammani issammani deleted the cc/FXIOS-13498_add-initial-recent-searches-cache branch September 24, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants