You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iceraven-browser/app/src/main/java/org/mozilla/fenix/home/topsites/DefaultTopSitesView.kt

31 lines
949 B
Kotlin

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.home.topsites
import mozilla.components.feature.top.sites.TopSite
import mozilla.components.feature.top.sites.view.TopSitesView
import org.mozilla.fenix.components.AppStore
import org.mozilla.fenix.components.appstate.AppAction
import org.mozilla.fenix.ext.sort
import org.mozilla.fenix.utils.Settings
class DefaultTopSitesView(
val store: AppStore,
val settings: Settings
) : TopSitesView {
override fun displayTopSites(topSites: List<TopSite>) {
store.dispatch(
AppAction.TopSitesChange(
if (!settings.showContileFeature) {
topSites
} else {
topSites.sort()
}
)
)
}
}