mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-05-30 09:37:13 -04:00
fix: break Koin circular dependency with Lazy<MeshConnectionManager>
MeshConnectionManagerImpl and LockdownCoordinatorImpl constructor-inject each other, causing a StackOverflowError at Koin resolution time. The coordinator only needs MeshConnectionManager in two rare paths (lock-now-ack and post-unlock config reload), so defer its resolution with Lazy<T> — matching the existing Lazy<MeshRouter> pattern in FromRadioPacketHandlerImpl.
This commit is contained in:
@@ -44,7 +44,7 @@ class LockdownCoordinatorImpl(
|
||||
private val commandSender: CommandSender,
|
||||
private val passphraseStore: LockdownPassphraseStore,
|
||||
private val radioInterfaceService: RadioInterfaceService,
|
||||
private val connectionManager: MeshConnectionManager,
|
||||
private val connectionManager: Lazy<MeshConnectionManager>,
|
||||
) : LockdownCoordinator {
|
||||
@Volatile private var wasAutoAttempt = false
|
||||
|
||||
@@ -86,7 +86,7 @@ class LockdownCoordinatorImpl(
|
||||
Logger.i { "Lockdown: Lock Now acknowledged — resetting session authorization" }
|
||||
serviceRepository.setSessionAuthorized(false)
|
||||
resetTransientState()
|
||||
connectionManager.clearRadioConfig()
|
||||
connectionManager.value.clearRadioConfig()
|
||||
serviceRepository.setLockdownState(LockdownState.LockNowAcknowledged)
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ class LockdownCoordinatorImpl(
|
||||
)
|
||||
serviceRepository.setLockdownState(LockdownState.Unlocked)
|
||||
serviceRepository.setSessionAuthorized(true)
|
||||
connectionManager.startConfigOnly()
|
||||
connectionManager.value.startConfigOnly()
|
||||
}
|
||||
|
||||
@Suppress("TooGenericExceptionCaught")
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.meshtastic.proto.ClientNotification
|
||||
import org.meshtastic.proto.Config
|
||||
import org.meshtastic.proto.DeviceMetadata
|
||||
import org.meshtastic.proto.FromRadio
|
||||
import org.meshtastic.proto.LockdownStatus
|
||||
import org.meshtastic.proto.ModuleConfig
|
||||
import org.meshtastic.proto.MqttClientProxyMessage
|
||||
import org.meshtastic.proto.MyNodeInfo
|
||||
@@ -42,7 +43,6 @@ import kotlin.test.BeforeTest
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
import org.meshtastic.proto.LockdownStatus
|
||||
import org.meshtastic.proto.NodeInfo as ProtoNodeInfo
|
||||
|
||||
class FromRadioPacketHandlerImplTest {
|
||||
|
||||
@@ -151,7 +151,7 @@ class LockdownCoordinatorImplTest {
|
||||
commandSender = commandSender,
|
||||
passphraseStore = passphraseStore,
|
||||
radioInterfaceService = radioService,
|
||||
connectionManager = connectionManager,
|
||||
connectionManager = lazy { connectionManager },
|
||||
)
|
||||
|
||||
private val testDeviceAddress = "AA:BB:CC:DD:EE:FF"
|
||||
|
||||
Reference in New Issue
Block a user