feat #3642: Add infrastructure to the list of filters. (#3716)

This commit is contained in:
Dane Evans 2025-11-17 11:52:25 +11:00 committed by GitHub
parent 4015e67b2b
commit d6f39fdcb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 192 additions and 68 deletions

View file

@ -39,6 +39,7 @@ internal const val KEY_THEME = "theme"
// Node list filters/sort
internal const val KEY_NODE_SORT = "node-sort-option"
internal const val KEY_INCLUDE_UNKNOWN = "include-unknown"
internal const val KEY_EXCLUDE_INFRASTRUCTURE = "exclude-infrastructure"
internal const val KEY_ONLY_ONLINE = "only-online"
internal const val KEY_ONLY_DIRECT = "only-direct"
internal const val KEY_SHOW_IGNORED = "show-ignored"
@ -57,6 +58,8 @@ class UiPreferencesDataSource @Inject constructor(private val dataStore: DataSto
val nodeSort: StateFlow<Int> = dataStore.prefStateFlow(key = NODE_SORT, default = -1)
val includeUnknown: StateFlow<Boolean> = dataStore.prefStateFlow(key = INCLUDE_UNKNOWN, default = false)
val excludeInfrastructure: StateFlow<Boolean> =
dataStore.prefStateFlow(key = EXCLUDE_INFRASTRUCTURE, default = false)
val onlyOnline: StateFlow<Boolean> = dataStore.prefStateFlow(key = ONLY_ONLINE, default = false)
val onlyDirect: StateFlow<Boolean> = dataStore.prefStateFlow(key = ONLY_DIRECT, default = false)
val showIgnored: StateFlow<Boolean> = dataStore.prefStateFlow(key = SHOW_IGNORED, default = false)
@ -77,6 +80,10 @@ class UiPreferencesDataSource @Inject constructor(private val dataStore: DataSto
dataStore.setPref(key = INCLUDE_UNKNOWN, value = value)
}
fun setExcludeInfrastructure(value: Boolean) {
dataStore.setPref(key = EXCLUDE_INFRASTRUCTURE, value = value)
}
fun setOnlyOnline(value: Boolean) {
dataStore.setPref(key = ONLY_ONLINE, value = value)
}
@ -104,6 +111,7 @@ class UiPreferencesDataSource @Inject constructor(private val dataStore: DataSto
val THEME = intPreferencesKey(KEY_THEME)
val NODE_SORT = intPreferencesKey(KEY_NODE_SORT)
val INCLUDE_UNKNOWN = booleanPreferencesKey(KEY_INCLUDE_UNKNOWN)
val EXCLUDE_INFRASTRUCTURE = booleanPreferencesKey(KEY_EXCLUDE_INFRASTRUCTURE)
val ONLY_ONLINE = booleanPreferencesKey(KEY_ONLY_ONLINE)
val ONLY_DIRECT = booleanPreferencesKey(KEY_ONLY_DIRECT)
val SHOW_IGNORED = booleanPreferencesKey(KEY_SHOW_IGNORED)

View file

@ -32,6 +32,7 @@
<string name="desc_node_filter_clear">clear node filter</string>
<string name="node_filter_title">Filter by</string>
<string name="node_filter_include_unknown">Include unknown</string>
<string name="node_filter_exclude_infrastructure">Exclude infrastructure</string>
<string name="node_filter_only_online">Hide offline nodes</string>
<string name="node_filter_only_direct">Only show direct nodes</string>
<string name="node_filter_ignored">You are viewing ignored nodes,\nPress to return to the node list.</string>
@ -46,7 +47,7 @@
<string name="node_sort_via_mqtt">via MQTT</string>
<string name="via_mqtt">via MQTT</string>
<string name="node_sort_via_favorite">via Favorite</string>
<string name="node_filter_show_ignored">Ignored Nodes</string>
<string name="node_filter_show_ignored">Only show ignored Nodes</string>
<string name="unrecognized">Unrecognized</string>
<string name="message_status_enroute">Waiting to be acknowledged</string>
<string name="message_status_queued">Queued for sending</string>