mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Refactor: Remove "include unmessageable" filter (#1889)
This commit is contained in:
parent
990cd103d7
commit
f6e75e970b
5 changed files with 3 additions and 53 deletions
|
|
@ -147,7 +147,6 @@ data class NodesUiState(
|
|||
val sort: NodeSortOption = NodeSortOption.LAST_HEARD,
|
||||
val filter: String = "",
|
||||
val includeUnknown: Boolean = false,
|
||||
val includeUnmessageable: Boolean = true,
|
||||
val gpsFormat: Int = 0,
|
||||
val distanceUnits: Int = 0,
|
||||
val tempInFahrenheit: Boolean = false,
|
||||
|
|
@ -263,8 +262,6 @@ class UIViewModel @Inject constructor(
|
|||
private val nodeSortOption = MutableStateFlow(NodeSortOption.LAST_HEARD)
|
||||
private val includeUnknown = MutableStateFlow(preferences.getBoolean("include-unknown", false))
|
||||
private val showDetails = MutableStateFlow(preferences.getBoolean("show-details", false))
|
||||
private val includeUnmessageable =
|
||||
MutableStateFlow(preferences.getBoolean("include-unmessageable", true))
|
||||
|
||||
fun setSortOption(sort: NodeSortOption) {
|
||||
nodeSortOption.value = sort
|
||||
|
|
@ -275,11 +272,6 @@ class UIViewModel @Inject constructor(
|
|||
preferences.edit { putBoolean("show-details", showDetails.value) }
|
||||
}
|
||||
|
||||
fun toggleIncludeUnmessageable() {
|
||||
includeUnmessageable.value = !includeUnmessageable.value
|
||||
preferences.edit { putBoolean("include-unmessageable", includeUnmessageable.value) }
|
||||
}
|
||||
|
||||
fun toggleIncludeUnknown() {
|
||||
includeUnknown.value = !includeUnknown.value
|
||||
preferences.edit { putBoolean("include-unknown", includeUnknown.value) }
|
||||
|
|
@ -301,8 +293,6 @@ class UIViewModel @Inject constructor(
|
|||
tempInFahrenheit = profile.moduleConfig.telemetry.environmentDisplayFahrenheit,
|
||||
showDetails = showDetails,
|
||||
)
|
||||
}.combine(includeUnmessageable) { state, includeUnmessageable ->
|
||||
state.copy(includeUnmessageable = includeUnmessageable)
|
||||
}.stateIn(
|
||||
scope = viewModelScope,
|
||||
started = SharingStarted.WhileSubscribed(5_000),
|
||||
|
|
@ -316,7 +306,7 @@ class UIViewModel @Inject constructor(
|
|||
)
|
||||
|
||||
val nodeList: StateFlow<List<Node>> = nodesUiState.flatMapLatest { state ->
|
||||
nodeDB.getNodes(state.sort, state.filter, state.includeUnknown, state.includeUnmessageable)
|
||||
nodeDB.getNodes(state.sort, state.filter, state.includeUnknown)
|
||||
}.stateIn(
|
||||
scope = viewModelScope,
|
||||
started = SharingStarted.WhileSubscribed(5_000),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue