mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix: replace duplicate packet IDs before sending queue (#646)
This commit is contained in:
parent
9970ced53b
commit
bb3b1eaa85
3 changed files with 17 additions and 0 deletions
|
|
@ -34,6 +34,10 @@ class PacketRepository @Inject constructor(private val packetDaoLazy: dagger.Laz
|
|||
packetDao.updateMessageStatus(d, m)
|
||||
}
|
||||
|
||||
suspend fun updateMessageId(d: DataPacket, id: Int) = withContext(Dispatchers.IO) {
|
||||
packetDao.updateMessageId(d, id)
|
||||
}
|
||||
|
||||
suspend fun getDataPacketById(requestId: Int) = withContext(Dispatchers.IO) {
|
||||
packetDao.getDataPacketById(requestId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@ interface PacketDao {
|
|||
findDataPacket(data)?.let { update(it.copy(data = new)) }
|
||||
}
|
||||
|
||||
@Transaction
|
||||
fun updateMessageId(data: DataPacket, id: Int) {
|
||||
val new = data.copy(id = id)
|
||||
findDataPacket(data)?.let { update(it.copy(data = new)) }
|
||||
}
|
||||
|
||||
@Query("Select data from packet order by received_time asc")
|
||||
fun getDataPackets(): List<DataPacket>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue