Skip to content

Commit

Permalink
For mozilla-mobile#15711: Also add custom engines to fallback list.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarare authored and liuche committed Oct 15, 2020
1 parent 39ac009 commit d79f521
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -92,7 +92,7 @@ open class FenixSearchEngineProvider(
CustomSearchEngineProvider().loadSearchEngines(context)
}

private var loadedSearchEngines = refreshAsync()
private var loadedSearchEngines = refreshAsync(baseSearchEngines)

// https://github.com/mozilla-mobile/fenix/issues/9935
// Create new getter that will return the fallback SearchEngineList if
Expand All @@ -102,7 +102,7 @@ open class FenixSearchEngineProvider(
if (isRegionCachedByLocationService) {
loadedSearchEngines
} else {
fallbackEngines
refreshAsync(fallbackEngines)
}

fun getDefaultEngine(context: Context): SearchEngine {
Expand Down Expand Up @@ -176,7 +176,7 @@ open class FenixSearchEngineProvider(
fun reload() {
launch {
customSearchEngines = async { CustomSearchEngineProvider().loadSearchEngines(context) }
loadedSearchEngines = refreshAsync()
loadedSearchEngines = refreshAsync(baseSearchEngines)
}
}

Expand All @@ -188,8 +188,8 @@ open class FenixSearchEngineProvider(
}
}

private fun refreshAsync() = async {
val engineList = baseSearchEngines.await()
private fun refreshAsync(baseList: Deferred<SearchEngineList>) = async {
val engineList = baseList.await()
val bundledList = bundledSearchEngines.await().list
val customList = customSearchEngines.await().list

Expand Down

0 comments on commit d79f521

Please sign in to comment.