mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-27 10:23:20 -04:00
Don't load updates on very first start
it may find apps we had installed before, but are not (yet) in any repo, so it will show issues already during initial repo fetch
This commit is contained in:
@@ -78,6 +78,7 @@ class SettingsManager @Inject constructor(
|
||||
}
|
||||
private val _lastRepoUpdateFlow = MutableStateFlow(lastRepoUpdate)
|
||||
val lastRepoUpdateFlow = _lastRepoUpdateFlow.asStateFlow()
|
||||
val isFirstStart get() = lastRepoUpdate <= PREF_DEFAULT_LAST_UPDATE_CHECK.toLong()
|
||||
|
||||
/**
|
||||
* A set of package name for which we should not show app issues.
|
||||
|
||||
@@ -8,7 +8,6 @@ import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import org.fdroid.database.Repository
|
||||
import org.fdroid.repo.RepoUpdateState
|
||||
import org.fdroid.settings.SettingsConstants.PREF_DEFAULT_LAST_UPDATE_CHECK
|
||||
import org.fdroid.ui.categories.CategoryGroup
|
||||
import org.fdroid.ui.categories.CategoryItem
|
||||
|
||||
@@ -20,7 +19,7 @@ fun DiscoverPresenter(
|
||||
categoriesFlow: Flow<List<CategoryItem>>,
|
||||
repositoriesFlow: Flow<List<Repository>>,
|
||||
searchResultsFlow: StateFlow<SearchResults?>,
|
||||
lastRepoUpdate: Long,
|
||||
isFirstStart: Boolean,
|
||||
repoUpdateStateFlow: StateFlow<RepoUpdateState?>,
|
||||
): DiscoverModel {
|
||||
val newApps = newAppsFlow.collectAsState(null).value
|
||||
@@ -34,7 +33,6 @@ fun DiscoverPresenter(
|
||||
// So if we don't have those, we are still loading, have no enabled repo, or this is first start
|
||||
return if (recentlyUpdatedApps.isNullOrEmpty()) {
|
||||
val repositories = repositoriesFlow.collectAsState(null).value
|
||||
val isFirstStart = lastRepoUpdate < PREF_DEFAULT_LAST_UPDATE_CHECK.toLong()
|
||||
if (repositories?.all { !it.enabled } == true) {
|
||||
NoEnabledReposDiscoverModel
|
||||
} else if (isFirstStart) {
|
||||
|
||||
@@ -99,7 +99,7 @@ class DiscoverViewModel @Inject constructor(
|
||||
categoriesFlow = categories,
|
||||
repositoriesFlow = repoManager.repositoriesState,
|
||||
searchResultsFlow = searchResults,
|
||||
lastRepoUpdate = settingsManager.lastRepoUpdate,
|
||||
isFirstStart = settingsManager.isFirstStart,
|
||||
repoUpdateStateFlow = repoUpdateManager.repoUpdateState,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -90,7 +90,8 @@ class UpdatesManager @Inject constructor(
|
||||
coroutineScope.launch {
|
||||
// refresh updates whenever installed apps change
|
||||
installedAppsCache.installedApps.collect {
|
||||
loadUpdates(it)
|
||||
// don't load updates on very first start or we may find issues too early
|
||||
if (!settingsManager.isFirstStart) loadUpdates(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,6 +152,8 @@ class UpdatesManager @Inject constructor(
|
||||
lastUpdated = -1,
|
||||
iconModel = PackageName(app.packageName, null),
|
||||
)
|
||||
}.also {
|
||||
log.error { "ISSUE: $it" }
|
||||
}
|
||||
}
|
||||
_appsWithIssues.value = issueItems
|
||||
|
||||
Reference in New Issue
Block a user