mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
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:
parent
0fa690eb61
commit
b3ebe760dd
35 changed files with 3568 additions and 2816 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue