1
0
Fork 0

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
Will Hawkins 2019-08-29 15:48:46 -04:00 committed by Jeff Boek
parent ab57bfd46f
commit 3abffd5d77
2 changed files with 6 additions and 8 deletions

View File

@ -31,12 +31,11 @@ class Search(private val context: Context) {
).apply {
registerForLocaleUpdates(context)
GlobalScope.launch {
loadAsync(context).await()
defaultSearchEngine = getDefaultSearchEngineAsync(
context,
Settings.getInstance(context).defaultSearchEngineName
)
}
defaultSearchEngine = getDefaultSearchEngine(
context,
Settings.getInstance(context).defaultSearchEngineName
)
}
}
}

View File

@ -152,9 +152,8 @@ class AwesomeBarView(
defaultSearchSuggestionProvider =
SearchSuggestionProvider(
searchEngine = components.search.searchEngineManager.getDefaultSearchEngine(
this
),
context = this,
searchEngineManager = components.search.searchEngineManager,
searchUseCase = searchUseCase,
fetchClient = components.core.client,
mode = SearchSuggestionProvider.Mode.MULTIPLE_SUGGESTIONS,