From 77323c525bebc090b76cd704284de68908b3b268 Mon Sep 17 00:00:00 2001 From: crc-32 Date: Mon, 6 Jan 2025 17:08:20 +0000 Subject: [PATCH] reorder init of system service to avoid use before init issue --- .../io/rebble/cobble/shared/domain/common/PebbleDevice.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android/shared/src/commonMain/kotlin/io/rebble/cobble/shared/domain/common/PebbleDevice.kt b/android/shared/src/commonMain/kotlin/io/rebble/cobble/shared/domain/common/PebbleDevice.kt index 66ebf660..b0471293 100644 --- a/android/shared/src/commonMain/kotlin/io/rebble/cobble/shared/domain/common/PebbleDevice.kt +++ b/android/shared/src/commonMain/kotlin/io/rebble/cobble/shared/domain/common/PebbleDevice.kt @@ -48,6 +48,9 @@ open class PebbleDevice( val appMessageTransactionSequence = AppMessageTransactionSequence().iterator() + // Required for the system handler + val systemService: SystemService by inject {parametersOf(protocolHandler)} + init { // This will init all the handlers by reading the lazy value causing them to be injected negotiationScope.launch { @@ -68,7 +71,6 @@ open class PebbleDevice( val appRunStateService: AppRunStateService by inject {parametersOf(protocolHandler)} val blobDBService: BlobDBService by inject {parametersOf(protocolHandler)} val appMessageService: AppMessageService by inject {parametersOf(protocolHandler)} - val systemService: SystemService by inject {parametersOf(protocolHandler)} val musicService: MusicService by inject {parametersOf(protocolHandler)} val putBytesService: PutBytesService by inject {parametersOf(protocolHandler)} val phoneControlService: PhoneControlService by inject {parametersOf(protocolHandler)}