feat: Refactor MeshService into smaller, single-responsibility components (#4108)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-01-02 11:13:38 -06:00 committed by GitHub
parent 0fa690eb61
commit b3ebe760dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 3568 additions and 2816 deletions

View file

@ -35,7 +35,7 @@ class MeshServiceBroadcasts
@Inject
constructor(
@ApplicationContext private val context: Context,
private val connectionStateHolder: MeshServiceConnectionStateHolder,
private val connectionStateHolder: ConnectionStateHandler,
private val serviceRepository: ServiceRepository,
) {
// A mapping of receiver class name to package name - used for explicit broadcasts
@ -52,7 +52,7 @@ constructor(
fun broadcastNodeChange(info: NodeInfo) {
Logger.d { "Broadcasting node change ${info.user?.toPIIString()}" }
val intent = Intent(MeshService.ACTION_NODE_CHANGE).putExtra(EXTRA_NODEINFO, info)
val intent = Intent(ACTION_NODE_CHANGE).putExtra(EXTRA_NODEINFO, info)
explicitBroadcast(intent)
}
@ -65,7 +65,7 @@ constructor(
// Do not log, contains PII possibly
// MeshService.Logger.d { "Broadcasting message status $p" }
val intent =
Intent(MeshService.ACTION_MESSAGE_STATUS).apply {
Intent(ACTION_MESSAGE_STATUS).apply {
putExtra(EXTRA_PACKET_ID, id)
putExtra(EXTRA_STATUS, status as Parcelable)
}
@ -76,7 +76,7 @@ constructor(
/** Broadcast our current connection status */
fun broadcastConnection() {
val connectionState = connectionStateHolder.connectionState.value
val intent = Intent(MeshService.ACTION_MESH_CONNECTED).putExtra(EXTRA_CONNECTED, connectionState.toString())
val intent = Intent(ACTION_MESH_CONNECTED).putExtra(EXTRA_CONNECTED, connectionState.toString())
serviceRepository.setConnectionState(connectionState)
explicitBroadcast(intent)
}