Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gaba
fenix
Commits
a8746320
Commit
a8746320
authored
Jan 16, 2020
by
Jeff Boek
Browse files
For #3869 - Uses RegionSearchLocalizationProvider in the search engine provider
parent
2b0a5086
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
a8746320
...
@@ -84,6 +84,7 @@ gen-external-apklibs
...
@@ -84,6 +84,7 @@ gen-external-apklibs
.adjust_token
.adjust_token
.sentry_token
.sentry_token
.digital_asset_links_token
.digital_asset_links_token
.mls_token
# Python Byte-compiled / optimized / DLL files
# Python Byte-compiled / optimized / DLL files
...
...
app/build.gradle
View file @
a8746320
...
@@ -356,6 +356,21 @@ android.applicationVariants.all { variant ->
...
@@ -356,6 +356,21 @@ android.applicationVariants.all { variant ->
buildConfigField
'String'
,
'DIGITAL_ASSET_LINKS_TOKEN'
,
'null'
buildConfigField
'String'
,
'DIGITAL_ASSET_LINKS_TOKEN'
,
'null'
println
(
"X_X"
)
println
(
"X_X"
)
}
}
// -------------------------------------------------------------------------------------------------
// MLS: Read token from local file if it exists
// -------------------------------------------------------------------------------------------------
print
(
"MLS token: "
)
try
{
def
token
=
new
File
(
"${rootDir}/.mls_token"
).
text
.
trim
()
buildConfigField
'String'
,
'MLS_TOKEN'
,
'"'
+
token
+
'"'
println
"(Added from .mls_token file)"
}
catch
(
FileNotFoundException
ignored
)
{
buildConfigField
'String'
,
'MLS_TOKEN'
,
'""'
println
(
"X_X"
)
}
}
}
androidExtensions
{
androidExtensions
{
...
@@ -429,6 +444,8 @@ dependencies {
...
@@ -429,6 +444,8 @@ dependencies {
implementation
Deps
.
mozilla_service_firefox_accounts
implementation
Deps
.
mozilla_service_firefox_accounts
implementation
Deps
.
mozilla_service_glean
implementation
Deps
.
mozilla_service_glean
implementation
Deps
.
mozilla_service_experiments
implementation
Deps
.
mozilla_service_experiments
implementation
Deps
.
mozilla_service_location
implementation
Deps
.
mozilla_support_base
implementation
Deps
.
mozilla_support_base
implementation
Deps
.
mozilla_support_ktx
implementation
Deps
.
mozilla_support_ktx
...
...
app/src/main/java/org/mozilla/fenix/components/searchengine/FenixSearchEngineProvider.kt
View file @
a8746320
...
@@ -17,7 +17,10 @@ import mozilla.components.browser.search.provider.AssetsSearchEngineProvider
...
@@ -17,7 +17,10 @@ import mozilla.components.browser.search.provider.AssetsSearchEngineProvider
import
mozilla.components.browser.search.provider.SearchEngineList
import
mozilla.components.browser.search.provider.SearchEngineList
import
mozilla.components.browser.search.provider.SearchEngineProvider
import
mozilla.components.browser.search.provider.SearchEngineProvider
import
mozilla.components.browser.search.provider.filter.SearchEngineFilter
import
mozilla.components.browser.search.provider.filter.SearchEngineFilter
import
mozilla.components.browser.search.provider.localization.LocaleSearchLocalizationProvider
import
mozilla.components.service.location.MozillaLocationService
import
mozilla.components.service.location.search.RegionSearchLocalizationProvider
import
org.mozilla.fenix.BuildConfig
import
org.mozilla.fenix.ext.components
import
org.mozilla.fenix.ext.settings
import
org.mozilla.fenix.ext.settings
import
java.util.Locale
import
java.util.Locale
...
@@ -26,15 +29,25 @@ open class FenixSearchEngineProvider(
...
@@ -26,15 +29,25 @@ open class FenixSearchEngineProvider(
private
val
context
:
Context
private
val
context
:
Context
)
:
SearchEngineProvider
,
CoroutineScope
by
CoroutineScope
(
Job
()
+
Dispatchers
.
IO
)
{
)
:
SearchEngineProvider
,
CoroutineScope
by
CoroutineScope
(
Job
()
+
Dispatchers
.
IO
)
{
@VisibleForTesting
(
otherwise
=
VisibleForTesting
.
PRIVATE
)
@VisibleForTesting
(
otherwise
=
VisibleForTesting
.
PRIVATE
)
private
val
localizationProvider
=
RegionSearchLocalizationProvider
(
MozillaLocationService
(
context
,
context
.
components
.
core
.
client
,
BuildConfig
.
MLS_TOKEN
)
)
open
val
baseSearchEngines
=
async
{
open
val
baseSearchEngines
=
async
{
AssetsSearchEngineProvider
(
LocaleSearchL
ocalizationProvider
()
).
loadSearchEngines
(
context
)
AssetsSearchEngineProvider
(
l
ocalizationProvider
).
loadSearchEngines
(
context
)
}
}
@VisibleForTesting
(
otherwise
=
VisibleForTesting
.
PRIVATE
)
@VisibleForTesting
(
otherwise
=
VisibleForTesting
.
PRIVATE
)
open
val
bundledSearchEngines
=
async
{
open
val
bundledSearchEngines
=
async
{
val
defaultEngineIdentifiers
=
baseSearchEngines
.
await
().
list
.
map
{
it
.
identifier
}.
toSet
()
val
defaultEngineIdentifiers
=
baseSearchEngines
.
await
().
list
.
map
{
it
.
identifier
}.
toSet
()
AssetsSearchEngineProvider
(
AssetsSearchEngineProvider
(
LocaleSearchL
ocalizationProvider
()
,
l
ocalizationProvider
,
filters
=
listOf
(
object
:
SearchEngineFilter
{
filters
=
listOf
(
object
:
SearchEngineFilter
{
override
fun
filter
(
context
:
Context
,
searchEngine
:
SearchEngine
):
Boolean
{
override
fun
filter
(
context
:
Context
,
searchEngine
:
SearchEngine
):
Boolean
{
return
BUNDLED_SEARCH_ENGINES
.
contains
(
searchEngine
.
identifier
)
&&
return
BUNDLED_SEARCH_ENGINES
.
contains
(
searchEngine
.
identifier
)
&&
...
...
buildSrc/src/main/java/Dependencies.kt
View file @
a8746320
...
@@ -135,6 +135,7 @@ object Deps {
...
@@ -135,6 +135,7 @@ object Deps {
const
val
mozilla_service_glean
=
"org.mozilla.components:service-glean:${Versions.mozilla_android_components}"
const
val
mozilla_service_glean
=
"org.mozilla.components:service-glean:${Versions.mozilla_android_components}"
const
val
mozilla_service_glean_forUnitTests
=
"org.mozilla.telemetry:glean-forUnitTests:${Versions.mozilla_glean}"
const
val
mozilla_service_glean_forUnitTests
=
"org.mozilla.telemetry:glean-forUnitTests:${Versions.mozilla_glean}"
const
val
mozilla_service_experiments
=
"org.mozilla.components:service-experiments:${Versions.mozilla_android_components}"
const
val
mozilla_service_experiments
=
"org.mozilla.components:service-experiments:${Versions.mozilla_android_components}"
const
val
mozilla_service_location
=
"org.mozilla.components:service-location:${Versions.mozilla_android_components}"
const
val
mozilla_ui_colors
=
"org.mozilla.components:ui-colors:${Versions.mozilla_android_components}"
const
val
mozilla_ui_colors
=
"org.mozilla.components:ui-colors:${Versions.mozilla_android_components}"
const
val
mozilla_ui_icons
=
"org.mozilla.components:ui-icons:${Versions.mozilla_android_components}"
const
val
mozilla_ui_icons
=
"org.mozilla.components:ui-icons:${Versions.mozilla_android_components}"
...
...
taskcluster/fenix_taskgraph/transforms/build.py
View file @
a8746320
...
@@ -47,6 +47,7 @@ def add_shippable_secrets(config, tasks):
...
@@ -47,6 +47,7 @@ def add_shippable_secrets(config, tasks):
(
'digital_asset_links'
,
'.digital_asset_links_token'
),
(
'digital_asset_links'
,
'.digital_asset_links_token'
),
(
'leanplum'
,
'.leanplum_token'
),
(
'leanplum'
,
'.leanplum_token'
),
(
'sentry_dsn'
,
'.sentry_token'
),
(
'sentry_dsn'
,
'.sentry_token'
),
(
'mls'
,
'.mls_token'
),
)])
)])
else
:
else
:
task
[
"run"
][
"pre-gradlew"
]
=
[[
task
[
"run"
][
"pre-gradlew"
]
=
[[
...
@@ -55,6 +56,7 @@ def add_shippable_secrets(config, tasks):
...
@@ -55,6 +56,7 @@ def add_shippable_secrets(config, tasks):
(
"--"
,
".adjust_token"
),
(
"--"
,
".adjust_token"
),
(
""
,
".digital_asset_links_token"
),
(
""
,
".digital_asset_links_token"
),
(
"-:-"
,
".leanplum_token"
),
(
"-:-"
,
".leanplum_token"
),
(
""
,
".mls_token"
),
(
"https://fake@sentry.prod.mozaws.net/368"
,
".sentry_token"
),
(
"https://fake@sentry.prod.mozaws.net/368"
,
".sentry_token"
),
)]
)]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment