fix #1484: Filter out ignored nodes from map (#1676)

* fix #1484: Filter out ignored nodes from map

- Created a new `filteredNodeList` `StateFlow` in `UIState.kt` that filters out nodes marked as ignored.
- Updated `MapFragment.kt` to use `filteredNodeList` instead of `nodeList`, ensuring that ignored nodes are not displayed on the map.

* Refactor: Remove ExperimentalCoroutinesApi opt-in and add it to compiler args

- Removes the `@OptIn(ExperimentalCoroutinesApi::class)` annotation from multiple files.
- Adds `-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi` to the `freeCompilerArgs` in the `build.gradle` file, enabling the use of Experimental Coroutines API project-wide without the need for per-file opt-ins.
- The coroutine api is now applied globally.

Signed-off-by: James Rich <james.a.rich@gmail.com>

* detekt

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>

---------

Signed-off-by: James Rich <james.a.rich@gmail.com>
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2025-03-17 11:40:08 -05:00 committed by GitHub
parent 559b47355d
commit 8e5accd518
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 16 additions and 17 deletions

View file

@ -18,12 +18,11 @@
package com.geeksville.mesh.database
import com.geeksville.mesh.CoroutineDispatchers
import com.geeksville.mesh.Portnums
import com.geeksville.mesh.MeshProtos.MeshPacket
import com.geeksville.mesh.Portnums
import com.geeksville.mesh.TelemetryProtos.Telemetry
import com.geeksville.mesh.database.dao.MeshLogDao
import com.geeksville.mesh.database.entity.MeshLog
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.conflate
import kotlinx.coroutines.flow.distinctUntilChanged
@ -54,7 +53,6 @@ class MeshLogRepository @Inject constructor(
.toBuilder().setTime((log.received_date / MILLIS_TO_SECONDS).toInt()).build()
}.getOrNull()
@OptIn(ExperimentalCoroutinesApi::class)
fun getTelemetryFrom(nodeNum: Int): Flow<List<Telemetry>> =
meshLogDao.getLogsFrom(nodeNum, Portnums.PortNum.TELEMETRY_APP_VALUE, MAX_MESH_PACKETS)
.distinctUntilChanged()
@ -73,7 +71,6 @@ class MeshLogRepository @Inject constructor(
* Retrieves MeshPackets matching 'nodeNum' and 'portNum'.
* If 'portNum' is not specified, returns all MeshPackets. Otherwise, filters by 'portNum'.
*/
@OptIn(ExperimentalCoroutinesApi::class)
fun getMeshPacketsFrom(
nodeNum: Int,
portNum: Int = Portnums.PortNum.UNKNOWN_APP_VALUE,

View file

@ -28,7 +28,6 @@ import com.geeksville.mesh.database.entity.MyNodeEntity
import com.geeksville.mesh.database.entity.NodeEntity
import com.geeksville.mesh.model.Node
import com.geeksville.mesh.model.NodeSortOption
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
@ -65,7 +64,6 @@ class NodeRepository @Inject constructor(
.map { map -> map.mapValues { (_, it) -> it.toEntity() } }
// A map from nodeNum to Node
@OptIn(ExperimentalCoroutinesApi::class)
val nodeDBbyNum: StateFlow<Map<Int, Node>> = nodeInfoDao.nodeDBbyNum()
.mapLatest { map -> map.mapValues { (_, it) -> it.toModel() } }
.onEach {
@ -94,7 +92,6 @@ class NodeRepository @Inject constructor(
.setHwModel(MeshProtos.HardwareModel.UNSET)
.build()
@OptIn(ExperimentalCoroutinesApi::class)
fun getNodes(
sort: NodeSortOption = NodeSortOption.LAST_HEARD,
filter: String = "",