search query preference and BackHandler fix

This commit is contained in:
semenvav 2023-07-25 00:17:34 +03:00
parent a0625e5de2
commit a6f35dda4d
2 changed files with 7 additions and 3 deletions

View File

@ -216,11 +216,13 @@ private fun DownloadStatsAppBar(
}, },
scrollBehavior = scrollBehavior, scrollBehavior = scrollBehavior,
) )
if (searchQuery != null) {
BackHandler( BackHandler(
onBack = { onChangeSearchQuery(null) }, onBack = { onChangeSearchQuery(null) },
) )
} }
} }
}
@Composable @Composable
private fun DownloadStatsActionAppBar( private fun DownloadStatsActionAppBar(

View File

@ -298,6 +298,8 @@ class DownloadStatsScreenModel(
mutableState.update { it.copy(searchQuery = query) } mutableState.update { it.copy(searchQuery = query) }
if (query != null) { if (query != null) {
preferenceStore.getString("search_query", "").set(query) preferenceStore.getString("search_query", "").set(query)
} else {
preferenceStore.getString("search_query", "").delete()
} }
} }