2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

[fenix] Convert flow from AC to livedata

This commit is contained in:
Tiger Oakes 2020-06-12 15:00:25 -07:00 committed by Jonathan Almeida
parent 1fa7b8a4dc
commit 0fbed9aa3c
2 changed files with 4 additions and 2 deletions

View File

@ -7,6 +7,7 @@ package org.mozilla.fenix.components
import android.content.Context import android.content.Context
import android.os.StrictMode import android.os.StrictMode
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.asLiveData
import androidx.paging.DataSource import androidx.paging.DataSource
import mozilla.components.browser.session.Session import mozilla.components.browser.session.Session
import mozilla.components.browser.session.SessionManager import mozilla.components.browser.session.SessionManager
@ -71,7 +72,7 @@ class TabCollectionStorage(
} }
fun getCollections(limit: Int = 20): LiveData<List<TabCollection>> { fun getCollections(limit: Int = 20): LiveData<List<TabCollection>> {
return collectionStorage.getCollections(limit) return collectionStorage.getCollections(limit).asLiveData()
} }
fun getCollectionsPaged(): DataSource.Factory<Int, TabCollection> { fun getCollectionsPaged(): DataSource.Factory<Int, TabCollection> {

View File

@ -6,6 +6,7 @@ package org.mozilla.fenix.components
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.asLiveData
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -41,7 +42,7 @@ class TopSiteStorage(private val context: Context) {
* Returns a [LiveData] list of all the [TopSite] instances. * Returns a [LiveData] list of all the [TopSite] instances.
*/ */
fun getTopSites(): LiveData<List<TopSite>> { fun getTopSites(): LiveData<List<TopSite>> {
return storage.getTopSites() return storage.getTopSites().asLiveData()
} }
/** /**