Bug 1804594 - Differentiate search engines between "general" and "topic specific" when they are loaded#273
Conversation
| // List of general search engine ids, taken from | ||
| // https://searchfox.org/mozilla-central/rev/ef0aa879e94534ffd067a3748d034540a9fc10b0/toolkit/components/search/SearchUtils.sys.mjs#200 | ||
| internal val GENERAL_SEARCH_ENGINE_IDS = setOf( | ||
| GOOGLE_ID, |
There was a problem hiding this comment.
I think we could've also just put google-b-m and google-com-nocodes instead of doing a startsWith as well. I went with startsWith because I saw there was google-b-amzes for Echo Show in my search https://searchfox.org/mozilla-mobile/search?q=google-&path=&case=false®exp=false
No strong opinions here - happy to make the switch.
| assertEquals(searchEngine.name, readSearchEngine.name) | ||
| assertEquals(searchEngine.type, readSearchEngine.type) | ||
| assertEquals(searchEngine.resultUrls, readSearchEngine.resultUrls) | ||
| assertFalse(readSearchEngine.isGeneral) |
There was a problem hiding this comment.
Snuck the false check here
| val type: Type, | ||
| val resultUrls: List<String> = emptyList(), | ||
| val suggestUrl: String? = null, | ||
| val isGeneral: Boolean = false, |
There was a problem hiding this comment.
Wanted to ask about the direction to take in regards to user added search engines.
Because based on https://mozilla-hub.atlassian.net/browse/FNXV2-22038 only "general" search engines can be set as the default:
- should the default here be
trueor - should we amend Fenix to go with "only general or user added search engines can be set as the default"?
cc @DreVla
There was a problem hiding this comment.
So, I thinking we will just set isGeneral when we call createSearchEngine in Fenix https://searchfox.org/mozilla-mobile/source/fenix/app/src/main/java/org/mozilla/fenix/settings/search/AddSearchEngineFragment.kt#180
|
This pull request has conflicts when rebasing. Could you fix it @gabrielluong? 🙏 |
f081f55 to
67baabd
Compare
67baabd to
62df449
Compare
| type = type, | ||
| resultUrls = resultsUrls, | ||
| suggestUrl = suggestUrl, | ||
| isGeneral = type == SearchEngine.Type.CUSTOM || isGeneralSearchEngine(identifier), |
There was a problem hiding this comment.
I don't know if I am happy with this check type == SearchEngine.Type.CUSTOM with all custom search engines being considered general. However, I am assuming all custom search engines are user added search engines. I could also do something similar to above with the variables name, suggestUrl, etc which will set isGeneral based on the value is that is saved in the file instead of deriving isGeneral from the type.
62df449 to
8ec8824
Compare
|
@Mugurell I am wondering if we even need this patch if we could just derive that the search engine is general when it's a |
That would work also and is what @DreVla has been doing in his Fenix drafts.
|
|
I have been following this patch and also tested it for this ticket: mozilla-mobile/fenix#28112. I have to agree with what @Mugurell said, rather taking this one patch as basis for the many other tasks involving the separation between the two search engines categories in fenix. |
|
Sounds good, I will land this after the cut. We'll need to update the changelog. |
…ic specific" when they are loaded
8ec8824 to
021e2c9
Compare
ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1830530 mozilla-mobile/firefox-android#273 Signed-off-by: Tad <tad@spotco.us>
Pull Request checklist
After merge
GitHub Automation
Used by GitHub Actions.