-
Notifications
You must be signed in to change notification settings - Fork 896
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
[iOS] Search Suggestions Enhancement #24376
Conversation
e32662c
to
1944047
Compare
1944047
to
5a47cf7
Compare
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.
lets wait for sec/priv review
399c737
to
69ebf35
Compare
A Storybook has been deployed to preview UI for the latest push |
7595442
to
b3e0c37
Compare
1cd62f3
to
335f688
Compare
335f688
to
b3f5eec
Compare
BraveSearch default countries show search suggestion flag to ON at first launch application time
b3f5eec
to
65c4e09
Compare
[puLL-Merge] - brave/brave-core@24376 DescriptionThis PR introduces changes to improve search functionality and security in the Brave iOS app. It adds a new URLBarHelper class to detect suspicious search queries, updates the search suggestion behavior, and modifies how default search engines are determined based on region. Possible Issues
Security Hotspots
ChangesChanges
The PR also includes some file moves and renames in the test directory. |
A Storybook has been deployed to preview UI for the latest push |
Verification PASSED on
Region with Brave SE as
|
Example |
Example |
---|---|
This partially reverts a change in #24376 which removed a set of TabEventHandler's
Resolves brave/brave-browser#38137
Security Ticket: https://github.com/brave/reviews/issues/1567 to evaluate the spec
https://github.com/brave/reviews/issues/1672 to evaluate the implementation iOS
The main focus:
This PR is aiming to enhance the user experience especially for the first time users for search suggestions. Some users are confused about enabling search suggestions and considering Brave doesn't have search suggestions because they can easily miss prompt for enabling it or forget about disabling it and don't know where to enable inside setting screens later.
To improve this, users from Brave Search Default regions have their search suggestions enabled by default. (They can disable from settings etc, that behaviour is not changed)
The change can be seen at
InitialSearchEngine
andSearchEngine
classes along with the tests for it insideInitialSearchEngineTests
.To enabled this behaviour the additional changes were required
Do not offer suggestions if you have pasted from clipboard and isSuspicious query method . After 1 keystroke the suggestions should appear. And test the pasted query with this method.
Suspicious Query
check is converted into swift from https://github.com/brave/search/blob/main/services/mixer/serpkit/src/lib/utils/hw.ts#L376and the tests from https://github.com/brave/search/blob/a68168a840980b219c4ed9ea4cc45f3550ea6296/services/mixer/serpkit/tests/lib/utils/hw.test.ts#L95 are also added to prove the converted function acts as desired.
This conversion also included the conversion regex phrases to be used in swift with rules like
-Use a "raw" string literal to avoid double escaping backslashes that form regex escapes (you have \1 backreference and . regex escape in the pattern), so use let format = #"..."#
-Escape square brackets inside character classes in a regex pattern because square brackets "[" and "]" are both special (they are used to create character class intersections and unions).
Also some quality of life changes are made to SearchEngines class.
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
test
and check search suggestions are displayed and delete the entryScreenshots-Videos:
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-06-26.at.14.37.51.mp4