revert broadcastMessageStatus

This commit is contained in:
andrekir
2022-11-29 17:45:04 -03:00
parent 7d8e5a93a6
commit a1984c5136
2 changed files with 17 additions and 0 deletions

View File

@@ -92,6 +92,7 @@ class MeshService : Service(), Logging {
const val ACTION_NODE_CHANGE = "$prefix.NODE_CHANGE"
const val ACTION_MESH_CONNECTED = "$prefix.MESH_CONNECTED"
const val ACTION_MESSAGE_STATUS = "$prefix.MESSAGE_STATUS"
open class NodeNotFoundException(reason: String) : Exception(reason)
class InvalidNodeIdException : NodeNotFoundException("Invalid NodeId")
@@ -833,6 +834,7 @@ class MeshService : Service(), Logging {
serviceScope.handledLaunch {
packetRepository.get().updateMessageStatus(p, m)
}
serviceBroadcasts.broadcastMessageStatus(p)
}
/**

View File

@@ -2,6 +2,7 @@ package com.geeksville.mesh.service
import android.content.Context
import android.content.Intent
import android.os.Parcelable
import com.geeksville.mesh.DataPacket
import com.geeksville.mesh.NodeInfo
@@ -37,6 +38,20 @@ class MeshServiceBroadcasts(
explicitBroadcast(intent)
}
fun broadcastMessageStatus(p: DataPacket) {
if (p.id == 0) {
MeshService.debug("Ignoring anonymous packet status")
} else {
// Do not log, contains PII possibly
// MeshService.debug("Broadcasting message status $p")
val intent = Intent(MeshService.ACTION_MESSAGE_STATUS).apply {
putExtra(EXTRA_PACKET_ID, p.id)
putExtra(EXTRA_STATUS, p.status as Parcelable)
}
explicitBroadcast(intent)
}
}
/**
* Broadcast our current connection status
*/