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:
parent
1fa7b8a4dc
commit
0fbed9aa3c
@ -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> {
|
||||||
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user