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 set default search engine screen for BR / AR #15669

Merged
merged 1 commit into from
Oct 26, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ TEST_F(BraveTemplateURLPrepopulateDataTest, ProvidersFromPrepopulated) {
}

// Verifies default search provider for locale
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForArgentina) {
CheckForCountry('A', 'R', "Brave");
}

TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForBrazil) {
CheckForCountry('B', 'R', "Brave");
}

TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForUSA) {
CheckForCountry('U', 'S', "Brave");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,58 @@ BravePrepopulatedEngineID GetDefaultSearchEngine(int country_id, int version) {
{country_codes::CountryCharsToCountryID('M', 'X'),
PREPOPULATED_ENGINE_ID_BRAVE},
});
if (version > 19) {

static constexpr auto content_v21 =
base::MakeFixedFlatMap<int, BravePrepopulatedEngineID>({
{country_codes::CountryCharsToCountryID('A', 'M'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('A', 'Z'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('B', 'Y'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('C', 'A'),
PREPOPULATED_ENGINE_ID_BRAVE},
{country_codes::CountryCharsToCountryID('D', 'E'),
PREPOPULATED_ENGINE_ID_BRAVE},
{country_codes::CountryCharsToCountryID('F', 'R'),
PREPOPULATED_ENGINE_ID_BRAVE},
{country_codes::CountryCharsToCountryID('G', 'B'),
PREPOPULATED_ENGINE_ID_BRAVE},
{country_codes::CountryCharsToCountryID('K', 'G'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('K', 'Z'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('M', 'D'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('R', 'U'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('T', 'J'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('T', 'M'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('U', 'S'),
PREPOPULATED_ENGINE_ID_BRAVE},
{country_codes::CountryCharsToCountryID('U', 'Z'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('A', 'T'),
PREPOPULATED_ENGINE_ID_BRAVE},
{country_codes::CountryCharsToCountryID('E', 'S'),
PREPOPULATED_ENGINE_ID_BRAVE},
{country_codes::CountryCharsToCountryID('M', 'X'),
PREPOPULATED_ENGINE_ID_BRAVE},
// Added values in this version bellow
{country_codes::CountryCharsToCountryID('A', 'R'),
PREPOPULATED_ENGINE_ID_BRAVE},
{country_codes::CountryCharsToCountryID('B', 'R'),
PREPOPULATED_ENGINE_ID_BRAVE},
});
if (version > 20) {
auto* it = content_v21.find(country_id);
if (it == content_v21.end()) {
return default_v6;
}
return it->second;
} else if (version > 19) {
auto* it = content_v20.find(country_id);
if (it == content_v20.end()) {
return default_v6;
Expand Down
2 changes: 1 addition & 1 deletion components/brave_welcome_ui/reducers/welcome_reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const welcomeReducer: Reducer<Welcome.State | undefined> = (state: Welcome.State
// Regions approved for Brave Search will skip search welcome card
// Regions not approved show the card- but without Brave Search
const braveSearchApprovedRegion: boolean =
['AT', 'ES', 'MX', 'US', 'CA', 'DE', 'FR', 'GB'].includes(loadTimeData.getString('countryString'))
['AR', 'BR', 'AT', 'ES', 'MX', 'US', 'CA', 'DE', 'FR', 'GB'].includes(loadTimeData.getString('countryString'))
state = {
...state,
searchProviders: payload,
Expand Down
2 changes: 1 addition & 1 deletion components/search_engines/brave_prepopulated_engines.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace TemplateURLPrepopulateData {

// IMPORTANT! Make sure to bump this value if you make changes to the
// engines below or add/remove engines.
const int kBraveCurrentDataVersion = 20;
const int kBraveCurrentDataVersion = 21;
// DO NOT CHANGE THIS ONE. Used for backfilling kBraveDefaultSearchVersion.
const int kBraveFirstTrackedDataVersion = 6;

Expand Down