Use new async API to load and access search engines
Use the new asynchronous features of the search engine manager from a-c to avoid the latency required to load the default search engine.master
parent
ab57bfd46f
commit
3abffd5d77
|
@ -31,12 +31,11 @@ class Search(private val context: Context) {
|
||||||
).apply {
|
).apply {
|
||||||
registerForLocaleUpdates(context)
|
registerForLocaleUpdates(context)
|
||||||
GlobalScope.launch {
|
GlobalScope.launch {
|
||||||
loadAsync(context).await()
|
defaultSearchEngine = getDefaultSearchEngineAsync(
|
||||||
|
context,
|
||||||
|
Settings.getInstance(context).defaultSearchEngineName
|
||||||
|
)
|
||||||
}
|
}
|
||||||
defaultSearchEngine = getDefaultSearchEngine(
|
|
||||||
context,
|
|
||||||
Settings.getInstance(context).defaultSearchEngineName
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,9 +152,8 @@ class AwesomeBarView(
|
||||||
|
|
||||||
defaultSearchSuggestionProvider =
|
defaultSearchSuggestionProvider =
|
||||||
SearchSuggestionProvider(
|
SearchSuggestionProvider(
|
||||||
searchEngine = components.search.searchEngineManager.getDefaultSearchEngine(
|
context = this,
|
||||||
this
|
searchEngineManager = components.search.searchEngineManager,
|
||||||
),
|
|
||||||
searchUseCase = searchUseCase,
|
searchUseCase = searchUseCase,
|
||||||
fetchClient = components.core.client,
|
fetchClient = components.core.client,
|
||||||
mode = SearchSuggestionProvider.Mode.MULTIPLE_SUGGESTIONS,
|
mode = SearchSuggestionProvider.Mode.MULTIPLE_SUGGESTIONS,
|
||||||
|
|
Loading…
Reference in New Issue