feat(profiles): add local on-device profile hiding and filtering

This commit is contained in:
M57 committed 2026-08-30 20:51:06 +03:00
1 parent 5c8ab7ed6c
commit cdcecb9734
11 files changed
+240 -10

No files matched your search

@@ -25,6 +25,8 @@ data class ServerStoreState(
// App display language. "system" = follow device locale; otherwise a BCP-47
// language code such as "en" or "ko". Applied via ContextWrapper in MainActivity.
val appLanguage: String = "system",
// Local on-device hidden profile names (filtered out from list views unless revealed).
val hiddenProfiles: List<String> = emptyList(),
// App version the silent update check (issue #867) last completed for.
// Null / mismatched with BuildConfig.VERSION_NAME → the About tab runs
// its one-time check again (re-check on app version bump).
@@ -357,6 +357,28 @@ object AuthManager {
serverStore.update { it.copy(pinnedModels = pinned) }
}
// ── Hidden Profiles (Local On-Device Filtering) ──────────────────────
fun getHiddenProfiles(): List<String> = serverStore.getLatestState().hiddenProfiles
fun isProfileHidden(name: String): Boolean = serverStore.getLatestState().hiddenProfiles.contains(name)
fun hideProfile(name: String) {
serverStore.update { s ->
s.copy(hiddenProfiles = (s.hiddenProfiles + name).distinct())
}
}
fun unhideProfile(name: String) {
serverStore.update { s ->
s.copy(hiddenProfiles = s.hiddenProfiles.filter { it != name })
}
}
fun setHiddenProfiles(hidden: List<String>) {
serverStore.update { it.copy(hiddenProfiles = hidden.distinct()) }
}
fun getProfileToken(profileId: String): String? = requirePrefs().getString("token_$profileId", null)
fun setProfileToken(