mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: waypoints
This commit is contained in:
parent
a9784f3747
commit
62420132f1
10 changed files with 214 additions and 14 deletions
|
|
@ -45,6 +45,11 @@ class PacketRepository @Inject constructor(private val packetDaoLazy: dagger.Laz
|
|||
suspend fun deleteMessages(uuidList: List<Long>) = withContext(Dispatchers.IO) {
|
||||
packetDao.deleteMessages(uuidList)
|
||||
}
|
||||
|
||||
suspend fun deleteWaypoint(id: Int) = withContext(Dispatchers.IO) {
|
||||
packetDao.deleteWaypoint(id)
|
||||
}
|
||||
|
||||
suspend fun delete(packet: Packet) = withContext(Dispatchers.IO) {
|
||||
packetDao.delete(packet)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,4 +59,13 @@ interface PacketDao {
|
|||
@Transaction
|
||||
fun getQueuedPackets(): List<DataPacket>? =
|
||||
getDataPackets().filter { it.status in setOf(MessageStatus.ENROUTE, MessageStatus.QUEUED) }
|
||||
|
||||
@Query("Select * from packet where port_num = 8 order by received_time asc")
|
||||
fun getAllWaypoints(): List<Packet>
|
||||
|
||||
@Transaction
|
||||
fun deleteWaypoint(id: Int) {
|
||||
val uuidList = getAllWaypoints().filter { it.data.waypoint?.id == id }.map { it.uuid }
|
||||
deleteMessages(uuidList)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue