feat(#480): pass refresh=true on Models pull-to-refresh to re-probe custom providers (#481)

* feat(#480): pass refresh=true on Models pull-to-refresh to re-probe custom providers

* test(#480): assert refresh flag propagation for default vs pull-to-refresh loads

* fix(#480): capture refresh arg via slot instead of brittle coVerify in propagation test

---------

Co-authored-by: ronia <ronia@m57>
This commit is contained in:
M57andronia authored and GitHub committed 2026-07-07 02:53:36 +03:00
1 parent 7384b51476
commit bdf566ba3e
4 files changed
+54 -5

No files matched your search

@@ -101,7 +101,7 @@ fun ModelScreen(
title = { Text(stringResource(R.string.screen_models)) },
navigationIcon = onOpenDrawer?.let { NavIcon.Menu(it) },
isRefreshing = state.isLoading,
onRefresh = { viewModel.loadAll() },
onRefresh = { viewModel.loadAll(refresh = true) },
) { paddingValues ->
when {
state.isLoading && state.providers.isEmpty() -> {
@@ -76,12 +76,12 @@ class ModelViewModel :
_uiState.update { it.copy(pinnedModels = AuthManager.getPinnedModels()) }
}
fun loadAll() {
fun loadAll(refresh: Boolean = false) {
_uiState.update { it.copy(isLoading = true, errorMessage = null) }
viewModelScope.launch {
val optionsDeferred =
async(Dispatchers.IO) {
safeApiCall { ApiClient.hermesApi.getModelOptions() }
safeApiCall { ApiClient.hermesApi.getModelOptions(refresh = refresh) }
}
val activeProfileDeferred =
async(Dispatchers.IO) {