|
|
|
@ -14,7 +14,7 @@ import mozilla.components.feature.top.sites.TopSite
|
|
|
|
|
import mozilla.components.feature.top.sites.TopSiteStorage
|
|
|
|
|
import mozilla.components.support.locale.LocaleManager
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
import org.mozilla.fenix.ext.observeOnce
|
|
|
|
|
import org.mozilla.fenix.ext.observeOnceAndRemoveObserver
|
|
|
|
|
import org.mozilla.fenix.ext.settings
|
|
|
|
|
import org.mozilla.fenix.settings.SupportUtils
|
|
|
|
|
import org.mozilla.fenix.settings.advanced.getSelectedLocale
|
|
|
|
@ -88,8 +88,15 @@ class TopSiteStorage(private val context: Context) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This is for issue https://github.com/mozilla-mobile/fenix/issues/11660. We prefetch the top
|
|
|
|
|
* sites for startup so that we're sure that we have all the data available as our fragment is
|
|
|
|
|
* launched to make sure that we can display everything on the home screen on the first drawing pass.
|
|
|
|
|
* This method doesn't negatively affect performance since the [getTopSites] runs on the a
|
|
|
|
|
* background thread.
|
|
|
|
|
*/
|
|
|
|
|
fun prefetch() {
|
|
|
|
|
getTopSites().observeOnce {
|
|
|
|
|
getTopSites().observeOnceAndRemoveObserver {
|
|
|
|
|
cachedTopSites = it
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|