mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-18 05:47:22 -04:00
Don't recreate database flows on each recomposition
this speeds up initial loading of data for main screen
This commit is contained in:
@@ -53,6 +53,8 @@ constructor(
|
||||
CoroutineScope(viewModelScope.coroutineContext + AndroidUiDispatcher.Main)
|
||||
private val collator = Collator.getInstance(Locale.getDefault())
|
||||
|
||||
private val newAppsFlow = db.getAppDao().getNewAppsFlow()
|
||||
private val recentlyUpdatedAppsFlow = db.getAppDao().getRecentlyUpdatedAppsFlow()
|
||||
private val mostDownloadedApps =
|
||||
flow {
|
||||
val packageNames =
|
||||
@@ -87,8 +89,8 @@ constructor(
|
||||
@SuppressLint("StateFlowValueCalledInComposition") // see comment below
|
||||
moleculeScope.launchMolecule(mode = ContextClock) {
|
||||
DiscoverPresenter(
|
||||
newAppsFlow = db.getAppDao().getNewAppsFlow(),
|
||||
recentlyUpdatedAppsFlow = db.getAppDao().getRecentlyUpdatedAppsFlow(),
|
||||
newAppsFlow = newAppsFlow,
|
||||
recentlyUpdatedAppsFlow = recentlyUpdatedAppsFlow,
|
||||
mostDownloadedAppsFlow = mostDownloadedApps,
|
||||
categoriesFlow = categories,
|
||||
installedAppsFlow = installedAppsCache.installedApps,
|
||||
|
||||
Reference in New Issue
Block a user